X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-dbus.c;h=eeadb9cfe980ad6c92655741215f592f262d254c;hb=afff776f7e27c8be7610cfbd23c4d1be32699ed9;hp=cace4d2b65a6c4fe85d4b5ad09abfe6e2f0d38ef;hpb=7682c2aacb3efd6abed3dee43f8a03d7646d8153;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c index cace4d2b..eeadb9cf 100644 --- a/src/afb-api-dbus.c +++ b/src/afb-api-dbus.c @@ -29,7 +29,7 @@ #include -#include "afb-common.h" +#include "afb-systemd.h" #include "afb-session.h" #include "afb-msg-json.h" @@ -113,7 +113,7 @@ static struct api_dbus *make_api_dbus_3(int system, const char *path, size_t pat goto error2; } api->api++; - if (!afb_api_is_valid_name(api->api)) { + if (!afb_api_is_valid_name(api->api, 1)) { errno = EINVAL; goto error2; } @@ -128,7 +128,7 @@ static struct api_dbus *make_api_dbus_3(int system, const char *path, size_t pat } /* choose the bus */ - sdbus = (system ? afb_common_get_system_bus : afb_common_get_user_bus)(); + sdbus = (system ? afb_systemd_get_system_bus : afb_systemd_get_user_bus)(); if (sdbus == NULL) goto error2; @@ -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 **********************************/