diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index be7fd5c6bc444b47b65c240207ebf65dc0ed6b62..ff3b8f41296541a7b05d31344a89aa3fdafa9566 100644 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -80,6 +80,7 @@ libkea_dhcpsrv_la_SOURCES += base_host_data_source.h libkea_dhcpsrv_la_SOURCES += callout_handle_store.h libkea_dhcpsrv_la_SOURCES += cfg_hosts.cc cfg_hosts.h libkea_dhcpsrv_la_SOURCES += cfg_iface.cc cfg_iface.h +libkea_dhcpsrv_la_SOURCES += cfg_expiration.cc cfg_expiration.h libkea_dhcpsrv_la_SOURCES += cfg_option.cc cfg_option.h libkea_dhcpsrv_la_SOURCES += cfg_option_def.cc cfg_option_def.h libkea_dhcpsrv_la_SOURCES += cfg_rsoo.cc cfg_rsoo.h diff --git a/src/lib/dhcpsrv/cfg_expiration.cc b/src/lib/dhcpsrv/cfg_expiration.cc new file mode 100644 index 0000000000000000000000000000000000000000..d1b2d1570627fe723f3ad2f381c536325530e896 --- /dev/null +++ b/src/lib/dhcpsrv/cfg_expiration.cc @@ -0,0 +1,108 @@ +// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include + +namespace isc { +namespace dhcp { + +// Default values +const uint16_t CfgExpiration::DEFAULT_RECLAIM_TIMER_WAIT_TIME = 10; +const uint16_t CfgExpiration::DEFAULT_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 25; +const uint32_t CfgExpiration::DEFAULT_HOLD_RECLAIMED_TIME = 3600; +const uint32_t CfgExpiration::DEFAULT_MAX_RECLAIM_LEASES = 100; +const uint16_t CfgExpiration::DEFAULT_MAX_RECLAIM_TIME = 250; +const uint16_t CfgExpiration::DEFAULT_UNWARNED_RECLAIM_CYCLES = 5; + +// Maximum values. +const uint16_t CfgExpiration::LIMIT_RECLAIM_TIMER_WAIT_TIME = + std::numeric_limits::max(); +const uint16_t CfgExpiration::LIMIT_FLUSH_RECLAIMED_TIMER_WAIT_TIME = + std::numeric_limits::max(); +const uint32_t CfgExpiration::LIMIT_HOLD_RECLAIMED_TIME = + std::numeric_limits::max(); +const uint32_t CfgExpiration::LIMIT_MAX_RECLAIM_LEASES = + std::numeric_limits::max(); +const uint16_t CfgExpiration::LIMIT_MAX_RECLAIM_TIME = 10000; +const uint16_t CfgExpiration::LIMIT_UNWARNED_RECLAIM_CYCLES = + std::numeric_limits::max(); + +CfgExpiration::CfgExpiration() + : reclaim_timer_wait_time_(DEFAULT_RECLAIM_TIMER_WAIT_TIME), + flush_reclaimed_timer_wait_time_(DEFAULT_FLUSH_RECLAIMED_TIMER_WAIT_TIME), + hold_reclaimed_time_(DEFAULT_HOLD_RECLAIMED_TIME), + max_reclaim_leases_(DEFAULT_MAX_RECLAIM_LEASES), + max_reclaim_time_(DEFAULT_MAX_RECLAIM_TIME), + unwarned_reclaim_cycles_(DEFAULT_UNWARNED_RECLAIM_CYCLES) { +} + +void +CfgExpiration::setReclaimTimerWaitTime(const int64_t reclaim_timer_wait_time) { + rangeCheck(reclaim_timer_wait_time, LIMIT_RECLAIM_TIMER_WAIT_TIME, + "reclaim-timer-wait-time"); + reclaim_timer_wait_time_ = reclaim_timer_wait_time; +} + +void +CfgExpiration::setFlushReclaimedTimerWaitTime(const int64_t flush_reclaimed_wait_time) { + rangeCheck(flush_reclaimed_wait_time, LIMIT_FLUSH_RECLAIMED_TIMER_WAIT_TIME, + "flush-reclaimed-timer-wait-time"); + flush_reclaimed_timer_wait_time_ = flush_reclaimed_wait_time; +} + +void +CfgExpiration::setHoldReclaimedTime(const int64_t hold_reclaimed_time) { + rangeCheck(hold_reclaimed_time, LIMIT_HOLD_RECLAIMED_TIME, "hold-reclaimed-time"); + hold_reclaimed_time_ = hold_reclaimed_time; +} + +void +CfgExpiration::setMaxReclaimLeases(const int64_t max_reclaim_leases) { + rangeCheck(max_reclaim_leases, LIMIT_MAX_RECLAIM_LEASES, "max-reclaim-leases"); + max_reclaim_leases_ = max_reclaim_leases; +} + +void +CfgExpiration::setMaxReclaimTime(const int64_t max_reclaim_time) { + rangeCheck(max_reclaim_time, LIMIT_MAX_RECLAIM_TIME, "max-reclaim-time"); + max_reclaim_time_ = max_reclaim_time; +} + +void +CfgExpiration::setUnwarnedReclaimCycles(const int64_t unwarned_reclaim_cycles) { + rangeCheck(unwarned_reclaim_cycles, LIMIT_UNWARNED_RECLAIM_CYCLES, + "unwarned-reclaim-cycles"); + unwarned_reclaim_cycles_ = unwarned_reclaim_cycles; +} + +void +CfgExpiration::rangeCheck(const int64_t value, const uint64_t max_value, + const std::string& config_parameter_name) const { + if (value < 0) { + isc_throw(OutOfRange, "value for configuration parameter '" + << config_parameter_name << "' must not be negtive"); + + } else if (value > max_value) { + isc_throw(OutOfRange, "out range value '" << value << "' for configuration" + " parameter '" << config_parameter_name << "', expected maximum" + " value of '" << max_value << "'"); + } +} + + + +} +} diff --git a/src/lib/dhcpsrv/cfg_expiration.h b/src/lib/dhcpsrv/cfg_expiration.h new file mode 100644 index 0000000000000000000000000000000000000000..b79558277db362153ac5f35165bf0f922e50a914 --- /dev/null +++ b/src/lib/dhcpsrv/cfg_expiration.h @@ -0,0 +1,227 @@ +// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#ifndef CFG_EXPIRATION_H +#define CFG_EXPIRATION_H + +#include +#include +#include + +namespace isc { +namespace dhcp { + +/// @brief Holds configuration parameters pertaining to lease expiration +/// and lease affinity. +/// +/// This class holds the values of the following configuration parameters: +/// +/// - reclaim-timer-wait-time - is the time between two cycles of processing +/// expired leases, expressed in seconds, i.e. the time between the end of +/// one cycle and the beginning of the next cycle. If this value is 0, the +/// expired leases are not processed. +/// +/// - flush-reclaimed-timer-wait-time - is the time between two cycles of +/// recycling "expired-reclaimed" leases, expressed in seconds. If this +/// value is 0, the expired leases are removed by the leases reclamation +/// routine rather than recycling function. The recycling function is not +/// executed and the value of the "hold-reclaimed-time" is ignored. +/// +/// - hold-reclaimed-time -is the time for which "expired-reclaimed" leases +/// are held in the lease database in the "expired-reclaimed" state after +/// they expire. If this time is set to 0, the recycling function is not +/// executed and the value of the "recycle-timer-wait-time" is ignored. +/// This value is expressed in seconds. +/// +/// - max-reclaim-leases - is the maximum number of leases to be processed +/// in a single cycle. If this value is 0, all expired leases are +/// processed in a single cycle, unless the maximum processing time +/// (configured with the "max-time") parameter elapses first. +/// +/// - max-reclaim-time - the maximum time that a single processing cycle +/// may last, expressed in milliseconds. If this value is 0, there is no +/// limitation for the maximum processing time. This value is expressed +/// in milliseconds. +/// +/// - unwarned-reclaim-cycles - is the number of consecutive processing +/// cycles of expired leases, after which the system issues a warning if +/// there are still expired leases in the database. If this value is 0, +/// the warning is never issued. +/// +/// The @c 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. +class CfgExpiration { +public: + + /// @name Default values. + //@{ + /// + /// @brief Default value for reclaim-timer-wait-time. + static const uint16_t DEFAULT_RECLAIM_TIMER_WAIT_TIME; + + /// @brief Default value for flush-reclaimed-timer-wait-time. + static const uint16_t DEFAULT_FLUSH_RECLAIMED_TIMER_WAIT_TIME; + + /// @brief Default value for hold-reclaimed-time. + static const uint32_t DEFAULT_HOLD_RECLAIMED_TIME; + + /// @brief Default value for max-reclaim-leases. + static const uint32_t DEFAULT_MAX_RECLAIM_LEASES; + + /// @brief Default value for max-reclaim-time. + static const uint16_t DEFAULT_MAX_RECLAIM_TIME; + + /// @brief Default value for unwarned-reclaim-cycles. + static const uint16_t DEFAULT_UNWARNED_RECLAIM_CYCLES; + + //@} + + /// @name Upper limits for the parameters + //@{ + /// + /// @brief Maximum value for reclaim-timer-wait-time. + static const uint16_t LIMIT_RECLAIM_TIMER_WAIT_TIME; + + /// @brief Maximum value for flush-reclaimed-timer-wait-time. + static const uint16_t LIMIT_FLUSH_RECLAIMED_TIMER_WAIT_TIME; + + /// @brief Maximum value for hold-reclaimed-time. + static const uint32_t LIMIT_HOLD_RECLAIMED_TIME; + + /// @brief Maximum value for max-reclaim-leases. + static const uint32_t LIMIT_MAX_RECLAIM_LEASES; + + /// @brief Defalt value for max-reclaim-time. + static const uint16_t LIMIT_MAX_RECLAIM_TIME; + + /// @brief Maximum value for unwarned-reclaim-cycles. + static const uint16_t LIMIT_UNWARNED_RECLAIM_CYCLES; + + //@} + + /// @brief Constructor. + /// + /// Sets all parameters to their defaults. + CfgExpiration(); + + /// @brief Returns reclaim-timer-wait-time + uint16_t getReclaimTimerWaitTime() const { + return (reclaim_timer_wait_time_); + } + + /// @brief Sets reclaim-timer-wait-time + /// + /// @param reclaim_timer_wait_time New value. + void setReclaimTimerWaitTime(const int64_t reclaim_timer_wait_time); + + /// @brief Returns flush-reclaimed-timer-wait-time. + uint16_t getFlushReclaimedTimerWaitTime() const { + return (flush_reclaimed_timer_wait_time_); + } + + /// @brief Sets flush-reclaimed-timer-wait-time. + /// + /// @param flush_reclaimed_wait_time New value. + void setFlushReclaimedTimerWaitTime(const int64_t flush_reclaimed_wait_time); + + /// @brief Returns hold-reclaimed-time. + uint32_t getHoldReclaimedTime() const { + return (hold_reclaimed_time_); + } + + /// @brief Sets hold-reclaimed-time + /// + /// @param hold_reclaimed_time New value. + void setHoldReclaimedTime(const int64_t hold_reclaimed_time); + + /// @brief Returns max-reclaim-leases. + uint32_t getMaxReclaimLeases() const { + return (max_reclaim_leases_); + } + + /// @brief Sets max-reclaim-leases. + /// + /// @param max_reclaim_leases New value. + void setMaxReclaimLeases(const int64_t max_reclaim_leases); + + /// @brief Returns max-reclaim-time. + uint16_t getMaxReclaimTime() const { + return (max_reclaim_time_); + } + + /// @brief Sets max-reclaim-time. + /// + /// @param max_reclaim_time New value. + void setMaxReclaimTime(const int64_t max_reclaim_time); + + /// @brief Returns unwarned-reclaim-cycles. + uint16_t getUnwarnedReclaimCycles() const { + return (unwarned_reclaim_cycles_); + } + + /// @brief Sets unwarned-reclaim-cycles. + /// + /// @param unwarned_reclaim_cycles New value. + void setUnwarnedReclaimCycles(const int64_t unwarned_reclaim_cycles); + +private: + + /// @brief Checks if the value being set by one of the modifiers is + /// within an allowed range. + /// + /// @param value Value to be checked. + /// @param max_value Maximum allowed value. + /// @param config_parameter_name A name of the configuration parameter + /// (used for logging purposes if value is out of range). + /// + /// @throw isc::OutOfRange if the value is negative or greater than + /// the maximum value. + void rangeCheck(const int64_t value, const uint64_t max_value, + const std::string& config_parameter_name) const; + + /// @brief reclaim-timer-wait-time + uint16_t reclaim_timer_wait_time_; + + /// @brief flush-reclaimed-timer-wait-time + uint16_t flush_reclaimed_timer_wait_time_; + + /// @brief hold-reclaimed-time + uint32_t hold_reclaimed_time_; + + /// @brief max-reclaim-leases + uint32_t max_reclaim_leases_; + + /// @brief max-reclaim-time + uint16_t max_reclaim_time_; + + /// @brief unwarned-reclaim-cycles. + uint16_t unwarned_reclaim_cycles_; + +}; + +/// @name Pointers to the @c CfgExpiration objects. +//@{ +/// @brief Pointer to the Non-const object. +typedef boost::shared_ptr CfgExpirationPtr; + +/// @brief Pointer to the const object. +typedef boost::shared_ptr ConstCfgExpirationPtr; + +//@} + +} // end of isc::dhcp namespace +} // end of isc namespace + +#endif // CFG_EXPIRATION_H diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index bdf4ea3763081a11654308b5097d05b556a2b840..b614ff5d2d7f8df72ca17735547154c5ccdcd9ef 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -31,6 +31,7 @@ SrvConfig::SrvConfig() cfg_option_def_(new CfgOptionDef()), cfg_option_(new CfgOption()), cfg_subnets4_(new CfgSubnets4()), cfg_subnets6_(new CfgSubnets6()), cfg_hosts_(new CfgHosts()), cfg_rsoo_(new CfgRSOO()), + cfg_expiration_(new CfgExpiration()), decline_timer_(0) { } @@ -39,6 +40,7 @@ SrvConfig::SrvConfig(const uint32_t sequence) cfg_option_def_(new CfgOptionDef()), cfg_option_(new CfgOption()), cfg_subnets4_(new CfgSubnets4()), cfg_subnets6_(new CfgSubnets6()), cfg_hosts_(new CfgHosts()), cfg_rsoo_(new CfgRSOO()), + cfg_expiration_(new CfgExpiration()), decline_timer_(0) { } diff --git a/src/lib/dhcpsrv/srv_config.h b/src/lib/dhcpsrv/srv_config.h index b1b9dbe88e9d6351e41492caeee1c5bb4d896470..da387c9a563dc23f18ec48758f931ba156183fdb 100644 --- a/src/lib/dhcpsrv/srv_config.h +++ b/src/lib/dhcpsrv/srv_config.h @@ -15,6 +15,7 @@ #ifndef DHCPSRV_CONFIG_H #define DHCPSRV_CONFIG_H +#include #include #include #include @@ -259,6 +260,18 @@ public: return (cfg_rsoo_); } + /// @brief Returns pointer to the object holding configuration pertaining + /// to processing expired leases. + CfgExpirationPtr getCfgExpiration() { + return (cfg_expiration_); + } + + /// @brief Returns pointer to the const object holding configuration + /// pertaining to processing expired leases. + ConstCfgExpirationPtr getCfgExpiration() const { + return (cfg_expiration_); + } + //@} /// @brief Returns non-const reference to an array that stores @@ -441,6 +454,10 @@ private: /// RFC 6422 for the definition of the RSOO-enabled option. CfgRSOOPtr cfg_rsoo_; + /// @brief Pointer to the configuration pertaining to processing of + /// expired leases. + CfgExpirationPtr cfg_expiration_; + /// @brief Pointer to the control-socket information isc::data::ConstElementPtr control_socket_; diff --git a/src/lib/dhcpsrv/tests/Makefile.am b/src/lib/dhcpsrv/tests/Makefile.am index e8a14385596fdcd871fd26edbfe5a3157498105f..d0afbc510277a32d9068d8ff05c796134b3c1d88 100644 --- a/src/lib/dhcpsrv/tests/Makefile.am +++ b/src/lib/dhcpsrv/tests/Makefile.am @@ -65,6 +65,7 @@ libdhcpsrv_unittests_SOURCES += alloc_engine_hooks_unittest.cc libdhcpsrv_unittests_SOURCES += alloc_engine4_unittest.cc libdhcpsrv_unittests_SOURCES += alloc_engine6_unittest.cc libdhcpsrv_unittests_SOURCES += callout_handle_store_unittest.cc +libdhcpsrv_unittests_SOURCES += cfg_expiration_unittest.cc libdhcpsrv_unittests_SOURCES += cfg_hosts_unittest.cc libdhcpsrv_unittests_SOURCES += cfg_iface_unittest.cc libdhcpsrv_unittests_SOURCES += cfg_mac_source_unittest.cc diff --git a/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc b/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc new file mode 100644 index 0000000000000000000000000000000000000000..86a1fc750afb147424d4520180c443775f63beb0 --- /dev/null +++ b/src/lib/dhcpsrv/tests/cfg_expiration_unittest.cc @@ -0,0 +1,157 @@ +// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include +#include +#include +#include + +using namespace isc; +using namespace isc::dhcp; + +namespace { + +/// @brief Type definition of the @c CfgExpiration modified function. +typedef boost::function ModifierFun; +/// @brief Type definition of the @c CfgExpiration accessor function +/// returning uint16_t value. +typedef boost::function AccessorFunUint16; +/// @brief Type definition of the @c CfgExpiration accessor function +/// returning uint32_t value. +typedef boost::function AccessorFunUint32; + +/// @brief Tests the accessor and modifier function for a particular +/// configuration parameter held in @c CfgExpiration. +/// +/// This is a simple test which tries to set the given parameter to +/// different values: +/// - value greater than maximum allowed for this parameter - expects +/// the exception to be thrown, +/// - value lower than 0 - expects the exception to be thrown, +/// - value equal to the maximum allowed, +/// - value equal to maximum allowed minus 1. +/// +/// @param limit Maximum allowed value for the parameter. +/// @param modifier Pointer to the modifier function to be tested. +/// @param accessor Pointer to the accessor function to be tested. +/// @tparam ReturnType Type of the value returned by the accessor, +/// i.e. uint16_t or uint32_t. +template +void +testAccessModify(const int64_t limit, const ModifierFun& modifier, + const boost::function& accessor) { + CfgExpiration cfg; + + // Setting the value to maximum allowed + 1 should result in + // an exception. + ASSERT_THROW(modifier(&cfg, limit + 1), OutOfRange); + + // Setting to the negative value should result in an exception. + ASSERT_THROW(modifier(&cfg, -1), OutOfRange); + + // Setting the value to the maximum allowed should pass. + ASSERT_NO_THROW(modifier(&cfg, limit)); + EXPECT_EQ(limit, accessor(&cfg)); + + // Setting the value to the maximum allowed - 1 should pass. + ASSERT_NO_THROW(modifier(&cfg, limit - 1)); + EXPECT_EQ(limit - 1, accessor(&cfg)); +} + +/// @brief Tests that modifier and the accessor returning uint16_t value +/// work as expected. +/// +/// @param limit Maximum allowed value for the parameter. +/// @param modifier Pointer to the modifier function to be tested. +/// @param accessor Pointer to the accessor function to be tested. +void +testAccessModifyUint16(const int64_t limit, const ModifierFun& modifier, + const AccessorFunUint16& accessor) { + testAccessModify(limit, modifier, accessor); +} + +/// @brief Tests that modifier and the accessor returning uint32_t value +/// work as expected. +/// +/// @param limit Maximum allowed value for the parameter. +/// @param modifier Pointer to the modifier function to be tested. +/// @param accessor Pointer to the accessor function to be tested. +void +testAccessModifyUint32(const int64_t limit, const ModifierFun& modifier, + const AccessorFunUint32& accessor) { + testAccessModify(limit, modifier, accessor); +} + +/// Test the default values of CfgExpiration object. +TEST(CfgExpirationTest, defaults) { + CfgExpiration cfg; + EXPECT_EQ(CfgExpiration::DEFAULT_RECLAIM_TIMER_WAIT_TIME, + cfg.getReclaimTimerWaitTime()); + EXPECT_EQ(CfgExpiration::DEFAULT_FLUSH_RECLAIMED_TIMER_WAIT_TIME, + cfg.getFlushReclaimedTimerWaitTime()); + EXPECT_EQ(CfgExpiration::DEFAULT_HOLD_RECLAIMED_TIME, + cfg.getHoldReclaimedTime()); + EXPECT_EQ(CfgExpiration::DEFAULT_MAX_RECLAIM_LEASES, + cfg.getMaxReclaimLeases()); + EXPECT_EQ(CfgExpiration::DEFAULT_MAX_RECLAIM_TIME, + cfg.getMaxReclaimTime()); + EXPECT_EQ(CfgExpiration::DEFAULT_UNWARNED_RECLAIM_CYCLES, + cfg.getUnwarnedReclaimCycles()); +} + +// Test the {get,set}ReclaimTimerWaitTime. +TEST(CfgExpirationTest, getReclaimTimerWaitTime) { + testAccessModify(CfgExpiration::LIMIT_RECLAIM_TIMER_WAIT_TIME, + &CfgExpiration::setReclaimTimerWaitTime, + &CfgExpiration::getReclaimTimerWaitTime); +} + +// Test the {get,set}FlushReclaimedTimerWaitTime. +TEST(CfgExpirationTest, getFlushReclaimedTimerWaitTime) { + testAccessModifyUint16(CfgExpiration::LIMIT_FLUSH_RECLAIMED_TIMER_WAIT_TIME, + &CfgExpiration::setFlushReclaimedTimerWaitTime, + &CfgExpiration::getFlushReclaimedTimerWaitTime); +} + +// Test the {get,set}HoldReclaimedTime. +TEST(CfgExpirationTest, getHoldReclaimedTime) { + testAccessModifyUint32(CfgExpiration::LIMIT_HOLD_RECLAIMED_TIME, + &CfgExpiration::setHoldReclaimedTime, + &CfgExpiration::getHoldReclaimedTime); +} + +// Test the {get,set}MaxReclaimLeases. +TEST(CfgExpirationTest, getMaxReclaimLeases) { + testAccessModifyUint32(CfgExpiration::LIMIT_MAX_RECLAIM_LEASES, + &CfgExpiration::setMaxReclaimLeases, + &CfgExpiration::getMaxReclaimLeases); +} + +// Test the {get,set}MaxReclaimTime. +TEST(CfgExpirationTest, getMaxReclaimTime) { + testAccessModifyUint16(CfgExpiration::LIMIT_MAX_RECLAIM_TIME, + &CfgExpiration::setMaxReclaimTime, + &CfgExpiration::getMaxReclaimTime); +} + +// Test the {get,set}UnwarnedReclaimCycles. +TEST(CfgExpirationTest, getUnwarnedReclaimCycles) { + testAccessModifyUint16(CfgExpiration::LIMIT_UNWARNED_RECLAIM_CYCLES, + &CfgExpiration::setUnwarnedReclaimCycles, + &CfgExpiration::getUnwarnedReclaimCycles); +} + +} // end of anonymous namespace