diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2013-12-16 15:44:27 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2013-12-20 11:37:54 +0100 |
commit | 17a7763d81bc3626106a2e23bfa9d881dfde5389 (patch) | |
tree | 2c46f3bf629aa4c48aeae5cb03a2714d2642fa2b | |
parent | 44bd2275e733fc0378648c36af0cb95a6c26f0a0 (diff) | |
download | NetworkManager-17a7763d81bc3626106a2e23bfa9d881dfde5389.tar.gz |
libnm-glib: add 'mtu' property to NMDevice
-rw-r--r-- | libnm-glib/libnm-glib.ver | 1 | ||||
-rw-r--r-- | libnm-glib/nm-device.c | 40 | ||||
-rw-r--r-- | libnm-glib/nm-device.h | 4 |
3 files changed, 44 insertions, 1 deletions
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver index 52f4b33741..b8ce807e4c 100644 --- a/libnm-glib/libnm-glib.ver +++ b/libnm-glib/libnm-glib.ver @@ -135,6 +135,7 @@ global: nm_device_get_ip6_config; nm_device_get_ip_iface; nm_device_get_managed; + nm_device_get_mtu; nm_device_get_physical_port_id; nm_device_get_product; nm_device_get_state; diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index 971baea822..806c9347d3 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -98,6 +98,7 @@ typedef struct { char *vendor; char *physical_port_id; + guint32 mtu; } NMDevicePrivate; enum { @@ -124,6 +125,7 @@ enum { PROP_ACTIVE_CONNECTION, PROP_AVAILABLE_CONNECTIONS, PROP_PHYSICAL_PORT_ID, + PROP_MTU, LAST_PROP }; @@ -203,6 +205,7 @@ register_properties (NMDevice *device) { NM_DEVICE_ACTIVE_CONNECTION, &priv->active_connection, NULL, NM_TYPE_ACTIVE_CONNECTION }, { NM_DEVICE_AVAILABLE_CONNECTIONS, &priv->available_connections, NULL, NM_TYPE_REMOTE_CONNECTION }, { NM_DEVICE_PHYSICAL_PORT_ID, &priv->physical_port_id }, + { NM_DEVICE_MTU, &priv->mtu }, /* Properties that exist in D-Bus but that we don't track */ { "ip4-address", NULL }, @@ -481,6 +484,9 @@ get_property (GObject *object, case PROP_PHYSICAL_PORT_ID: g_value_set_string (value, nm_device_get_physical_port_id (device)); break; + case PROP_MTU: + g_value_set_uint (value, nm_device_get_mtu (device)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -828,6 +834,21 @@ nm_device_class_init (NMDeviceClass *device_class) NULL, G_PARAM_READABLE)); + /** + * NMDevice:mtu: + * + * The MTU of the device. + * + * Since: 0.9.10 + **/ + g_object_class_install_property + (object_class, PROP_MTU, + g_param_spec_uint (NM_DEVICE_MTU, + "MTU", + "MTU", + 0, G_MAXUINT32, 1500, + G_PARAM_READABLE)); + /* signals */ /** @@ -1610,6 +1631,25 @@ nm_device_get_physical_port_id (NMDevice *device) return NULL; } +/** + * nm_device_get_mtu: + * @device: a #NMDevice + * + * Gets the MTU of the #NMDevice. + * + * Returns: the MTU of the device. + * + * Since: 0.9.10 + **/ +guint32 +nm_device_get_mtu (NMDevice *device) +{ + g_return_val_if_fail (NM_IS_DEVICE (device), 0); + + _nm_object_ensure_inited (NM_OBJECT (device)); + return NM_DEVICE_GET_PRIVATE (device)->mtu; +} + typedef struct { NMDevice *device; NMDeviceDeactivateFn fn; diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h index 6a96cbc6ff..33ab8a3dcb 100644 --- a/libnm-glib/nm-device.h +++ b/libnm-glib/nm-device.h @@ -18,7 +18,7 @@ * Boston, MA 02110-1301 USA. * * Copyright (C) 2007 - 2008 Novell, Inc. - * Copyright (C) 2007 - 2012 Red Hat, Inc. + * Copyright (C) 2007 - 2013 Red Hat, Inc. */ #ifndef NM_DEVICE_H @@ -81,6 +81,7 @@ GQuark nm_device_error_quark (void); #define NM_DEVICE_VENDOR "vendor" #define NM_DEVICE_PRODUCT "product" #define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id" +#define NM_DEVICE_MTU "mtu" typedef struct { NMObject parent; @@ -138,6 +139,7 @@ const GPtrArray * nm_device_get_available_connections(NMDevice *device); const char * nm_device_get_product (NMDevice *device); const char * nm_device_get_vendor (NMDevice *device); const char * nm_device_get_physical_port_id (NMDevice *device); +guint32 nm_device_get_mtu (NMDevice *device); typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data); |