moves more helpers from config to helper-api
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 23 Mar 2016 12:31:23 +0000 (13:31 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 23 Mar 2016 12:31:23 +0000 (13:31 +0100)
Change-Id: I5bc012ebe79c0b3f6cb89ac56c994e2a9d7ed5e9
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
include/local-def.h
src/config.c
src/helper-api.c

index df4ddb2..f03666a 100644 (file)
@@ -83,9 +83,6 @@ typedef enum  {AFB_PLUGIN_JSON=123456789, AFB_PLUGIN_JSCRIPT=987654321,  AFB_PLU
 // prebuild json error are constructed in config.c
 typedef enum  { AFB_FALSE, AFB_TRUE, AFB_FATAL, AFB_FAIL, AFB_WARNING, AFB_EMPTY, AFB_SUCCESS, AFB_DONE, AFB_UNAUTH} AFB_error;
 
-extern char *ERROR_LABEL[];
-#define ERROR_LABEL_DEF {"false", "true", "fatal", "fail", "warning", "empty", "success"}
-
 #define BANNER "<html><head><title>Application Framework Binder</title></head><body>Application Framework </body></html>"
 #define JSON_CONTENT  "application/json"
 #define FORM_CONTENT "multipart/form-data"
@@ -96,13 +93,6 @@ extern char *ERROR_LABEL[];
 typedef json_object* (*AFB_apiCB)();
 typedef void (*AFB_freeCtxCB)(void*, void*, char*);
 
-// Error code are requested through function to manage json usage count
-typedef struct {
-  int   level;
-  char* label;
-  json_object *json;
-} AFB_errorT;
-
 typedef enum  {AFB_POST_NONE=0, AFB_POST_JSON, AFB_POST_FORM, AFB_POST_EMPTY} AFB_PostType;
 typedef enum  {AFB_MODE_LOCAL=0, AFB_MODE_REMOTE, AFB_MODE_GLOBAL} AFB_Mode;
 
index 32336a7..6f23664 100644 (file)
@@ -28,7 +28,6 @@
 
 #define AFB_CONFIG_JTYPE "AFB_config"
 
-PUBLIC  char *ERROR_LABEL[]=ERROR_LABEL_DEF;
 
 // load config from disk and merge with CLI option
 PUBLIC AFB_error configLoadFile (AFB_session * session, AFB_config *cliconfig) {
index 7684469..50abcea 100644 (file)
@@ -30,10 +30,20 @@ typedef struct {
      size_t  len;
 } queryHandleT;
 
+// Error code are requested through function to manage json usage count
+typedef struct {
+  int   level;
+  const char* label;
+  json_object *json;
+} AFB_errorT;
+
 static AFB_errorT   AFBerr [AFB_SUCCESS+1];
 static json_object *jTypeStatic;
+
 PUBLIC int verbose;
 
+static const char *ERROR_LABEL[] = {"false", "true", "fatal", "fail", "warning", "empty", "success"};
+
 /* ------------------------------------------------------------------------------
  * Get localtime and return in a string
  * ------------------------------------------------------------------------------ */