Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
cHTTPServer Class Reference

#include <HTTPServer.h>

Collaboration diagram for cHTTPServer:
Collaboration graph
[legend]

Classes

class  cCallbacks
 

Public Member Functions

 cHTTPServer (void)
 
bool Initialize (void)
 Initializes the server - reads the cert files etc. More...
 
bool Start (cCallbacks &a_Callbacks, const AStringVector &a_Ports)
 Starts the server and assigns the callbacks to use for incoming requests. More...
 
void Stop (void)
 Stops the server, drops all current connections. More...
 
virtual ~cHTTPServer ()
 

Protected Member Functions

void NewRequest (cHTTPServerConnection &a_Connection, cHTTPIncomingRequest &a_Request)
 Called by cHTTPServerConnection when it finishes parsing the request header. More...
 
cTCPLink::cCallbacksPtr OnIncomingConnection (const AString &a_RemoteIPAddress, UInt16 a_RemotePort)
 Called by cHTTPServerListenCallbacks when there's a new incoming connection. More...
 
void RequestBody (cHTTPServerConnection &a_Connection, cHTTPIncomingRequest &a_Request, const void *a_Data, size_t a_Size)
 Called by cHTTPConenction when it receives more data for the request body. More...
 
void RequestFinished (cHTTPServerConnection &a_Connection, cHTTPIncomingRequest &a_Request)
 Called by cHTTPServerConnection when it detects that the request has finished (all of its body has been received) More...
 

Protected Attributes

cCallbacksm_Callbacks
 The callbacks to call for various events. More...
 
cServerHandlePtrs m_ServerHandles
 The cNetwork API handle for the listening socket. More...
 
std::shared_ptr< const cSslConfigm_SslConfig
 Configuration for server ssl connections. More...
 

Friends

class cHTTPServerConnection
 
class cHTTPServerListenCallbacks
 
class cSslHTTPServerConnection
 

Detailed Description

Definition at line 30 of file HTTPServer.h.

Constructor & Destructor Documentation

◆ cHTTPServer()

cHTTPServer::cHTTPServer ( void  )

Definition at line 67 of file HTTPServer.cpp.

◆ ~cHTTPServer()

cHTTPServer::~cHTTPServer ( )
virtual

Definition at line 76 of file HTTPServer.cpp.

Member Function Documentation

◆ Initialize()

bool cHTTPServer::Initialize ( void  )

Initializes the server - reads the cert files etc.

Definition at line 85 of file HTTPServer.cpp.

◆ NewRequest()

void cHTTPServer::NewRequest ( cHTTPServerConnection a_Connection,
cHTTPIncomingRequest a_Request 
)
protected

Called by cHTTPServerConnection when it finishes parsing the request header.

Definition at line 208 of file HTTPServer.cpp.

◆ OnIncomingConnection()

cTCPLink::cCallbacksPtr cHTTPServer::OnIncomingConnection ( const AString a_RemoteIPAddress,
UInt16  a_RemotePort 
)
protected

Called by cHTTPServerListenCallbacks when there's a new incoming connection.

Returns the connection instance to be used as the cTCPLink callbacks.

Definition at line 189 of file HTTPServer.cpp.

◆ RequestBody()

void cHTTPServer::RequestBody ( cHTTPServerConnection a_Connection,
cHTTPIncomingRequest a_Request,
const void *  a_Data,
size_t  a_Size 
)
protected

Called by cHTTPConenction when it receives more data for the request body.

May be called multiple times for a single request.

Definition at line 217 of file HTTPServer.cpp.

◆ RequestFinished()

void cHTTPServer::RequestFinished ( cHTTPServerConnection a_Connection,
cHTTPIncomingRequest a_Request 
)
protected

Called by cHTTPServerConnection when it detects that the request has finished (all of its body has been received)

Definition at line 226 of file HTTPServer.cpp.

◆ Start()

bool cHTTPServer::Start ( cCallbacks a_Callbacks,
const AStringVector a_Ports 
)

Starts the server and assigns the callbacks to use for incoming requests.

Definition at line 134 of file HTTPServer.cpp.

◆ Stop()

void cHTTPServer::Stop ( void  )

Stops the server, drops all current connections.

Definition at line 176 of file HTTPServer.cpp.

Friends And Related Function Documentation

◆ cHTTPServerConnection

friend class cHTTPServerConnection
friend

Definition at line 63 of file HTTPServer.h.

◆ cHTTPServerListenCallbacks

friend class cHTTPServerListenCallbacks
friend

Definition at line 65 of file HTTPServer.h.

◆ cSslHTTPServerConnection

friend class cSslHTTPServerConnection
friend

Definition at line 64 of file HTTPServer.h.

Member Data Documentation

◆ m_Callbacks

cCallbacks* cHTTPServer::m_Callbacks
protected

The callbacks to call for various events.

Definition at line 71 of file HTTPServer.h.

◆ m_ServerHandles

cServerHandlePtrs cHTTPServer::m_ServerHandles
protected

The cNetwork API handle for the listening socket.

Definition at line 68 of file HTTPServer.h.

◆ m_SslConfig

std::shared_ptr<const cSslConfig> cHTTPServer::m_SslConfig
protected

Configuration for server ssl connections.

Definition at line 74 of file HTTPServer.h.


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