Kea 2.7.5
|
Holds configuration parameters pertaining to lease expiration and lease affinity. More...
#include <cfg_expiration.h>
Public Member Functions | |
CfgExpiration (const bool test_mode=false) | |
Constructor. | |
uint16_t | getFlushReclaimedTimerWaitTime () const |
Returns flush-reclaimed-timer-wait-time. | |
uint32_t | getHoldReclaimedTime () const |
Returns hold-reclaimed-time. | |
uint32_t | getMaxReclaimLeases () const |
Returns max-reclaim-leases. | |
uint16_t | getMaxReclaimTime () const |
Returns max-reclaim-time. | |
uint16_t | getReclaimTimerWaitTime () const |
Returns reclaim-timer-wait-time. | |
uint16_t | getUnwarnedReclaimCycles () const |
Returns unwarned-reclaim-cycles. | |
void | setFlushReclaimedTimerWaitTime (const int64_t flush_reclaimed_wait_time) |
Sets flush-reclaimed-timer-wait-time. | |
void | setHoldReclaimedTime (const int64_t hold_reclaimed_time) |
Sets hold-reclaimed-time. | |
void | setMaxReclaimLeases (const int64_t max_reclaim_leases) |
Sets max-reclaim-leases. | |
void | setMaxReclaimTime (const int64_t max_reclaim_time) |
Sets max-reclaim-time. | |
void | setReclaimTimerWaitTime (const int64_t reclaim_timer_wait_time) |
Sets reclaim-timer-wait-time. | |
void | setUnwarnedReclaimCycles (const int64_t unwarned_reclaim_cycles) |
Sets unwarned-reclaim-cycles. | |
template<typename Instance > | |
void | setupTimers (void(Instance::*reclaim_fun)(const size_t, const uint16_t, const bool, const uint16_t), void(Instance::*delete_fun)(const uint32_t), Instance *instance_ptr) const |
Setup timers for the reclamation of expired leases according to the configuration parameters. | |
virtual isc::data::ElementPtr | toElement () const |
Unparse a configuration object. | |
Public Member Functions inherited from isc::data::CfgToElement | |
virtual | ~CfgToElement () |
Destructor. | |
Static Public Attributes | |
Default values. | |
Default value for reclaim-timer-wait-time. | |
static const uint16_t | DEFAULT_RECLAIM_TIMER_WAIT_TIME = 10 |
static const uint16_t | DEFAULT_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 25 |
Default value for flush-reclaimed-timer-wait-time. | |
static const uint32_t | DEFAULT_HOLD_RECLAIMED_TIME = 3600 |
Default value for hold-reclaimed-time. | |
static const uint32_t | DEFAULT_MAX_RECLAIM_LEASES = 100 |
Default value for max-reclaim-leases. | |
static const uint16_t | DEFAULT_MAX_RECLAIM_TIME = 250 |
Default value for max-reclaim-time. | |
static const uint16_t | DEFAULT_UNWARNED_RECLAIM_CYCLES = 5 |
Default value for unwarned-reclaim-cycles. | |
Upper limits for the parameters | |
Maximum value for reclaim-timer-wait-time. | |
static const uint16_t | LIMIT_RECLAIM_TIMER_WAIT_TIME |
static const uint16_t | LIMIT_FLUSH_RECLAIMED_TIMER_WAIT_TIME |
Maximum value for flush-reclaimed-timer-wait-time. | |
static const uint32_t | LIMIT_HOLD_RECLAIMED_TIME |
Maximum value for hold-reclaimed-time. | |
static const uint32_t | LIMIT_MAX_RECLAIM_LEASES |
Maximum value for max-reclaim-leases. | |
static const uint16_t | LIMIT_MAX_RECLAIM_TIME = 10000 |
Default value for max-reclaim-time. | |
static const uint16_t | LIMIT_UNWARNED_RECLAIM_CYCLES |
Maximum value for unwarned-reclaim-cycles. | |
Timers' names | |
static const std::string | RECLAIM_EXPIRED_TIMER_NAME |
Name of the timer for reclaiming expired leases. | |
static const std::string | FLUSH_RECLAIMED_TIMER_NAME |
Name of the timer for flushing reclaimed leases. | |
Holds configuration parameters pertaining to lease expiration and lease affinity.
This class holds the values of the following configuration parameters:
The CfgExpiration
class provides a collection of accessors and modifiers to manage the data. Each accessor checks if the given value is in range allowed for this value.
Definition at line 61 of file cfg_expiration.h.
isc::dhcp::CfgExpiration::CfgExpiration | ( | const bool | test_mode = false | ) |
Constructor.
Sets all parameters to their defaults.
test_mode | Indicates if the instance should be created in the test mode. In this mode the intervals for the timers are considered to be specified in milliseconds, rather than seconds. This facilitates testing execution of timers without the delays. |
Definition at line 46 of file cfg_expiration.cc.
|
inline |
Returns flush-reclaimed-timer-wait-time.
Definition at line 142 of file cfg_expiration.h.
|
inline |
Returns hold-reclaimed-time.
Definition at line 152 of file cfg_expiration.h.
|
inline |
Returns max-reclaim-leases.
Definition at line 162 of file cfg_expiration.h.
|
inline |
Returns max-reclaim-time.
Definition at line 172 of file cfg_expiration.h.
|
inline |
Returns reclaim-timer-wait-time.
Definition at line 132 of file cfg_expiration.h.
|
inline |
Returns unwarned-reclaim-cycles.
Definition at line 182 of file cfg_expiration.h.
void isc::dhcp::CfgExpiration::setFlushReclaimedTimerWaitTime | ( | const int64_t | flush_reclaimed_wait_time | ) |
Sets flush-reclaimed-timer-wait-time.
flush_reclaimed_wait_time | New value. |
Definition at line 65 of file cfg_expiration.cc.
References LIMIT_FLUSH_RECLAIMED_TIMER_WAIT_TIME.
void isc::dhcp::CfgExpiration::setHoldReclaimedTime | ( | const int64_t | hold_reclaimed_time | ) |
Sets hold-reclaimed-time.
hold_reclaimed_time | New value. |
Definition at line 72 of file cfg_expiration.cc.
References LIMIT_HOLD_RECLAIMED_TIME.
void isc::dhcp::CfgExpiration::setMaxReclaimLeases | ( | const int64_t | max_reclaim_leases | ) |
Sets max-reclaim-leases.
max_reclaim_leases | New value. |
Definition at line 78 of file cfg_expiration.cc.
References LIMIT_MAX_RECLAIM_LEASES.
void isc::dhcp::CfgExpiration::setMaxReclaimTime | ( | const int64_t | max_reclaim_time | ) |
Sets max-reclaim-time.
max_reclaim_time | New value. |
Definition at line 84 of file cfg_expiration.cc.
References LIMIT_MAX_RECLAIM_TIME.
void isc::dhcp::CfgExpiration::setReclaimTimerWaitTime | ( | const int64_t | reclaim_timer_wait_time | ) |
Sets reclaim-timer-wait-time.
reclaim_timer_wait_time | New value. |
Definition at line 58 of file cfg_expiration.cc.
References LIMIT_RECLAIM_TIMER_WAIT_TIME.
void isc::dhcp::CfgExpiration::setUnwarnedReclaimCycles | ( | const int64_t | unwarned_reclaim_cycles | ) |
Sets unwarned-reclaim-cycles.
unwarned_reclaim_cycles | New value. |
Definition at line 90 of file cfg_expiration.cc.
References LIMIT_UNWARNED_RECLAIM_CYCLES.
void isc::dhcp::CfgExpiration::setupTimers | ( | void(Instance::*)(const size_t, const uint16_t, const bool, const uint16_t) | reclaim_fun, |
void(Instance::*)(const uint32_t) | delete_fun, | ||
Instance * | instance_ptr ) const |
Setup timers for the reclamation of expired leases according to the configuration parameters.
This method includes the logic for setting the interval timers performing the reclamation of the expired leases and the removal of expired-reclaimed leases.
The following is the sample code illustrating how to call this function to setup the leases reclamation for the DHCPv4 server.
reclaim_fun | Pointer to the leases reclamation routine. |
delete_fun | Pointer to the function which removes the expired-reclaimed leases from the lease database. |
instance_ptr | Pointer to the instance of the object which implements the lease reclamation routine. Typically it will be the pointer to the AllocEngine . In case of unit tests it will be a pointer to some test class which provides stub implementation of the leases reclamation routines. |
Instance | Instance of the object in which both functions are implemented. |
Definition at line 284 of file cfg_expiration.h.
References isc::asiolink::IntervalTimer::ONE_SHOT.
|
virtual |
Unparse a configuration object.
Implements isc::data::CfgToElement.
Definition at line 111 of file cfg_expiration.cc.
References isc::data::Element::create(), and isc::data::Element::createMap().
|
static |
Default value for flush-reclaimed-timer-wait-time.
Definition at line 71 of file cfg_expiration.h.
|
static |
Default value for hold-reclaimed-time.
Definition at line 74 of file cfg_expiration.h.
|
static |
Default value for max-reclaim-leases.
Definition at line 77 of file cfg_expiration.h.
|
static |
Default value for max-reclaim-time.
Definition at line 80 of file cfg_expiration.h.
|
static |
Definition at line 68 of file cfg_expiration.h.
|
static |
Default value for unwarned-reclaim-cycles.
Definition at line 83 of file cfg_expiration.h.
|
static |
Name of the timer for flushing reclaimed leases.
Definition at line 117 of file cfg_expiration.h.
|
static |
Maximum value for flush-reclaimed-timer-wait-time.
Definition at line 94 of file cfg_expiration.h.
Referenced by setFlushReclaimedTimerWaitTime().
|
static |
Maximum value for hold-reclaimed-time.
Definition at line 97 of file cfg_expiration.h.
Referenced by setHoldReclaimedTime().
|
static |
Maximum value for max-reclaim-leases.
Definition at line 100 of file cfg_expiration.h.
Referenced by setMaxReclaimLeases().
|
static |
Default value for max-reclaim-time.
Definition at line 103 of file cfg_expiration.h.
Referenced by setMaxReclaimTime().
|
static |
Definition at line 91 of file cfg_expiration.h.
Referenced by setReclaimTimerWaitTime().
|
static |
Maximum value for unwarned-reclaim-cycles.
Definition at line 106 of file cfg_expiration.h.
Referenced by setUnwarnedReclaimCycles().
|
static |
Name of the timer for reclaiming expired leases.
Definition at line 114 of file cfg_expiration.h.