Add plugin for using Google Public DNS service
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Dec 2009 04:09:14 +0000 (05:09 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 14 Dec 2009 04:09:14 +0000 (05:09 +0100)
Makefile.plugins
bootstrap-configure
configure.ac
plugins/google.c [new file with mode: 0644]

index 052a24d..8786c47 100644 (file)
@@ -178,6 +178,18 @@ plugins_dnsproxy_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
+if GOOGLE
+if GOOGLE_BUILTIN
+builtin_modules += google
+builtin_sources += plugins/google.c
+else
+plugin_LTLIBRARIES += plugins/google.la
+plugin_objects += $(plugins_google_la_OBJECTS)
+plugins_google_la_CFLAGS = $(plugin_cflags)
+plugins_google_la_LDFLAGS = $(plugin_ldflags)
+endif
+endif
+
 if POLKIT
 if POLKIT_BUILTIN
 builtin_modules += polkit
index 6d91052..e64a271 100755 (executable)
@@ -26,6 +26,7 @@ fi
                --enable-openconnect=builtin \
                --enable-resolvconf=builtin \
                --enable-dnsproxy=builtin \
+               --enable-google=builtin \
                --enable-hso=builtin \
                --enable-mbm=builtin \
                --enable-iwmx \
index 1dc7184..365b9dc 100644 (file)
@@ -179,6 +179,12 @@ AC_ARG_ENABLE(dnsproxy,
 AM_CONDITIONAL(DNSPROXY, test "${enable_dnsproxy}" != "no")
 AM_CONDITIONAL(DNSPROXY_BUILTIN, test "${enable_dnsproxy}" = "builtin")
 
+AC_ARG_ENABLE(google,
+       AC_HELP_STRING([--enable-google], [enable Google Public DNS support]),
+                       [enable_google=${enableval}], [enable_google="no"])
+AM_CONDITIONAL(GOOGLE, test "${enable_google}" != "no")
+AM_CONDITIONAL(GOOGLE_BUILTIN, test "${enable_google}" = "builtin")
+
 AC_ARG_ENABLE(hso,
        AC_HELP_STRING([--enable-hso], [enable HSO support]),
                        [enable_hso=${enableval}], [enable_hso="no"])
diff --git a/plugins/google.c b/plugins/google.c
new file mode 100644 (file)
index 0000000..5e8a63f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *
+ *  Connection Manager
+ *
+ *  Copyright (C) 2007-2009  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
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/plugin.h>
+#include <connman/resolver.h>
+
+#define GOOGLE_DNS1    "8.8.8.8"
+#define GOOGLE_DNS2    "8.8.4.4"
+
+static int google_init(void)
+{
+       connman_resolver_append_public_server(GOOGLE_DNS1);
+       connman_resolver_append_public_server(GOOGLE_DNS2);
+
+       return 0;
+}
+
+static void google_exit(void)
+{
+       connman_resolver_remove_public_server(GOOGLE_DNS2);
+       connman_resolver_remove_public_server(GOOGLE_DNS1);
+}
+
+CONNMAN_PLUGIN_DEFINE(google, "Google Public DNS plugin", VERSION,
+                       CONNMAN_PLUGIN_PRIORITY_LOW, google_init, google_exit)