summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-06-28 10:27:57 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-06-28 10:27:57 +0200
commitffb18df525c7435ec77ecb5ceac14cb357ca57d7 (patch)
tree89fa5a333ab73ec0388a56cc3801546d0748a92b /include
parentabd3d59620a11ba5c9aec630bf28cf04ea6c3cf6 (diff)
downloadconnman-ffb18df525c7435ec77ecb5ceac14cb357ca57d7.tar.gz
connman-ffb18df525c7435ec77ecb5ceac14cb357ca57d7.tar.bz2
connman-ffb18df525c7435ec77ecb5ceac14cb357ca57d7.zip
Add new element infrastructure
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am2
-rw-r--r--include/driver.h54
-rw-r--r--include/element.h123
3 files changed, 178 insertions, 1 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 15af3746..e2dacdcc 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,7 +1,7 @@
includedir = @includedir@/connman
-include_HEADERS = log.h plugin.h dbus.h
+include_HEADERS = log.h plugin.h driver.h element.h dbus.h
noinst_HEADERS = iface.h rtnl.h dhcp.h resolver.h
diff --git a/include/driver.h b/include/driver.h
new file mode 100644
index 00000000..3d0ad920
--- /dev/null
+++ b/include/driver.h
@@ -0,0 +1,54 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2008 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
+ *
+ */
+
+#ifndef __CONNMAN_DRIVER_H
+#define __CONNMAN_DRIVER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <connman/element.h>
+
+#define CONNMAN_DRIVER_PRIORITY_LOW -100
+#define CONNMAN_DRIVER_PRIORITY_DEFAULT 0
+#define CONNMAN_DRIVER_PRIORITY_HIGH 100
+
+struct connman_driver {
+ const char *name;
+ enum connman_element_type type;
+ enum connman_element_type subtype;
+ int priority;
+ int (*probe) (struct connman_element *element);
+ void (*remove) (struct connman_element *element);
+ int (*update) (struct connman_element *element);
+ int (*connect) (struct connman_element *element);
+ int (*disconnect) (struct connman_element *element);
+};
+
+extern int connman_driver_register(struct connman_driver *driver);
+extern void connman_driver_unregister(struct connman_driver *driver);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONNMAN_DRIVER_H */
diff --git a/include/element.h b/include/element.h
new file mode 100644
index 00000000..dfcbd0f0
--- /dev/null
+++ b/include/element.h
@@ -0,0 +1,123 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2008 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
+ *
+ */
+
+#ifndef __CONNMAN_ELEMENT_H
+#define __CONNMAN_ELEMENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+#include <glib.h>
+
+enum connman_element_state {
+ CONNMAN_ELEMENT_STATE_UNKNOWN = 0,
+ CONNMAN_ELEMENT_STATE_CONNECT = 1,
+ CONNMAN_ELEMENT_STATE_CONNECTED = 2,
+ CONNMAN_ELEMENT_STATE_CLOSED = 3,
+};
+
+enum connman_element_type {
+ CONNMAN_ELEMENT_TYPE_UNKNOWN = 0,
+ CONNMAN_ELEMENT_TYPE_ROOT = 1,
+ CONNMAN_ELEMENT_TYPE_DEVICE = 2,
+ CONNMAN_ELEMENT_TYPE_NETWORK = 3,
+ CONNMAN_ELEMENT_TYPE_IPV4 = 4,
+ CONNMAN_ELEMENT_TYPE_IPV6 = 5,
+ CONNMAN_ELEMENT_TYPE_DHCP = 6,
+ CONNMAN_ELEMENT_TYPE_BOOTP = 7,
+ CONNMAN_ELEMENT_TYPE_ZEROCONF = 8,
+
+ CONNMAN_ELEMENT_TYPE_CONNECTION = 42,
+};
+
+enum connman_element_subtype {
+ CONNMAN_ELEMENT_SUBTYPE_UNKNOWN = 0,
+ CONNMAN_ELEMENT_SUBTYPE_ETHERNET = 1,
+ CONNMAN_ELEMENT_SUBTYPE_WIFI = 2,
+ CONNMAN_ELEMENT_SUBTYPE_WIMAX = 3,
+ CONNMAN_ELEMENT_SUBTYPE_MODEM = 4,
+ CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH = 5,
+};
+
+struct connman_driver;
+
+struct connman_element {
+ gint refcount;
+ gchar *name;
+ gchar *path;
+ enum connman_element_type type;
+ enum connman_element_subtype subtype;
+ enum connman_element_state state;
+
+ struct connman_element *parent;
+
+ struct connman_driver *driver;
+ void *driver_data;
+
+ struct {
+ gchar *driver;
+ gchar *vendor;
+ gchar *product;
+ } info;
+
+ struct {
+ int index;
+ short flags;
+ gchar *name;
+ } netdev;
+
+ struct {
+ gchar *address;
+ gchar *netmask;
+ gchar *gateway;
+ gchar *network;
+ gchar *broadcast;
+ gchar *nameserver;
+ } ipv4;
+};
+
+extern struct connman_element *connman_element_create(void);
+extern struct connman_element *connman_element_ref(struct connman_element *element);
+extern void connman_element_unref(struct connman_element *element);
+
+extern int connman_element_register(struct connman_element *element,
+ struct connman_element *parent);
+extern void connman_element_unregister(struct connman_element *element);
+extern void connman_element_update(struct connman_element *element);
+
+static inline void *connman_element_get_data(struct connman_element *element)
+{
+ return element->driver_data;
+}
+
+static inline void connman_element_set_data(struct connman_element *element,
+ void *data)
+{
+ element->driver_data = data;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONNMAN_ELEMENT_H */