summaryrefslogtreecommitdiff
path: root/libnm-glib
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-06-19 11:21:05 +0200
committerJiří Klimeš <jklimes@redhat.com>2014-07-22 14:24:42 +0200
commit3dbe8041a71b532e3321a54b17b673e17b0a5edb (patch)
treed2ec165e7ef6dec9e8c9b6246b088fd0616dd35d /libnm-glib
parentbbf13002d3315388b31c3a819552a37a9bb6045b (diff)
downloadNetworkManager-3dbe8041a71b532e3321a54b17b673e17b0a5edb.tar.gz
libnm-glib: add nm_device_is_software() function to NMDevice
It says whether the device is a software one, according to device capabilities.
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/libnm-glib.ver1
-rw-r--r--libnm-glib/nm-device.c19
-rw-r--r--libnm-glib/nm-device.h2
3 files changed, 22 insertions, 0 deletions
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index 982288e50c..730af64ffd 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -156,6 +156,7 @@ global:
nm_device_infiniband_get_hw_address;
nm_device_infiniband_get_type;
nm_device_infiniband_new;
+ nm_device_is_software;
nm_device_modem_error_get_type;
nm_device_modem_error_quark;
nm_device_modem_get_current_capabilities;
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index 1a63d28d21..5df0d49c1e 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -2065,6 +2065,25 @@ nm_device_get_mtu (NMDevice *device)
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 {
NMDevice *device;
NMDeviceDeactivateFn fn;
diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h
index 3c57744a00..3c9b7fd45b 100644
--- a/libnm-glib/nm-device.h
+++ b/libnm-glib/nm-device.h
@@ -142,6 +142,8 @@ NM_AVAILABLE_IN_0_9_10
const char * nm_device_get_physical_port_id (NMDevice *device);
NM_AVAILABLE_IN_0_9_10
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_vendor (NMDevice *device);