summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-10-28 14:42:54 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-10-28 14:42:54 +0200
commitd00d1b7ce817aa3fefed9ee59d0904af561bb66c (patch)
tree73b117eab6f19baebcce3ee2f4cedd645375d536
parent36e53e878baaa9d56c09097ada0b7061266caff8 (diff)
hook: add few comments
Change-Id: I453625b70f13a5b01a84b2ac60eb6fb9e0dd0ebd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-hook.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/afb-hook.c b/src/afb-hook.c
index 2dfd1b1e..c06eb789 100644
--- a/src/afb-hook.c
+++ b/src/afb-hook.c
@@ -32,22 +32,25 @@
#include "verbose.h"
/*
- * Trace
+ * Definition of a hook
*/
struct afb_hook {
struct afb_hook *next; /* next hook */
unsigned refcount; /* reference count */
- char *api;
- char *verb;
- struct AFB_clientCtx *session;
+ char *api; /* api hooked or NULL for any */
+ char *verb; /* verb hooked or NULL for any */
+ struct AFB_clientCtx *session; /* session hooked or NULL if any */
unsigned flags; /* hook flags */
- struct afb_hook_req_itf *reqitf;
- void *closure;
+ struct afb_hook_req_itf *reqitf; /* interface of hook */
+ void *closure; /* closure for callbacks */
};
+/*
+ * Link hooks to a hooked request
+ */
struct hook_req_observer {
- struct afb_hook *hook;
- struct hook_req_observer *next;
+ struct afb_hook *hook; /* the hook */
+ struct hook_req_observer *next; /* the next observer */
};
/*
@@ -70,8 +73,10 @@ struct hook_subcall {
void *cb_closure; /* cient closure */
};
+/* counter of hooking */
static unsigned hook_count = 0;
+/* list of hooks */
static struct afb_hook *list_of_hooks = NULL;
/******************************************************************************