From 85b59718d6cb109b5e3900715ea8d42f5eed5341 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 21 Jul 2010 23:21:58 -0700 Subject: [PATCH] Add skeleton for generic DHCP plugin --- Makefile.plugins | 3 +++ plugins/dhcp.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 plugins/dhcp.c diff --git a/Makefile.plugins b/Makefile.plugins index 0a7424e..c8434c6 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -4,6 +4,9 @@ plugin_cflags = -fvisibility=hidden -I$(srcdir)/gdbus \ plugin_ldflags = -no-undefined -module -avoid-version +builtin_modules += dhcp +builtin_sources += plugins/dhcp.c + if LOOPBACK if LOOPBACK_BUILTIN builtin_modules += loopback diff --git a/plugins/dhcp.c b/plugins/dhcp.c new file mode 100644 index 0000000..2e07c7f --- /dev/null +++ b/plugins/dhcp.c @@ -0,0 +1,63 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2007-2010 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 +#endif + +#define CONNMAN_API_SUBJECT_TO_CHANGE +#include +#include +#include + +static int dhcp_request(struct connman_dhcp *dhcp) +{ + DBG("dhcp %p", dhcp); + + return -1; +} + +static int dhcp_release(struct connman_dhcp *dhcp) +{ + DBG("dhcp %p", dhcp); + + return -1; +} + +static struct connman_dhcp_driver dhcp_driver = { + .name = "dhcp", + .priority = CONNMAN_DHCP_PRIORITY_LOW, + .request = dhcp_request, + .release = dhcp_release, +}; + +static int dhcp_init(void) +{ + return connman_dhcp_driver_register(&dhcp_driver); +} + +static void dhcp_exit(void) +{ + connman_dhcp_driver_unregister(&dhcp_driver); +} + +CONNMAN_PLUGIN_DEFINE(dhcp, "Generic DHCP plugin", VERSION, + CONNMAN_PLUGIN_PRIORITY_LOW, dhcp_init, dhcp_exit) -- 2.7.4