PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Classes | Typedefs | Functions
httpserver.h File Reference
#include <string>
#include <stdint.h>
#include <functional>
Include dependency graph for httpserver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  HTTPRequest
 In-flight HTTP request. More...
 
class  HTTPClosure
 Event handler closure. More...
 
class  HTTPEvent
 Event class. More...
 

Typedefs

typedef std::function< void(HTTPRequest *req, const std::string &)> HTTPRequestHandler
 Handler for requests to a certain HTTP path. More...
 

Functions

bool InitHTTPServer ()
 Initialize HTTP server. More...
 
bool StartHTTPServer ()
 Start HTTP server. More...
 
void InterruptHTTPServer ()
 Interrupt HTTP server threads. More...
 
void StopHTTPServer ()
 Stop HTTP server. More...
 
bool UpdateHTTPServerLogging (bool enable)
 Change logging level for libevent. More...
 
void RegisterHTTPHandler (const std::string &prefix, bool exactMatch, const HTTPRequestHandler &handler)
 Register handler for prefix. More...
 
void UnregisterHTTPHandler (const std::string &prefix, bool exactMatch)
 Unregister handler for prefix. More...
 
struct event_base * EventBase ()
 Return evhttp event base. More...
 

Typedef Documentation

◆ HTTPRequestHandler

typedef std::function<void(HTTPRequest* req, const std::string &)> HTTPRequestHandler

Handler for requests to a certain HTTP path.

Definition at line 40 of file httpserver.h.

Function Documentation

◆ EventBase()

struct event_base* EventBase ( )

Return evhttp event base.

This can be used by submodules to queue timers or custom events.

Definition at line 540 of file httpserver.cpp.

◆ InitHTTPServer()

bool InitHTTPServer ( )

Initialize HTTP server.

Call this before RegisterHTTPHandler or EventBase().

Definition at line 393 of file httpserver.cpp.

Here is the caller graph for this function:

◆ InterruptHTTPServer()

void InterruptHTTPServer ( )

Interrupt HTTP server threads.

Definition at line 492 of file httpserver.cpp.

Here is the caller graph for this function:

◆ RegisterHTTPHandler()

void RegisterHTTPHandler ( const std::string &  prefix,
bool  exactMatch,
const HTTPRequestHandler handler 
)

Register handler for prefix.

If multiple handlers match a prefix, the first-registered one will be invoked.

Definition at line 695 of file httpserver.cpp.

◆ StartHTTPServer()

bool StartHTTPServer ( )

Start HTTP server.

This is separate from InitHTTPServer to give users race-condition-free time to register their handlers between InitHTTPServer and StartHTTPServer.

Definition at line 476 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopHTTPServer()

void StopHTTPServer ( )

Stop HTTP server.

Definition at line 505 of file httpserver.cpp.

Here is the caller graph for this function:

◆ UnregisterHTTPHandler()

void UnregisterHTTPHandler ( const std::string &  prefix,
bool  exactMatch 
)

Unregister handler for prefix.

Definition at line 701 of file httpserver.cpp.

Here is the caller graph for this function:

◆ UpdateHTTPServerLogging()

bool UpdateHTTPServerLogging ( bool  enable)

Change logging level for libevent.

Removes BCLog::LIBEVENT from log categories if libevent doesn't support debug logging.

Definition at line 459 of file httpserver.cpp.

Here is the caller graph for this function: