7#ifndef ISC_LIMITS_CONFIGURATION_H
8#define ISC_LIMITS_CONFIGURATION_H
26template <
typename limit_t>
27static void checkForLimitBoundaries(int64_t
const limit) {
30 "expected positive limit configured, got negative limit " << limit);
33 if (std::numeric_limits<limit_t>::max() < limit) {
34 isc_throw(ConfigError,
"expected limit in range [0, "
35 << std::numeric_limits<limit_t>::max()
36 <<
"], got limit " << limit);
66template <
typename limit_t>
78 config->getClientClassDictionary()->getClasses());
118 virtual const std::string&
key()
const = 0;
140 const std::string&
key()
const override;
162 const std::string&
key()
const override;
184 const std::string&
key()
const override;
Defines elements for storing the names of client classes.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
std::string ClientClass
Defines a single class name.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet6Collection
A collection of Subnet6 objects.
boost::shared_ptr< ClientClassDef > ClientClassDefPtr
a pointer to an ClientClassDef
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet4Collection
A collection of Subnet4 objects.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< ClientClassDefList > ClientClassDefListPtr
Defines a pointer to a ClientClassDefList.
uint32_t LeaseLimit
a single lease-limiting entry configured as an integer
Defines the logger used by the top-level component of kea-lfc.
the configuration manager for address limiting
virtual void logClientClassLimit(isc::dhcp::ClientClass const &client_class, isc::data::ConstElementPtr const &user_context) override
Method that checks and logs limit which is to be applied to a client class.
virtual void logSubnetLimit(isc::dhcp::SubnetID const subnet_id, isc::data::ConstElementPtr const &user_context) override
Method that checks and logs limit which is to be applied to a client class.
const std::string & key() const override
Returns the key required to configure the limit in the user context.
a datastore used for configuring functionally dedicated parts of the limits library
virtual const std::string & key() const =0
Returns the key required to configure the limit in the user context.
virtual void logClientClassLimit(isc::dhcp::ClientClass const &client_class, isc::data::ConstElementPtr const &user_context)=0
Abstract method that checks and logs limit which is to be applied to a client class.
isc::data::ConstElementPtr const parseUserContext(isc::data::ConstElementPtr const &user_context) const
Abstract method that takes a user context from any configuration element and returns the value of the...
void parse(isc::dhcp::SrvConfigPtr const &config)
Handles all the parsing of the Kea configuration required for limiting functionality.
virtual void logSubnetLimit(isc::dhcp::SubnetID const subnet_id, isc::data::ConstElementPtr const &user_context)=0
Abstract method that checks and logs limit which is to be applied to a client class.
virtual ~Configuration()=default
Destructor. Declared only to be marked as virtual.
the configuration manager for prefix limiting
virtual void logClientClassLimit(isc::dhcp::ClientClass const &client_class, isc::data::ConstElementPtr const &user_context) override
Method that checks and logs limit which is to be applied to a client class.
virtual void logSubnetLimit(isc::dhcp::SubnetID const subnet_id, isc::data::ConstElementPtr const &user_context) override
Method that checks and logs limit which is to be applied to a client class.
const std::string & key() const override
Returns the key required to configure the limit in the user context.
the configuration manager for rate limiting
virtual void logClientClassLimit(isc::dhcp::ClientClass const &client_class, isc::data::ConstElementPtr const &user_context) override
Method that checks and logs limit which is to be applied to a client class.
const std::string & key() const override
Returns the key required to configure the limit in the user context.
virtual void logSubnetLimit(isc::dhcp::SubnetID const subnet_id, isc::data::ConstElementPtr const &user_context) override
Method that checks and logs limit which is to be applied to a client class.
std::string text_
a string representation of the rate limit as specified in the configuration used for logging purposes
std::chrono::seconds time_unit_
Seconds of one time unit's worth.
uint32_t allowed_packets_
the configured limit