aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-config.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-06-01 12:34:29 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-06-01 12:34:29 +0200
commitb67e18b39830a01750721787bf3bdc5d71983144 (patch)
tree20104692fd55fcb27b3a20aae0b144bb64286150 /src/afb-config.c
parent4dc768d67031aa99e2b885a0df7e643fdd1fa80c (diff)
Add hooking for events
Change-Id: If5fe736e04c9f4298302c3cbba568f1d6346ee67 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-config.c')
-rw-r--r--src/afb-config.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/afb-config.c b/src/afb-config.c
index dc3388e4..98dd4e55 100644
--- a/src/afb-config.c
+++ b/src/afb-config.c
@@ -87,6 +87,7 @@
#define ADD_CALL 'c'
#define SET_TRACEDITF 'D'
+#define SET_TRACEEVT 'E'
#define SET_EXEC 'e'
#define DISPLAY_HELP 'h'
#define SET_QUIET 'q'
@@ -99,7 +100,7 @@
#define SET_VERBOSE 'v'
#define SET_WORK_DIR 'w'
-#define SHORTOPTS "c:D:ehqrT:t:u:Vvw:"
+#define SHORTOPTS "c:D:E:ehqrT:t:u:Vvw:"
// Command line structure hold cli --command + help text
typedef struct {
@@ -154,6 +155,8 @@ static AFB_options cliOptions[] = {
{SET_TRACEREQ, 1, "tracereq", "Log the requests: no, common, extra, all"},
{SET_TRACEDITF, 1, "traceditf", "Log the requests: no, common, extra, all"},
{SET_TRACESVC, 1, "tracesvc", "Log the requests: no, all"},
+ {SET_TRACEEVT, 1, "traceevt", "Log the requests: no, common, extra, all"},
+
{ADD_CALL, 1, "call", "call at start format of val: API/VERB:json-args"},
{SET_NO_HTTPD, 0, "no-httpd", "Forbids HTTP service"},
@@ -192,6 +195,14 @@ static struct enumdesc tracesvc_desc[] = {
{ NULL, 0 }
};
+static struct enumdesc traceevt_desc[] = {
+ { "no", 0 },
+ { "common", afb_hook_flags_evt_common },
+ { "extra", afb_hook_flags_evt_extra },
+ { "all", afb_hook_flags_evt_all },
+ { NULL, 0 }
+};
+
static struct enumdesc mode_desc[] = {
{ "local", AFB_MODE_LOCAL },
{ "remote", AFB_MODE_REMOTE },
@@ -518,6 +529,10 @@ static void parse_arguments(int argc, char **argv, struct afb_config *config)
config->tracesvc = argvalenum(optc, tracesvc_desc);
break;
+ case SET_TRACEEVT:
+ config->traceevt = argvalenum(optc, traceevt_desc);
+ break;
+
case SET_NO_HTTPD:
noarg(optc);
config->noHttpd = 1;