![]() |
NetFlex
0.0.0
C++11 HTTP Server Library.
|
#include <client.hpp>
Public Types | |
typedef std::function< void(bool, request &)> | request_handler_t |
typedef tacopie::tcp_client::disconnection_handler_t | disconnection_handler_t |
Public Member Functions | |
client (const std::shared_ptr< tacopie::tcp_client > &tcp_client) | |
~client (void)=default | |
default dtor | |
client (const client &)=delete | |
copy ctor | |
client & | operator= (const client &)=delete |
assignment operator | |
const std::string & | get_host (void) const |
std::uint32_t | get_port (void) const |
void | set_request_handler (const request_handler_t &cb) |
void | set_disconnection_handler (const disconnection_handler_t &cb) |
void | send_response (const response &response) |
void | on_async_read_result (tacopie::tcp_client::read_result &res) |
http client represent one client connected to the HTTP server and notify on new requests
typedef tacopie::tcp_client::disconnection_handler_t netflex::http::client::disconnection_handler_t |
notify on client disconnection
typedef std::function<void(bool, request&)> netflex::http::client::request_handler_t |
notify on new http request received notify on invalid http request received (err while parsing)
|
explicit |
ctor
tcp_client | underlying tcp connection |
const std::string& netflex::http::client::get_host | ( | void | ) | const |
std::uint32_t netflex::http::client::get_port | ( | void | ) | const |
void netflex::http::client::on_async_read_result | ( | tacopie::tcp_client::read_result & | res | ) |
tcp_client callback called on async_read operation completion
res | read operation result |
void netflex::http::client::send_response | ( | const response & | response | ) |
send http response to the client this should only be called as a result of receiving a valid http request
void netflex::http::client::set_disconnection_handler | ( | const disconnection_handler_t & | cb | ) |
define the callback to be called on disconnection
cb | callback to be called |
void netflex::http::client::set_request_handler | ( | const request_handler_t & | cb | ) |
define the callback to be called on new valid or invalid http requests
cb | callback to be called |