X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=server%2Ffastcgi.h;h=365aa6c6d0565ae91f3afa215cdb91c6561bd07f;hb=6a5de8e3b2870ca950f2116aeb9561ad7d707427;hp=adb1db9007d55cc3cf38734f025fe5835555b65f;hpb=4fbe722e8fc016b6812ebdef40003359781490ba;p=matches%2FMCTX3420.git diff --git a/server/fastcgi.h b/server/fastcgi.h index adb1db9..365aa6c 100644 --- a/server/fastcgi.h +++ b/server/fastcgi.h @@ -17,7 +17,8 @@ typedef enum StatusCodes { STATUS_OK = 1, STATUS_ERROR = -1, STATUS_UNAUTHORIZED = -2, - STATUS_OUTOFRANGE = -3 + STATUS_NOTRUNNING = -3, + STATUS_ALREADYEXISTS = -4 } StatusCodes; #define FCGI_PARAM_REQUIRED (1 << 0) @@ -38,15 +39,28 @@ typedef struct FCGIValue { unsigned flags; } FCGIValue; -typedef struct FCGIContext FCGIContext; +/**Contextual information related to FCGI requests*/ +typedef struct +{ + /**The time of last valid user access possessing the control key*/ + time_t control_timestamp; + char control_key[41]; + char control_ip[16]; + /**The name of the current module**/ + const char *current_module; + /**For debugging purposes?**/ + int response_number; +} FCGIContext; + typedef void (*ModuleHandler) (FCGIContext *context, char *params); -extern void FCGI_BeginControl(FCGIContext *context, bool force); -extern void FCGI_EndControl(FCGIContext *context); +extern bool FCGI_LockControl(FCGIContext *context, bool force); +extern void FCGI_ReleaseControl(FCGIContext *context); extern bool FCGI_HasControl(FCGIContext *context, const char *key); extern char *FCGI_KeyPair(char *in, const char **key, const char **value); extern bool FCGI_ParseRequest(FCGIContext *context, char *params, FCGIValue values[], size_t count); extern void FCGI_BeginJSON(FCGIContext *context, StatusCodes status_code); +extern void FCGI_AcceptJSON(FCGIContext *context, const char *description, const char *cookie); extern void FCGI_JSONPair(const char *key, const char *value); extern void FCGI_JSONLong(const char *key, long value); extern void FCGI_JSONDouble(const char *key, double value); @@ -54,8 +68,8 @@ extern void FCGI_JSONBool(const char *key, bool value); extern void FCGI_JSONKey(const char *key); extern void FCGI_PrintRaw(const char *format, ...); extern void FCGI_EndJSON(); -extern char *FCGI_EscapeJSON(char *buf); extern void FCGI_RejectJSONEx(FCGIContext *context, StatusCodes status, const char *description); +extern char *FCGI_EscapeText(char *buf); extern void *FCGI_RequestLoop (void *data); extern void FCGI_WriteBinary(void * data, size_t size, size_t num_elem);