diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-09-04 18:17:55 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-09-07 09:43:14 +0200 |
commit | 550b36945f2e9eae1fc4b822ea9a00a2a866eb83 (patch) | |
tree | 6d94b4fa92efcd7ff4a4cf9f8e0bb5b73f46dc3d /src/afb-hook.c | |
parent | e51d68ddc998f558507217e3c849b16ce94c068f (diff) |
Allow renaming of API
The function afb_daemon_rename_api allows to rename
an API during the preinit phase.
Change-Id: I35477ba99d35b1dc51a7cacf8e55c3f02d86d7b4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hook.c')
-rw-r--r-- | src/afb-hook.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c index 7dd81cba..a1ecea6d 100644 --- a/src/afb-hook.c +++ b/src/afb-hook.c @@ -752,6 +752,11 @@ static void hook_ditf_require_api_result_cb(void *closure, const struct afb_hook _hook_ditf_(ditf, "...require_api(%s, %d) -> %d", name, initialized, result); } +static void hook_ditf_rename_api_cb(void *closure, const struct afb_hookid *hookid, const struct afb_ditf *ditf, const char *oldname, const char *newname, int result) +{ + _hook_ditf_(ditf, "rename_api(%s -> %s) -> %d", oldname, newname, result); +} + static struct afb_hook_ditf_itf hook_ditf_default_itf = { .hook_ditf_event_broadcast_before = hook_ditf_event_broadcast_before_cb, .hook_ditf_event_broadcast_after = hook_ditf_event_broadcast_after_cb, @@ -765,7 +770,8 @@ static struct afb_hook_ditf_itf hook_ditf_default_itf = { .hook_ditf_queue_job = hook_ditf_queue_job_cb, .hook_ditf_unstore_req = hook_ditf_unstore_req_cb, .hook_ditf_require_api = hook_ditf_require_api_cb, - .hook_ditf_require_api_result = hook_ditf_require_api_result_cb + .hook_ditf_require_api_result = hook_ditf_require_api_result_cb, + .hook_ditf_rename_api = hook_ditf_rename_api_cb }; /****************************************************************************** @@ -862,6 +868,12 @@ int afb_hook_ditf_require_api_result(const struct afb_ditf *ditf, const char *na return result; } +int afb_hook_ditf_rename_api(const struct afb_ditf *ditf, const char *oldname, const char *newname, int result) +{ + _HOOK_DITF_(rename_api, ditf, oldname, newname, result); + return result; +} + /****************************************************************************** * section: hooking ditf *****************************************************************************/ |