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