Kea 2.7.5
|
Implementation of the NetworkState
class.
More...
Public Member Functions | |
NetworkStateImpl () | |
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 | resetForLocalCommands () |
Reset origin for local commands. | |
void | resetForRemoteCommands () |
Reset origin for remote commands. | |
void | setDisableService (const bool disable, unsigned int origin) |
Sets appropriate disabled or enabled DHCP service state for the respective origin. | |
virtual ElementPtr | toElement () const |
The network state as Element. | |
Public Member Functions inherited from isc::data::CfgToElement | |
virtual | ~CfgToElement () |
Destructor. | |
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. | |
TimerMgrPtr | timer_mgr_ |
A pointer to the common timer manager. | |
Implementation of the NetworkState
class.
Definition at line 26 of file network_state.cc.
|
inline |
Constructor.
Definition at line 31 of file network_state.cc.
|
inline |
Destructor.
Definition at line 37 of file network_state.cc.
References destroyTimer(), and disabled_by_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.
seconds | Number of seconds to elapse before the delayedEnable is called. |
origin | The origin of the state transition. |
Definition at line 142 of file network_state.cc.
References isc::dhcp::NetworkState::DB_CONNECTION, delayedEnable(), destroyTimer(), getTimerName(), isc_throw, isc::asiolink::IntervalTimer::ONE_SHOT, and timer_mgr_.
|
inline |
Enables DHCP service for an origin.
If delayed enabling DHCP service has been scheduled, it cancels it.
origin | The origin of the state transition. |
Definition at line 128 of file network_state.cc.
References destroyTimer(), and setDisableService().
Referenced by createTimer().
|
inline |
Destroys a timer if present.
origin | The origin of the state transition. |
Definition at line 159 of file network_state.cc.
References isc::dhcp::NetworkState::DB_CONNECTION, getTimerName(), and timer_mgr_.
Referenced by ~NetworkStateImpl(), createTimer(), and delayedEnable().
|
inline |
Creates a unique timer name from the origin.
origin | The origin of the state transition. |
Definition at line 173 of file network_state.cc.
Referenced by createTimer(), and destroyTimer().
|
inline |
Reset internal counters for a database connection origin.
Definition at line 84 of file network_state.cc.
References disabled_by_db_connection_, disabled_by_origin_, and globally_disabled_.
|
inline |
Reset origin for local commands.
Definition at line 94 of file network_state.cc.
References disabled_by_db_connection_, disabled_by_origin_, globally_disabled_, isc::dhcp::NetworkState::HA_LOCAL_COMMAND, and isc::dhcp::NetworkState::HA_REMOTE_COMMAND.
|
inline |
Reset origin for remote commands.
Definition at line 110 of file network_state.cc.
References isc::dhcp::NetworkState::DB_CONNECTION, disabled_by_db_connection_, disabled_by_origin_, globally_disabled_, and isc::dhcp::NetworkState::HA_REMOTE_COMMAND.
|
inline |
Sets appropriate disabled or enabled DHCP service state for the respective origin.
disable | The value of the flag used to perform the transition. |
origin | The 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().
|
inlinevirtual |
The network state as Element.
Implements isc::data::CfgToElement.
Definition at line 182 of file network_state.cc.
References isc::data::Element::create(), isc::data::Element::createList(), isc::data::Element::createMap(), isc::dhcp::NetworkState::DB_CONNECTION, disabled_by_db_connection_, disabled_by_origin_, globally_disabled_, isc::dhcp::NetworkState::HA_LOCAL_COMMAND, isc::dhcp::NetworkState::HA_REMOTE_COMMAND, and isc::dhcp::NetworkState::USER_COMMAND.
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 228 of file network_state.cc.
Referenced by resetForDbConnection(), resetForLocalCommands(), resetForRemoteCommands(), setDisableService(), and toElement().
std::unordered_set<unsigned int> isc::dhcp::NetworkStateImpl::disabled_by_origin_ |
A set of requests to disable the service by origin.
Definition at line 224 of file network_state.cc.
Referenced by ~NetworkStateImpl(), resetForDbConnection(), resetForLocalCommands(), resetForRemoteCommands(), setDisableService(), and toElement().
NetworkState::Networks isc::dhcp::NetworkStateImpl::disabled_networks_ |
A list of networks for which the DHCP service has been disabled.
Definition at line 215 of file network_state.cc.
NetworkState::Subnets isc::dhcp::NetworkStateImpl::disabled_subnets_ |
A list of subnets for which the DHCP service has been disabled.
Definition at line 212 of file network_state.cc.
bool isc::dhcp::NetworkStateImpl::globally_disabled_ |
A flag indicating if DHCP service is globally disabled.
Definition at line 209 of file network_state.cc.
Referenced by resetForDbConnection(), resetForLocalCommands(), resetForRemoteCommands(), setDisableService(), and toElement().
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 221 of file network_state.cc.
Referenced by createTimer(), and destroyTimer().