From 4f9a0637340e17790ad3c29546adc34ab6ce0362 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 5 Jan 2009 17:02:46 +0100 Subject: [PATCH] Add skeleton for core connection driver --- src/Makefile.am | 6 ++--- src/connection.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/connman.h | 3 +++ src/element.c | 2 ++ 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/connection.c diff --git a/src/Makefile.am b/src/Makefile.am index 3ea9035..54c06d8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,9 +6,9 @@ dbus_DATA = connman.conf sbin_PROGRAMS = connmand connmand_SOURCES = main.c connman.h log.c selftest.c error.c plugin.c \ - profile.c element.c device.c network.c \ - security.c resolver.c storage.c manager.c \ - agent.c detect.c rtnl.c dbus.c + profile.c element.c device.c network.c connection.c \ + security.c resolver.c storage.c manager.c agent.c \ + detect.c rtnl.c dbus.c if UDEV connmand_SOURCES += udev.c diff --git a/src/connection.c b/src/connection.c new file mode 100644 index 0000000..78080a4 --- /dev/null +++ b/src/connection.c @@ -0,0 +1,66 @@ +/* + * + * 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 +#endif + +#include "connman.h" + +static int connection_probe(struct connman_element *element) +{ + DBG("element %p name %s", element, element->name); + + return 0; +} + +static void connection_remove(struct connman_element *element) +{ + DBG("element %p name %s", element, element->name); +} + +static struct connman_driver connection_driver = { + .name = "connection", + .type = CONNMAN_ELEMENT_TYPE_CONNECTION, + .priority = CONNMAN_DRIVER_PRIORITY_LOW, + .probe = connection_probe, + .remove = connection_remove, +}; + +static DBusConnection *connection; + +int __connman_connection_init(void) +{ + DBG(""); + + connection = connman_dbus_get_connection(); + + return connman_driver_register(&connection_driver); +} + +void __connman_connection_cleanup(void) +{ + DBG(""); + + connman_driver_unregister(&connection_driver); + + dbus_connection_unref(connection); +} diff --git a/src/connman.h b/src/connman.h index 0b902dc..b97d835 100644 --- a/src/connman.h +++ b/src/connman.h @@ -131,6 +131,9 @@ static inline void __connman_element_unlock(struct connman_element *element) int __connman_detect_init(void); void __connman_detect_cleanup(void); +int __connman_connection_init(void); +void __connman_connection_cleanup(void); + #ifdef HAVE_UDEV int __connman_udev_init(void); void __connman_udev_cleanup(void); diff --git a/src/element.c b/src/element.c index ebe52c6..873a5f5 100644 --- a/src/element.c +++ b/src/element.c @@ -1802,6 +1802,7 @@ int __connman_element_init(DBusConnection *conn, const char *device) __connman_device_init(); __connman_network_init(); + __connman_connection_init(); return 0; } @@ -1878,6 +1879,7 @@ void __connman_element_cleanup(void) { DBG(""); + __connman_connection_cleanup(); __connman_network_cleanup(); __connman_device_cleanup(); -- 1.7.9.5