httpmockserver
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
httpmock::MockServer::Server Class Reference
Collaboration diagram for httpmock::MockServer::Server:
Collaboration graph
[legend]

Public Member Functions

 Server (MockServer &mock)
 Initialize server with no daemon running. More...
 
 ~Server ()
 
void start (int port)
 
void stop ()
 
bool isRunning () const
 

Private Member Functions

 Server (const Server &)
 
Serveroperator= (const Server &)
 
MHD_RESULT handlerCallback (struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
 

Static Private Member Functions

template<typename OutputType >
static std::vector< OutputType > getConnectionArgs (struct MHD_Connection *connection)
 Return key-value arguments in the vector. More...
 
template<typename OutputType >
static MHD_RESULT keyValueIterator (void *outputContainer, enum MHD_ValueKind, const char *key, const char *value)
 
static MHD_RESULT static_handlerCallback (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
 

Private Attributes

MockServermock
 Reference to the origin MockServer class instance. More...
 
std::unique_ptr< MHD_Daemon, void(*)(MHD_Daemon *)> daemon
 MicroHTTPD server instance. More...
 

Constructor & Destructor Documentation

◆ Server() [1/2]

httpmock::MockServer::Server::Server ( MockServer mock)
inlineexplicit

Initialize server with no daemon running.

◆ ~Server()

httpmock::MockServer::Server::~Server ( )
inline

◆ Server() [2/2]

httpmock::MockServer::Server::Server ( const Server )
private

Member Function Documentation

◆ getConnectionArgs()

template<typename OutputType >
std::vector< OutputType > httpmock::MockServer::Server::getConnectionArgs ( struct MHD_Connection *  connection)
staticprivate

Return key-value arguments in the vector.

◆ handlerCallback()

MHD_RESULT httpmock::MockServer::Server::handlerCallback ( struct MHD_Connection *  connection,
const char *  url,
const char *  method,
const char *  version,
const char *  upload_data,
size_t *  upload_data_size,
void **  con_cls 
)
private

Callback for MHD_AccessHandlerCallback() registred through static_handlerCallback() for specific Server instance. Parses MHD connection data and calls MockServer::responseHandler().

◆ isRunning()

bool httpmock::MockServer::Server::isRunning ( ) const
inline

◆ keyValueIterator()

template<typename OutputType >
MHD_RESULT httpmock::MockServer::Server::keyValueIterator ( void *  outputContainer,
enum  MHD_ValueKind,
const char *  key,
const char *  value 
)
staticprivate

Iterate key-value arguments (initiated by getConnectionArgs()). Store iterated data into output vector container.

Parameters
outputContainerpointer to the std::vector<OutputType> container.

◆ operator=()

Server& httpmock::MockServer::Server::operator= ( const Server )
private

◆ start()

void httpmock::MockServer::Server::start ( int  port)
inline

◆ static_handlerCallback()

MHD_RESULT httpmock::MockServer::Server::static_handlerCallback ( void *  cls,
struct MHD_Connection *  connection,
const char *  url,
const char *  method,
const char *  version,
const char *  upload_data,
size_t *  upload_data_size,
void **  con_cls 
)
staticprivate

Callback for MHD_AccessHandlerCallback().

Parameters
clsServer class instance pointer is passed and cls->handlerCallback() is called passing rest arguments.

◆ stop()

void httpmock::MockServer::Server::stop ( )
inline

Member Data Documentation

◆ daemon

std::unique_ptr<MHD_Daemon, void(*)(MHD_Daemon*)> httpmock::MockServer::Server::daemon
private

MicroHTTPD server instance.

◆ mock

MockServer& httpmock::MockServer::Server::mock
private

Reference to the origin MockServer class instance.


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