aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-xreq.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-xreq.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-xreq.c')
-rw-r--r--src/afb-xreq.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/afb-xreq.c b/src/afb-xreq.c
index 13deeb06..696bf9d4 100644
--- a/src/afb-xreq.c
+++ b/src/afb-xreq.c
@@ -527,6 +527,12 @@ static char *xreq_get_application_id_cb(void*closure)
return xreq->cred && xreq->cred->id ? strdup(xreq->cred->id) : NULL;
}
+static void *xreq_context_make_cb(void *closure, int replace, void *(*create_value)(void*), void (*free_value)(void*), void *create_closure)
+{
+ struct afb_xreq *xreq = closure;
+ return afb_context_make(&xreq->context, replace, create_value, free_value, create_closure);
+}
+
/******************************************************************************/
static struct json_object *xreq_hooked_json_cb(void *closure)
@@ -696,6 +702,13 @@ static char *xreq_hooked_get_application_id_cb(void*closure)
return afb_hook_xreq_get_application_id(xreq, r);
}
+static void *xreq_hooked_context_make_cb(void *closure, int replace, void *(*create_value)(void*), void (*free_value)(void*), void *create_closure)
+{
+ struct afb_xreq *xreq = closure;
+ void *result = xreq_context_make_cb(closure, replace, create_value, free_value, create_closure);
+ return afb_hook_xreq_context_make(xreq, replace, create_value, free_value, create_closure, result);
+}
+
/******************************************************************************/
const struct afb_req_itf xreq_itf = {
@@ -719,7 +732,8 @@ const struct afb_req_itf xreq_itf = {
.store = xreq_store_cb,
.subcall_req = xreq_subcall_req_cb,
.has_permission = xreq_has_permission_cb,
- .get_application_id = xreq_get_application_id_cb
+ .get_application_id = xreq_get_application_id_cb,
+ .context_make = xreq_context_make_cb
};
const struct afb_req_itf xreq_hooked_itf = {
@@ -743,7 +757,8 @@ const struct afb_req_itf xreq_hooked_itf = {
.store = xreq_hooked_store_cb,
.subcall_req = xreq_hooked_subcall_req_cb,
.has_permission = xreq_hooked_has_permission_cb,
- .get_application_id = xreq_hooked_get_application_id_cb
+ .get_application_id = xreq_hooked_get_application_id_cb,
+ .context_make = xreq_hooked_context_make_cb
};
/******************************************************************************/