Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH v1 6/7] wispr: Merge two DBGs into one (Daniel Wagner)
2. [PATCH v1 7/7] rtnl: Remove useless DBG (Daniel Wagner)
3. [PATCH v1 0/7] IWD plugin (Daniel Wagner)
4. [PATCH v1 1/7] service: Add support for IWD security type
mapping (Daniel Wagner)
5. [PATCH v1 2/7] iwd: Add infrastructure for iwd plugin
(Daniel Wagner)
6. [PATCH v1 3/7] iwd: Track D-Bus API (Daniel Wagner)
7. [PATCH v1 5/7] iwd: Register technology, device and network
driver stub (Daniel Wagner)
----------------------------------------------------------------------
Message: 1
Date: Fri, 11 Nov 2016 13:21:00 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 6/7] wispr: Merge two DBGs into one
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
There is little point in having two DBGs for this. Let's merge them.
---
src/wispr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wispr.c b/src/wispr.c
index ef4bdabacb4f..2cf874628f5a 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -832,8 +832,8 @@ static int wispr_portal_detect(struct
connman_wispr_portal_context *wp_context)
int err = 0;
int i;
- DBG("wispr/portal context %p", wp_context);
- DBG("service %p", wp_context->service);
+ DBG("wispr/portal context %p service %p", wp_context,
+ wp_context->service);
service_type = connman_service_get_type(wp_context->service);
--
2.7.4
------------------------------
Message: 2
Date: Fri, 11 Nov 2016 13:21:01 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 7/7] rtnl: Remove useless DBG
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
No real value in this DBG. Let's remove it.
---
src/rtnl.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/rtnl.c b/src/rtnl.c
index 0e58eeff2cfe..195368daeb01 100644
--- a/src/rtnl.c
+++ b/src/rtnl.c
@@ -1374,8 +1374,6 @@ static int process_response(guint32 seq)
static void rtnl_message(void *buf, size_t len)
{
- DBG("buf %p len %zd", buf, len);
-
while (len > 0) {
struct nlmsghdr *hdr = buf;
struct nlmsgerr *err;
--
2.7.4
------------------------------
Message: 3
Date: Fri, 11 Nov 2016 16:53:08 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 0/7] IWD plugin
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
Hi,
This version should be okay to get things rolling. Fixed a couple
of memory overwrites due to wrong ref/unref. I removed also the
things which didn't do anything useful (like tethering).
WPS and tetherning support is missing. I am running out of time
to work on this in the next few weeks. Please give it a try
and see and report problems.
cheers,
daniel
changes from v0:
- addressed feedback from Denis (property changed)
- fixed a couple of memory overwrites due to wrong ref/unref
- dropped tethering bits (not implemented)
- handling of signal strength
Daniel Wagner (7):
service: Add support for IWD security type mapping
iwd: Add infrastructure for iwd plugin
iwd: Track D-Bus API
iwd: Add Agent support
iwd: Register technology, device and network driver stub
iwd: Add/remove ConnMan devices
iwd: Add/remove ConnMan networks
Makefile.plugins | 5 +
configure.ac | 5 +
plugins/iwd.c | 1101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/service.c | 4 +-
4 files changed, 1113 insertions(+), 2 deletions(-)
create mode 100644 plugins/iwd.c
--
2.7.4
------------------------------
Message: 4
Date: Fri, 11 Nov 2016 16:53:09 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 1/7] service: Add support for IWD security type
mapping
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
IWD names the security types slightly different to what
gsupplicant returns. Though we need to map them to those names
because ConnMan exposes these strings via the Service.Security
property.
---
src/service.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/service.c b/src/service.c
index 5304c0db72bd..40e117d5dd35 100644
--- a/src/service.c
+++ b/src/service.c
@@ -241,9 +241,9 @@ enum connman_service_security
__connman_service_string2security(const char *str)
if (!strcmp(str, "psk"))
return CONNMAN_SERVICE_SECURITY_PSK;
- if (!strcmp(str, "ieee8021x"))
+ if (!strcmp(str, "ieee8021x") || !strcmp(str, "8021x"))
return CONNMAN_SERVICE_SECURITY_8021X;
- if (!strcmp(str, "none"))
+ if (!strcmp(str, "none") || !strcmp(str, "open"))
return CONNMAN_SERVICE_SECURITY_NONE;
if (!strcmp(str, "wep"))
return CONNMAN_SERVICE_SECURITY_WEP;
--
2.7.4
------------------------------
Message: 5
Date: Fri, 11 Nov 2016 16:53:10 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 2/7] iwd: Add infrastructure for iwd plugin
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
---
Makefile.plugins | 5 +++++
configure.ac | 5 +++++
plugins/iwd.c | 39 +++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
create mode 100644 plugins/iwd.c
diff --git a/Makefile.plugins b/Makefile.plugins
index b01fd808d481..dce8b2834a4d 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -26,6 +26,11 @@ builtin_modules += wifi
builtin_sources += plugins/wifi.c $(gsupplicant_sources)
endif
+if IWD
+builtin_modules += iwd
+builtin_sources += plugins/iwd.c
+endif
+
if BLUETOOTH
builtin_modules += bluetooth
builtin_sources += plugins/bluetooth.c
diff --git a/configure.ac b/configure.ac
index b477aa1682cb..20d3b56a494d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,6 +340,11 @@ AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
[enable_wifi=${enableval}])
AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
+AC_ARG_ENABLE(iwd, AC_HELP_STRING([--disable-iwd],
+ [disable iwd support]),
+ [enable_iwd=${enableval}])
+AM_CONDITIONAL(IWD, test "${enable_iwd}" != "no")
+
AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
[disable Bluetooth support]),
[enable_bluetooth=${enableval}])
diff --git a/plugins/iwd.c b/plugins/iwd.c
new file mode 100644
index 000000000000..d42f21a2281e
--- /dev/null
+++ b/plugins/iwd.c
@@ -0,0 +1,39 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2016 BMW Car IT GmbH.
+ *
+ * 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
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include <connman/plugin.h>
+
+static int iwd_init(void)
+{
+ return 0;
+}
+
+static void iwd_exit(void)
+{
+}
+
+CONNMAN_PLUGIN_DEFINE(iwd, "IWD plugin", VERSION,
+ CONNMAN_PLUGIN_PRIORITY_DEFAULT, iwd_init, iwd_exit)
--
2.7.4
------------------------------
Message: 6
Date: Fri, 11 Nov 2016 16:53:11 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 3/7] iwd: Track D-Bus API
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
---
plugins/iwd.c | 458 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 458 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index d42f21a2281e..bb351f07d3af 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -23,16 +23,474 @@
#include <config.h>
#endif
+#include <errno.h>
+#include <string.h>
+#include <stdbool.h>
+
#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <connman/plugin.h>
+#include <connman/dbus.h>
+#include <gdbus.h>
+
+static DBusConnection *connection;
+static GDBusClient *client;
+static GHashTable *adapters;
+static GHashTable *devices;
+static GHashTable *networks;
+
+#define IWD_SERVICE "net.connman.iwd"
+#define IWD_PATH "/"
+#define IWD_AGENT_MANAGER_INTERFACE "net.connman.iwd.AgentManager"
+#define IWD_ADAPTER_INTERFACE "net.connman.iwd.Adapter"
+#define IWD_DEVICE_INTERFACE "net.connman.iwd.Device"
+#define IWD_NETWORK_INTERFACE "net.connman.iwd.Network"
+
+enum iwd_device_state {
+ IWD_DEVICE_STATE_UNKNOWN,
+ IWD_DEVICE_STATE_CONNECTED,
+ IWD_DEVICE_STATE_DISCONNECTED,
+ IWD_DEVICE_STATE_CONNECTING,
+ IWD_DEVICE_STATE_DISCONNECTING,
+};
+
+struct iwd_adapter {
+ GDBusProxy *proxy;
+ char *vendor;
+ char *model;
+ bool powered;
+};
+
+struct iwd_device {
+ GDBusProxy *proxy;
+ char *adapter;
+ char *name;
+ char *address;
+ enum iwd_device_state state;
+ bool powered;
+ bool scanning;
+};
+
+struct iwd_network {
+ GDBusProxy *proxy;
+ char *device;
+ char *name;
+ char *type;
+ bool connected;
+};
+
+static enum iwd_device_state string2state(const char *str)
+{
+ if (!strcmp(str, "connected"))
+ return IWD_DEVICE_STATE_CONNECTED;
+ else if (!strcmp(str, "disconnected"))
+ return IWD_DEVICE_STATE_DISCONNECTED;
+ else if (!strcmp(str, "connecting"))
+ return IWD_DEVICE_STATE_CONNECTING;
+ else if (!strcmp(str, "disconnecting"))
+ return IWD_DEVICE_STATE_DISCONNECTING;
+
+ return IWD_DEVICE_STATE_UNKNOWN;
+}
+
+static const char *state2string(enum iwd_device_state state)
+{
+ switch (state) {
+ case IWD_DEVICE_STATE_CONNECTED:
+ return "connected";
+ case IWD_DEVICE_STATE_DISCONNECTED:
+ return "disconnected";
+ case IWD_DEVICE_STATE_CONNECTING:
+ return "connecting";
+ case IWD_DEVICE_STATE_DISCONNECTING:
+ return "disconnecting";
+ default:
+ break;
+ }
+
+ return "unknown";
+}
+
+static const char *proxy_get_string(GDBusProxy *proxy, const char *property)
+{
+ DBusMessageIter iter;
+ const char *str;
+
+ if (!g_dbus_proxy_get_property(proxy, property, &iter))
+ return NULL;
+ dbus_message_iter_get_basic(&iter, &str);
+ return str;
+}
+
+static bool proxy_get_bool(GDBusProxy *proxy, const char *property)
+{
+ DBusMessageIter iter;
+ dbus_bool_t value;
+
+ if (!g_dbus_proxy_get_property(proxy, property, &iter))
+ return false;
+ dbus_message_iter_get_basic(&iter, &value);
+ return value;
+}
+
+static void adapter_property_change(GDBusProxy *proxy, const char *name,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct iwd_adapter *adapter;
+ const char *path;
+
+ path = g_dbus_proxy_get_path(proxy);
+ adapter = g_hash_table_lookup(adapters, path);
+ if (!adapter)
+ return;
+
+ if (!strcmp(name, "Powered")) {
+ dbus_bool_t powered;
+
+ dbus_message_iter_get_basic(iter, &powered);
+ adapter->powered = powered;
+
+ DBG("%p powered %d", path, adapter->powered);
+ }
+}
+
+static void device_property_change(GDBusProxy *proxy, const char *name,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct iwd_device *iwdd;
+ const char *path;
+
+ path = g_dbus_proxy_get_path(proxy);
+ iwdd = g_hash_table_lookup(devices, path);
+ if (!iwdd)
+ return;
+
+ if (!strcmp(name, "Name")) {
+ const char *name;
+
+ dbus_message_iter_get_basic(iter, &name);
+ g_free(iwdd->name);
+ iwdd->name = g_strdup(name);
+
+ DBG("%p name %s", path, iwdd->name);
+ } else if (!strcmp(name, "State")) {
+ const char *state;
+
+ dbus_message_iter_get_basic(iter, &state);
+ iwdd->state = string2state(state);
+
+ DBG("%s state %s", path, state2string(iwdd->state));
+ } else if (!strcmp(name, "Powered")) {
+ dbus_bool_t powered;
+
+ dbus_message_iter_get_basic(iter, &powered);
+ iwdd->powered = powered;
+
+ DBG("%s powered %d", path, iwdd->powered);
+ } else if (!strcmp(name, "Scanning")) {
+ dbus_bool_t scanning;
+
+ dbus_message_iter_get_basic(iter, &scanning);
+ iwdd->scanning = scanning;
+
+ DBG("%s scanning %d", path, iwdd->scanning);
+ }
+}
+
+static void network_property_change(GDBusProxy *proxy, const char *name,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct iwd_network *iwdn;
+ const char *path;
+
+ path = g_dbus_proxy_get_path(proxy);
+ iwdn = g_hash_table_lookup(networks, path);
+ if (!iwdn)
+ return;
+
+ if (!strcmp(name, "Connected")) {
+ dbus_bool_t connected;
+
+ dbus_message_iter_get_basic(iter, &connected);
+ iwdn->connected = connected;
+
+ DBG("%s connected %d", path, iwdn->connected);
+ }
+}
+
+static void adapter_free(gpointer data)
+{
+ struct iwd_adapter *iwda = data;
+
+ if (iwda->proxy) {
+ g_dbus_proxy_unref(iwda->proxy);
+ iwda->proxy = NULL;
+ }
+
+ g_free(iwda->vendor);
+ g_free(iwda->model);
+ g_free(iwda);
+}
+
+static void device_free(gpointer data)
+{
+ struct iwd_device *iwdd = data;
+
+ if (iwdd->proxy) {
+ g_dbus_proxy_unref(iwdd->proxy);
+ iwdd->proxy = NULL;
+ }
+
+ g_free(iwdd->adapter);
+ g_free(iwdd->name);
+ g_free(iwdd->address);
+ g_free(iwdd);
+}
+
+static void network_free(gpointer data)
+{
+ struct iwd_network *iwdn = data;
+
+ if (iwdn->proxy) {
+ g_dbus_proxy_unref(iwdn->proxy);
+ iwdn->proxy = NULL;
+ }
+
+ g_free(iwdn->device);
+ g_free(iwdn->name);
+ g_free(iwdn->type);
+ g_free(iwdn);
+}
+
+static void create_adapter(GDBusProxy *proxy)
+{
+ const char *path = g_dbus_proxy_get_path(proxy);
+ struct iwd_adapter *iwda;
+ DBusMessageIter iter, value;
+
+ iwda = g_try_new0(struct iwd_adapter, 1);
+
+ if (!iwda) {
+ connman_error("Out of memory creating IWD adapter");
+ return;
+ }
+
+ g_hash_table_replace(adapters, g_strdup(path), iwda);
+
+ iwda->proxy = g_dbus_proxy_ref(proxy);
+
+ if (!iwda->proxy) {
+ connman_error("Cannot create IWD adapter watcher %s", path);
+ g_hash_table_remove(adapters, path);
+ return;
+ }
+
+ iwda->vendor = g_strdup(proxy_get_string(proxy, "Vendor"));
+ iwda->model = g_strdup(proxy_get_string(proxy, "Model"));
+ iwda->powered = proxy_get_bool(proxy, "Powered");
+
+ DBG("%s vendor '%s' model '%s' powered %d", path, iwda->vendor,
+ iwda->model, iwda->powered);
+
+ if (!g_dbus_proxy_get_property(iwda->proxy, "Devices", &iter))
+ return;
+
+ dbus_message_iter_recurse(&iter, &value);
+ while (dbus_message_iter_get_arg_type(&value) ==
+ DBUS_TYPE_OBJECT_PATH) {
+ const char *path;
+
+ dbus_message_iter_get_basic(&value, &path);
+ DBG("device %s", path);
+
+ dbus_message_iter_next(&value);
+ }
+
+ g_dbus_proxy_set_property_watch(iwda->proxy,
+ adapter_property_change, NULL);
+}
+
+static void create_device(GDBusProxy *proxy)
+{
+ const char *path = g_dbus_proxy_get_path(proxy);
+ struct iwd_device *iwdd;
+
+ iwdd = g_try_new0(struct iwd_device, 1);
+
+ if (!iwdd) {
+ connman_error("Out of memory creating IWD device");
+ return;
+ }
+
+ g_hash_table_replace(devices, g_strdup(path), iwdd);
+
+ iwdd->proxy = g_dbus_proxy_ref(proxy);
+
+ if (!iwdd->proxy) {
+ connman_error("Cannot create IWD device watcher %s", path);
+ g_hash_table_remove(devices, path);
+ return;
+ }
+
+ iwdd->adapter = g_strdup(proxy_get_string(proxy, "Adapter"));
+ iwdd->name = g_strdup(proxy_get_string(proxy, "Name"));
+ iwdd->address = g_strdup(proxy_get_string(proxy, "Address"));
+ iwdd->state = string2state(proxy_get_string(proxy, "State"));
+ iwdd->powered = proxy_get_bool(proxy, "Powered");
+ iwdd->scanning = proxy_get_bool(proxy, "Scanning");
+
+ DBG("adapter %s name %s address %s state %s powered %d scanning %d",
+ iwdd->adapter, iwdd->name, iwdd->address,
+ state2string(iwdd->state),
+ iwdd->powered, iwdd->scanning);
+
+ g_dbus_proxy_set_property_watch(iwdd->proxy,
+ device_property_change, NULL);
+}
+
+static void register_agent(GDBusProxy *proxy)
+{
+}
+
+static void unregister_agent()
+{
+}
+
+static void create_network(GDBusProxy *proxy)
+{
+ const char *path = g_dbus_proxy_get_path(proxy);
+ struct iwd_network *network;
+
+ network = g_try_new0(struct iwd_network, 1);
+
+ if (!network) {
+ connman_error("Out of memory creating IWD network");
+ return;
+ }
+
+ g_hash_table_replace(networks, g_strdup(path), network);
+
+ network->proxy = g_dbus_proxy_ref(proxy);
+
+ if (!network->proxy) {
+ connman_error("Cannot create IWD network watcher %s", path);
+ g_hash_table_remove(networks, path);
+ return;
+ }
+
+ network->device = g_strdup(proxy_get_string(proxy, "Device"));
+ network->name = g_strdup(proxy_get_string(proxy, "Name"));
+ network->type = g_strdup(proxy_get_string(proxy, "Type"));
+ network->connected = proxy_get_bool(proxy, "Connected");
+
+ DBG("device %s name '%s' type %s connected %d",
+ network->device,
+ network->name,
+ network->type,
+ network->connected);
+
+ g_dbus_proxy_set_property_watch(network->proxy,
+ network_property_change, NULL);
+}
+
+static void object_added(GDBusProxy *proxy, void *user_data)
+{
+ const char *interface;
+
+ interface = g_dbus_proxy_get_interface(proxy);
+ if (!interface) {
+ connman_warn("Interface or proxy missing when adding "
+ "iwd object");
+ return;
+ }
+
+ DBG("%s %s", interface, g_dbus_proxy_get_path(proxy));
+
+ if (!strcmp(interface, IWD_AGENT_MANAGER_INTERFACE))
+ register_agent(proxy);
+ else if (!strcmp(interface, IWD_ADAPTER_INTERFACE))
+ create_adapter(proxy);
+ else if (!strcmp(interface, IWD_DEVICE_INTERFACE))
+ create_device(proxy);
+ else if (!strcmp(interface, IWD_NETWORK_INTERFACE))
+ create_network(proxy);
+}
+
+static void object_removed(GDBusProxy *proxy, void *user_data)
+{
+ const char *interface, *path;
+
+ interface = g_dbus_proxy_get_interface(proxy);
+ if (!interface) {
+ connman_warn("Interface or proxy missing when removing "
+ "iwd object");
+ return;
+ }
+
+ path = g_dbus_proxy_get_path(proxy);
+ DBG("%s %s", interface, path);
+
+ if (!strcmp(interface, IWD_AGENT_MANAGER_INTERFACE))
+ unregister_agent();
+ if (!strcmp(interface, IWD_ADAPTER_INTERFACE))
+ g_hash_table_remove(adapters, path);
+ else if (!strcmp(interface, IWD_DEVICE_INTERFACE))
+ g_hash_table_remove(devices, path);
+ else if (!strcmp(interface, IWD_NETWORK_INTERFACE))
+ g_hash_table_remove(networks, path);
+}
static int iwd_init(void)
{
+ connection = connman_dbus_get_connection();
+ if (!connection)
+ goto out;
+
+ adapters = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+ adapter_free);
+
+ devices = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+ device_free);
+
+ networks = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+ network_free);
+
+ client = g_dbus_client_new(connection, IWD_SERVICE, IWD_PATH);
+ if (!client) {
+ connman_warn("Failed to initialize D-Bus client for "
+ IWD_SERVICE);
+ goto out;
+ }
+
+ g_dbus_client_set_proxy_handlers(client, object_added, object_removed,
+ NULL, NULL);
+
return 0;
+
+out:
+ if (devices)
+ g_hash_table_destroy(devices);
+
+ if (networks)
+ g_hash_table_destroy(networks);
+
+ if (adapters)
+ g_hash_table_destroy(adapters);
+
+ if (connection)
+ dbus_connection_unref(connection);
+
+ return -EIO;
}
static void iwd_exit(void)
{
+ g_dbus_client_unref(client);
+
+ g_hash_table_destroy(networks);
+ g_hash_table_destroy(devices);
+ g_hash_table_destroy(adapters);
+
+ dbus_connection_unref(connection);
}
CONNMAN_PLUGIN_DEFINE(iwd, "IWD plugin", VERSION,
--
2.7.4
------------------------------
Message: 7
Date: Fri, 11 Nov 2016 16:53:13 +0100
From: Daniel Wagner <[email protected]>
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Subject: [PATCH v1 5/7] iwd: Register technology, device and network
driver stub
Message-ID: <[email protected]>
From: Daniel Wagner <[email protected]>
---
plugins/iwd.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index 56b0d4b3943a..b289cb05f09e 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -30,6 +30,8 @@
#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <connman/plugin.h>
#include <connman/dbus.h>
+#include <connman/network.h>
+#include <connman/technology.h>
#include <gdbus.h>
static DBusConnection *connection;
@@ -138,6 +140,83 @@ static bool proxy_get_bool(GDBusProxy *proxy, const char
*property)
return value;
}
+static int cm_network_probe(struct connman_network *network)
+{
+ return -EOPNOTSUPP;
+}
+
+static void cm_network_remove(struct connman_network *network)
+{
+}
+
+static int cm_network_connect(struct connman_network *network)
+{
+ return -EINPROGRESS;
+}
+
+static int cm_network_disconnect(struct connman_network *network)
+{
+ return -EINPROGRESS;
+}
+
+static struct connman_network_driver network_driver = {
+ .name = "iwd",
+ .type = CONNMAN_NETWORK_TYPE_WIFI,
+ .probe = cm_network_probe,
+ .remove = cm_network_remove,
+ .connect = cm_network_connect,
+ .disconnect = cm_network_disconnect,
+};
+
+static int cm_device_probe(struct connman_device *device)
+{
+ return -EOPNOTSUPP;
+}
+
+static void cm_device_remove(struct connman_device *device)
+{
+}
+
+static int set_device_powered(struct connman_device *device, bool powered)
+{
+ return -EINPROGRESS;
+}
+
+static int cm_device_enable(struct connman_device *device)
+{
+ return set_device_powered(device, true);
+}
+
+static int cm_device_disable(struct connman_device *device)
+{
+ return set_device_powered(device, false);
+}
+
+static struct connman_device_driver device_driver = {
+ .name = "iwd",
+ .type = CONNMAN_DEVICE_TYPE_WIFI,
+ .probe = cm_device_probe,
+ .remove = cm_device_remove,
+ .enable = cm_device_enable,
+ .disable = cm_device_disable,
+};
+
+static int cm_tech_probe(struct connman_technology *technology)
+{
+ return 0;
+}
+
+static void cm_tech_remove(struct connman_technology *technology)
+{
+}
+
+static struct connman_technology_driver tech_driver = {
+ .name = "iwd",
+ .type = CONNMAN_SERVICE_TYPE_WIFI,
+ .probe = cm_tech_probe,
+ .remove = cm_tech_remove,
+};
+
static void adapter_property_change(GDBusProxy *proxy, const char *name,
DBusMessageIter *iter, void *user_data)
{
@@ -580,6 +659,24 @@ static int iwd_init(void)
networks = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
network_free);
+ if (connman_technology_driver_register(&tech_driver) < 0) {
+ connman_warn("Failed to initialize technology for IWD");
+ goto out;
+ }
+
+ if (connman_device_driver_register(&device_driver) < 0) {
+ connman_warn("Failed to initialize device driver for "
+ IWD_SERVICE);
+ connman_technology_driver_unregister(&tech_driver);
+ goto out;
+ }
+
+ if (connman_network_driver_register(&network_driver) < 0) {
+ connman_technology_driver_unregister(&tech_driver);
+ connman_device_driver_unregister(&device_driver);
+ goto out;
+ }
+
client = g_dbus_client_new(connection, IWD_SERVICE, IWD_PATH);
if (!client) {
connman_warn("Failed to initialize D-Bus client for "
@@ -612,6 +709,10 @@ static int iwd_init(void)
static void iwd_exit(void)
{
+ connman_network_driver_unregister(&network_driver);
+ connman_device_driver_unregister(&device_driver);
+ connman_technology_driver_unregister(&tech_driver);
+
g_dbus_client_unref(client);
g_hash_table_destroy(networks);
--
2.7.4
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 13, Issue 15
***************************************