aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-hook.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-09-20 15:34:11 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-09 14:08:31 +0200
commit7b42076a77b81e205ecc704c3bb7538716567487 (patch)
treef1158e4ea14177f01ebf55355aa995257c7b79c8 /src/afb-hook.c
parent9ece61d2cbda88878b9f1e6a6e62d3d42cbdef00 (diff)
Atomic context initialisation for bindings
Change-Id: I3e81b64d57c917da1fba9b3a9387d0f4d7f3e6b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hook.c')
-rw-r--r--src/afb-hook.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c
index 188aabae..b3a13a7e 100644
--- a/src/afb-hook.c
+++ b/src/afb-hook.c
@@ -359,6 +359,11 @@ static void hook_xreq_get_application_id_default_cb(void *closure, const struct
_hook_xreq_(xreq, "get_application_id() -> %s", result);
}
+static void hook_xreq_context_make_default_cb(void *closure, const struct afb_hookid *hookid, const struct afb_xreq *xreq, int replace, void *(*create_value)(void*), void (*free_value)(void*), void *create_closure, void *result)
+{
+ _hook_xreq_(xreq, "context_make(replace=%s, %p, %p, %p) -> %p", replace?"yes":"no", create_value, free_value, create_closure, 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,
@@ -384,7 +389,8 @@ static struct afb_hook_xreq_itf hook_xreq_default_itf = {
.hook_xreq_subcall_req = hook_xreq_subcall_req_default_cb,
.hook_xreq_subcall_req_result = hook_xreq_subcall_req_result_default_cb,
.hook_xreq_has_permission = hook_xreq_has_permission_default_cb,
- .hook_xreq_get_application_id = hook_xreq_get_application_id_default_cb
+ .hook_xreq_get_application_id = hook_xreq_get_application_id_default_cb,
+ .hook_xreq_context_make = hook_xreq_context_make_default_cb
};
/******************************************************************************
@@ -544,6 +550,12 @@ char *afb_hook_xreq_get_application_id(const struct afb_xreq *xreq, char *result
return result;
}
+void *afb_hook_xreq_context_make(const struct afb_xreq *xreq, int replace, void *(*create_value)(void*), void (*free_value)(void*), void *create_closure, void *result)
+{
+ _HOOK_XREQ_(context_make, xreq, replace, create_value, free_value, create_closure, result);
+ return result;
+}
+
/******************************************************************************
* section: hooking xreqs
*****************************************************************************/