summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-01-05 17:02:46 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-01-05 17:02:46 +0100
commit4f9a0637340e17790ad3c29546adc34ab6ce0362 (patch)
tree5456fdfc36dc4c2841f46c9b43bbb9481127ef6a /src
parent19262ea6023ca56de20d5b69950bed1146437849 (diff)
downloadconnman-4f9a0637340e17790ad3c29546adc34ab6ce0362.tar.gz
connman-4f9a0637340e17790ad3c29546adc34ab6ce0362.tar.bz2
connman-4f9a0637340e17790ad3c29546adc34ab6ce0362.zip
Add skeleton for core connection driver
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am6
-rw-r--r--src/connection.c66
-rw-r--r--src/connman.h3
-rw-r--r--src/element.c2
4 files changed, 74 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3ea9035a..54c06d8d 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 00000000..78080a44
--- /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 <config.h>
+#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 0b902dc3..b97d835b 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 ebe52c66..873a5f5f 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();