EHS Embedded HTTP Server
1.5.1.0
|
33 # pragma warning(disable : 4786)
38 #include <formvalue.h>
41 #include <httpresponse.h>
42 #include <httprequest.h>
48 const char * getEHSconfig();
110 virtual bool BindPrivilegedPort(
int socket,
const char *addr,
const unsigned short port) = 0;
140 #define MAX_REQUEST_SIZE_DEFAULT (256 * 1024)
158 EHS & operator=(
const EHS &);
193 EHS(
EHS *parent = NULL, std::string registerpath =
"");
358 void AddResponse(ehs_autoptr<GenericResponse> ehs_rvref response);
virtual ResponseCode HandleRequest(HttpRequest *request, HttpResponse *response)
Main request handler.
EHSConnection abstracts the concept of a connection to an EHS application.
RawSocketHandler * GetRawSocketHandler() const
Retrieves our RawSocketHandler.
void StopServer()
Shuts down this instance.
EHSMap m_oEHSMap
Stores path => EHSConnection pairs for path/tree traversal.
virtual bool ThreadInitHandler()
Hook for thread startup.
Helper class for performing raw socket IO.
EHSServer * m_poEHSServer
EHSServer object associated with this EHS object.
EHS * m_poParent
Points to the EHS object this object was registered with, NULL if top level.
This class represents what is sent back to the client.
virtual const std::string GetPassphrase(bool twice)=0
Retrieves a passphrase.
void SetBindHelper(PrivilegedBindHelper *helper)
Sets a PrivilegedBindHelper for use by the network abstraction layer.
Helper class for binding of sockets to privileged ports.
bool ShouldTerminate() const
Retrieve the server's exception status.
void SetSourceEHS(EHS &source)
Establishes this EHS instance as request handler of another EHS instance.
PrivilegedBindHelper * m_poBindHelper
Our bind helper.
ehs_autoptr< HttpResponse > RouteRequest(HttpRequest *request)
Routes a request to the appropriate instance.
void AddResponse(ehs_autoptr< GenericResponse > ehs_rvref response)
Enqueues a generic response.
void RegisterEHS(EHS *child, const char *uripath)
Instructs this EHS instance to invoke HandleRequest of another EHS instance whenever a specific URI i...
bool m_bNoRouting
Flag: We don't do request routing.
virtual void ThreadExitHandler()
Hook for thread shutdown.
std::string m_sRegisteredAs
The string that this EHS object is regestered as.
EHSServerParameters m_oParams
Stores a map with server parameters.
virtual const std::string GetPassphrase(bool twice)
Default PassphraseHandler implementation.
virtual void OnDisconnect(EHSConnection *conn)=0
Handle disconnect event.
virtual bool BindPrivilegedPort(int socket, const char *addr, const unsigned short port)=0
Binds a socket to a privileged port/address.
virtual void OnConnect(EHSConnection *conn)=0
Handle connect event.
void HandleData(int timeout=0)
Dispatches incoming data.
virtual bool OnData(EHSConnection *conn, std::string data)=0
Handle raw data.
This interface describes a handler for retrieving passphrases.
This class represents a clients HTTP request.
virtual ~PassphraseHandler()
Destructor.
RawSocketHandler * m_poRawSocketHandler
Our RawSocketHandler.
EHS * m_poSourceEHS
Source EHS object to route requests to for data instead of processing it ourselves.
void UnregisterEHS(const char *uripath)
Removes a previously registered path registration.
PrivilegedBindHelper * GetBindHelper() const
Retieves our PrivilegedBindHelper.
EHSServer contains all the network related services for EHS.
EHS provides HTTP server functionality to a child class.
void SetRawSocketHandler(RawSocketHandler *helper)
Sets a RawSocketHandler for use by the network abstraction layer.
void StartServer(EHSServerParameters ¶ms)
Starts up this instance.
virtual ~EHS()
Destructor.
virtual HttpResponse * HandleThreadException(ehs_threadid_t tid, HttpRequest *request, std::exception &ex)
Hook for handling exceptions in threads.