summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-06-03 10:27:38 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-06-07 10:05:27 +0300
commit5186846c70447c633b28f22aa6ecf410b7473121 (patch)
tree5b8e22c3d82071ccf9c0da5e1b10edcba1b63637
parent032adc9de53adafd29603159ec8e6f31358b964b (diff)
downloadconnman-5186846c70447c633b28f22aa6ecf410b7473121.tar.gz
connman-5186846c70447c633b28f22aa6ecf410b7473121.tar.bz2
connman-5186846c70447c633b28f22aa6ecf410b7473121.zip
client: Add parameter to specify D-Bus service for method call
-rw-r--r--client/agent.c8
-rw-r--r--client/commands.c26
-rw-r--r--client/dbus_helpers.c12
-rw-r--r--client/dbus_helpers.h13
4 files changed, 33 insertions, 26 deletions
diff --git a/client/agent.c b/client/agent.c
index 5fe695fb..afd265bc 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -476,8 +476,8 @@ int __connmanctl_agent_register(DBusConnection *connection)
return 0;
}
- result = __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "RegisterAgent",
+ result = __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Manager", "RegisterAgent",
agent_register_return, connection,
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
@@ -517,8 +517,8 @@ int __connmanctl_agent_unregister(DBusConnection *connection)
g_dbus_unregister_interface(connection, agent_path(), AGENT_INTERFACE);
- result = __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "UnregisterAgent",
+ result = __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Manager", "UnregisterAgent",
agent_unregister_return, NULL,
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
diff --git a/client/commands.c b/client/commands.c
index 1a87c539..9490bf66 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -250,8 +250,8 @@ static int cmd_state(char *args[], int num, struct connman_option *options)
if (num > 1)
return -E2BIG;
- return __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "GetProperties",
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Manager", "GetProperties",
state_print, NULL, DBUS_TYPE_INVALID);
}
@@ -324,16 +324,17 @@ static int cmd_services(char *args[], int num, struct connman_option *options)
}
if (service_name == NULL) {
- return __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "GetServices",
- services_list, NULL, DBUS_TYPE_INVALID);
+ return __connmanctl_dbus_method_call(connection,
+ CONNMAN_SERVICE, CONNMAN_PATH,
+ "net.connman.Manager", "GetServices",
+ services_list, NULL, DBUS_TYPE_INVALID);
}
if (check_dbus_name(service_name) == false)
return -EINVAL;
path = g_strdup_printf("/net/connman/service/%s", service_name);
- return __connmanctl_dbus_method_call(connection, path,
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE, path,
"net.connman.Service", "GetProperties",
services_properties, path, DBUS_TYPE_INVALID);
}
@@ -375,8 +376,8 @@ static int cmd_technologies(char *args[], int num,
if (num > 1)
return -E2BIG;
- return __connmanctl_dbus_method_call(connection, "/",
- "net.connman.Manager", "GetTechnologies",
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Manager", "GetTechnologies",
technology_print, NULL, DBUS_TYPE_INVALID);
}
@@ -590,7 +591,7 @@ static int cmd_scan(char *args[], int num, struct connman_option *options)
return -EINVAL;
path = g_strdup_printf("/net/connman/technology/%s", args[1]);
- return __connmanctl_dbus_method_call(connection, path,
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE, path,
"net.connman.Technology", "Scan",
scan_return, path, DBUS_TYPE_INVALID);
}
@@ -626,7 +627,7 @@ static int cmd_connect(char *args[], int num, struct connman_option *options)
return -EINVAL;
path = g_strdup_printf("/net/connman/service/%s", args[1]);
- return __connmanctl_dbus_method_call(connection, path,
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE, path,
"net.connman.Service", "Connect",
connect_return, path, DBUS_TYPE_INVALID);
}
@@ -662,7 +663,7 @@ static int cmd_disconnect(char *args[], int num, struct connman_option *options)
return -EINVAL;
path = g_strdup_printf("/net/connman/service/%s", args[1]);
- return __connmanctl_dbus_method_call(connection, path,
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE, path,
"net.connman.Service", "Disconnect",
disconnect_return, path, DBUS_TYPE_INVALID);
}
@@ -981,7 +982,8 @@ static int cmd_config(char *args[], int num, struct connman_option *options)
break;
case 'r':
res = __connmanctl_dbus_method_call(connection,
- path, "net.connman.Service", "Remove",
+ CONNMAN_SERVICE, path,
+ "net.connman.Service", "Remove",
config_return, g_strdup(service_name),
DBUS_TYPE_INVALID);
break;
diff --git a/client/dbus_helpers.c b/client/dbus_helpers.c
index a3e08433..4913b688 100644
--- a/client/dbus_helpers.c
+++ b/client/dbus_helpers.c
@@ -216,16 +216,16 @@ static int append_variant(DBusMessageIter *iter, const char *property,
return 0;
}
-int __connmanctl_dbus_method_call(DBusConnection *connection, const char *path,
- const char *interface, const char *method,
- connmanctl_dbus_method_return_func_t cb, void *user_data,
- int arg1, ...)
+int __connmanctl_dbus_method_call(DBusConnection *connection,
+ const char *service, const char *path, const char *interface,
+ const char *method, connmanctl_dbus_method_return_func_t cb,
+ void *user_data, int arg1, ...)
{
DBusMessage *message;
va_list args;
- message = dbus_message_new_method_call("net.connman", path,
- interface, method);
+ message = dbus_message_new_method_call(service, path, interface,
+ method);
if (message == NULL)
return -ENOMEM;
diff --git a/client/dbus_helpers.h b/client/dbus_helpers.h
index fde11837..9fc21648 100644
--- a/client/dbus_helpers.h
+++ b/client/dbus_helpers.h
@@ -29,15 +29,20 @@
extern "C" {
#endif
+#define CONNMAN_SERVICE "net.connman"
+#define CONNMAN_PATH "/"
+#define VPN_SERVICE CONNMAN_SERVICE ".vpn"
+#define VPN_PATH "/"
+
void __connmanctl_dbus_print(DBusMessageIter *iter, const char *pre,
const char *dict, const char *sep);
typedef int (*connmanctl_dbus_method_return_func_t)(DBusMessageIter *iter,
const char *error, void *user_data);
-int __connmanctl_dbus_method_call(DBusConnection *connection, const char *path,
- const char *interface, const char *method,
- connmanctl_dbus_method_return_func_t cb, void * user_data,
- int arg1, ...);
+int __connmanctl_dbus_method_call(DBusConnection *connection,
+ const char *service, const char *path, const char *interface,
+ const char *method, connmanctl_dbus_method_return_func_t cb,
+ void * user_data, int arg1, ...);
int __connmanctl_dbus_set_property(DBusConnection *connection,
const char *path, const char *interface,