3 * @brief Headers for the fastcgi web interface
10 * Status codes that fcgi module handlers can return
11 * Success status codes have values > 0
12 * Failure status codes have values <(=) 0
13 * Note: 0 is counted as an error code to minimise confusion
14 * with in-browser JSON parsing error codes
16 typedef enum StatusCodes {
19 STATUS_UNAUTHORIZED = -2,
20 STATUS_OUTOFRANGE = -3
23 typedef struct FCGIContext FCGIContext;
24 typedef void (*ModuleHandler) (FCGIContext *context, char *params);
26 extern void FCGI_BeginControl(FCGIContext *context, bool force);
27 extern void FCGI_EndControl(FCGIContext *context);
28 extern bool FCGI_HasControl(FCGIContext *context, const char *key);
29 extern char *FCGI_KeyPair(char *in, const char **key, const char **value);
30 extern void FCGI_BeginJSON(FCGIContext *context, StatusCodes status_code);
31 extern void FCGI_JSONPair(const char *key, const char *value);
32 extern void FCGI_JSONLong(const char *key, long value);
33 extern void FCGI_JSONDouble(const char *key, double value);
34 extern void FCGI_JSONBool(const char *key, bool value);
35 extern void FCGI_JSONKey(const char *key);
36 extern void FCGI_PrintRaw(const char *format, ...);
37 extern void FCGI_EndJSON();
38 extern void FCGI_RejectJSONEx(FCGIContext *context, StatusCodes status, const char *description);
39 extern void *FCGI_RequestLoop (void *data);
42 * Shortcut to calling FCGI_RejectJSONEx. Sets the error code
44 * @param context The context to work in
45 * @param description A short description of why the request was rejected.
46 * @see FCGI_RejectJSONEx
48 #define FCGI_RejectJSON(context, description) FCGI_RejectJSONEx(context, STATUS_ERROR, description)
51 * Custom formatting function for the JSON value. To be used in
52 * conjunction with FCGI_JSONKey. Care should be taken to ensure
53 * that valid JSON is produced.
54 * @see FCGI_PrintRaw for calling syntax
56 #define FCGI_JSONValue FCGI_PrintRaw