libnm-glib: add nm_device_is_software() function to NMDevice

It says whether the device is a software one, according to device capabilities.
This commit is contained in:
Jiří Klimeš
2014-06-19 11:21:05 +02:00
parent bbf13002d3
commit 3dbe8041a7
3 changed files with 22 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ global:
nm_device_infiniband_get_hw_address; nm_device_infiniband_get_hw_address;
nm_device_infiniband_get_type; nm_device_infiniband_get_type;
nm_device_infiniband_new; nm_device_infiniband_new;
nm_device_is_software;
nm_device_modem_error_get_type; nm_device_modem_error_get_type;
nm_device_modem_error_quark; nm_device_modem_error_quark;
nm_device_modem_get_current_capabilities; nm_device_modem_get_current_capabilities;

View File

@@ -2065,6 +2065,25 @@ nm_device_get_mtu (NMDevice *device)
return NM_DEVICE_GET_PRIVATE (device)->mtu; return NM_DEVICE_GET_PRIVATE (device)->mtu;
} }
/**
* nm_device_is_software:
* @device: a #NMDevice
*
* Whether the device is a software device.
*
* Returns: %TRUE if @device is a software device, %FALSE if it is a hardware device.
*
* Since: 1.0
**/
gboolean
nm_device_is_software (NMDevice *device)
{
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
_nm_object_ensure_inited (NM_OBJECT (device));
return !!(NM_DEVICE_GET_PRIVATE (device)->capabilities & NM_DEVICE_CAP_IS_SOFTWARE);
}
typedef struct { typedef struct {
NMDevice *device; NMDevice *device;
NMDeviceDeactivateFn fn; NMDeviceDeactivateFn fn;

View File

@@ -142,6 +142,8 @@ NM_AVAILABLE_IN_0_9_10
const char * nm_device_get_physical_port_id (NMDevice *device); const char * nm_device_get_physical_port_id (NMDevice *device);
NM_AVAILABLE_IN_0_9_10 NM_AVAILABLE_IN_0_9_10
guint32 nm_device_get_mtu (NMDevice *device); guint32 nm_device_get_mtu (NMDevice *device);
NM_AVAILABLE_IN_1_0
gboolean nm_device_is_software (NMDevice *device);
const char * nm_device_get_product (NMDevice *device); const char * nm_device_get_product (NMDevice *device);
const char * nm_device_get_vendor (NMDevice *device); const char * nm_device_get_vendor (NMDevice *device);