X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-config.c;h=98dd4e553f805d1085af782beebd162158ddc386;hb=305d98f7b6db1a3207cc877bd2cda819e3b90656;hp=7852f6c472e7395727e4b0c7b07d3549b12e201d;hpb=c6c911a50ec61bef1ccd757ef9d8415a511751e0;p=src%2Fapp-framework-binder.git diff --git a/src/afb-config.c b/src/afb-config.c index 7852f6c4..98dd4e55 100644 --- a/src/afb-config.c +++ b/src/afb-config.c @@ -16,7 +16,7 @@ */ #define _GNU_SOURCE -#define NO_BINDING_VERBOSE_MACRO +#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO #include #include @@ -31,7 +31,7 @@ #include "afb-config.h" #include "afb-hook.h" -#include +#include #if !defined(BINDING_INSTALL_DIR) #error "you should define BINDING_INSTALL_DIR" @@ -71,7 +71,6 @@ #define SET_MODE 18 -#define SET_READYFD 19 #define DBUS_CLIENT 20 #define DBUS_SERVICE 21 @@ -86,10 +85,14 @@ #define SET_NO_HTTPD 28 +#define ADD_CALL 'c' +#define SET_TRACEDITF 'D' +#define SET_TRACEEVT 'E' #define SET_EXEC 'e' #define DISPLAY_HELP 'h' #define SET_QUIET 'q' #define SET_RNDTOKEN 'r' +#define SET_TRACESVC 'S' #define SET_TRACEREQ 'T' #define SET_AUTH_TOKEN 't' #define SET_UPLOAD_DIR 'u' @@ -97,7 +100,7 @@ #define SET_VERBOSE 'v' #define SET_WORK_DIR 'w' -#define SHORTOPTS "ehqrT:t:u:Vvw:" +#define SHORTOPTS "c:D:E:ehqrT:t:u:Vvw:" // Command line structure hold cli --command + help text typedef struct { @@ -141,7 +144,6 @@ static AFB_options cliOptions[] = { {DISPLAY_HELP, 0, "help", "Display this help"}, {SET_MODE, 1, "mode", "Set the mode: either local, remote or global"}, - {SET_READYFD, 1, "readyfd", "Set the #fd to signal when ready"}, {DBUS_CLIENT, 1, "dbus-client", "Bind to an afb service through dbus"}, {DBUS_SERVICE, 1, "dbus-server", "Provides an afb service through dbus"}, @@ -151,6 +153,11 @@ static AFB_options cliOptions[] = { {SET_SESSIONMAX, 1, "session-max", "Max count of session simultaneously [default 10]"}, {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"}, {SET_EXEC, 0, "exec", "Execute the remaining arguments"}, @@ -174,6 +181,28 @@ static struct enumdesc tracereq_desc[] = { { NULL, 0 } }; +static struct enumdesc traceditf_desc[] = { + { "no", 0 }, + { "common", afb_hook_flags_ditf_common }, + { "extra", afb_hook_flags_ditf_extra }, + { "all", afb_hook_flags_ditf_all }, + { NULL, 0 } +}; + +static struct enumdesc tracesvc_desc[] = { + { "no", 0 }, + { "all", afb_hook_flags_svc_all }, + { 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 }, @@ -429,6 +458,10 @@ static void parse_arguments(int argc, char **argv, struct afb_config *config) list_add(&config->ldpaths, argvalstr(optc)); break; + case ADD_CALL: + list_add(&config->calls, argvalstr(optc)); + break; + case SET_SESSION_DIR: /* config->sessiondir = argvalstr(optc); */ WARNING("Obsolete otpion %s ignored", optname(optc)); @@ -464,10 +497,6 @@ static void parse_arguments(int argc, char **argv, struct afb_config *config) config->mode = argvalenum(optc, mode_desc); break; - case SET_READYFD: - config->readyfd = argvalintdec(optc, 0, INT_MAX); - break; - case DBUS_CLIENT: list_add(&config->dbus_clients, argvalstr(optc)); break; @@ -492,6 +521,18 @@ static void parse_arguments(int argc, char **argv, struct afb_config *config) config->tracereq = argvalenum(optc, tracereq_desc); break; + case SET_TRACEDITF: + config->traceditf = argvalenum(optc, traceditf_desc); + break; + + case SET_TRACESVC: + 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; @@ -551,13 +592,13 @@ static void config_set_default(struct afb_config *config) /* set directories */ if (config->workdir == NULL) - config->workdir = get_current_dir_name(); + config->workdir = "."; if (config->rootdir == NULL) - config->rootdir = config->workdir; + config->rootdir = "."; if (config->uploaddir == NULL) - config->uploaddir = config->workdir; + config->uploaddir = "."; // if no Angular/HTML5 rootbase let's try '/' as default if (config->rootbase == NULL) @@ -612,18 +653,19 @@ void afb_config_dump(struct afb_config *config) L(ws_servers) L(so_bindings) L(ldpaths) + L(calls) V(exec) D(httpdPort) B(background) - D(readyfd) D(cacheTimeout) D(apiTimeout) D(cntxTimeout) D(nbSessionMax) E(mode,mode_desc) E(tracereq,tracereq_desc) + E(traceditf,traceditf_desc) B(noHttpd) P("---END-OF-CONFIG---\n");