X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fafb-req-itf.h;h=3efb089df2d2771a0a16fd789fbc05225f79b1c9;hb=da61b6ea09f77ea5a8ff6cb79b440db858980211;hp=2b3bc467eabb08f870070f88fba686c795b1a4c8;hpb=7e0abe76db7b90369429bf387d7aad0fb5a42328;p=src%2Fapp-framework-binder.git diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h index 2b3bc467..3efb089d 100644 --- a/include/afb/afb-req-itf.h +++ b/include/afb/afb-req-itf.h @@ -70,6 +70,8 @@ struct afb_req_itf { int (*subscribe)(void *closure, struct afb_event event); int (*unsubscribe)(void *closure, struct afb_event event); + + void (*subcall)(void *closure, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *cb_closure); }; /* @@ -340,8 +342,18 @@ static inline int afb_req_unsubscribe(struct afb_req req, struct afb_event event return req.itf->unsubscribe(req.closure, event); } - - +/* + * Makes a call to the method of name 'api' / 'verb' with the object 'args'. + * This call is made in the context of the request 'req'. + * On completion, the function 'callback' is invoked with the + * 'closure' given at call and two other parameters: 'iserror' and 'result'. + * 'iserror' is a boolean that indicates if the reply is an error reply. + * 'result' is the json object of the reply. + */ +static inline void afb_req_subcall(struct afb_req req, const char *api, const char *verb, struct json_object *args, void (*callback)(void *closure, int iserror, struct json_object *result), void *closure) +{ + req.itf->subcall(req.closure, api, verb, args, callback, closure); +} /* internal use */ static inline const char *afb_req_raw(struct afb_req req, size_t *size)