 |
Kea
1.5.0
|
Go to the documentation of this file.
7 #ifndef HTTP_CONNECTION_H
8 #define HTTP_CONNECTION_H
15 #include <boost/function.hpp>
16 #include <boost/enable_shared_from_this.hpp>
17 #include <boost/system/error_code.hpp>
18 #include <boost/shared_ptr.hpp>
36 class HttpConnectionPool;
43 class HttpConnection :
public boost::enable_shared_from_this<HttpConnection> {
48 typedef boost::function<void(boost::system::error_code ec,
size_t length)>
49 SocketCallbackFunction;
54 class SocketCallback {
61 SocketCallback(SocketCallbackFunction socket_callback)
62 : callback_(socket_callback) {
74 void operator()(boost::system::error_code ec,
size_t length = 0);
78 SocketCallbackFunction callback_;
102 const long request_timeout,
103 const long idle_timeout);
152 void acceptorCallback(
const boost::system::error_code& ec);
162 void socketReadCallback(boost::system::error_code ec,
169 void socketWriteCallback(boost::system::error_code ec,
178 void reinitProcessingState();
181 void setupRequestTimer();
184 void setupIdleTimer();
190 void requestTimeoutCallback();
192 void idleTimeoutCallback();
195 void stopThisConnection();
198 std::string getRemoteEndpointAddressAsText()
const;
204 long request_timeout_;
233 std::array<char, 32768> buf_;
236 std::string output_buf_;
The IntervalTimer class is a wrapper for the ASIO boost::asio::deadline_timer class.
boost::shared_ptr< HttpRequestParser > HttpRequestParserPtr
Pointer to the HttpRequestParser.
Pool of active HTTP connections.
boost::function< void(const boost::system::error_code &)> HttpAcceptorCallback
Type of the callback for the TCP acceptor used in this library.
The IOService class is a wrapper for the ASIO io_service class.
~HttpConnection()
Destructor.
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
boost::shared_ptr< const HttpResponse > ConstHttpResponsePtr
Pointer to the const HttpResponse object.
This is a base class for exceptions thrown from the DNS library module.
HttpConnectionError(const char *file, size_t line, const char *what)
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Accepts and handles a single HTTP connection.
boost::shared_ptr< HttpResponseCreator > HttpResponseCreatorPtr
Pointer to the HttpResponseCreator object.
HttpConnection(asiolink::IOService &io_service, HttpAcceptor &acceptor, HttpConnectionPool &connection_pool, const HttpResponseCreatorPtr &response_creator, const HttpAcceptorCallback &callback, const long request_timeout, const long idle_timeout)
Constructor.
Generic error reported within HttpConnection class.
boost::shared_ptr< HttpConnection > HttpConnectionPtr
Pointer to the HttpConnection.
void doRead()
Starts asynchronous read from the socket.
void asyncAccept()
Asynchronously accepts new connection.
void close()
Closes the socket.