17#include <json_lexer.h>
19#include <config_obj.h>
47 HtmlPostHandler(
const char *url,
int accessGroup = 0) :
HtmlPageHandler(url,
tPost, accessGroup,
false) {}
75 const char *pFileName;
88class HtmlPostVariableListHandler :
public HtmlPostHandler
104 HtmlPostVariableListHandler(
const char *pUrl,
int accessGroup = 0) : HtmlPostHandler(pUrl, accessGroup){};
119 virtual int ProcessPostVariables(
int sock, PostEvents event,
const char *pNames,
const char *pValues) = 0;
123typedef void(postvarhandler)(
int sock, PostEvents event,
const char *pNames,
const char *pValue);
124typedef int(postvarhandler_int)(
int sock, PostEvents event,
const char *pNames,
const char *pValue);
139 postvarhandler *m_pf;
140 postvarhandler_int *m_pfi;
145 inline int ProcessPostVariables(
int sock, PostEvents event,
const char *pName,
const char *pValue)
151 m_pf(sock, event, pName, pValue);
154 return m_pfi(sock, event, pName, pValue);
167 : HtmlPostVariableListHandler(pUrl, accessGroup), m_pf(pCallback), pfType(pf_void){};
178 : HtmlPostVariableListHandler(pUrl, accessGroup), m_pfi(pCallback), pfType(pf_int){};
186class JsonPostHandler :
public HtmlPostHandler
192 JsonPostHandler(
const char *pUrl,
int accessGroup = 0) : HtmlPostHandler(pUrl, accessGroup){};
199class JsonPostCallbackHandler :
public JsonPostHandler
201 jsonpostvarhandler *m_pf;
209 inline JsonPostCallbackHandler(
const char *pUrl, jsonpostvarhandler *pCallback,
int accessGroup = 0)
210 : JsonPostHandler(pUrl, accessGroup), m_pf(pCallback){};
215bool HandleConfigFormEvent(PostEvents event,
const char *pName,
const char *pValue);
218class HtmlPostConfigVariableHandler :
public HtmlPostVariableListHandler
220 const char *m_pRedirect_url;
223 HtmlPostConfigVariableHandler(
const char *pUrl,
const char *pRedirect_Url = 0,
int accessGroup = 0)
224 : HtmlPostVariableListHandler(pUrl, accessGroup)
226 m_pRedirect_url = pRedirect_Url;
232 virtual int ProcessPostVariables(
int sock, PostEvents event,
const char *pNames,
const char *pValues);
236class CustomConfigFormHandler
238static CustomConfigFormHandler * pHead;
239CustomConfigFormHandler * pNext;
240const char * pTypeName;
242CustomConfigFormHandler(
const char * pTypeName);
244virtual void RenderValue(
int fd, config_leaf *pl,
int len,
const char *extra)=0;
245virtual void RenderInput(
int fd, config_leaf *pl,
int len,
const char *extra)=0;
246virtual bool ProcessValue(
const char * pValue,config_leaf * pl)=0;
247static CustomConfigFormHandler * Find(
const NBString &type_name);
Implements the HtmlPostHandler class as a function pointer callback for POST requests.
Definition httppost.h:59
virtual int ProcessRaw(int sock, HTTP_Request &pdt)
Pure virtual method that must be implemented to process HTTP requests.
Definition httppost.h:64
Base class for HTTP request handlers that process requests for specific URLs and HTTP methods.
Definition http.h:220
HtmlPageHandler(const char *url, HTTP_RequestTypes rt=tGet, int accessGroup=0, bool Before_Files=false)
Constructs and registers an HTTP request handler for a specific URL pattern and method.
Implements the HtmlPostVariableListHandler class as a function pointer callback for HTTP POST submiss...
Definition httppost.h:131
HtmlPostVariableListCallback(const char *pUrl, postvarhandler_int *pCallback, int accessGroup=0)
Custom HTTP POST handler callback function constructor.
Definition httppost.h:177
HtmlPostVariableListCallback(const char *pUrl, postvarhandler *pCallback, int accessGroup=0)
Custom HTTP POST handler callback function constructor.
Definition httppost.h:166
Lightweight alternative to C++ CString class.
Definition nbstring.h:118
A class to create, read, and modify a JSON object.
Definition json_lexer.h:535
int http_posthandler(int sock, HTTP_Request &httpReqInfo)
Type definition of the HtmlPostHandler callback for POST requests.
Definition httppost.h:40
@ tPost
POST request.
Definition http.h:38
HTTP Request Structure.
Definition http.h:87