2 * Copyright (C) 2015-2018 "IoT.bzh"
3 * Author José Bollo <jose.bollo@iot.bzh>
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #define NO_PLUGIN_VERBOSE_MACRO
27 #include <systemd/sd-bus.h>
28 #include <json-c/json.h>
30 #include <afb/afb-event-x2.h>
32 #include "afb-systemd.h"
34 #include "afb-session.h"
35 #include "afb-msg-json.h"
37 #include "afb-apiset.h"
38 #include "afb-api-dbus.h"
39 #include "afb-context.h"
45 static const char DEFAULT_PATH_PREFIX[] = "/org/agl/afb/api/";
52 * The path given are of the form
53 * system:/org/agl/afb/api/...
55 * user:/org/agl/afb/api/...
59 struct sd_bus *sdbus; /* the bus */
60 char *path; /* path of the object for the API */
61 char *name; /* name/interface of the object */
62 char *api; /* api name of the interface */
65 struct sd_bus_slot *slot_broadcast;
66 struct sd_bus_slot *slot_event;
67 struct dbus_event *events;
68 struct dbus_memo *memos;
71 struct sd_bus_slot *slot_call;
72 struct afb_evt_listener *listener; /* listener for broadcasted events */
73 struct origin *origins;
74 struct afb_apiset *apiset;
79 /******************* common part **********************************/
82 * create a structure api_dbus connected on either the system
83 * bus if 'system' is not null or on the user bus. The connection
84 * is established for either emiting/receiving on 'path' being of length
87 static struct api_dbus *make_api_dbus_3(int system, const char *path, size_t pathlen)
93 /* allocates the structure */
94 api = calloc(1, sizeof *api + 1 + pathlen + pathlen);
100 /* init the structure's strings */
102 /* path is copied after the struct */
103 api->path = (void*)(api+1);
104 strcpy(api->path, path);
106 /* api name is at the end of the path */
107 api->api = strrchr(api->path, '/');
108 if (api->api == NULL) {
113 if (!afb_api_is_valid_name(api->api)) {
118 /* the name/interface is copied after the path */
119 api->name = &api->path[pathlen + 1];
120 strcpy(api->name, &path[1]);
121 ptr = strchr(api->name, '/');
124 ptr = strchr(ptr, '/');
128 sdbus = (system ? afb_systemd_get_system_bus : afb_systemd_get_user_bus)();
142 * create a structure api_dbus connected on either the system
143 * bus if 'system' is not null or on the user bus. The connection
144 * is established for either emiting/receiving on 'path'.
145 * If 'path' is not absolute, it is prefixed with DEFAULT_PATH_PREFIX.
147 static struct api_dbus *make_api_dbus_2(int system, const char *path)
152 /* check the length of the path */
159 /* if the path is absolute, creation now */
161 return make_api_dbus_3(system, path, len);
163 /* compute the path prefixed with DEFAULT_PATH_PREFIX */
164 assert(strlen(DEFAULT_PATH_PREFIX) > 0);
165 assert(DEFAULT_PATH_PREFIX[strlen(DEFAULT_PATH_PREFIX) - 1] == '/');
166 len += strlen(DEFAULT_PATH_PREFIX);
167 ptr = alloca(len + 1);
168 strcpy(stpcpy(ptr, DEFAULT_PATH_PREFIX), path);
170 /* creation for prefixed path */
171 return make_api_dbus_3(system, ptr, len);
175 * create a structure api_dbus connected either emiting/receiving
177 * The path can be prefixed with "system:" or "user:" to select
178 * either the user or the system D-Bus. If none is set then user's
180 * If remaining 'path' is not absolute, it is prefixed with
181 * DEFAULT_PATH_PREFIX.
183 static struct api_dbus *make_api_dbus(const char *path)
188 /* retrieves the prefix "scheme-like" part */
189 ptr = strchr(path, ':');
191 return make_api_dbus_2(0, path);
193 /* check the prefix part */
194 preflen = (size_t)(ptr - path);
195 if (strncmp(path, "system", preflen) == 0)
196 return make_api_dbus_2(1, ptr + 1);
198 if (strncmp(path, "user", preflen) == 0)
199 return make_api_dbus_2(0, ptr + 1);
201 /* TODO: connect to a foreign D-Bus? */
206 static void destroy_api_dbus(struct api_dbus *api)
211 /******************* client part **********************************/
214 * structure for recording query data
217 struct dbus_memo *next; /* the next memo */
218 struct api_dbus *api; /* the dbus api */
219 struct afb_xreq *xreq; /* the request */
220 uint64_t msgid; /* the message identifier */
225 struct dbus_event *next;
226 struct afb_event_x2 *event;
231 /* allocates and init the memorizing data */
232 static struct dbus_memo *api_dbus_client_memo_make(struct api_dbus *api, struct afb_xreq *xreq)
234 struct dbus_memo *memo;
236 memo = malloc(sizeof *memo);
238 afb_xreq_unhooked_addref(xreq);
242 memo->next = api->client.memos;
243 api->client.memos = memo;
248 /* free and release the memorizing data */
249 static void api_dbus_client_memo_destroy(struct dbus_memo *memo)
251 struct dbus_memo **prv;
253 prv = &memo->api->client.memos;
254 while (*prv != NULL) {
262 afb_xreq_unhooked_unref(memo->xreq);
266 /* search a memorized request */
267 static struct dbus_memo *api_dbus_client_memo_search(struct api_dbus *api, uint64_t msgid)
269 struct dbus_memo *memo;
271 memo = api->client.memos;
272 while (memo != NULL && memo->msgid != msgid)
278 /* callback when received answer */
279 static int api_dbus_client_on_reply(sd_bus_message *message, void *userdata, sd_bus_error *ret_error)
282 struct dbus_memo *memo;
283 const char *json, *error, *info;
285 /* retrieve the recorded data */
289 rc = sd_bus_message_read(message, "sss", &json, &error, &info);
291 /* failing to have the answer */
292 afb_xreq_reply(memo->xreq, NULL, "error", "dbus error");
294 /* report the answer */
295 afb_xreq_reply(memo->xreq, *json ? json_tokener_parse(json) : NULL, *error ? error : NULL, *info ? info : NULL);
297 api_dbus_client_memo_destroy(memo);
301 /* on call, propagate it to the dbus service */
302 static void api_dbus_client_call(void *closure, struct afb_xreq *xreq)
304 struct api_dbus *api = closure;
307 struct dbus_memo *memo;
308 struct sd_bus_message *msg;
311 /* create the recording data */
312 memo = api_dbus_client_memo_make(api, xreq);
314 afb_xreq_reply(memo->xreq, NULL, "error", "out of memory");
318 /* creates the message */
320 rc = sd_bus_message_new_method_call(api->sdbus, &msg, api->name, api->path, api->name, xreq->request.called_verb);
324 creds = xreq_on_behalf_cred_export(xreq);
325 rc = sd_bus_message_append(msg, "ssus",
326 afb_xreq_raw(xreq, &size),
327 afb_session_uuid(xreq->context.session),
328 (uint32_t)xreq->context.flags,
334 rc = sd_bus_call_async(api->sdbus, NULL, msg, api_dbus_client_on_reply, memo, (uint64_t)-1);
338 rc = sd_bus_message_get_cookie(msg, &memo->msgid);
343 /* if there was an error report it directly */
345 afb_xreq_reply(memo->xreq, NULL, "error", "dbus error");
346 api_dbus_client_memo_destroy(memo);
348 sd_bus_message_unref(msg);
351 /* receives broadcasted events */
352 static int api_dbus_client_on_broadcast_event(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
354 struct json_object *object;
355 const char *event, *data;
356 int rc = sd_bus_message_read(m, "ss", &event, &data);
358 ERROR("unreadable broadcasted event");
360 object = json_tokener_parse(data);
361 afb_evt_broadcast(event, object);
366 /* search the eventid */
367 static struct dbus_event *api_dbus_client_event_search(struct api_dbus *api, int id, const char *name)
369 struct dbus_event *ev;
371 ev = api->client.events;
372 while (ev != NULL && (ev->id != id || 0 != strcmp(afb_evt_event_x2_fullname(ev->event), name)))
378 /* adds an eventid */
379 static void api_dbus_client_event_create(struct api_dbus *api, int id, const char *name)
381 struct dbus_event *ev;
383 /* check conflicts */
384 ev = api_dbus_client_event_search(api, id, name);
390 /* no conflict, try to add it */
391 ev = malloc(sizeof *ev);
393 ev->event = afb_evt_event_x2_create(name);
394 if (ev->event == NULL)
399 ev->next = api->client.events;
400 api->client.events = ev;
404 ERROR("can't create event %s, out of memory", name);
407 /* removes an eventid */
408 static void api_dbus_client_event_drop(struct api_dbus *api, int id, const char *name)
410 struct dbus_event *ev, **prv;
412 /* retrieves the event */
413 ev = api_dbus_client_event_search(api, id, name);
415 ERROR("event %s not found", name);
419 /* decrease the reference count */
423 /* unlinks the event */
424 prv = &api->client.events;
429 /* destroys the event */
430 afb_evt_event_x2_unref(ev->event);
435 static void api_dbus_client_event_push(struct api_dbus *api, int id, const char *name, const char *data)
437 struct json_object *object;
438 struct dbus_event *ev;
440 /* retrieves the event */
441 ev = api_dbus_client_event_search(api, id, name);
443 ERROR("event %s not found", name);
447 /* destroys the event */
448 object = json_tokener_parse(data);
449 afb_evt_event_x2_push(ev->event, object);
452 /* subscribes an event */
453 static void api_dbus_client_event_subscribe(struct api_dbus *api, int id, const char *name, uint64_t msgid)
456 struct dbus_event *ev;
457 struct dbus_memo *memo;
459 /* retrieves the event */
460 ev = api_dbus_client_event_search(api, id, name);
462 ERROR("event %s not found", name);
466 /* retrieves the memo */
467 memo = api_dbus_client_memo_search(api, msgid);
469 ERROR("message not found");
473 /* subscribe the request to the event */
474 rc = afb_xreq_subscribe(memo->xreq, ev->event);
476 ERROR("can't subscribe: %m");
479 /* unsubscribes an event */
480 static void api_dbus_client_event_unsubscribe(struct api_dbus *api, int id, const char *name, uint64_t msgid)
483 struct dbus_event *ev;
484 struct dbus_memo *memo;
486 /* retrieves the event */
487 ev = api_dbus_client_event_search(api, id, name);
489 ERROR("event %s not found", name);
493 /* retrieves the memo */
494 memo = api_dbus_client_memo_search(api, msgid);
496 ERROR("message not found");
500 /* unsubscribe the request from the event */
501 rc = afb_xreq_unsubscribe(memo->xreq, ev->event);
503 ERROR("can't unsubscribe: %m");
506 /* receives calls for event */
507 static int api_dbus_client_on_manage_event(sd_bus_message *m, void *userdata, sd_bus_error *ret_error)
509 const char *eventname, *data;
513 struct api_dbus *api;
516 /* check if expected message */
518 if (0 != strcmp(api->name, sd_bus_message_get_interface(m)))
519 return 0; /* not the expected interface */
520 if (0 != strcmp("event", sd_bus_message_get_member(m)))
521 return 0; /* not the expected member */
522 if (sd_bus_message_get_expect_reply(m))
523 return 0; /* not the expected type of message */
525 /* reads the message */
526 rc = sd_bus_message_read(m, "yisst", &order, &eventid, &eventname, &data, &msgid);
528 ERROR("unreadable event");
532 /* what is the order ? */
533 switch ((char)order) {
534 case '+': /* creates the event */
535 api_dbus_client_event_create(api, eventid, eventname);
537 case '-': /* drops the event */
538 api_dbus_client_event_drop(api, eventid, eventname);
540 case '!': /* pushs the event */
541 api_dbus_client_event_push(api, eventid, eventname, data);
543 case 'S': /* subscribe event for a request */
544 api_dbus_client_event_subscribe(api, eventid, eventname, msgid);
546 case 'U': /* unsubscribe event for a request */
547 api_dbus_client_event_unsubscribe(api, eventid, eventname, msgid);
550 /* unexpected order */
551 ERROR("unexpected order '%c' received", (char)order);
557 static struct afb_api_itf dbus_api_itf = {
558 .call = api_dbus_client_call
561 /* adds a afb-dbus-service client api */
562 int afb_api_dbus_add_client(const char *path, struct afb_apiset *declare_set, struct afb_apiset *call_set)
565 struct api_dbus *api;
566 struct afb_api_item afb_api;
569 /* create the dbus client api */
570 api = make_api_dbus(path);
574 /* connect to broadcasted events */
575 rc = asprintf(&match, "type='signal',path='%s',interface='%s',member='broadcast'", api->path, api->name);
578 ERROR("out of memory");
581 rc = sd_bus_add_match(api->sdbus, &api->client.slot_broadcast, match, api_dbus_client_on_broadcast_event, api);
585 ERROR("can't add dbus match %s for %s", api->path, api->name);
589 /* connect to event management */
590 rc = sd_bus_add_object(api->sdbus, &api->client.slot_event, api->path, api_dbus_client_on_manage_event, api);
593 ERROR("can't add dbus object %s for %s", api->path, api->name);
597 /* record it as an API */
598 afb_api.closure = api;
599 afb_api.itf = &dbus_api_itf;
600 afb_api.group = NULL;
601 if (afb_apiset_add(declare_set, api->api, afb_api) < 0)
607 destroy_api_dbus(api);
612 /******************* event structures for server part **********************************/
614 static void afb_api_dbus_server_event_add(void *closure, const char *event, int eventid);
615 static void afb_api_dbus_server_event_remove(void *closure, const char *event, int eventid);
616 static void afb_api_dbus_server_event_push(void *closure, const char *event, int eventid, struct json_object *object);
617 static void afb_api_dbus_server_event_broadcast(void *closure, const char *event, int eventid, struct json_object *object);
619 /* the interface for events broadcasting */
620 static const struct afb_evt_itf evt_broadcast_itf = {
621 .broadcast = afb_api_dbus_server_event_broadcast,
624 /* the interface for events pushing */
625 static const struct afb_evt_itf evt_push_itf = {
626 .push = afb_api_dbus_server_event_push,
627 .add = afb_api_dbus_server_event_add,
628 .remove = afb_api_dbus_server_event_remove
631 /******************* origin description part for server *****************************/
635 /* link to next different origin */
638 /* the server dbus-api */
639 struct api_dbus *api;
641 /* count of references */
644 /* credentials of the origin */
645 struct afb_cred *cred;
651 /* get the credentials for the message */
652 static void init_origin_creds(struct origin *origin)
661 rc = sd_bus_get_name_creds(origin->api->sdbus, origin->name,
662 SD_BUS_CREDS_PID|SD_BUS_CREDS_UID|SD_BUS_CREDS_GID|SD_BUS_CREDS_SELINUX_CONTEXT,
667 afb_cred_unref(origin->cred);
668 sd_bus_creds_get_uid(c, &uid);
669 sd_bus_creds_get_gid(c, &gid);
670 sd_bus_creds_get_pid(c, &pid);
671 sd_bus_creds_get_selinux_context(c, &context);
672 origin->cred = afb_cred_create(uid, gid, pid, context);
673 sd_bus_creds_unref(c);
677 static struct origin *afb_api_dbus_server_origin_get(struct api_dbus *api, const char *sender)
679 struct origin *origin;
681 /* searchs for an existing origin */
682 origin = api->server.origins;
683 while (origin != NULL) {
684 if (0 == strcmp(origin->name, sender)) {
688 origin = origin->next;
691 /* not found, create it */
692 origin = malloc(strlen(sender) + sizeof *origin);
697 origin->refcount = 1;
698 strcpy(origin->name, sender);
699 init_origin_creds(origin);
700 origin->next = api->server.origins;
701 api->server.origins = origin;
706 static void afb_api_dbus_server_origin_unref(struct origin *origin)
708 if (!--origin->refcount) {
711 prv = &origin->api->server.origins;
712 while(*prv != origin)
715 afb_cred_unref(origin->cred);
722 /* link to next different origin */
723 struct origin *origin;
725 /* the listener of events */
726 struct afb_evt_listener *listener;
729 static void afb_api_dbus_server_listener_free(struct listener *listener)
731 afb_evt_listener_unref(listener->listener);
732 afb_api_dbus_server_origin_unref(listener->origin);
736 static struct listener *afb_api_dbus_server_listener_get(struct api_dbus *api, const char *sender, struct afb_session *session)
739 struct listener *listener;
740 struct origin *origin;
743 origin = afb_api_dbus_server_origin_get(api, sender);
747 /* retrieves the stored listener */
748 listener = afb_session_get_cookie(session, origin);
749 if (listener != NULL) {
751 afb_api_dbus_server_origin_unref(origin);
755 /* creates the listener */
756 listener = malloc(sizeof *listener);
757 if (listener == NULL)
760 listener->origin = origin;
761 listener->listener = afb_evt_listener_create(&evt_push_itf, origin);
762 if (listener->listener != NULL) {
763 rc = afb_session_set_cookie(session, origin, listener, (void*)afb_api_dbus_server_listener_free);
766 afb_evt_listener_unref(listener->listener);
770 afb_api_dbus_server_origin_unref(origin);
774 /******************* dbus request part for server *****************/
777 * Structure for a dbus request
780 struct afb_xreq xreq; /**< the xreq of the request */
781 sd_bus_message *message; /**< the incoming request message */
782 const char *request; /**< the readen request as string */
783 struct json_object *json; /**< the readen request as object */
784 struct listener *listener; /**< the listener for events */
787 /* decrement the reference count of the request and free/release it on falling to null */
788 static void dbus_req_destroy(struct afb_xreq *xreq)
790 struct dbus_req *dreq = CONTAINER_OF_XREQ(struct dbus_req, xreq);
792 afb_context_disconnect(&dreq->xreq.context);
793 json_object_put(dreq->json);
794 sd_bus_message_unref(dreq->message);
798 /* get the object of the request */
799 static struct json_object *dbus_req_json(struct afb_xreq *xreq)
801 struct dbus_req *dreq = CONTAINER_OF_XREQ(struct dbus_req, xreq);
806 void dbus_req_raw_reply(struct afb_xreq *xreq, struct json_object *obj, const char *error, const char *info)
808 struct dbus_req *dreq = CONTAINER_OF_XREQ(struct dbus_req, xreq);
811 rc = sd_bus_reply_method_return(dreq->message, "sss",
812 obj ? json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN) : "",
816 ERROR("sending the reply failed");
819 static void afb_api_dbus_server_event_send(struct origin *origin, char order, const char *event, int eventid, const char *data, uint64_t msgid);
821 static int dbus_req_subscribe(struct afb_xreq *xreq, struct afb_event_x2 *event)
823 struct dbus_req *dreq = CONTAINER_OF_XREQ(struct dbus_req, xreq);
827 rc = afb_evt_event_x2_add_watch(dreq->listener->listener, event);
828 sd_bus_message_get_cookie(dreq->message, &msgid);
829 afb_api_dbus_server_event_send(dreq->listener->origin, 'S', afb_evt_event_x2_fullname(event), afb_evt_event_x2_id(event), "", msgid);
833 static int dbus_req_unsubscribe(struct afb_xreq *xreq, struct afb_event_x2 *event)
835 struct dbus_req *dreq = CONTAINER_OF_XREQ(struct dbus_req, xreq);
839 sd_bus_message_get_cookie(dreq->message, &msgid);
840 afb_api_dbus_server_event_send(dreq->listener->origin, 'U', afb_evt_event_x2_fullname(event), afb_evt_event_x2_id(event), "", msgid);
841 rc = afb_evt_event_x2_remove_watch(dreq->listener->listener, event);
845 const struct afb_xreq_query_itf afb_api_dbus_xreq_itf = {
846 .json = dbus_req_json,
847 .reply = dbus_req_raw_reply,
848 .unref = dbus_req_destroy,
849 .subscribe = dbus_req_subscribe,
850 .unsubscribe = dbus_req_unsubscribe,
853 /******************* server part **********************************/
855 static void afb_api_dbus_server_event_send(struct origin *origin, char order, const char *event, int eventid, const char *data, uint64_t msgid)
858 struct api_dbus *api;
859 struct sd_bus_message *msg;
864 rc = sd_bus_message_new_method_call(api->sdbus, &msg, origin->name, api->path, api->name, "event");
868 rc = sd_bus_message_append(msg, "yisst", (uint8_t)order, (int32_t)eventid, event, data, msgid);
872 rc = sd_bus_send(api->sdbus, msg, NULL); /* NULL for cookie implies no expected reply */
877 ERROR("error while send event %c%s(%d) to %s", order, event, eventid, origin->name);
879 sd_bus_message_unref(msg);
882 static void afb_api_dbus_server_event_add(void *closure, const char *event, int eventid)
884 afb_api_dbus_server_event_send(closure, '+', event, eventid, "", 0);
887 static void afb_api_dbus_server_event_remove(void *closure, const char *event, int eventid)
889 afb_api_dbus_server_event_send(closure, '-', event, eventid, "", 0);
892 static void afb_api_dbus_server_event_push(void *closure, const char *event, int eventid, struct json_object *object)
894 const char *data = json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN);
895 afb_api_dbus_server_event_send(closure, '!', event, eventid, data, 0);
896 json_object_put(object);
899 static void afb_api_dbus_server_event_broadcast(void *closure, const char *event, int eventid, struct json_object *object)
902 struct api_dbus *api;
905 rc = sd_bus_emit_signal(api->sdbus, api->path, api->name, "broadcast",
906 "ss", event, json_object_to_json_string_ext(object, JSON_C_TO_STRING_PLAIN));
908 ERROR("error while broadcasting event %s", event);
909 json_object_put(object);
912 /* called when the object for the service is called */
913 static int api_dbus_server_on_object_called(sd_bus_message *message, void *userdata, sd_bus_error *ret_error)
919 struct dbus_req *dreq;
920 struct api_dbus *api = userdata;
922 struct afb_session *session;
923 struct listener *listener;
925 /* check the interface */
926 if (strcmp(sd_bus_message_get_interface(message), api->name) != 0)
930 method = sd_bus_message_get_member(message);
932 /* create the request */
933 dreq = calloc(1 , sizeof *dreq);
938 rc = sd_bus_message_read(message, "ssus", &dreq->request, &uuid, &flags, &creds);
940 sd_bus_reply_method_errorf(message, SD_BUS_ERROR_INVALID_SIGNATURE, "invalid signature");
944 /* connect to the context */
945 afb_xreq_init(&dreq->xreq, &afb_api_dbus_xreq_itf);
946 if (afb_context_connect(&dreq->xreq.context, uuid, NULL) < 0)
948 session = dreq->xreq.context.session;
950 /* get the listener */
951 listener = afb_api_dbus_server_listener_get(api, sd_bus_message_get_sender(message), session);
952 if (listener == NULL)
955 /* fulfill the request and emit it */
956 dreq->xreq.context.flags = flags;
957 dreq->xreq.cred = afb_cred_mixed_on_behalf_import(listener->origin->cred, uuid, creds && creds[0] ? creds : NULL);
958 dreq->message = sd_bus_message_ref(message);
959 dreq->json = json_tokener_parse(dreq->request);
960 if (dreq->json == NULL && strcmp(dreq->request, "null")) {
961 /* lazy error detection of json request. Is it to improve? */
962 dreq->json = json_object_new_string(dreq->request);
964 dreq->listener = listener;
965 dreq->xreq.request.called_api = api->api;
966 dreq->xreq.request.called_verb = method;
967 afb_xreq_process(&dreq->xreq, api->server.apiset);
971 sd_bus_reply_method_errorf(message, SD_BUS_ERROR_NO_MEMORY, "out of memory");
977 /* create the service */
978 int afb_api_dbus_add_server(const char *path, struct afb_apiset *declare_set, struct afb_apiset *call_set)
981 struct api_dbus *api;
983 /* get the dbus api object connected */
984 api = make_api_dbus(path);
988 /* request the service object name */
989 rc = sd_bus_request_name(api->sdbus, api->name, 0);
992 ERROR("can't register name %s", api->name);
996 /* connect the service to the dbus object */
997 rc = sd_bus_add_object(api->sdbus, &api->server.slot_call, api->path, api_dbus_server_on_object_called, api);
1000 ERROR("can't add dbus object %s for %s", api->path, api->name);
1003 INFO("afb service over dbus installed, name %s, path %s", api->name, api->path);
1005 api->server.listener = afb_evt_listener_create(&evt_broadcast_itf, api);
1006 api->server.apiset = afb_apiset_addref(call_set);
1009 sd_bus_release_name(api->sdbus, api->name);
1011 destroy_api_dbus(api);