From: Marcel Holtmann Date: Wed, 26 Dec 2007 08:47:00 +0000 (+0100) Subject: Add skeleton for manager interface X-Git-Tag: 2.0_alpha~4979 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c00282b78a8c8eee17f65fb75f7f9eaa89c1925a;p=framework%2Fconnectivity%2Fconnman.git Add skeleton for manager interface --- diff --git a/src/Makefile.am b/src/Makefile.am index 65636af..b78d4b3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ dbus_DATA = connman.conf sbin_PROGRAMS = connmand -connmand_SOURCES = main.c connman.h plugin.c iface.c rtnl.c dhcp.c +connmand_SOURCES = main.c connman.h manager.c plugin.c iface.c rtnl.c dhcp.c connmand_LDADD = @HAL_LIBS@ @GDBUS_LIBS@ @GMODULE_LIBS@ diff --git a/src/connman.h b/src/connman.h index b1b6cbe..cff8f8f 100644 --- a/src/connman.h +++ b/src/connman.h @@ -34,6 +34,9 @@ #define CONNMAN_IFACE_BASEPATH "/interface" #define CONNMAN_IFACE_INTERFACE CONNMAN_SERVICE ".Interface" +int __connman_manager_init(DBusConnection *conn); +void __connman_manager_cleanup(void); + #include int __connman_plugin_init(void); diff --git a/src/main.c b/src/main.c index 40d6e07..21a0513 100644 --- a/src/main.c +++ b/src/main.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) exit(1); } - g_dbus_register_object(conn, CONNMAN_MANAGER_PATH, NULL, NULL); + __connman_manager_init(conn); __connman_plugin_init(); @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) __connman_plugin_cleanup(); - g_dbus_unregister_object(conn, CONNMAN_MANAGER_PATH); + __connman_manager_cleanup(); g_dbus_cleanup_connection(conn); diff --git a/src/manager.c b/src/manager.c new file mode 100644 index 0000000..5fa60cc --- /dev/null +++ b/src/manager.c @@ -0,0 +1,52 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2007 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 + +#include + +#include "connman.h" + +static DBusConnection *connection = NULL; + +int __connman_manager_init(DBusConnection *conn) +{ + DBG("conn %p", conn); + + connection = dbus_connection_ref(conn); + if (connection == NULL) + return -1; + + g_dbus_register_object(connection, CONNMAN_MANAGER_PATH, NULL, NULL); + + return 0; +} + +void __connman_manager_cleanup(void) +{ + DBG("conn %p", connection); + + g_dbus_unregister_object(connection, CONNMAN_MANAGER_PATH); + + dbus_connection_unref(connection); +}