GClasses
GClasses::GDynamicPageServer Class Reference

#include <GDynamicPage.h>

Inheritance diagram for GClasses::GDynamicPageServer:
GClasses::GHttpServer

Public Member Functions

 GDynamicPageServer (int port, GRand *pRand)
 
virtual ~GDynamicPageServer ()
 
const char * daemonSalt ()
 
GDynamicPageSessionfindSession (unsigned long long id)
 Returns the session with the specified id. If no session is found with that id, returns NULL. More...
 
void flushSessions ()
 
void go ()
 
GDynamicPageSessionmakeNewSession (unsigned long long id)
 Makes a new session with the specified id. More...
 
const char * myAddress ()
 Returns the account if the password is correct. Returns NULL if not. More...
 
virtual void onEverySixHours ()
 
virtual void onShutDown ()
 
virtual void onStateChange ()
 
const char * passwordSalt ()
 
void printSessionIds (std::ostream &stream)
 Prints all known session ids to the stream. (This is used for debugging purposes.) More...
 
GRandprng ()
 
void redirect (std::ostream &response, const char *szUrl)
 
void setDaemonSalt (const char *szSalt)
 
void shutDown ()
 
- Public Member Functions inherited from GClasses::GHttpServer
 GHttpServer (int nPort)
 
virtual ~GHttpServer ()
 
virtual GHttpConnectionmakeConnection (SOCKET s)=0
 This method should return a new instance of an object that inherrits from GHttpConnection. More...
 
bool process ()
 You should call this method constantly inside the main loop. It returns true if it did anything, and false if it didn't, so if it returns false you may want to sleep for a little while. More...
 
GTCPServersocket ()
 Returns a reference to the socket on which this server listens. More...
 

Protected Member Functions

void computePasswordSalt ()
 
void doMaintenance ()
 
- Protected Member Functions inherited from GClasses::GHttpServer
void beginRequest (GHttpConnection *pConn, int eType, const char *szIn)
 
virtual void onProcessLine (GHttpConnection *pConn, const char *szLine)
 
void onReceiveFullPostRequest (GHttpConnection *pConn)
 
void processHeaderLine (GHttpConnection *pConn, const char *szLine)
 
void processPostData (GHttpConnection *pConn, const unsigned char *pData, size_t nDataSize)
 
void sendNotModifiedResponse (GHttpConnection *pConn)
 
void sendResponse (GHttpConnection *pConn)
 

Protected Attributes

bool m_bKeepGoing
 
char m_daemonSalt [16]
 
char m_passwordSalt [16]
 
GRandm_pRand
 
std::map< unsigned long long, GDynamicPageSession * > m_sessions
 
char * m_szMyAddress
 
- Protected Attributes inherited from GClasses::GHttpServer
char * m_pReceiveBuf
 
GHttpServerSocket * m_pSocket
 
std::ostringstream m_stream
 

Additional Inherited Members

- Static Public Member Functions inherited from GClasses::GHttpServer
static bool parseFileParam (const char *pParams, size_t nParamsLen, const char **ppFilename, size_t *pFilenameLen, const unsigned char **ppFile, size_t *pFileLen)
 This is a rather hacky method that parses the parameters of a specific upload-file form. More...
 
static void unescapeUrl (char *szOut, const char *szIn, size_t nInLen)
 Unescapes a URL. (i.e. replace "%20" with " ", etc.). szOut should point to a buffer at least as big as szIn (including the null terminator). This will stop when it hits the null-terminator in szIn or when nInLen characters have been parsed. So if szIn is null-terminated, you can safely pass in a huge arbitrary value for nInLen. More...
 

Constructor & Destructor Documentation

GClasses::GDynamicPageServer::GDynamicPageServer ( int  port,
GRand pRand 
)
virtual GClasses::GDynamicPageServer::~GDynamicPageServer ( )
virtual

Member Function Documentation

void GClasses::GDynamicPageServer::computePasswordSalt ( )
protected
const char* GClasses::GDynamicPageServer::daemonSalt ( )
void GClasses::GDynamicPageServer::doMaintenance ( )
protected
GDynamicPageSession* GClasses::GDynamicPageServer::findSession ( unsigned long long  id)

Returns the session with the specified id. If no session is found with that id, returns NULL.

void GClasses::GDynamicPageServer::flushSessions ( )
void GClasses::GDynamicPageServer::go ( )
GDynamicPageSession* GClasses::GDynamicPageServer::makeNewSession ( unsigned long long  id)

Makes a new session with the specified id.

const char* GClasses::GDynamicPageServer::myAddress ( )

Returns the account if the password is correct. Returns NULL if not.

virtual void GClasses::GDynamicPageServer::onEverySixHours ( )
inlinevirtual
virtual void GClasses::GDynamicPageServer::onShutDown ( )
inlinevirtual
virtual void GClasses::GDynamicPageServer::onStateChange ( )
inlinevirtual
const char* GClasses::GDynamicPageServer::passwordSalt ( )
void GClasses::GDynamicPageServer::printSessionIds ( std::ostream &  stream)

Prints all known session ids to the stream. (This is used for debugging purposes.)

GRand* GClasses::GDynamicPageServer::prng ( )
inline
void GClasses::GDynamicPageServer::redirect ( std::ostream &  response,
const char *  szUrl 
)
void GClasses::GDynamicPageServer::setDaemonSalt ( const char *  szSalt)
void GClasses::GDynamicPageServer::shutDown ( )

Member Data Documentation

bool GClasses::GDynamicPageServer::m_bKeepGoing
protected
char GClasses::GDynamicPageServer::m_daemonSalt[16]
protected
char GClasses::GDynamicPageServer::m_passwordSalt[16]
protected
GRand* GClasses::GDynamicPageServer::m_pRand
protected
std::map<unsigned long long, GDynamicPageSession*> GClasses::GDynamicPageServer::m_sessions
protected
char* GClasses::GDynamicPageServer::m_szMyAddress
protected