summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-device.c
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/nm-device.c
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/nm-device.c')
-rw-r--r--libnm-glib/nm-device.c19
1 files changed, 19 insertions, 0 deletions
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;