Add skeleton for IPv4 configuration plugin
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 28 Jun 2008 09:02:28 +0000 (11:02 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 28 Jun 2008 09:02:28 +0000 (11:02 +0200)
plugins/Makefile.am
plugins/ipv4.c [new file with mode: 0644]

index 9b73edd..88936e7 100644 (file)
@@ -1,17 +1,13 @@
 
 plugindir = $(libdir)/connman/plugins
 
-plugin_LTLIBRARIES = hal.la ethernet.la bluetooth.la dhclient.la \
+plugin_LTLIBRARIES = hal.la ethernet.la bluetooth.la dhclient.la ipv4.la \
                                        80203.la 80211.la resolvconf.la
 
 hal_la_SOURCES = hal.c
 hal_la_LIBADD = @HAL_LIBS@
 hal_la_CFLAGS = @GLIB_CFLAGS@ @HAL_CFLAGS@
 
-80203_la_SOURCES = 80203.c
-
-80211_la_SOURCES = 80211.c supplicant.h supplicant.c
-
 ethernet_la_SOURCES = ethernet.c
 
 bluetooth_la_SOURCES = bluetooth.c
@@ -20,6 +16,12 @@ dhclient_la_SOURCES = dhclient.c
 dhclient_la_CFLAGS = @GDBUS_CFLAGS@ -DDHCLIENT=\"@DHCLIENT@\" \
                -DSTATEDIR=\""$(statedir)"\" -DSCRIPTDIR=\""$(scriptdir)"\"
 
+ipv4_la_SOURCES = ipv4.c
+
+80203_la_SOURCES = 80203.c
+
+80211_la_SOURCES = 80211.c supplicant.h supplicant.c
+
 resolvconf_la_SOURCES = resolvconf.c
 
 AM_LDFLAGS = -module -avoid-version -export-symbols-regex connman_plugin_desc
diff --git a/plugins/ipv4.c b/plugins/ipv4.c
new file mode 100644 (file)
index 0000000..66e55b9
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007-2008  Intel Corporation. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <connman/plugin.h>
+#include <connman/driver.h>
+#include <connman/log.h>
+
+static int ipv4_probe(struct connman_element *element)
+{
+       DBG("element %p name %s", element, element->name);
+
+       DBG("address %s", element->ipv4.address);
+       DBG("netmask %s", element->ipv4.netmask);
+       DBG("gateway %s", element->ipv4.gateway);
+
+       return 0;
+}
+
+static void ipv4_remove(struct connman_element *element)
+{
+       DBG("element %p name %s", element, element->name);
+}
+
+static struct connman_driver ipv4_driver = {
+       .name           = "ipv4",
+       .type           = CONNMAN_ELEMENT_TYPE_IPV4,
+       .probe          = ipv4_probe,
+       .remove         = ipv4_remove,
+};
+
+static int ipv4_init(void)
+{
+       return connman_driver_register(&ipv4_driver);
+}
+
+static void ipv4_exit(void)
+{
+       connman_driver_unregister(&ipv4_driver);
+}
+
+CONNMAN_PLUGIN_DEFINE("ipv4", "IPv4 configuration plugin", VERSION,
+                                                       ipv4_init, ipv4_exit)