X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Flocal-def.h;h=f46dd97c464e93d182df35585b4c2351ce30beb7;hb=dde70b62b09f49ad672c104a3f81714bf11047be;hp=91b61abc5ce6cbeca8b6c189a6eea42e4c44d1f8;hpb=0a621f91ee673dd9182467a4ed649636dd0f2ba0;p=src%2Fapp-framework-binder.git diff --git a/include/local-def.h b/include/local-def.h index 91b61abc..f46dd97c 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include -#include -#include -#include - - +#include /* 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,76 +121,15 @@ typedef struct AFB_plugin AFB_plugin; - - - - -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; - -// Post Upload File Handle -typedef struct { - int fd; - char *path; - int errcode; - json_object* jresp; -} AFB_PostCtx; - -typedef struct { - int len; // post element size - char *data; // post data in raw format - AFB_PostType type; // Json type -} AFB_PostRequest; - -// Post handler -typedef struct { - void* ctx; // Application context - int len; // current len for post - int uid; // post uid for debug - AFB_PostType type; // JSON or FORM - AFB_apiCB completeCB; // callback when post is completed - char *privatebuf; // use internally to keep track or partial buffer - struct MHD_PostProcessor *pp; // iterator handle -} AFB_PostHandle; - -typedef struct { - enum MHD_ValueKind kind; // kind type of the value - const char *key; // key 0-terminated key for the value - const char *filename; // filename of the uploaded file, NULL if not known - const char *mimetype; // content_type mime-type of the data, NULL if not known - const char *encoding; // transfer_encoding encoding of the data, NULL if not known - const char *data; // data pointer to size bytes of data at the specified offset - uint64_t offset; // offset of data in the overall value - size_t len; // number of bytes in data available -} AFB_PostItem; - -typedef struct { - char path[512]; - int fd; -} AFB_staticfile; - typedef struct { char *url; char *path; size_t len; } AFB_aliasdir; -typedef struct { - char *msg; - size_t len; -} AFB_redirect_msg; - -// User Client Session Context -typedef struct { - char uuid[37]; // long term authentication of remote client - char token[37]; // short term authentication of remote client - time_t timeStamp; // last time token was refresh - int restfull; // client does not use cookie - void **contexts; // application specific context [one per plugin]] -} AFB_clientCtx; - // main config structure struct AFB_config { @@ -233,21 +152,24 @@ struct AFB_config typedef struct { const char *uuid; const char *url; - char *prefix; // plugin convivial name - char *method; + const char *prefix; // plugin convivial name + const char *method; +/* 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 struct AFB_config *config; // plugin may need access to config - struct MHD_Connection *connection; + struct afb_req *areq; } AFB_request; 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