X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-ws-json1.c;h=31e9e42e9d207f24f3eafa198f068c6b46e16b21;hb=6518887513840471ea9c5af7e534787717e6bd82;hp=5ef751f1243e679c6584d2abbec6b9efe8a977dc;hpb=741d4e0505c588f38a64350c1d3c53c74f7ac22c;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 5ef751f1..31e9e42e 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -25,14 +25,16 @@ #include +#include + #include "afb-wsj1.h" #include "afb-ws-json1.h" #include "afb-msg-json.h" #include "session.h" -#include #include "afb-apis.h" #include "afb-context.h" #include "afb-evt.h" +#include "afb-subcall.h" #include "verbose.h" static void aws_on_hangup(struct afb_ws_json1 *ws, struct afb_wsj1 *wsj1); @@ -144,6 +146,7 @@ static const char *wsreq_raw(struct afb_wsreq *wsreq, size_t *size); static void wsreq_send(struct afb_wsreq *wsreq, const char *buffer, size_t size); static int wsreq_subscribe(struct afb_wsreq *wsreq, struct afb_event event); static int wsreq_unsubscribe(struct afb_wsreq *wsreq, struct afb_event event); +static void wsreq_subcall(struct afb_wsreq *wsreq, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *closure); const struct afb_req_itf afb_ws_json1_req_itf = { .json = (void*)wsreq_json, @@ -159,7 +162,8 @@ const struct afb_req_itf afb_ws_json1_req_itf = { .session_close = (void*)afb_context_close, .session_set_LOA = (void*)afb_context_change_loa, .subscribe = (void*)wsreq_subscribe, - .unsubscribe = (void*)wsreq_unsubscribe + .unsubscribe = (void*)wsreq_unsubscribe, + .subcall = (void*)wsreq_subcall }; static void aws_on_call(struct afb_ws_json1 *ws, const char *api, const char *verb, struct afb_wsj1_msg *msg) @@ -282,3 +286,8 @@ static int wsreq_unsubscribe(struct afb_wsreq *wsreq, struct afb_event event) return afb_evt_remove_watch(wsreq->aws->listener, event); } +static void wsreq_subcall(struct afb_wsreq *wsreq, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*), void *closure) +{ + afb_subcall(&wsreq->context, api, verb, args, callback, closure, (struct afb_req){ .itf = &afb_ws_json1_req_itf, .closure = wsreq }); +} +