-static int xreq_hooked_subcallsync_cb(void *closure, const char *api, const char *verb, struct json_object *args, struct json_object **result)
+static void xreq_hooked_subcall_request_cb(struct afb_request *closure, const char *api, const char *verb, struct json_object *args, void (*callback)(void*, int, struct json_object*, struct afb_request *), void *cb_closure)
+{
+ struct afb_xreq *xreq = xreq_from_request(closure);
+ struct subcall *sc;
+
+ afb_hook_xreq_subcall(xreq, api, verb, args);
+ sc = subcall_alloc(xreq, api, verb, args);
+ if (sc == NULL) {
+ if (callback)
+ callback(cb_closure, 1, afb_msg_json_internal_error(), xreq_to_request(xreq));
+ json_object_put(args);
+ } else {
+ subcall_request_hooked(sc, callback, cb_closure);
+ }
+}
+
+static int xreq_hooked_subcallsync_cb(struct afb_request *closure, const char *api, const char *verb, struct json_object *args, struct json_object **result)