aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-api-dbus.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-06-13 16:36:51 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-06-13 16:36:51 +0200
commit5b5a2e4412eea806451c016da9fb285bc09c17ab (patch)
treed6c9340bef28754483309b2a9095c24e69af6a9a /src/afb-api-dbus.c
parent0a8f8f784646254d9b71e928e930003f82d89603 (diff)
Service instanciation
Adds the ability for a service to initiate calls to other services and to receive events in its own context. Change-Id: I5ff149a0231e551e9ce8a8de9658cb492a38cae1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-dbus.c')
-rw-r--r--src/afb-api-dbus.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c
index 7452339b..3d9da07f 100644
--- a/src/afb-api-dbus.c
+++ b/src/afb-api-dbus.c
@@ -296,6 +296,17 @@ static void api_dbus_client_call(struct api_dbus *api, struct afb_req req, struc
}
}
+static int api_dbus_service_start(struct api_dbus *api, int share_session, int onneed)
+{
+ /* not an error when onneed */
+ if (onneed != 0)
+ return 0;
+
+ /* already started: it is an error */
+ ERROR("The Dbus binding %s is not a startable service", api->name);
+ return -1;
+}
+
/* receives events */
static int api_dbus_client_on_event(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
{
@@ -343,6 +354,7 @@ int afb_api_dbus_add_client(const char *path)
/* record it as an API */
afb_api.closure = api;
afb_api.call = (void*)api_dbus_client_call;
+ afb_api.service_start = (void*)api_dbus_service_start;
if (afb_apis_add(api->api, afb_api) < 0)
goto error2;