summaryrefslogtreecommitdiff
path: root/src/iface.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-01-03 09:11:41 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-01-03 09:11:41 +0100
commit8af2802c979ac2d63df1885c247a1cb387cab3bd (patch)
tree4a088287522b162bd7ea689704d81ed483dccc37 /src/iface.c
parent047005ba15de74a21a39240d85ba37927db9cdb0 (diff)
downloadconnman-8af2802c979ac2d63df1885c247a1cb387cab3bd.tar.gz
connman-8af2802c979ac2d63df1885c247a1cb387cab3bd.tar.bz2
connman-8af2802c979ac2d63df1885c247a1cb387cab3bd.zip
Add callbacks for setting network name and passphrase
Diffstat (limited to 'src/iface.c')
-rw-r--r--src/iface.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/iface.c b/src/iface.c
index 53031f62..82fbdda9 100644
--- a/src/iface.c
+++ b/src/iface.c
@@ -328,9 +328,61 @@ static DBusMessage *scan_iface(DBusConnection *conn,
return reply;
}
+static DBusMessage *set_network(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct connman_iface *iface = data;
+ struct connman_iface_driver *driver = iface->driver;
+ DBusMessage *reply;
+ const char *network;
+
+ DBG("conn %p", conn);
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &network,
+ DBUS_TYPE_INVALID);
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ if (driver->set_network)
+ driver->set_network(iface, network);
+
+ dbus_message_append_args(reply, DBUS_TYPE_INVALID);
+
+ return reply;
+}
+
+static DBusMessage *set_passphrase(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct connman_iface *iface = data;
+ struct connman_iface_driver *driver = iface->driver;
+ DBusMessage *reply;
+ const char *passphrase;
+
+ DBG("conn %p", conn);
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &passphrase,
+ DBUS_TYPE_INVALID);
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ if (driver->set_passphrase)
+ driver->set_passphrase(iface, passphrase);
+
+ dbus_message_append_args(reply, DBUS_TYPE_INVALID);
+
+ return reply;
+}
+
static GDBusMethodTable iface_methods[] = {
- { "Enable", "", "", enable_iface },
- { "Scan", "", "", scan_iface },
+ { "Enable", "", "", enable_iface },
+ { "Scan", "", "", scan_iface },
+ { "SetNetwork", "s", "", set_network },
+ { "SetPassphrase", "s", "", set_passphrase },
{ },
};