7#ifndef MT_TCP_LISTENER_MGR_H
8#define MT_TCP_LISTENER_MGR_H
27 const unsigned short server_port,
60 const uint16_t thread_pool_size = 1,
126 return (thread_pool_size_);
133 return (tls_context_);
144 return (thread_pool_->getThreadCount());
153 return (thread_io_service_);
158 return(tcp_listener_);
169 return (idle_timeout_.
value_);
189 std::size_t thread_pool_size_;
The IOAddress class represents an IP addresses (version agnostic)
Manages a thread-pool that is used to drive a TcpListener.
isc::asiolink::IOAddress getAddress() const
Fetches the IP address on which to listen.
asiolink::TlsContextPtr getTlsContext() const
Fetches the TLS context.
void pause()
Pauses the listener's thread pool.
const TcpListenerPtr getTcpListener()
Fetch a pointer to the listener.
void start()
Starts running the listener's thread pool.
bool isPaused()
Indicates if the thread pool is paused.
void checkPermissions()
Check if the current thread can perform thread pool state transition.
bool isStopped()
Indicates if the thread pool is stopped.
MtTcpListenerMgr(TcpListenerFactory listener_factory, const asiolink::IOAddress &address, const uint16_t port, const uint16_t thread_pool_size=1, asiolink::TlsContextPtr context=asiolink::TlsContextPtr(), TcpConnectionFilterCallback connection_filter=0)
Constructor.
uint16_t getPort() const
Fetches the port number on which to listen.
void setIdleTimeout(long milliseconds)
Sets the idle time per connection.
uint16_t getThreadPoolSize() const
Fetches the maximum size of the thread pool.
void resume()
Resumes running the listener's thread pool.
void stop()
Stops the listener's thread pool.
uint16_t getThreadCount() const
Fetches the number of threads in the pool.
virtual ~MtTcpListenerMgr()
Destructor.
bool isRunning()
Indicates if the thread pool is running.
asiolink::IOServicePtr getThreadIOService() const
Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
boost::shared_ptr< IoServiceThreadPool > IoServiceThreadPoolPtr
Defines a pointer to a thread pool.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const long TCP_IDLE_CONNECTION_TIMEOUT
Default connection idle timeout in milliseconds.
boost::shared_ptr< MtTcpListenerMgr > MtTcpListenerMgrPtr
Defines a shared pointer to MtTcpListenerMgr.
std::function< bool(const boost::asio::ip::tcp::endpoint &) TcpConnectionFilterCallback)
Type of the callback for filtering new connections by ip address.
std::function< TcpListenerPtr(const asiolink::IOServicePtr &io_service, const asiolink::IOAddress &server_address, const unsigned short server_port, const asiolink::TlsContextPtr &tls_context, const TcpListener::IdleTimeout &idle_timeout, const TcpConnectionFilterCallback &connection_filter) TcpListenerFactory)
Defines a factory function for creating TcpListeners.
boost::shared_ptr< TcpListener > TcpListenerPtr
Pointer to a TcpListener.
Defines the logger used by the top-level component of kea-lfc.
long value_
Connection idle timeout value specified.