summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-03-27 11:54:05 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-04-04 07:27:26 (GMT)
commitf24d12fe64d321bb895601bc6b6d8395d7b08671 (patch)
tree546d4a53d96a94c8221b10c4fab28e64302cc63c /client
parent80bc28a74843eeee1333e1446455d1bd7701aa54 (diff)
downloadconnman-f24d12fe64d321bb895601bc6b6d8395d7b08671.zip
connman-f24d12fe64d321bb895601bc6b6d8395d7b08671.tar.gz
connman-f24d12fe64d321bb895601bc6b6d8395d7b08671.tar.bz2
client: Use helper functions for setting domains, nameservers and timeservers
Diffstat (limited to 'client')
-rw-r--r--client/commands.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/client/commands.c b/client/commands.c
index 2cdf4b3..731a7b2 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -522,6 +522,24 @@ static void config_append_ipv6(DBusMessageIter *iter, void *user_data)
&opts[0]);
}
+static void config_append_str(DBusMessageIter *iter, void *user_data)
+{
+ struct config_append *append = user_data;
+ char **opts = append->opts;
+ int i = 0;
+
+ if (opts == NULL)
+ return;
+
+ while (opts[i] != NULL) {
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
+ &opts[i]);
+ i++;
+ }
+
+ append->values = i;
+}
+
static int cmd_config(char *args[], int num, struct option *options)
{
int result = 0, res = 0, index = 2, oldindex = 0;
@@ -595,23 +613,35 @@ static int cmd_config(char *args[], int num, struct option *options)
break;
case 'n':
- res = set_service_property(connection, message,
- service_name,
+ res = __connmanctl_dbus_set_property_array(connection,
+ path, "net.connman.Service",
+ config_return, g_strdup(service_name),
"Nameservers.Configuration",
- NULL, opt_start, 0);
+ DBUS_TYPE_STRING, config_append_str,
+ &append);
+ index += append.values;
break;
+
case 't':
- res = set_service_property(connection, message,
- service_name,
+ res = __connmanctl_dbus_set_property_array(connection,
+ path, "net.connman.Service",
+ config_return, g_strdup(service_name),
"Timeservers.Configuration",
- NULL, opt_start, 0);
+ DBUS_TYPE_STRING, config_append_str,
+ &append);
+ index += append.values;
break;
+
case 'd':
- res = set_service_property(connection, message,
- service_name,
+ res = __connmanctl_dbus_set_property_array(connection,
+ path, "net.connman.Service",
+ config_return, g_strdup(service_name),
"Domains.Configuration",
- NULL, opt_start, 0);
+ DBUS_TYPE_STRING, config_append_str,
+ &append);
+ index += append.values;
break;
+
case 'x':
if (*opt_start == NULL) {
res = -EINVAL;