mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 05:40:29 +01:00
libnm-glib: add 'mtu' property to NMDevice
This commit is contained in:
parent
44bd2275e7
commit
17a7763d81
3 changed files with 44 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue