Add skeleton for DNS proxy resolver plugin
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 13 Dec 2008 19:04:06 +0000 (20:04 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 13 Dec 2008 19:04:06 +0000 (20:04 +0100)
plugins/Makefile.am
plugins/dnsproxy.c [new file with mode: 0644]

index 88a2d78..41f20bd 100644 (file)
@@ -2,8 +2,8 @@
 plugindir = $(libdir)/connman/plugins
 
 plugin_LTLIBRARIES = loopback.la ethernet.la wifi.la bluetooth.la \
-                               netdev.la dhclient.la ipv4.la \
-                               resolvconf.la resolvfile.la rtnllink.la
+                               netdev.la dhclient.la ipv4.la rtnllink.la \
+                               dnsproxy.la resolvconf.la resolvfile.la
 
 loopback_la_SOURCES = loopback.c
 
@@ -23,12 +23,14 @@ dhclient_la_CFLAGS = @GLIB_CFLAGS@ @GDBUS_CFLAGS@ -DDHCLIENT=\"@DHCLIENT@\" \
 
 ipv4_la_SOURCES = ipv4.c
 
+rtnllink_la_SOURCES = rtnllink.c inet.h inet.c
+
+dnsproxy_la_SOURCES = dnsproxy.c
+
 resolvconf_la_SOURCES = resolvconf.c
 
 resolvfile_la_SOURCES = resolvfile.c
 
-rtnllink_la_SOURCES = rtnllink.c inet.h inet.c
-
 if POLKIT
 plugin_LTLIBRARIES += polkit.la
 
diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c
new file mode 100644 (file)
index 0000000..419d33d
--- /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/resolver.h>
+#include <connman/log.h>
+
+static int dnsproxy_append(const char *interface, const char *domain,
+                                                       const char *server)
+{
+       DBG("server %s", server);
+
+       return -1;
+}
+
+static int dnsproxy_remove(const char *interface, const char *domain,
+                                                       const char *server)
+{
+       DBG("server %s", server);
+
+       return 0;
+}
+
+static struct connman_resolver dnsproxy_resolver = {
+       .name           = "dnsproxy",
+       .priority       = CONNMAN_RESOLVER_PRIORITY_HIGH,
+       .append         = dnsproxy_append,
+       .remove         = dnsproxy_remove,
+};
+
+static int dnsproxy_init(void)
+{
+       return connman_resolver_register(&dnsproxy_resolver);
+}
+
+static void dnsproxy_exit(void)
+{
+       connman_resolver_unregister(&dnsproxy_resolver);
+}
+
+CONNMAN_PLUGIN_DEFINE(dnsproxy, "DNS proxy resolver plugin", VERSION,
+                                       dnsproxy_init, dnsproxy_exit)