From b55efc33fb8df8b0518570b2584b6da9abb3221b Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 9 Dec 2015 01:27:23 +0100 Subject: Added POST, Plugin API signal protection, refactor HTML5 rewrite --- include/local-def.h | 10 ++++++++-- include/proto-def.h | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/local-def.h b/include/local-def.h index 3f0a26a0..72c51dea 100644 --- a/include/local-def.h +++ b/include/local-def.h @@ -40,6 +40,10 @@ /* other definitions --------------------------------------------------- */ +// Note: because of a bug in libmagic MAGIC_DB NULL should not be used for default +#define MAGIC_DB "/usr/share/misc/magic.mgc" +#define OPA_INDEX "index.html" + typedef int BOOL; #ifndef FALSE #define FALSE 0 @@ -97,8 +101,8 @@ typedef struct { } AFB_request; typedef struct { - char *msg; - int len; + char *msg; + size_t len; } AFB_redirect_msg; // main config structure @@ -117,6 +121,7 @@ typedef struct { char *configfile; // where to store configuration on gateway exit uid_t setuid; int cacheTimeout; + int apiTimeout; } AFB_config; // Command line structure hold cli --command + help text @@ -134,6 +139,7 @@ typedef struct { char *name; AFB_apiCB callback; char *info; + void * handle; } AFB_restapi; // Plugin definition diff --git a/include/proto-def.h b/include/proto-def.h index d1b0c3fb..3e1d1c38 100644 --- a/include/proto-def.h +++ b/include/proto-def.h @@ -21,9 +21,15 @@ */ // Rest-api -PUBLIC json_object* pingSample (AFB_plugin *plugin, AFB_session *session, AFB_request *post); + +PUBLIC json_object* apiPingTest(AFB_session *session, AFB_request *request, void* handle); PUBLIC const char* getQueryValue (AFB_request * request, char *name); -PUBLIC int doRestApi(struct MHD_Connection *connection, AFB_session *session, const char *method, const char* url); +PUBLIC const char* 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 + , const char *upload_data, size_t *upload_data_size, void **con_cls); + void initPlugins (AFB_session *session); typedef AFB_plugin* (*AFB_pluginCB)(AFB_session *session); -- cgit 1.2.3-korg