C++ Actor Framework 0.19
|
Sits on top of a server and dispatches incoming requests to user-defined handlers. More...
#include <router.hpp>
Public Member Functions | |
router (std::vector< route_ptr > routes) | |
lower_layer * | down () |
Returns a pointer to the underlying HTTP layer. | |
actor_shell * | self () |
Returns an actor_shell for this router that enables routes to interact with actors. | |
request | lift (responder &&res) |
Lifts a responder to an request object that allows asynchronous processing of the HTTP request. | |
void | shutdown (const error &err) |
error | start (lower_layer *down) override |
Initializes the upper layer. | |
ptrdiff_t | consume (const request_header &hdr, const_byte_span payload) override |
Consumes an HTTP message. | |
void | prepare_send () override |
Gives the upper layer an opportunity to add additional data to the output buffer. | |
bool | done_sending () override |
Queries whether all pending data has been sent. | |
void | abort (const error &reason) override |
Called by the lower layer for cleaning up any state in case of an error or when disposed. | |
virtual error | start (lower_layer *down)=0 |
Initializes the upper layer. | |
virtual ptrdiff_t | consume (const request_header &hdr, const_byte_span payload)=0 |
Consumes an HTTP message. | |
virtual void | prepare_send ()=0 |
Gives the upper layer an opportunity to add additional data to the output buffer. | |
virtual bool | done_sending ()=0 |
Queries whether all pending data has been sent. | |
virtual void | abort (const error &reason)=0 |
Called by the lower layer for cleaning up any state in case of an error or when disposed. | |
Static Public Member Functions | |
static std::unique_ptr< router > | make (std::vector< route_ptr > routes) |
Sits on top of a server and dispatches incoming requests to user-defined handlers.
|
overridevirtual |
Called by the lower layer for cleaning up any state in case of an error or when disposed.
Implements caf::net::generic_upper_layer.
|
overridevirtual |
Consumes an HTTP message.
hdr | The header fields for the received message. |
payload | The payload of the received message. |
Implements caf::net::http::upper_layer.
|
overridevirtual |
Queries whether all pending data has been sent.
The lower calls this function to decide whether it has to wait for write events on the socket.
Implements caf::net::generic_upper_layer.
|
overridevirtual |
Gives the upper layer an opportunity to add additional data to the output buffer.
Implements caf::net::generic_upper_layer.
|
overridevirtual |
Initializes the upper layer.
down | A pointer to the lower layer that remains valid for the lifetime of the upper layer. |
Implements caf::net::http::upper_layer.