Kea 2.7.3
|
A multi-threaded HTTP listener that can process API commands requests. More...
#include <cmd_http_listener.h>
Public Member Functions | |
CmdHttpListener (const asiolink::IOAddress &address, const uint16_t port, const uint16_t thread_pool_size=1, asiolink::TlsContextPtr context=asiolink::TlsContextPtr()) | |
Constructor. | |
virtual | ~CmdHttpListener () |
Destructor. | |
void | checkPermissions () |
Check if the current thread can perform thread pool state transition. | |
isc::asiolink::IOAddress | getAddress () const |
Fetches the IP address on which to listen. | |
uint16_t | getPort () const |
Fetches the port number on which to listen. | |
uint16_t | getThreadCount () const |
Fetches the number of threads in the pool. | |
asiolink::IOServicePtr | getThreadIOService () const |
Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode. | |
uint16_t | getThreadPoolSize () const |
Fetches the maximum size of the thread pool. | |
asiolink::TlsContextPtr | getTlsContext () const |
Fetches the TLS context. | |
bool | isPaused () |
Indicates if the thread pool is paused. | |
bool | isRunning () |
Indicates if the thread pool is running. | |
bool | isStopped () |
Indicates if the thread pool is stopped. | |
void | pause () |
Pauses the listener's thread pool. | |
void | resume () |
Resumes running the listener's thread pool. | |
void | start () |
Starts running the listener's thread pool. | |
void | stop () |
Stops the listener's thread pool. | |
A multi-threaded HTTP listener that can process API commands requests.
This class will listen for Command API client requests on a given IP address and port. It uses its own IOService instance to drive a thread-pool which can service multiple connections concurrently. The number of concurrent connections is currently limited to the configured thread pool size.
Definition at line 32 of file cmd_http_listener.h.
isc::config::CmdHttpListener::CmdHttpListener | ( | const asiolink::IOAddress & | address, |
const uint16_t | port, | ||
const uint16_t | thread_pool_size = 1, | ||
asiolink::TlsContextPtr | context = asiolink::TlsContextPtr() ) |
Constructor.
Definition at line 29 of file cmd_http_listener.cc.
|
virtual |
Destructor.
Definition at line 37 of file cmd_http_listener.cc.
References stop().
void isc::config::CmdHttpListener::checkPermissions | ( | ) |
Check if the current thread can perform thread pool state transition.
MultiThreadingInvalidOperation | if the state transition is done on any of the worker threads. |
Definition at line 116 of file cmd_http_listener.cc.
|
inline |
Fetches the IP address on which to listen.
Definition at line 86 of file cmd_http_listener.h.
|
inline |
Fetches the port number on which to listen.
Definition at line 93 of file cmd_http_listener.h.
|
inline |
Fetches the number of threads in the pool.
Definition at line 114 of file cmd_http_listener.h.
|
inline |
Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode.
Definition at line 127 of file cmd_http_listener.h.
|
inline |
Fetches the maximum size of the thread pool.
Definition at line 100 of file cmd_http_listener.h.
|
inline |
bool isc::config::CmdHttpListener::isPaused | ( | ) |
Indicates if the thread pool is paused.
Definition at line 189 of file cmd_http_listener.cc.
bool isc::config::CmdHttpListener::isRunning | ( | ) |
Indicates if the thread pool is running.
Definition at line 171 of file cmd_http_listener.cc.
bool isc::config::CmdHttpListener::isStopped | ( | ) |
Indicates if the thread pool is stopped.
Definition at line 180 of file cmd_http_listener.cc.
Referenced by start().
void isc::config::CmdHttpListener::pause | ( | ) |
Pauses the listener's thread pool.
Suspends thread pool event processing.
Definition at line 123 of file cmd_http_listener.cc.
void isc::config::CmdHttpListener::resume | ( | ) |
Resumes running the listener's thread pool.
Resumes thread pool event processing.
Definition at line 130 of file cmd_http_listener.cc.
void isc::config::CmdHttpListener::start | ( | ) |
Starts running the listener's thread pool.
Definition at line 42 of file cmd_http_listener.cc.
References isc::config::COMMAND_HTTP_LISTENER_STARTED, isc::config::command_logger, isc::config::DBG_COMMAND, isc::util::MultiThreadingMgr::instance(), isc_throw, isStopped(), LOG_DEBUG, isc::config::TIMEOUT_AGENT_IDLE_CONNECTION_TIMEOUT, isc::config::TIMEOUT_AGENT_RECEIVE_COMMAND, and isc::Exception::what().
void isc::config::CmdHttpListener::stop | ( | ) |
Stops the listener's thread pool.
Definition at line 137 of file cmd_http_listener.cc.
References isc::config::COMMAND_HTTP_LISTENER_STOPPED, isc::config::COMMAND_HTTP_LISTENER_STOPPING, isc::config::command_logger, isc::config::DBG_COMMAND, and LOG_DEBUG.
Referenced by ~CmdHttpListener().