Update date of copyright notices
[src/app-framework-binder.git] / src / afb-config.c
index f7e5000..b23619e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015, 2016, 2017 "IoT.bzh"
+ * Copyright (C) 2015-2018 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -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'
 #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,11 +747,14 @@ 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)
        B(background)
+#if defined(WITH_MONITORING_OPTION)
        B(monitoring)
+#endif
        B(random_token)
        P("---END-OF-CONFIG---\n");
 
@@ -785,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");
 }
 
@@ -862,11 +879,14 @@ 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)
        B(background)
+#if defined(WITH_MONITORING_OPTION)
        B(monitoring)
+#endif
        B(random_token)
 
 #undef E