aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-hook.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-08-29 17:58:08 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-08-29 18:02:15 +0200
commit170aef20bc3a59d5139c2eff8794d9ba4c83a2e5 (patch)
tree8354a7496e390e03e6fbdd0e6e663c4228326cb7 /src/afb-hook.h
parent6d8d9dc5aad148a74bcdf8965bee9f7058a08166 (diff)
hooking: Add hook at global scope
Actually the global scope only allows to trace log messages. Change-Id: Ib73edf2e3168311b2ad694d857e6647e34884313 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hook.h')
-rw-r--r--src/afb-hook.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/afb-hook.h b/src/afb-hook.h
index 8f7f61d1..43341242 100644
--- a/src/afb-hook.h
+++ b/src/afb-hook.h
@@ -32,6 +32,11 @@ struct afb_svc;
struct afb_stored_req;
struct sd_bus;
struct sd_event;
+struct afb_hook_xreq;
+struct afb_hook_ditf;
+struct afb_hook_svc;
+struct afb_hook_evt;
+struct afb_hook_global;
/*********************************************************
* section hookid
@@ -45,7 +50,6 @@ struct afb_hookid
/*********************************************************
* section hooking xreq
*********************************************************/
-struct afb_hook_xreq;
/* individual flags */
#define afb_hook_flag_req_begin 0x000001
@@ -301,7 +305,23 @@ extern void afb_hook_evt_name(const char *evt, int id);
extern void afb_hook_evt_drop(const char *evt, int id);
extern int afb_hook_flags_evt(const char *name);
-extern struct afb_hook_evt *afb_hook_create_evt(const char *name, int flags, struct afb_hook_evt_itf *itf, void *closure);
+extern struct afb_hook_evt *afb_hook_create_evt(const char *pattern, int flags, struct afb_hook_evt_itf *itf, void *closure);
extern struct afb_hook_evt *afb_hook_addref_evt(struct afb_hook_evt *hook);
extern void afb_hook_unref_evt(struct afb_hook_evt *hook);
+/*********************************************************
+* section hooking global (global interface)
+*********************************************************/
+
+#define afb_hook_flag_global_vverbose 0x000001
+
+#define afb_hook_flags_global_all (afb_hook_flag_global_vverbose)
+
+struct afb_hook_global_itf {
+ void (*hook_global_vverbose)(void *closure, const struct afb_hookid *hookid, int level, const char *file, int line, const char *function, const char *fmt, va_list args);
+};
+
+extern struct afb_hook_global *afb_hook_create_global(int flags, struct afb_hook_global_itf *itf, void *closure);
+extern struct afb_hook_global *afb_hook_addref_global(struct afb_hook_global *hook);
+extern void afb_hook_unref_global(struct afb_hook_global *hook);
+