aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2015-12-10 18:12:57 +0100
committerFulup Ar Foll <fulup@iot.bzh>2015-12-10 18:12:57 +0100
commit446e0a75684131f2f2fec251775db9ee450003ec (patch)
treed6fe912a7b1824d13b28e7417cf5a3bc14b4d0a6 /include
parent8c6965fd4a7b0e301fb842a7c2917001327fcd6b (diff)
Fix Json Message Structure
Diffstat (limited to 'include')
-rw-r--r--include/local-def.h9
-rw-r--r--include/proto-def.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/include/local-def.h b/include/local-def.h
index 8fe87d0c..d8010c1c 100644
--- a/include/local-def.h
+++ b/include/local-def.h
@@ -64,7 +64,7 @@ typedef int BOOL;
#define FAILED -1
// 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_error;
+typedef enum { AFB_FALSE, AFB_TRUE, AFB_FATAL, AFB_FAIL, AFB_WARNING, AFB_EMPTY, AFB_SUCCESS, AFB_DONE} AFB_error;
extern char *ERROR_LABEL[];
#define ERROR_LABEL_DEF {"false", "true","fatal", "fail", "warning", "empty", "success"}
@@ -110,6 +110,7 @@ typedef struct {
char *plugin;
char *api;
char *post;
+ json_object *jresp;
struct MHD_Connection *connection;
sigjmp_buf checkPluginCall; // context save for timeout set/longjmp
} AFB_request;
@@ -147,6 +148,11 @@ typedef struct {
char *help; // help text
} AFB_options;
+typedef struct {
+ int len; // command number within application
+ json_object *jtype;
+} AFB_privateApi;
+
typedef json_object* (*AFB_apiCB)();
// API definition
@@ -155,6 +161,7 @@ typedef struct {
AFB_apiCB callback;
char *info;
void * handle;
+ AFB_privateApi *private;
} AFB_restapi;
// Plugin definition
diff --git a/include/proto-def.h b/include/proto-def.h
index 3e1d1c38..cc372bf7 100644
--- a/include/proto-def.h
+++ b/include/proto-def.h
@@ -24,7 +24,7 @@
PUBLIC json_object* apiPingTest(AFB_session *session, AFB_request *request, void* handle);
PUBLIC const char* getQueryValue (AFB_request * request, char *name);
-PUBLIC const char* getQueryAll(AFB_request * request, char *query, size_t len);
+PUBLIC int getQueryAll(AFB_request * request, char *query, size_t len);
PUBLIC int doRestApi(struct MHD_Connection *connection, AFB_session *session, const char* url, const char *method