X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-args.c;h=af3cfcabac0d657b52f8c7c057ed74af1507e41f;hb=16f014ef35b8355de1006891fe6920c8b51675fe;hp=05a88655797836fe232edc6016d5522546a610f1;hpb=84f4aec41817417a3b94d91da1b9b2fba9711e40;p=src%2Fapp-framework-binder.git diff --git a/src/afb-args.c b/src/afb-args.c index 05a88655..af3cfcab 100644 --- a/src/afb-args.c +++ b/src/afb-args.c @@ -80,14 +80,13 @@ #define SET_CACHE_TIMEOUT 7 -#define AUTO_WS 8 -#define AUTO_LINK 9 - +#if WITH_DYNAMIC_BINDING #define ADD_LDPATH 10 -#define SET_API_TIMEOUT 11 -#define SET_SESSION_TIMEOUT 12 -#define ADD_WEAK_LDPATH 13 -#define SET_NO_LDPATH 14 +#define ADD_WEAK_LDPATH 11 +#define SET_NO_LDPATH 12 +#endif +#define SET_API_TIMEOUT 13 +#define SET_SESSION_TIMEOUT 14 #define SET_SESSIONMAX 15 @@ -109,13 +108,15 @@ #endif #define SET_TRAP_FAULTS 27 #define ADD_CALL 28 -#if defined(WITH_DBUS_TRANSPARENCY) +#if WITH_DBUS_TRANSPARENCY # define ADD_DBUS_CLIENT 30 # define ADD_DBUS_SERVICE 31 #endif #define ADD_AUTO_API 'A' +#if WITH_DYNAMIC_BINDING #define ADD_BINDING 'b' +#endif #define SET_CONFIG 'C' #define SET_COLOR 'c' #define SET_DAEMON 'D' @@ -174,18 +175,19 @@ static struct option_desc optdefs[] = { {SET_UPLOAD_DIR, 1, "uploaddir", "Directory for uploading files [default: workdir] relative to workdir"}, {SET_ROOT_DIR, 1, "rootdir", "Root Directory of the application [default: workdir] relative to workdir"}, +#if WITH_DYNAMIC_BINDING {ADD_LDPATH, 1, "ldpaths", "Load bindings from dir1:dir2:... [default = " BINDING_INSTALL_DIR "]"}, {ADD_BINDING, 1, "binding", "Load the binding of path"}, {ADD_WEAK_LDPATH, 1, "weak-ldpaths","Same as --ldpaths but ignore errors"}, {SET_NO_LDPATH, 0, "no-ldpaths", "Discard default ldpaths loading"}, - +#endif {SET_TOKEN, 1, "token", "Initial Secret [default=random, use --token="" to allow any token]"}, {SET_RANDOM_TOKEN, 0, "random-token","Enforce a random token"}, {GET_VERSION, 0, "version", "Display version and copyright"}, {GET_HELP, 0, "help", "Display this help"}, -#if defined(WITH_DBUS_TRANSPARENCY) +#if WITH_DBUS_TRANSPARENCY {ADD_DBUS_CLIENT, 1, "dbus-client", "Bind to an afb service through dbus"}, {ADD_DBUS_SERVICE, 1, "dbus-server", "Provide an afb service through dbus"}, #endif @@ -335,7 +337,7 @@ static void printVersion(FILE * file) "\n" " AGL Framework Binder [AFB %s] " -#if defined(WITH_DBUS_TRANSPARENCY) +#if WITH_DBUS_TRANSPARENCY "+" #else "-" @@ -348,7 +350,7 @@ static void printVersion(FILE * file) "-" #endif "MONITOR " -#if defined(WITH_SUPERVISION) +#if WITH_SUPERVISION "+" #else "-" @@ -369,19 +371,31 @@ static void printVersion(FILE * file) #endif "TRACE " - "[BINDINGS " -#if defined(WITH_LEGACY_BINDING_V1) + "[" +#if WITH_DYNAMIC_BINDING + "BINDINGS " + "+" +#else + "-" +#endif +#if WITH_LEGACY_BINDING_V1 "+" #else "-" #endif "V1 " -#if defined(WITH_LEGACY_BINDING_VDYN) +#if WITH_LEGACY_BINDING_VDYN + "+" +#else + "-" +#endif + "VDYN " +#if WITH_LEGACY_BINDING_V2 "+" #else "-" #endif - "VDYN +V2 +V3]\n" + "V2 +V3]\n" "\n", AFB_VERSION ); @@ -420,7 +434,11 @@ static void printHelp(FILE * file, const char *name) fprintf(file, "Example:\n %s --verbose --port=" d2s(DEFAULT_HTTP_PORT) - " --token='azerty' --ldpaths=build/bindings:/usr/lib64/agl/bindings\n", + " --token='azerty'" +#if WITH_DYNAMIC_BINDING + " --ldpaths=build/bindings:/usr/lib64/agl/bindings" +#endif + "\n", name); } @@ -545,6 +563,7 @@ static int config_has_bool(struct json_object *config, int optid) && json_object_get_boolean(x); } +__attribute__((unused)) static int config_has_str(struct json_object *config, int optid, const char *val) { int i, n; @@ -814,17 +833,19 @@ static void parse_arguments_inner(int argc, char **argv, struct json_object *con config_set_optstr(config, optid); break; -#if defined(WITH_DBUS_TRANSPARENCY) +#if WITH_DBUS_TRANSPARENCY case ADD_DBUS_CLIENT: case ADD_DBUS_SERVICE: #endif case ADD_ALIAS: +#if WITH_DYNAMIC_BINDING case ADD_LDPATH: case ADD_WEAK_LDPATH: + case ADD_BINDING: +#endif case ADD_CALL: case ADD_WS_CLIENT: case ADD_WS_SERVICE: - case ADD_BINDING: case ADD_AUTO_API: config_add_optstr(config, optid); break; @@ -838,7 +859,9 @@ static void parse_arguments_inner(int argc, char **argv, struct json_object *con #endif case SET_RANDOM_TOKEN: case SET_NO_HTTPD: +#if WITH_DYNAMIC_BINDING case SET_NO_LDPATH: +#endif noarg(optid); config_set_bool(config, optid, 1); break; @@ -972,8 +995,10 @@ static void fulfill_config(struct json_object *config) if (config_has_bool(config, SET_RANDOM_TOKEN)) config_del(config, SET_TOKEN); +#if WITH_DYNAMIC_BINDING if (!config_has(config, ADD_LDPATH) && !config_has(config, ADD_WEAK_LDPATH) && !config_has_bool(config, SET_NO_LDPATH)) config_add_str(config, ADD_LDPATH, BINDING_INSTALL_DIR); +#endif #if defined(WITH_MONITORING_OPTION) if (config_has_bool(config, SET_MONITORING) && !config_has_str(config, ADD_ALIAS, MONITORING_ALIAS)) @@ -1033,7 +1058,9 @@ static void parse_environment(struct json_object *config) on_environment_enum(config, SET_TRACESVC, "AFB_TRACESVC", afb_hook_flags_legacy_svc_from_text); #endif #endif +#if WITH_DYNAMIC_BINDING on_environment(config, ADD_LDPATH, "AFB_LDPATHS", config_add_str); +#endif on_environment(config, ADD_SET, "AFB_SET", config_mix2_str); on_environment_bool(config, SET_TRAP_FAULTS, "AFB_TRAP_FAULTS"); }