Fawkes API
Fawkes Development Version
|
Web request dispatcher. More...
#include "request_dispatcher.h"
Public Member Functions | |
WebRequestDispatcher (WebUrlManager *url_manager, WebPageHeaderGenerator *headergen=0, WebPageFooterGenerator *footergen=0) | |
Constructor. More... | |
~WebRequestDispatcher () | |
Destructor. More... | |
void | setup_basic_auth (const char *realm, WebUserVerifier *verifier) |
Setup basic authentication. More... | |
void | setup_access_log (const char *filename) |
Setup access log. More... | |
unsigned int | active_requests () const |
Get number of active requests. More... | |
Time | last_request_completion_time () const |
Get time when last request was completed. More... | |
Static Public Member Functions | |
static int | process_request_cb (void *callback_data, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **session_data) |
Process request callback for libmicrohttpd. More... | |
static void | request_completed_cb (void *cls, struct MHD_Connection *connection, void **con_cls, enum MHD_RequestTerminationCode toe) |
Process request completion. More... | |
static void * | uri_log_cb (void *cls, const char *uri) |
Callback for new requests. More... | |
Web request dispatcher.
Takes web request received via a webserver run by libmicrohttpd and dispatches pages to registered WebRequestProcessor instances or gives a 404 error if no processor was registered for the given base url.
Definition at line 50 of file request_dispatcher.h.
fawkes::WebRequestDispatcher::WebRequestDispatcher | ( | WebUrlManager * | url_manager, |
WebPageHeaderGenerator * | headergen = 0 , |
||
WebPageFooterGenerator * | footergen = 0 |
||
) |
Constructor.
url_manager | URL manager to use for URL to processor mapping |
headergen | page header generator |
footergen | page footer generator |
Definition at line 72 of file request_dispatcher.cpp.
fawkes::WebRequestDispatcher::~WebRequestDispatcher | ( | ) |
Destructor.
Definition at line 88 of file request_dispatcher.cpp.
unsigned int fawkes::WebRequestDispatcher::active_requests | ( | ) | const |
Get number of active requests.
Definition at line 497 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::active_requests().
Time fawkes::WebRequestDispatcher::last_request_completion_time | ( | ) | const |
Get time when last request was completed.
Definition at line 507 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::last_request_completion_time().
|
static |
Process request callback for libmicrohttpd.
callback_data | instance of WebRequestDispatcher to call |
connection | libmicrohttpd connection instance |
url | URL, may contain escape sequences |
method | HTTP method |
version | HTTP version |
upload_data | uploaded data |
upload_data_size | size of upload_data parameter |
session_data | session data pointer |
Definition at line 157 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::WebServer().
|
static |
Process request completion.
cls | closure which is a pointer to the request dispatcher |
connection | connection on which the request completed |
con_cls | connection specific data, for us the request |
toe | termination code |
Definition at line 179 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::WebServer().
void fawkes::WebRequestDispatcher::setup_access_log | ( | const char * | filename | ) |
Setup access log.
filename | access log file name |
Definition at line 126 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::setup_access_log().
void fawkes::WebRequestDispatcher::setup_basic_auth | ( | const char * | realm, |
WebUserVerifier * | verifier | ||
) |
Setup basic authentication.
realm | authentication realm to display to the user. If NULL basic authentication will be disabled. |
verifier | verifier to use for checking credentials. If NULL basic authentication will be disabled. |
Definition at line 104 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::setup_basic_auth().
|
static |
Callback for new requests.
cls | closure, must be WebRequestDispatcher |
uri | requested URI |
Definition at line 139 of file request_dispatcher.cpp.
Referenced by fawkes::WebServer::WebServer().