NetBurner 3.5.7
PDF Version
CallBackFunctionPageHandler Class Reference

Implements the HtmlPageHandler class as a function pointer callback for GET requests. More...

#include <http.h>

Inherits HtmlPageHandler.

Public Member Functions

virtual int ProcessRaw (int sock, HTTP_Request &pdt)
 Pure virtual method that must be implemented to process HTTP requests.
 
 CallBackFunctionPageHandler (const char *pUrl, http_gethandlerfunc *pFunction, HTTP_RequestTypes reqType=tGet, int accessGroup=0, bool beforeFiles=false)
 Constructor for HTTP GET callback function.
 
 CallBackFunctionPageHandler (const char *pUrl, http_gethandlerfunc *pFunction, http_matchhandlerfunc *pMatchFunction, HTTP_RequestTypes reqType=tGet, int accessGroup=0, bool beforeFiles=false)
 Constructor for HTTP GET callback function, includes option for function to match the requested name.
 
virtual bool Match (HTTP_Request &req)
 Determines if this handler matches the incoming request.
 
- Public Member Functions inherited from HtmlPageHandler
 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.
 
 ~HtmlPageHandler ()
 Destructor that automatically unregisters the handler from the global chain.
 
void MoveHandlerToLast ()
 Moves this handler to the end of the handler chain, making it function as a 404 handler.
 
int GetGroup ()
 Returns the access control group identifier for this handler.
 

Additional Inherited Members

- Static Public Member Functions inherited from HtmlPageHandler
static HtmlPageHandlerFindHandler (HTTP_Request &req, bool bBeforeFiles)
 Locates the appropriate handler for an incoming HTTP request.
 
- Protected Member Functions inherited from HtmlPageHandler
void InsertSort (HtmlPageHandler *&ph)
 Inserts handler into sorted linked list based on priority.
 
int SortValue (HtmlPageHandler *pv)
 Compares handler priorities for sorting (-1, 0, 1)
 
void Remove ()
 Removes handler from the linked list.
 
- Protected Attributes inherited from HtmlPageHandler
HtmlPageHandlerm_pNextHandler
 Pointer to next handler in the linked list for efficient traversal.
 
const char * m_pUrlName
 URL pattern to match. Empty string or NULL matches all requests.
 
int m_access_group
 Access control group identifier for authorization checks.
 
HTTP_RequestTypes m_requestTypes
 HTTP method types this handler responds to (GET, POST, etc.)
 

Detailed Description

Implements the HtmlPageHandler class as a function pointer callback for GET requests.

Constructor & Destructor Documentation

◆ CallBackFunctionPageHandler() [1/2]

CallBackFunctionPageHandler::CallBackFunctionPageHandler ( const char * pUrl,
http_gethandlerfunc * pFunction,
HTTP_RequestTypes reqType = tGet,
int accessGroup = 0,
bool beforeFiles = false )
inline

Constructor for HTTP GET callback function.

Parameters
pUrlPointer to the URL to intercept from normal system processing
pFunctionPointer to the function to call for the requested URL
reqTypeOptional type of request to intercept, HTTP_RequestTypes. Default is tGet
accessGroupOptional password group access level. Default is 0 = no password, maximum is 255.
beforeFilesOptional parameter to specify a check for just a name, or the name of an actual file in the system. true = intercept before checking for a file of the same name false = check for any files of the requested name before intercepting

◆ CallBackFunctionPageHandler() [2/2]

CallBackFunctionPageHandler::CallBackFunctionPageHandler ( const char * pUrl,
http_gethandlerfunc * pFunction,
http_matchhandlerfunc * pMatchFunction,
HTTP_RequestTypes reqType = tGet,
int accessGroup = 0,
bool beforeFiles = false )
inline

Constructor for HTTP GET callback function, includes option for function to match the requested name.

Parameters
pUrlPointer to the URL to intercept from normal system processing
pFunctionPointer to the function to call for the requested URL
pMatchFunctionPointer to function to perform the match check
reqTypeOptional type of request to intercept, HTTP_RequestTypes. Default is tGet
accessGroupOptional parameter to set a password group access level. Default is 0 = no password.
beforeFilesOptional parameter to process a file name before checking for a compiled-in file of the same name. Default is false = check for any files of the requested name before intercepting

Member Function Documentation

◆ ProcessRaw()

virtual int CallBackFunctionPageHandler::ProcessRaw ( int sock,
HTTP_Request & pd )
inlinevirtual

Pure virtual method that must be implemented to process HTTP requests.

This method is called when a matching request is received and must contain the actual request processing logic. Implementations should read request data, perform necessary processing, and send appropriate HTTP responses.

Parameters
sockSocket file descriptor for the client connection
pdHTTP request object containing parsed request details (headers, URL, method, body data, etc.)
Returns
Non-zero if the request was successfully processed and a response was sent, or 0 if the request was not processed (allows fallback to other handlers)

Implements HtmlPageHandler.


The documentation for this class was generated from the following file: