summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-02-26 13:35:43 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-02-26 13:46:38 +0100
commit9e8fda2954d951ea819dbddfe5afe466b2306074 (patch)
treeb23aed5b3f475eafe7d3dbfe2555f9c82c47e3dd
parent6e11db3cd27b40bdfbf2f1b032cd912a1eb8f156 (diff)
afb-config: Add traceses for tracing sessions
Change-Id: I9d36eb9eb4991066f94b1340262ad27467fc591e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-config.c18
-rw-r--r--src/afb-config.h1
-rw-r--r--src/main.c2
3 files changed, 20 insertions, 1 deletions
diff --git a/src/afb-config.c b/src/afb-config.c
index fc3f5d70..6c77c1db 100644
--- a/src/afb-config.c
+++ b/src/afb-config.c
@@ -97,6 +97,7 @@
#define SET_QUIET 'q'
#define SET_RNDTOKEN 'r'
#define SET_TRACESVC 'S'
+#define SET_TRACESES 's'
#define SET_TRACEREQ 'T'
#define SET_AUTH_TOKEN 't'
#define SET_UPLOAD_DIR 'u'
@@ -105,7 +106,7 @@
#define SET_WORK_DIR 'w'
const char shortopts[] =
- "c:D:E:ehn:p:qrT:t:u:Vvw:"
+ "c:D:E:ehn:p:qrS:s:T:t:u:Vvw:"
#if defined(WITH_MONITORING_OPTION)
"M"
#endif
@@ -169,6 +170,7 @@ static AFB_options cliOptions[] = {
{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"},
+ {SET_TRACESES, 1, "traceses", "Log the sessions: no, all"},
{ADD_CALL, 1, "call", "call at start format of val: API/VERB:json-args"},
@@ -219,6 +221,13 @@ static struct enumdesc traceevt_desc[] = {
{ NULL, 0 }
};
+static struct enumdesc traceses_desc[] = {
+ { "no", 0 },
+ { "common", afb_hook_flags_session_common },
+ { "all", afb_hook_flags_session_all },
+ { NULL, 0 }
+};
+
static struct enumdesc mode_desc[] = {
{ "local", AFB_MODE_LOCAL },
{ "remote", AFB_MODE_REMOTE },
@@ -588,6 +597,10 @@ static void parse_arguments(int argc, char **argv, struct afb_config *config)
config->traceevt = argvalenum(optc, traceevt_desc);
break;
+ case SET_TRACESES:
+ config->traceses = argvalenum(optc, traceses_desc);
+ break;
+
case SET_NO_HTTPD:
noarg(optc);
config->noHttpd = 1;
@@ -734,6 +747,7 @@ void afb_config_dump(struct afb_config *config)
E(traceditf,traceditf_desc)
E(tracesvc,tracesvc_desc)
E(traceevt,traceevt_desc)
+ E(traceses,traceses_desc)
B(no_ldpaths)
B(noHttpd)
@@ -787,6 +801,7 @@ static void parse_environment(struct afb_config *config)
on_environment_enum(&config->traceditf, "AFB_TRACEDITF", traceditf_desc);
on_environment_enum(&config->tracesvc, "AFB_TRACESVC", tracesvc_desc);
on_environment_enum(&config->traceevt, "AFB_TRACEEVT", traceevt_desc);
+ on_environment_enum(&config->traceses, "AFB_TRACESES", traceses_desc);
on_environment_list(&config->ldpaths, "AFB_LDPATHS");
}
@@ -864,6 +879,7 @@ struct json_object *afb_config_json(struct afb_config *config)
E(traceditf,traceditf_desc)
E(tracesvc,tracesvc_desc)
E(traceevt,traceevt_desc)
+ E(traceses,traceses_desc)
B(no_ldpaths)
B(noHttpd)
diff --git a/src/afb-config.h b/src/afb-config.h
index 9f87651c..c46cd5ac 100644
--- a/src/afb-config.h
+++ b/src/afb-config.h
@@ -64,6 +64,7 @@ struct afb_config {
int traceditf;
int tracesvc;
int traceevt;
+ int traceses;
/* booleans */
unsigned no_ldpaths: 1; /* disable default ldpaths */
diff --git a/src/main.c b/src/main.c
index e3f4251c..c735ecbb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -585,6 +585,8 @@ static void start(int signum, void *arg)
afb_hook_create_svc(NULL, main_config->tracesvc, NULL, NULL);
if (main_config->traceevt)
afb_hook_create_evt(NULL, main_config->traceevt, NULL, NULL);
+ if (main_config->traceses)
+ afb_hook_create_session(NULL, main_config->traceses, NULL, NULL);
/* load bindings */
afb_debug("start-load");