Kea: isc::config::CmdHttpListener Class Reference

| Kea 3.0.3-git

isc::config::CmdHttpListener Class Reference

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.

## Detailed Description

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.

Note
  This class is NOT compatible with Kea core single-threading. It is incumbent upon the owner to ensure the Kea core multi-threading is (or will be) enabled when creating instances of this class.

Definition at line 32 of file cmd_http_listener.h.

## Constructor & Destructor Documentation

## ◆ CmdHttpListener()

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.

## ◆ ~CmdHttpListener()

isc::config::CmdHttpListener::~CmdHttpListener | ( |  | ) |
| virtual

Destructor.

Definition at line 37 of file cmd_http_listener.cc.

References stop().

Here is the call graph for this function:

## Member Function Documentation

## ◆ checkPermissions()

void isc::config::CmdHttpListener::checkPermissions | ( |  | ) |

Check if the current thread can perform thread pool state transition.

Exceptions

  MultiThreadingInvalidOperation | if the state transition is done on any of the worker threads.

Definition at line 116 of file cmd_http_listener.cc.

## ◆ getAddress()

isc::asiolink::IOAddress isc::config::CmdHttpListener::getAddress | ( |  | ) | const
| inline

Fetches the IP address on which to listen.

Returns
  IOAddress containing the address on which to listen.

Definition at line 86 of file cmd_http_listener.h.

## ◆ getPort()

uint16_t isc::config::CmdHttpListener::getPort | ( |  | ) | const
| inline

Fetches the port number on which to listen.

Returns
  uint16_t containing the port number on which to listen.

Definition at line 93 of file cmd_http_listener.h.

## ◆ getThreadCount()

uint16_t isc::config::CmdHttpListener::getThreadCount | ( |  | ) | const
| inline

Fetches the number of threads in the pool.

Returns
  uint16_t containing the number of running threads.

Definition at line 114 of file cmd_http_listener.h.

## ◆ getThreadIOService()

asiolink::IOServicePtr isc::config::CmdHttpListener::getThreadIOService | ( |  | ) | const
| inline

Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode.

Returns
  pointer to the IOService instance, or an empty pointer in single-threaded mode.

Definition at line 127 of file cmd_http_listener.h.

## ◆ getThreadPoolSize()

uint16_t isc::config::CmdHttpListener::getThreadPoolSize | ( |  | ) | const
| inline

Fetches the maximum size of the thread pool.

Returns
  uint16_t containing the maximum size of the thread pool.

Definition at line 100 of file cmd_http_listener.h.

## ◆ getTlsContext()

asiolink::TlsContextPtr isc::config::CmdHttpListener::getTlsContext | ( |  | ) | const
| inline

Fetches the TLS context.

Returns
  TLS context.

Definition at line 107 of file cmd_http_listener.h.

## ◆ isPaused()

bool isc::config::CmdHttpListener::isPaused | ( |  | ) |

Indicates if the thread pool is paused.

Returns
  True if the thread pool exists and it is in the PAUSED state, false otherwise.

Definition at line 189 of file cmd_http_listener.cc.

## ◆ isRunning()

bool isc::config::CmdHttpListener::isRunning | ( |  | ) |

Indicates if the thread pool is running.

Returns
  True if the thread pool exists and it is in the RUNNING state, false otherwise.

Definition at line 171 of file cmd_http_listener.cc.

## ◆ isStopped()

bool isc::config::CmdHttpListener::isStopped | ( |  | ) |

Indicates if the thread pool is stopped.

Returns
  True if the thread pool does not exist or it is in the STOPPED state, false otherwise.

Definition at line 180 of file cmd_http_listener.cc.

Referenced by start().

## ◆ pause()

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.

## ◆ resume()

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.

## ◆ start()

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, and isc::config::TIMEOUT_AGENT_RECEIVE_COMMAND.

Here is the call graph for this function:

## ◆ stop()

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().

The documentation for this class was generated from the following files:

- cmd_http_listener.h
- cmd_http_listener.cc