Kea  2.3.5-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. More...
 
virtual ~CmdHttpListener ()
 Destructor. More...
 
void checkPermissions ()
 Check if the current thread can perform thread pool state transition. More...
 
isc::asiolink::IOAddress getAddress () const
 Fetches the IP address on which to listen. More...
 
uint16_t getPort () const
 Fetches the port number on which to listen. More...
 
uint16_t getThreadCount () const
 Fetches the number of threads in the pool. More...
 
asiolink::IOServicePtr getThreadIOService () const
 Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode. More...
 
uint16_t getThreadPoolSize () const
 Fetches the maximum size of the thread pool. More...
 
asiolink::TlsContextPtr getTlsContext () const
 Fetches the TLS context. More...
 
bool isPaused ()
 Indicates if the thread pool is paused. More...
 
bool isRunning ()
 Indicates if the thread pool is running. More...
 
bool isStopped ()
 Indicates if the thread pool is stopped. More...
 
void pause ()
 Pauses the listener's thread pool. More...
 
void resume ()
 Resumes running the listener's thread pool. More...
 
void start ()
 Starts running the listener's thread pool. More...
 
void stop ()
 Stops the listener's thread pool. More...
 

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
MultiThreadingInvalidOperationif the state transition is done on any of the worker threads.

Definition at line 89 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 153 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 135 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 144 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 96 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 103 of file cmd_http_listener.cc.

◆ start()

void isc::config::CmdHttpListener::start ( )

◆ stop()

void isc::config::CmdHttpListener::stop ( )

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