summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-10-09 12:43:29 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-09 14:08:33 +0200
commit8145fbf6ddca62854bd6afdd79f6dd391e0097d0 (patch)
treedccb02acb365a772b71bf9f72775b7fc0813160c
parent2b037bbfd58046219d9cd083ae9422b9fc200ad4 (diff)
afb-api-dbus: Make error for subcalls if DBUS transport
The DBUS API actually doesn't support the subcall feature. Until the subcall is implemented, it is better to emit an error than to fall back to the default behaviour (calling in the context of the service). Change-Id: Ibf5f3524995692a509d2d648d61e9ed0f874d7c1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-api-dbus.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c
index cace4d2b..c66426e9 100644
--- a/src/afb-api-dbus.c
+++ b/src/afb-api-dbus.c
@@ -866,13 +866,27 @@ static int dbus_req_unsubscribe(struct afb_xreq *xreq, struct afb_eventid *event
return rc;
}
+static void dbus_req_subcall(
+ struct afb_xreq *xreq,
+ const char *api,
+ const char *verb,
+ struct json_object *args,
+ void (*callback)(void*, int, struct json_object*),
+ void *cb_closure)
+{
+ ERROR("DBUS API doesn't support subcalls, info: %s/%s(%s)", api, verb, json_object_to_json_string(args));
+ callback(cb_closure, 1, afb_msg_json_reply_error("error", "subcall isn't supported", NULL, NULL));
+ json_object_put(args);
+}
+
const struct afb_xreq_query_itf afb_api_dbus_xreq_itf = {
.json = dbus_req_json,
.success = dbus_req_success,
.fail = dbus_req_fail,
.unref = dbus_req_destroy,
.subscribe = dbus_req_subscribe,
- .unsubscribe = dbus_req_unsubscribe
+ .unsubscribe = dbus_req_unsubscribe,
+ .subcall = dbus_req_subcall
};
/******************* server part **********************************/