+static void hook_api_call_result_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, struct json_object *object, const char *error, const char *info)
+{
+ _hook_api_(export, " ...call... [%s] -> %s (%s)", error?:"success", json_object_to_json_string_ext(object, JSON_C_TO_STRING_NOSLASHESCAPE), info?:"");
+}
+
+static void hook_api_callsync_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *api, const char *verb, struct json_object *args)
+{
+ _hook_api_(export, "callsync(%s/%s, %s) ...", api, verb, json_object_to_json_string_ext(args, JSON_C_TO_STRING_NOSLASHESCAPE));
+}
+
+static void hook_api_callsync_result_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int status, struct json_object *object, const char *error, const char *info)
+{
+ _hook_api_(export, " ...callsync... %d [%s] -> %s (%s)", status, error?:"success", json_object_to_json_string_ext(object, JSON_C_TO_STRING_NOSLASHESCAPE), info?:"");
+}
+
+static void hook_api_new_api_before_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *api, const char *info, int noconcurrency)
+{
+ _hook_api_(export, "new_api.before %s (%s)%s ...", api, info?:"", noconcurrency?" no-concurrency" : "");
+}
+
+static void hook_api_new_api_after_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *api)
+{
+ _hook_api_(export, "... new_api.after %s -> %s (%d)", api, result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_set_verbs_v2_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const struct afb_verb_v2 *verbs)
+{
+ _hook_api_(export, "set_verbs_v2 -> %s (%d)", result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_set_verbs_v3_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const struct afb_verb_v3 *verbs)
+{
+ _hook_api_(export, "set_verbs_v3 -> %s (%d)", result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_add_verb_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *verb, const char *info, int glob)
+{
+ _hook_api_(export, "add_verb(%s%s [%s]) -> %s (%d)", verb, glob?" (GLOB)":"", info?:"", result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_del_verb_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *verb)
+{
+ _hook_api_(export, "del_verb(%s) -> %s (%d)", verb, result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_set_on_event_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result)
+{
+ _hook_api_(export, "set_on_event -> %s (%d)", result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_set_on_init_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result)
+{
+ _hook_api_(export, "set_on_init -> %s (%d)", result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_api_seal_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export)
+{
+ _hook_api_(export, "seal");
+}
+
+static void hook_api_event_handler_add_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *pattern)
+{
+ _hook_api_(export, "event_handler_add(%s) -> %s (%d)", pattern, result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_event_handler_del_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *pattern)
+{
+ _hook_api_(export, "event_handler_del(%s) -> %s (%d)", pattern, result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_class_provide_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *name)
+{
+ _hook_api_(export, "class_provide(%s) -> %s (%d)", name, result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_class_require_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result, const char *name)
+{
+ _hook_api_(export, "class_require(%s) -> %s (%d)", name, result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_delete_api_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, int result)
+{
+ _hook_api_(export, "delete_api -> %s (%d)", result >= 0 ? "OK" : "ERROR", result);
+}
+
+static void hook_api_on_event_handler_before_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *event, int event_x2, struct json_object *object, const char *pattern)
+{
+ _hook_api_(export, "on_event_handler[%s].before(%s, %d, %s)", pattern, event, event_x2, json_object_to_json_string_ext(object, JSON_C_TO_STRING_NOSLASHESCAPE));
+}
+
+static void hook_api_on_event_handler_after_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *event, int event_x2, struct json_object *object, const char *pattern)
+{
+ _hook_api_(export, "on_event_handler[%s].after(%s, %d, %s)", pattern, event, event_x2, json_object_to_json_string_ext(object, JSON_C_TO_STRING_NOSLASHESCAPE));
+}
+
+static void hook_api_settings_cb(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, struct json_object *object)
+{
+ _hook_api_(export, "settings -> %s", json_object_to_json_string_ext(object, JSON_C_TO_STRING_NOSLASHESCAPE));
+}
+
+static struct afb_hook_api_itf hook_api_default_itf = {
+ .hook_api_event_broadcast_before = hook_api_event_broadcast_before_cb,
+ .hook_api_event_broadcast_after = hook_api_event_broadcast_after_cb,
+ .hook_api_get_event_loop = hook_api_get_event_loop_cb,
+ .hook_api_get_user_bus = hook_api_get_user_bus_cb,
+ .hook_api_get_system_bus = hook_api_get_system_bus_cb,
+ .hook_api_vverbose = hook_api_vverbose_cb,
+ .hook_api_event_make = hook_api_event_make_cb,
+ .hook_api_rootdir_get_fd = hook_api_rootdir_get_fd_cb,
+ .hook_api_rootdir_open_locale = hook_api_rootdir_open_locale_cb,
+ .hook_api_queue_job = hook_api_queue_job_cb,
+ .hook_api_legacy_unstore_req = hook_api_unstore_req_cb,
+ .hook_api_require_api = hook_api_require_api_cb,
+ .hook_api_require_api_result = hook_api_require_api_result_cb,
+ .hook_api_add_alias = hook_api_add_alias_cb,
+ .hook_api_start_before = hook_api_start_before_cb,
+ .hook_api_start_after = hook_api_start_after_cb,
+ .hook_api_on_event_before = hook_api_on_event_before_cb,
+ .hook_api_on_event_after = hook_api_on_event_after_cb,
+ .hook_api_call = hook_api_call_cb,
+ .hook_api_call_result = hook_api_call_result_cb,
+ .hook_api_callsync = hook_api_callsync_cb,
+ .hook_api_callsync_result = hook_api_callsync_result_cb,
+ .hook_api_new_api_before = hook_api_new_api_before_cb,
+ .hook_api_new_api_after = hook_api_new_api_after_cb,
+ .hook_api_api_set_verbs_v2 = hook_api_api_set_verbs_v2_cb,
+ .hook_api_api_set_verbs_v3 = hook_api_api_set_verbs_v3_cb,
+ .hook_api_api_add_verb = hook_api_api_add_verb_cb,
+ .hook_api_api_del_verb = hook_api_api_del_verb_cb,
+ .hook_api_api_set_on_event = hook_api_api_set_on_event_cb,
+ .hook_api_api_set_on_init = hook_api_api_set_on_init_cb,
+ .hook_api_api_seal = hook_api_api_seal_cb,
+ .hook_api_event_handler_add = hook_api_event_handler_add_cb,
+ .hook_api_event_handler_del = hook_api_event_handler_del_cb,
+ .hook_api_class_provide = hook_api_class_provide_cb,
+ .hook_api_class_require = hook_api_class_require_cb,
+ .hook_api_delete_api = hook_api_delete_api_cb,
+ .hook_api_on_event_handler_before = hook_api_on_event_handler_before_cb,
+ .hook_api_on_event_handler_after = hook_api_on_event_handler_after_cb,
+ .hook_api_settings = hook_api_settings_cb,