summary refs log tree commit diff
path: root/src/devices/nm-device-factory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/nm-device-factory.c')
-rw-r--r--src/devices/nm-device-factory.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c
index fc4d1c24..abfb8d4a 100644
--- a/src/devices/nm-device-factory.c
+++ b/src/devices/nm-device-factory.c
@@ -18,6 +18,8 @@
  * Copyright (C) 2014 Red Hat, Inc.
  */
 
+#include "config.h"
+
 #include "nm-device-factory.h"
 
 enum {
@@ -27,6 +29,21 @@ enum {
 };
 static guint signals[LAST_SIGNAL] = { 0 };
 
+static GSList *internal_types = NULL;
+
+void
+_nm_device_factory_internal_register_type (GType factory_type)
+{
+	g_return_if_fail (g_slist_find (internal_types, GUINT_TO_POINTER (factory_type)) == NULL);
+	internal_types = g_slist_prepend (internal_types, GUINT_TO_POINTER (factory_type));
+}
+
+const GSList *
+nm_device_factory_get_internal_factory_types (void)
+{
+	return internal_types;
+}
+
 gboolean
 nm_device_factory_emit_component_added (NMDeviceFactory *factory, GObject *component)
 {
@@ -91,6 +108,23 @@ nm_device_factory_get_type (void)
 	return device_factory_type;
 }
 
+NMDeviceType
+nm_device_factory_get_device_type (NMDeviceFactory *factory)
+{
+	g_return_val_if_fail (factory != NULL, NM_DEVICE_TYPE_UNKNOWN);
+
+	return NM_DEVICE_FACTORY_GET_INTERFACE (factory)->get_device_type (factory);
+}
+
+void
+nm_device_factory_start (NMDeviceFactory *factory)
+{
+	g_return_if_fail (factory != NULL);
+
+	if (NM_DEVICE_FACTORY_GET_INTERFACE (factory)->start)
+		NM_DEVICE_FACTORY_GET_INTERFACE (factory)->start (factory);
+}
+
 NMDevice *
 nm_device_factory_new_link (NMDeviceFactory *factory,
                             NMPlatformLink *plink,
@@ -104,3 +138,21 @@ nm_device_factory_new_link (NMDeviceFactory *factory,
 	return NULL;
 }
 
+NMDevice *
+nm_device_factory_create_virtual_device_for_connection (NMDeviceFactory *factory,
+                                                        NMConnection *connection,
+                                                        NMDevice *parent,
+                                                        GError **error)
+{
+	NMDeviceFactory *interface;
+
+	g_return_val_if_fail (factory, NULL);
+	g_return_val_if_fail (connection, NULL);
+	g_return_val_if_fail (!error || !*error, NULL);
+
+	interface = NM_DEVICE_FACTORY_GET_INTERFACE (factory);
+	if (interface->create_virtual_device_for_connection)
+		return interface->create_virtual_device_for_connection (factory, connection, parent, error);
+	return NULL;
+}
+