Kea 2.7.0
isc::dhcp::NetworkStateImpl Class Reference

Implementation of the NetworkState class. More...

+ Inheritance diagram for isc::dhcp::NetworkStateImpl:

Public Member Functions

 NetworkStateImpl (const NetworkState::ServerType &server_type)
 Constructor.
 
 ~NetworkStateImpl ()
 Destructor.
 
void createTimer (const unsigned int seconds, unsigned int origin)
 Creates a timer counting the time when delayedEnable should be automatically called.
 
void delayedEnable (unsigned int origin)
 Enables DHCP service for an origin.
 
void destroyTimer (unsigned int origin)
 Destroys a timer if present.
 
std::string getTimerName (unsigned int origin) const
 Creates a unique timer name from the origin.
 
void resetForDbConnection ()
 Reset internal counters for a database connection origin.
 
void setDisableService (const bool disable, unsigned int origin)
 Sets appropriate disabled or enabled DHCP service state for the respective origin.
 

Public Attributes

uint32_t disabled_by_db_connection_
 Flag which indicates the state has been disabled by a DB connection loss.
 
std::unordered_set< unsigned int > disabled_by_origin_
 A set of requests to disable the service by origin.
 
NetworkState::Networks disabled_networks_
 A list of networks for which the DHCP service has been disabled.
 
NetworkState::Subnets disabled_subnets_
 A list of subnets for which the DHCP service has been disabled.
 
bool globally_disabled_
 A flag indicating if DHCP service is globally disabled.
 
NetworkState::ServerType server_type_
 Server type.
 
TimerMgrPtr timer_mgr_
 A pointer to the common timer manager.
 

Detailed Description

Implementation of the NetworkState class.

Definition at line 25 of file network_state.cc.

Constructor & Destructor Documentation

◆ NetworkStateImpl()

isc::dhcp::NetworkStateImpl::NetworkStateImpl ( const NetworkState::ServerType & server_type)
inline

Constructor.

Definition at line 29 of file network_state.cc.

◆ ~NetworkStateImpl()

isc::dhcp::NetworkStateImpl::~NetworkStateImpl ( )
inline

Destructor.

Definition at line 37 of file network_state.cc.

References destroyTimer(), and disabled_by_origin_.

+ Here is the call graph for this function:

Member Function Documentation

◆ createTimer()

void isc::dhcp::NetworkStateImpl::createTimer ( const unsigned int seconds,
unsigned int origin )
inline

Creates a timer counting the time when delayedEnable should be automatically called.

If the timer has been already scheduled, it is destroyed and replaced with a new timer.

Parameters
secondsNumber of seconds to elapse before the delayedEnable is called.
originThe origin of the state transition.

Definition at line 110 of file network_state.cc.

References isc::dhcp::NetworkState::DB_CONNECTION, delayedEnable(), destroyTimer(), getTimerName(), isc_throw, isc::asiolink::IntervalTimer::ONE_SHOT, and timer_mgr_.

+ Here is the call graph for this function:

◆ delayedEnable()

void isc::dhcp::NetworkStateImpl::delayedEnable ( unsigned int origin)
inline

Enables DHCP service for an origin.

If delayed enabling DHCP service has been scheduled, it cancels it.

Parameters
originThe origin of the state transition.

Definition at line 96 of file network_state.cc.

References destroyTimer(), and setDisableService().

Referenced by createTimer().

+ Here is the call graph for this function:

◆ destroyTimer()

void isc::dhcp::NetworkStateImpl::destroyTimer ( unsigned int origin)
inline

Destroys a timer if present.

Parameters
originThe origin of the state transition.

Definition at line 127 of file network_state.cc.

References isc::dhcp::NetworkState::DB_CONNECTION, getTimerName(), and timer_mgr_.

Referenced by ~NetworkStateImpl(), createTimer(), and delayedEnable().

+ Here is the call graph for this function:

◆ getTimerName()

std::string isc::dhcp::NetworkStateImpl::getTimerName ( unsigned int origin) const
inline

Creates a unique timer name from the origin.

Parameters
originThe origin of the state transition.
Returns
Unique timer name for the origin.

Definition at line 141 of file network_state.cc.

Referenced by createTimer(), and destroyTimer().

◆ resetForDbConnection()

void isc::dhcp::NetworkStateImpl::resetForDbConnection ( )
inline

Reset internal counters for a database connection origin.

Note
The dhcp service will remain disabled until all flags are cleared.

Definition at line 84 of file network_state.cc.

References disabled_by_db_connection_, disabled_by_origin_, and globally_disabled_.

◆ setDisableService()

void isc::dhcp::NetworkStateImpl::setDisableService ( const bool disable,
unsigned int origin )
inline

Sets appropriate disabled or enabled DHCP service state for the respective origin.

Note
If any of the user commands, HA internal commands or connection recovery processes disable the dhcp service, the service will remain disabled until all flags are cleared. In the case of the connection recovery a reference count is used internally, so that all connections must be restored before enabling the network state.
Parameters
disableThe value of the flag used to perform the transition.
originThe origin of the state transition.

Definition at line 55 of file network_state.cc.

References isc::dhcp::NetworkState::DB_CONNECTION, disabled_by_db_connection_, disabled_by_origin_, and globally_disabled_.

Referenced by delayedEnable().

Member Data Documentation

◆ disabled_by_db_connection_

uint32_t isc::dhcp::NetworkStateImpl::disabled_by_db_connection_

Flag which indicates the state has been disabled by a DB connection loss.

Definition at line 170 of file network_state.cc.

Referenced by resetForDbConnection(), and setDisableService().

◆ disabled_by_origin_

std::unordered_set<unsigned int> isc::dhcp::NetworkStateImpl::disabled_by_origin_

A set of requests to disable the service by origin.

Definition at line 166 of file network_state.cc.

Referenced by ~NetworkStateImpl(), resetForDbConnection(), and setDisableService().

◆ disabled_networks_

NetworkState::Networks isc::dhcp::NetworkStateImpl::disabled_networks_

A list of networks for which the DHCP service has been disabled.

Definition at line 157 of file network_state.cc.

◆ disabled_subnets_

NetworkState::Subnets isc::dhcp::NetworkStateImpl::disabled_subnets_

A list of subnets for which the DHCP service has been disabled.

Definition at line 154 of file network_state.cc.

◆ globally_disabled_

bool isc::dhcp::NetworkStateImpl::globally_disabled_

A flag indicating if DHCP service is globally disabled.

Definition at line 151 of file network_state.cc.

Referenced by resetForDbConnection(), and setDisableService().

◆ server_type_

NetworkState::ServerType isc::dhcp::NetworkStateImpl::server_type_

Server type.

Definition at line 148 of file network_state.cc.

◆ timer_mgr_

TimerMgrPtr isc::dhcp::NetworkStateImpl::timer_mgr_

A pointer to the common timer manager.

This pointer is held here to make sure that the timer manager is not destroyed before an instance of this class is destroyed.

Definition at line 163 of file network_state.cc.

Referenced by createTimer(), and destroyTimer().


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