Add skeleton for generic network driver
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 24 Dec 2008 11:37:58 +0000 (12:37 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 24 Dec 2008 11:37:58 +0000 (12:37 +0100)
src/connman.h
src/element.c
src/network.c

index 3c2f699..175a6cc 100644 (file)
@@ -114,6 +114,11 @@ static inline void __connman_element_unlock(struct connman_element *element)
 int __connman_device_init(void);
 void __connman_device_cleanup(void);
 
+#include <connman/network.h>
+
+int __connman_network_init(void);
+void __connman_network_cleanup(void);
+
 #include <connman/rtnl.h>
 
 int __connman_rtnl_init(void);
index ea4bea4..145d6fa 100644 (file)
@@ -2218,6 +2218,7 @@ int __connman_element_init(DBusConnection *conn, const char *device)
        element_root = g_node_new(element);
 
        __connman_device_init();
+       __connman_network_init();
 
        return 0;
 }
@@ -2285,6 +2286,7 @@ void __connman_element_cleanup(void)
 {
        DBG("");
 
+       __connman_network_cleanup();
        __connman_device_cleanup();
 
        g_node_traverse(element_root, G_POST_ORDER, G_TRAVERSE_ALL, -1,
index 715e8c4..6a27d03 100644 (file)
 #endif
 
 #include "connman.h"
+
+static int network_probe(struct connman_element *element)
+{
+       return 0;
+}
+
+static void network_remove(struct connman_element *element)
+{
+}
+
+static struct connman_driver network_driver = {
+       .name           = "network",
+       .type           = CONNMAN_ELEMENT_TYPE_NETWORK,
+       .priority       = CONNMAN_DRIVER_PRIORITY_LOW,
+       .probe          = network_probe,
+       .remove         = network_remove,
+};
+
+int __connman_network_init(void)
+{
+       DBG("");
+
+       return connman_driver_register(&network_driver);
+}
+
+void __connman_network_cleanup(void)
+{
+       DBG("");
+
+       connman_driver_unregister(&network_driver);
+}