libcex
1.0.0
Modern C++11 embedded webserver library
|
libcex
core classes and functions
More...
#include <evhtp/evhtp.h>
#include <event2/thread.h>
#include <thread>
#include <condition_variable>
#include <mutex>
#include <string>
#include <vector>
#include <regex>
#include <plist.hpp>
#include <cex/cex_config.h>
Go to the source code of this file.
Classes | |
class | cex::Request |
Contains the current request and all of its preparsed properties. More... | |
class | cex::Response |
Serves as interface to the response which will be sent to the client. Contains functions for modifying HTTP headers and specifying response contents. More... | |
class | cex::Middleware |
Represents a single middleware. More... | |
class | cex::Server |
Core class of the embedded webserver. Manages a single HTTP/HTTPS listener and performs routing as defined by the installed middlewares. More... | |
struct | cex::Server::Context |
Internal helper struct for handling libevhtp callback functions. More... | |
struct | cex::Server::Config |
Structure transporting all configuration options of the embedded server. Note that certain middlewares have additional config structs (e. g. cex::filesystem ) More... | |
Macros | |
#define | IO_BUFFER_SIZE 128*1024 |
Typedefs | |
typedef std::shared_ptr< Request > | cex::ReqPtr |
typedef std::shared_ptr< Response > | cex::ResPtr |
typedef std::function< void(Request *req, Response *res, std::function< void()> next)> | cex::MiddlewareFunction |
A function which is called by a standard Middleware when an incoming request matches. More... | |
typedef std::function< void(Request *req, const char *data, size_t len)> | cex::UploadFunction |
A function which is called by an upload Middleware when an incoming request matches. More... | |
typedef std::function< bool(const char *name, const char *value)> | cex::PairCallbackFunction |
A callback function which receives a name and a value parameter. More... | |
typedef std::pair< std::string, bool > | cex::MimeType |
typedef std::unordered_map< std::string, MimeType > | cex::MimeTypes |
typedef std::unique_ptr< std::thread, std::function< void(std::thread *t)> > | cex::ThreadPtr |
typedef std::unique_ptr< event_base, std::function< void(event_base *)> > | cex::EventBasePtr |
Enumerations | |
enum | ReturnValues { na = -1, fail = na, yes = 1, no = 0, success = 0, done = 0 } |
enum | cex::Method { unknownMethod = na, methodGET, methodHEAD, methodPOST, methodPUT, methodDELETE, methodOPTIONS, methodTRACE, methodCONNECT, methodPATCH, methodMKCOL, methodCOPY, methodMOVE, methodPROPFIND, methodPROPPATCH, methodLOCK, methodUNLOCK, nMethods } |
Enumeration of available HTTP methods. | |
enum | cex::Protocol { unknownProtocol = na, protocol10, protocol11, nProtocols } |
Enumeration of available HTTP versions (HTTP 1.0 or HTTP 1.1) | |
Functions | |
const char * | cex::getLibraryVersion () |
Returns the library version as string. | |
libcex
core classes and functions
typedef std::function<void(Request* req, Response* res, std::function<void()> next)> cex::MiddlewareFunction |
A function which is called by a standard Middleware when an incoming request matches.
req | The Request object representing the matched request |
res | The corresponding Response object which allows to create/send a response to the client |
next | A function to call when the next middleware shall be evaluated. |
typedef std::function<bool(const char* name, const char* value)> cex::PairCallbackFunction |
A callback function which receives a name and a value parameter.
name | The name of the header/parameter |
value | The value of the header/parameter |
true
to abort iteration, and false
to continue iteration typedef std::function<void(Request* req, const char* data, size_t len)> cex::UploadFunction |
A function which is called by an upload Middleware when an incoming request matches.
The UploadFunction receives the incoming data stream as parameters, so the upload can be processed (e. g. stored to disk or loaded into memory).
The function is called repeatedly, depending on the size of the upload. Following middlewares will not be called until the upload is finished.
req | The Request object representing the matched request |
data | The current data block of the upload |
len | The number of bytes of the current data block |