From 00857f9da5ae802794a4cb94aca576b11bfe6628 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Tue, 22 Dec 2015 23:09:04 +0100 Subject: New Session Model [compile but not tested] --- include/local-def.h | 7 ++++--- include/proto-def.h | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/local-def.h b/include/local-def.h index abbbd61f..9c584417 100644 --- a/include/local-def.h +++ b/include/local-def.h @@ -97,6 +97,7 @@ extern char *ERROR_LABEL[]; typedef json_object* (*AFB_apiCB)(); +typedef void (*AFB_freeCtxCB)(void*, char*); // Error code are requested through function to manage json usage count typedef struct { @@ -218,23 +219,23 @@ typedef struct { AFB_restapi *apis; void *handle; int ctxCount; - AFB_apiCB freeCtxCB; // callback to free application context [null for standard free] + AFB_freeCtxCB freeCtxCB; // callback to free application context [null for standard free] } AFB_plugin; // User Client Session Context typedef struct { - int cid; // index 0 if global 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 **ctx; // application specific context [one per plugin]] + void **contexts; // application specific context [one per plugin]] AFB_plugin **plugins; // we need plugins reference to cleanup session outside of call context } AFB_clientCtx; // MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "value"); typedef struct { + const char *uuid; const char *url; char *plugin; char *api; diff --git a/include/proto-def.h b/include/proto-def.h index 7f6fc065..0f5ca048 100644 --- a/include/proto-def.h +++ b/include/proto-def.h @@ -43,11 +43,11 @@ PUBLIC json_object *sessionList (AFB_session *session, AFB_request *request PUBLIC json_object *sessionToDisk (AFB_session *session, AFB_request *request, char *name,json_object *jsonSession); PUBLIC json_object *sessionFromDisk (AFB_session *session, AFB_request *request, char *name); -PUBLIC AFB_error ctxTokenRefresh (AFB_request *request); -PUBLIC AFB_error ctxTokenCreate (AFB_request *request); -PUBLIC AFB_error ctxTokenCheck (AFB_request *request); -PUBLIC AFB_error ctxTokenReset (AFB_request *request); -PUBLIC AFB_error ctxClientGet (AFB_request *request, AFB_session *session, int idx); +PUBLIC AFB_error ctxTokenRefresh (AFB_clientCtx *clientCtx, AFB_request *request); +PUBLIC AFB_error ctxTokenCreate (AFB_clientCtx *clientCtx, AFB_request *request); +PUBLIC AFB_error ctxTokenCheck (AFB_clientCtx *clientCtx, AFB_request *request); +PUBLIC AFB_error ctxTokenReset (AFB_clientCtx *clientCtx, AFB_request *request); +PUBLIC AFB_clientCtx *ctxClientGet (AFB_request *request, int idx); PUBLIC void ctxStoreInit (int); -- cgit 1.2.3-korg