aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-01 16:20:12 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-01 16:20:12 +0200
commitbbe18a624f4961165cf52d7f4c25de6f3a7ec012 (patch)
tree8167fa621fbcdcd91e11988ce6d8c9cf4072fc48 /include
parentc95f72616f59a317f72c58c0e5664992504a48e5 (diff)
work in progress
Change-Id: I3df95def03bb26ca4d1a52f7cd94b0fb67375d4c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include')
-rw-r--r--include/local-def.h49
-rw-r--r--include/proto-def.h8
2 files changed, 17 insertions, 40 deletions
diff --git a/include/local-def.h b/include/local-def.h
index 3f618717..605c05a3 100644
--- a/include/local-def.h
+++ b/include/local-def.h
@@ -21,29 +21,9 @@
#ifndef LOCAL_DEF_H
#define LOCAL_DEF_H
-#ifndef _GNU_SOURCE
- #define _GNU_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/signal.h>
-#include <sys/types.h>
-#include <time.h>
#include <json.h>
-#include <microhttpd.h>
#include <magic.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <uuid/uuid.h>
-
-
+#include <microhttpd.h>
/* other definitions --------------------------------------------------- */
@@ -111,7 +91,7 @@ struct AFB_restapi
{
const char *name;
enum AFB_sessionE session;
- json_object* (*callback)();
+ struct json_object* (*callback)();
const char *info;
};
@@ -127,7 +107,7 @@ struct AFB_plugin
typedef enum AFB_pluginE AFB_pluginE;
typedef enum AFB_sessionE AFB_sessionE;
-typedef json_object* (*AFB_apiCB)();
+typedef struct json_object* (*AFB_apiCB)();
typedef void (*AFB_freeCtxCB)(void*);
typedef struct AFB_restapi AFB_restapi;
typedef struct AFB_plugin AFB_plugin;
@@ -141,12 +121,12 @@ typedef struct AFB_plugin AFB_plugin;
+typedef enum {AFB_MODE_LOCAL=0, AFB_MODE_REMOTE, AFB_MODE_GLOBAL} AFB_Mode;
-
+#if 0
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;
@@ -155,7 +135,7 @@ typedef struct {
int fd;
char *path;
int errcode;
- json_object* jresp;
+ struct json_object* jresp;
} AFB_PostCtx;
typedef struct {
@@ -192,16 +172,18 @@ typedef struct {
} AFB_staticfile;
typedef struct {
+ char *msg;
+ size_t len;
+} AFB_redirect_msg;
+
+#endif
+
+typedef struct {
char *url;
char *path;
size_t len;
} AFB_aliasdir;
-typedef struct {
- char *msg;
- size_t len;
-} AFB_redirect_msg;
-
// main config structure
struct AFB_config
{
@@ -229,7 +211,7 @@ typedef struct {
/*
AFB_PostRequest *post;
*/
- json_object *jresp;
+ struct json_object *jresp;
void *context; // Hold Client Context when using session
int restfull; // request is resfull [uuid token provided]
int errcode; // http error code
@@ -240,7 +222,8 @@ typedef struct {
struct afb_hsrv_handler;
struct MHD_Daemon;
-struct AFB_session {
+struct AFB_session
+{
struct AFB_config *config; // pointer to current config
// List of commands to execute
int background; // run in backround mode
diff --git a/include/proto-def.h b/include/proto-def.h
index c364035a..e2190eb1 100644
--- a/include/proto-def.h
+++ b/include/proto-def.h
@@ -21,7 +21,7 @@
// helper-api
extern const char* getQueryValue (const AFB_request * request, const char *name);
-extern int getQueryAll(AFB_request * request, char *query, size_t len);
+extern size_t getQueryAll(AFB_request * request, char *query, size_t len);
/*
extern json_object* getPostFile (AFB_request *request, AFB_PostItem *item, char* destination) ;
extern char* getPostPath (AFB_request *request);
@@ -29,12 +29,6 @@ extern char* getPostPath (AFB_request *request);
extern json_object *jsonNewMessage (AFB_error level, char* format, ...);
-// rest-api
-extern void endPostRequest(AFB_PostHandle *posthandle);
-extern 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);
-
-
// Httpd server
extern AFB_error httpdStart (AFB_session *session);