-#if !defined(BINDING_INSTALL_DIR)
-#error "you should define BINDING_INSTALL_DIR"
-#endif
-
-#define TRACEREQ_NO 0
-#define TRACEREQ_COMMON 1
-#define TRACEREQ_EXTRA 2
-#define TRACEREQ_ALL 3
-
-#define AFB_VERSION "0.5"
-
-// Define command line option
-#define SET_VERBOSE 1
-#define SET_BACKGROUND 2
-#define SET_FORGROUND 3
-
-#define SET_TCP_PORT 5
-#define SET_ROOT_DIR 6
-#define SET_ROOT_BASE 7
-#define SET_ROOT_API 8
-#define SET_ALIAS 9
-
-#define SET_CACHE_TIMEOUT 10
-#define SET_SESSION_DIR 11
-
-#define SET_AUTH_TOKEN 12
-#define SET_LDPATH 13
-#define SET_APITIMEOUT 14
-#define SET_CNTXTIMEOUT 15
-
-#define DISPLAY_VERSION 16
-#define DISPLAY_HELP 17
-
-#define SET_MODE 18
-#define SET_READYFD 19
-
-#define DBUS_CLIENT 20
-#define DBUS_SERVICE 21
-#define SO_BINDING 22
-
-#define SET_SESSIONMAX 23
-
-#define WS_CLIENT 24
-#define WS_SERVICE 25
-
-#define SET_ROOT_HTTP 26
-
-#define SET_TRACEREQ 27
-
-// Command line structure hold cli --command + help text
-typedef struct {
- int val; // command number within application
- int has_arg; // command number within application
- char *name; // command as used in --xxxx cli
- char *help; // help text
-} AFB_options;
-
-
-// Supported option
-static AFB_options cliOptions [] = {
- {SET_VERBOSE ,0,"verbose" , "Verbose Mode, repeat to increase verbosity"},
-
- {SET_FORGROUND ,0,"foreground" , "Get all in foreground mode"},
- {SET_BACKGROUND ,0,"daemon" , "Get all in background mode"},
-
- {SET_TCP_PORT ,1,"port" , "HTTP listening TCP port [default 1234]"},
- {SET_ROOT_DIR ,1,"rootdir" , "Root Directory [default $HOME/.AFB]"},
- {SET_ROOT_HTTP ,1,"roothttp" , "HTTP Root Directory [default rootdir]"},
- {SET_ROOT_BASE ,1,"rootbase" , "Angular Base Root URL [default /opa]"},
- {SET_ROOT_API ,1,"rootapi" , "HTML Root API URL [default /api]"},
- {SET_ALIAS ,1,"alias" , "Muliple url map outside of rootdir [eg: --alias=/icons:/usr/share/icons]"},
-
- {SET_APITIMEOUT ,1,"apitimeout" , "Binding API timeout in seconds [default 10]"},
- {SET_CNTXTIMEOUT ,1,"cntxtimeout" , "Client Session Context Timeout [default 900]"},
- {SET_CACHE_TIMEOUT,1,"cache-eol" , "Client cache end of live [default 3600]"},
-
- {SET_SESSION_DIR ,1,"sessiondir" , "Sessions file path [default rootdir/sessions]"},
-
- {SET_LDPATH ,1,"ldpaths" , "Load bindingss from dir1:dir2:... [default = "BINDING_INSTALL_DIR"]"},
- {SET_AUTH_TOKEN ,1,"token" , "Initial Secret [default=no-session, --token="" for session without authentication]"},
-
- {DISPLAY_VERSION ,0,"version" , "Display version and copyright"},
- {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"},
- {WS_CLIENT ,1,"ws-client" , "bind to an afb service through websocket"},
- {WS_SERVICE ,1,"ws-server" , "provides an afb service through websockets"},
- {SO_BINDING ,1,"binding" , "load the binding of path"},
-
- {SET_SESSIONMAX ,1,"session-max" , "max count of session simultaneously [default 10]"},
-
- {SET_TRACEREQ ,1,"tracereq" , "log the requests: no, common, extra, all"},
-
- {0, 0, NULL, NULL}
- };
-
-/*----------------------------------------------------------
- | printversion
- | print version and copyright
- +--------------------------------------------------------- */
-static void printVersion (FILE *file)
-{
- fprintf(file, "\n----------------------------------------- \n");
- fprintf(file, " AFB [Application Framework Binder] version=%s |\n", AFB_VERSION);
- fprintf(file, " \n");
- fprintf(file, " Copyright (C) 2015, 2016, 2017 \"IoT.bzh\" [fulup -at- iot.bzh]\n");
- fprintf(file, " AFB comes with ABSOLUTELY NO WARRANTY.\n");
- fprintf(file, " Licence Apache 2\n\n");
- exit (0);
-}
-