Added POST, Plugin API signal protection, refactor HTML5 rewrite
[src/app-framework-binder.git] / src / main.c
index 795c2a7..9586bb5 100644 (file)
@@ -72,6 +72,7 @@ static sigjmp_buf restartpoint; // context save for set/longjmp
 
  #define SET_SMACK          140
  #define SET_PLUGINS        141
+ #define SET_APITIMEOUT     142
 
  #define DISPLAY_VERSION    150
  #define DISPLAY_HELP       151
@@ -88,8 +89,9 @@ static  AFB_options cliOptions [] = {
 
   {SET_TCP_PORT     ,1,"port"            , "HTTP listening TCP port  [default 1234]"},
   {SET_ROOT_DIR     ,1,"rootdir"         , "HTTP Root Directory [default $HOME/.AFB"},
-  {SET_ROOT_BASE    ,1,"rootbase"        , "Angular Base Root URL [default /"},
+  {SET_ROOT_BASE    ,1,"rootbase"        , "Angular Base Root URL [default /opa"},
   {SET_ROOT_API     ,1,"rootapi"         , "HTML Root API URL [default /api"},
+  {SET_APITIMEOUT   ,1,"apitimeout"      , "Plugin API timeout in seconds [default 10]"},
 
   {SET_CACHE_TO     ,1,"cache-eol"       , "Client cache end of live [default 3600s]"},
   {SET_cardid       ,1,"setuid"          , "Change user id [default don't change]"},
@@ -227,7 +229,7 @@ static void closeSession (AFB_session *session) {
  |   Main listening HTTP loop
  +--------------------------------------------------------- */
 static void listenLoop (AFB_session *session) {
-  AFB_ERROR  err;
+  AFB_error  err;
 
   if (signal (SIGABRT, signalFail) == SIG_ERR) {
         fprintf (stderr, "%s ERR: main fail to install Signal handler\n", configTime());
@@ -301,6 +303,11 @@ int main(int argc, char *argv[])  {
        if (optarg == 0) goto needValueForOption;
        if (!sscanf (optarg, "%d", &cliconfig.httpdPort)) goto notAnInteger;
        break;
+       
+    case SET_APITIMEOUT:
+       if (optarg == 0) goto needValueForOption;
+       if (!sscanf (optarg, "%d", &cliconfig.apiTimeout)) goto notAnInteger;
+       break;
 
     case SET_ROOT_DIR:
        if (optarg == 0) goto needValueForOption;