diff options
author | 2017-04-07 10:57:55 +0200 | |
---|---|---|
committer | 2017-04-07 10:57:55 +0200 | |
commit | 4846cec0be7f41f992b9f89b7adb97033e15b1a0 (patch) | |
tree | 0b03d4f8cd60af9057452c4c3e6301a610e851b2 /src/afb-hook.c | |
parent | 522569c5a9da8566f5213fa5b9b3abadf746331d (diff) |
Finalize hooking of requests
Change-Id: I0c03b2c8ce556f1e6987ee5a7ad355ba9e67f142
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hook.c')
-rw-r--r-- | src/afb-hook.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c index e16d6704..bafbbe90 100644 --- a/src/afb-hook.c +++ b/src/afb-hook.c @@ -174,6 +174,16 @@ static void hook_xreq_subcall_result_default_cb(void * closure, const struct afb _hook_xreq_(xreq, " ...subcall... -> %d: %s", status, json_object_to_json_string(result)); } +static void hook_xreq_subcallsync_default_cb(void * closure, const struct afb_xreq *xreq, const char *api, const char *verb, struct json_object *args) +{ + _hook_xreq_(xreq, "subcallsync(%s/%s, %s) ...", api, verb, json_object_to_json_string(args)); +} + +static void hook_xreq_subcallsync_result_default_cb(void * closure, const struct afb_xreq *xreq, int status, struct json_object *result) +{ + _hook_xreq_(xreq, " ...subcallsync... -> %d: %s", status, json_object_to_json_string(result)); +} + static struct afb_hook_xreq_itf hook_xreq_default_itf = { .hook_xreq_begin = hook_xreq_begin_default_cb, .hook_xreq_end = hook_xreq_end_default_cb, @@ -193,6 +203,8 @@ static struct afb_hook_xreq_itf hook_xreq_default_itf = { .hook_xreq_unsubscribe = hook_xreq_unsubscribe_default_cb, .hook_xreq_subcall = hook_xreq_subcall_default_cb, .hook_xreq_subcall_result = hook_xreq_subcall_result_default_cb, + .hook_xreq_subcallsync = hook_xreq_subcallsync_default_cb, + .hook_xreq_subcallsync_result = hook_xreq_subcallsync_result_default_cb, }; /****************************************************************************** @@ -313,6 +325,17 @@ void afb_hook_xreq_subcall_result(const struct afb_xreq *xreq, int status, struc _HOOK_XREQ_(subcall_result, xreq, status, result); } +void afb_hook_xreq_subcallsync(const struct afb_xreq *xreq, const char *api, const char *verb, struct json_object *args) +{ + _HOOK_XREQ_(subcallsync, xreq, api, verb, args); +} + +int afb_hook_xreq_subcallsync_result(const struct afb_xreq *xreq, int status, struct json_object *result) +{ + _HOOK_XREQ_(subcallsync_result, xreq, status, result); + return status; +} + /****************************************************************************** * section: *****************************************************************************/ |