16namespace ph = std::placeholders;
23 const unsigned short server_port,
26 const long request_timeout,
27 const long idle_timeout)
28 : io_service_(io_service), tls_context_(tls_context), acceptor_(),
30 creator_factory_(creator_factory),
31 request_timeout_(request_timeout), idle_timeout_(idle_timeout),
32 use_external_(false) {
46 << server_address <<
":" << server_port);
94 }
catch (
const boost::system::system_error& ex) {
97 "listening to the incoming HTTP requests: " << ex.
what());
124 conn->addExternalSockets(
true);
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The IOAddress class represents an IP addresses (version agnostic)
boost::asio::socket_base::reuse_address ReuseAddress
Represents SO_REUSEADDR socket option.
The TCPEndpoint class is a concrete derived class of IOEndpoint that represents an endpoint of a TCP ...
static IfaceMgr & instance()
IfaceMgr is a singleton class.
Pool of active HTTP connections.
Accepts and handles a single HTTP connection.
A generic error raised by the HttpListener class.
bool use_external_
Use external sockets flag.
HttpListenerImpl(const asiolink::IOServicePtr &io_service, const asiolink::IOAddress &server_address, const unsigned short server_port, const asiolink::TlsContextPtr &tls_context, const HttpResponseCreatorFactoryPtr &creator_factory, const long request_timeout, const long idle_timeout)
Constructor.
long request_timeout_
Timeout for HTTP Request Timeout desired.
void start()
Starts accepting new connections.
boost::scoped_ptr< asiolink::TCPEndpoint > endpoint_
Pointer to the endpoint representing IP address and port on which the service is running.
long idle_timeout_
Timeout after which idle persistent connection is closed by the server.
HttpResponseCreatorFactoryPtr creator_factory_
Pointer to the HttpResponseCreatorFactory.
asiolink::IOServicePtr io_service_
Pointer to the IO service.
const asiolink::TCPEndpoint & getEndpoint() const
Returns reference to the current listener endpoint.
void accept()
Creates HttpConnection instance and adds it to the pool of active connections.
void addExternalSockets(bool use_external)
Use external sockets flag.
HttpAcceptorPtr acceptor_
Acceptor instance.
int getNative() const
file descriptor of the underlying acceptor socket.
asiolink::TlsContextPtr tls_context_
TLS context.
virtual HttpConnectionPtr createConnection(const HttpResponseCreatorPtr &response_creator, const HttpAcceptorCallback &callback)
Creates an instance of the HttpConnection.
void acceptHandler(const boost::system::error_code &ec)
Callback invoked when the new connection is accepted.
HttpConnectionPoolPtr connections_
Pool of active connections.
void stop()
Stops all active connections and shuts down the service.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
boost::shared_ptr< HttpResponseCreator > HttpResponseCreatorPtr
Pointer to the HttpResponseCreator object.
boost::shared_ptr< HttpResponseCreatorFactory > HttpResponseCreatorFactoryPtr
Pointer to the HttpResponseCreatorFactory.
asiolink::TLSAcceptor< HttpAcceptorCallback > HttpsAcceptor
Type of the TLS acceptor used in this library.
std::function< void(const boost::system::error_code &) HttpAcceptorCallback)
Type of the callback for the TCP acceptor used in this library.
boost::shared_ptr< HttpConnection > HttpConnectionPtr
Pointer to the HttpConnection.
asiolink::TCPAcceptor< HttpAcceptorCallback > HttpAcceptor
Type of the TCP acceptor used in this library.
Defines the logger used by the top-level component of kea-lfc.