Kea 3.1.1
isc::limits Namespace Reference

Classes

struct  AddressLimitConfiguration
 the configuration manager for address limiting More...
 
struct  Configuration
 a datastore used for configuring functionally dedicated parts of the limits library More...
 
struct  LimitManager
 Provides the capability to limit the number of leases or the response rate. More...
 
struct  PrefixLimitConfiguration
 the configuration manager for prefix limiting More...
 
struct  ProtectedTimeSeries
 Holds a number of time points, used in limiting by a single criterion, and a mutex to protect concurrent reads and writes. More...
 
struct  RateLimit
 a single rate-limiting entry configured as "rate-limit": "<n> packet[s] per <time-unit>" More...
 
struct  RateLimitConfiguration
 the configuration manager for rate limiting More...
 

Typedefs

typedef boost::shared_ptr< const ElementConstElementPtr
 
using LeaseLimit = uint32_t
 a single lease-limiting entry configured as an integer
 
typedef std::shared_ptr< ProtectedTimeSeriesProtectedTimeSeriesPtr
 Defines a smart pointer to a ProtectedTimeSeries.
 
using TimePoint = std::chrono::time_point<std::chrono::system_clock>
 a point in time
 
using TimeSeries = boost::circular_buffer<TimePoint>
 Holds a number of time points, used in limiting by a single criterion.
 

Functions

int cb4_updated (CalloutHandle &handle)
 Callout at the cb4_updated hook point.
 
int cb6_updated (CalloutHandle &handle)
 Callout at the cb6_updated hook point.
 
int dhcp4_srv_configured (CalloutHandle &handle)
 dhcp4_srv_configured callout implementation
 
int dhcp6_srv_configured (CalloutHandle &handle)
 dhcp6_srv_configured callout implementation
 
int lease4_renew (CalloutHandle &handle)
 Callout at the leases4_renew hook point.
 
int lease4_select (CalloutHandle &handle)
 Callout at the leases4_select hook point.
 
int lease6_rebind (CalloutHandle &handle)
 Callout at the lease6_rebind hook point.
 
int lease6_renew (CalloutHandle &handle)
 Callout at the lease6_renew hook point.
 
int lease6_select (CalloutHandle &handle)
 Callout at the lease6_select hook point.
 
int load (isc::hooks::LibraryHandle &handle)
 Called by the hooks library manager when the library is loaded.
 
int multi_threading_compatible ()
 Return multi-threading compatibility.
 
int pkt4_receive (CalloutHandle &handle)
 Callout at the pkt4_receive hook point.
 
int pkt6_receive (CalloutHandle &handle)
 Callout at the pkt6_receive hook point.
 
int subnet4_select (CalloutHandle &handle)
 Callout at the subnet4_select hook point.
 
int subnet6_select (CalloutHandle &handle)
 Callout at the subnet6_select hook point.
 
int unload ()
 Called by the hooks library manager when the library is unloaded.
 
int version ()
 Version function required by Hooks API for compatibility checks.
 

Variables

const int DBGLVL_TRACE_BASIC
 Trace basic operations.
 
const isc::log::MessageID LIMITS_CONFIGURATION_LEASE_BACKEND_NOT_AVAILABLE = "LIMITS_CONFIGURATION_LEASE_BACKEND_NOT_AVAILABLE"
 
const isc::log::MessageID LIMITS_CONFIGURATION_LEASE_BACKEND_SHOULD_HAVE_BEEN_AVAILABLE = "LIMITS_CONFIGURATION_LEASE_BACKEND_SHOULD_HAVE_BEEN_AVAILABLE"
 
const isc::log::MessageID LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_CLIENT_CLASS = "LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_CLIENT_CLASS"
 
const isc::log::MessageID LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_SUBNET = "LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_SUBNET"
 
const isc::log::MessageID LIMITS_CONFIGURED_PREFIX_LIMIT_BY_CLIENT_CLASS = "LIMITS_CONFIGURED_PREFIX_LIMIT_BY_CLIENT_CLASS"
 
const isc::log::MessageID LIMITS_CONFIGURED_PREFIX_LIMIT_BY_SUBNET = "LIMITS_CONFIGURED_PREFIX_LIMIT_BY_SUBNET"
 
const isc::log::MessageID LIMITS_CONFIGURED_RATE_LIMIT_BY_CLIENT_CLASS = "LIMITS_CONFIGURED_RATE_LIMIT_BY_CLIENT_CLASS"
 
const isc::log::MessageID LIMITS_CONFIGURED_RATE_LIMIT_BY_SUBNET = "LIMITS_CONFIGURED_RATE_LIMIT_BY_SUBNET"
 
const isc::log::MessageID LIMITS_LEASE_LIMIT_EXCEEDED = "LIMITS_LEASE_LIMIT_EXCEEDED"
 
const isc::log::MessageID LIMITS_LEASE_WITHIN_LIMITS = "LIMITS_LEASE_WITHIN_LIMITS"
 
isc::log::Logger limits_logger ("limits-hooks")
 
const isc::log::MessageID LIMITS_PACKET_WIIH_SUBNET_ID_RATE_NO_SUBNET = "LIMITS_PACKET_WIIH_SUBNET_ID_RATE_NO_SUBNET"
 
const isc::log::MessageID LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_DROPPED = "LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_DROPPED"
 
const isc::log::MessageID LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_HONORED = "LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_HONORED"
 
const isc::log::MessageID LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_DROPPED = "LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_DROPPED"
 
const isc::log::MessageID LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_HONORED = "LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_HONORED"
 

Typedef Documentation

◆ ConstElementPtr

typedef boost::shared_ptr<const Element> isc::data::ConstElementPtr

Definition at line 29 of file data.h.

◆ LeaseLimit

using isc::limits::LeaseLimit = uint32_t

a single lease-limiting entry configured as an integer

Definition at line 41 of file configuration.h.

◆ ProtectedTimeSeriesPtr

Defines a smart pointer to a ProtectedTimeSeries.

Definition at line 52 of file limit_manager.h.

◆ TimePoint

using isc::limits::TimePoint = std::chrono::time_point<std::chrono::system_clock>

a point in time

Definition at line 35 of file limit_manager.h.

◆ TimeSeries

using isc::limits::TimeSeries = boost::circular_buffer<TimePoint>

Holds a number of time points, used in limiting by a single criterion.

It is important to use a data structure that ensures O(1) deletion.

Definition at line 39 of file limit_manager.h.

Function Documentation

◆ cb4_updated()

int isc::limits::cb4_updated ( CalloutHandle & handle)

Callout at the cb4_updated hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success

Definition at line 35 of file dhcpv4_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ cb6_updated()

int isc::limits::cb6_updated ( CalloutHandle & handle)

Callout at the cb6_updated hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success

Definition at line 35 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ dhcp4_srv_configured()

int isc::limits::dhcp4_srv_configured ( CalloutHandle & handle)

dhcp4_srv_configured callout implementation

Parameters
handleCalloutHandle
Returns
0 on success, non-zero otherwise.

Definition at line 45 of file dhcpv4_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ dhcp6_srv_configured()

int isc::limits::dhcp6_srv_configured ( CalloutHandle & handle)

dhcp6_srv_configured callout implementation

Parameters
handleCalloutHandle
Returns
0 on success, non-zero otherwise.

Definition at line 45 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ lease4_renew()

int isc::limits::lease4_renew ( CalloutHandle & handle)

Callout at the leases4_renew hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 85 of file dhcpv4_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ lease4_select()

int isc::limits::lease4_select ( CalloutHandle & handle)

Callout at the leases4_select hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 75 of file dhcpv4_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ lease6_rebind()

int isc::limits::lease6_rebind ( CalloutHandle & handle)

Callout at the lease6_rebind hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 95 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ lease6_renew()

int isc::limits::lease6_renew ( CalloutHandle & handle)

Callout at the lease6_renew hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 85 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ lease6_select()

int isc::limits::lease6_select ( CalloutHandle & handle)

Callout at the lease6_select hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 75 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ load()

int isc::limits::load ( isc::hooks::LibraryHandle & handle)

Called by the hooks library manager when the library is loaded.

Parameters
handleLibraryHandle
Returns
0 on success, non-zero otherwise.

Definition at line 35 of file limits/load_unload.cc.

References isc::dhcp::CfgMgr::getFamily(), isc::hooks::LibraryHandle::getParameters(), isc::process::Daemon::getProcName(), isc::limits::LimitManager::initialize(), isc::dhcp::CfgMgr::instance(), isc::limits::LimitManager::instance(), and isc_throw.

+ Here is the call graph for this function:

◆ multi_threading_compatible()

int isc::limits::multi_threading_compatible ( )

Return multi-threading compatibility.

Returns
1 means compatible with multi-threading.

Definition at line 84 of file limits/load_unload.cc.

◆ pkt4_receive()

int isc::limits::pkt4_receive ( CalloutHandle & handle)

Callout at the pkt4_receive hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 55 of file dhcpv4_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ pkt6_receive()

int isc::limits::pkt6_receive ( CalloutHandle & handle)

Callout at the pkt6_receive hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 55 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ subnet4_select()

int isc::limits::subnet4_select ( CalloutHandle & handle)

Callout at the subnet4_select hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 65 of file dhcpv4_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ subnet6_select()

int isc::limits::subnet6_select ( CalloutHandle & handle)

Callout at the subnet6_select hook point.

Parameters
handleCalloutHandle which provides access to context
Returns
0 upon success, non-zero otherwise.

Definition at line 65 of file dhcpv6_callouts.cc.

References isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ unload()

int isc::limits::unload ( )

Called by the hooks library manager when the library is unloaded.

Returns
0 on success, non-zero otherwise.

Definition at line 67 of file limits/load_unload.cc.

References isc::dhcp::LeaseMgr::clearClassLeaseCounts(), isc::dhcp::LeaseMgrFactory::haveInstance(), isc::limits::LimitManager::initialize(), isc::dhcp::LeaseMgrFactory::instance(), and isc::limits::LimitManager::instance().

+ Here is the call graph for this function:

◆ version()

int isc::limits::version ( )

Version function required by Hooks API for compatibility checks.

Definition at line 18 of file dhcp/limits/version.cc.

Variable Documentation

◆ DBGLVL_TRACE_BASIC

◆ LIMITS_CONFIGURATION_LEASE_BACKEND_NOT_AVAILABLE

const isc::log::MessageID isc::limits::LIMITS_CONFIGURATION_LEASE_BACKEND_NOT_AVAILABLE = "LIMITS_CONFIGURATION_LEASE_BACKEND_NOT_AVAILABLE"
extern

Definition at line 11 of file limits_messages.h.

Referenced by isc::limits::LimitManager::dhcp_srv_configured().

◆ LIMITS_CONFIGURATION_LEASE_BACKEND_SHOULD_HAVE_BEEN_AVAILABLE

const isc::log::MessageID isc::limits::LIMITS_CONFIGURATION_LEASE_BACKEND_SHOULD_HAVE_BEEN_AVAILABLE = "LIMITS_CONFIGURATION_LEASE_BACKEND_SHOULD_HAVE_BEEN_AVAILABLE"
extern

Definition at line 12 of file limits_messages.h.

Referenced by isc::limits::LimitManager::dhcp_srv_configured().

◆ LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_CLIENT_CLASS

const isc::log::MessageID isc::limits::LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_CLIENT_CLASS = "LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_CLIENT_CLASS"
extern

◆ LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_SUBNET

const isc::log::MessageID isc::limits::LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_SUBNET = "LIMITS_CONFIGURED_ADDRESS_LIMIT_BY_SUBNET"
extern

◆ LIMITS_CONFIGURED_PREFIX_LIMIT_BY_CLIENT_CLASS

const isc::log::MessageID isc::limits::LIMITS_CONFIGURED_PREFIX_LIMIT_BY_CLIENT_CLASS = "LIMITS_CONFIGURED_PREFIX_LIMIT_BY_CLIENT_CLASS"
extern

◆ LIMITS_CONFIGURED_PREFIX_LIMIT_BY_SUBNET

const isc::log::MessageID isc::limits::LIMITS_CONFIGURED_PREFIX_LIMIT_BY_SUBNET = "LIMITS_CONFIGURED_PREFIX_LIMIT_BY_SUBNET"
extern

◆ LIMITS_CONFIGURED_RATE_LIMIT_BY_CLIENT_CLASS

const isc::log::MessageID isc::limits::LIMITS_CONFIGURED_RATE_LIMIT_BY_CLIENT_CLASS = "LIMITS_CONFIGURED_RATE_LIMIT_BY_CLIENT_CLASS"
extern

◆ LIMITS_CONFIGURED_RATE_LIMIT_BY_SUBNET

const isc::log::MessageID isc::limits::LIMITS_CONFIGURED_RATE_LIMIT_BY_SUBNET = "LIMITS_CONFIGURED_RATE_LIMIT_BY_SUBNET"
extern

◆ LIMITS_LEASE_LIMIT_EXCEEDED

const isc::log::MessageID isc::limits::LIMITS_LEASE_LIMIT_EXCEEDED = "LIMITS_LEASE_LIMIT_EXCEEDED"
extern

Definition at line 19 of file limits_messages.h.

Referenced by isc::limits::LimitManager::lease_callout().

◆ LIMITS_LEASE_WITHIN_LIMITS

const isc::log::MessageID isc::limits::LIMITS_LEASE_WITHIN_LIMITS = "LIMITS_LEASE_WITHIN_LIMITS"
extern

Definition at line 20 of file limits_messages.h.

Referenced by isc::limits::LimitManager::lease_callout().

◆ limits_logger

◆ LIMITS_PACKET_WIIH_SUBNET_ID_RATE_NO_SUBNET

const isc::log::MessageID isc::limits::LIMITS_PACKET_WIIH_SUBNET_ID_RATE_NO_SUBNET = "LIMITS_PACKET_WIIH_SUBNET_ID_RATE_NO_SUBNET"
extern

Definition at line 21 of file limits_messages.h.

Referenced by isc::limits::LimitManager::subnet_select().

◆ LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_DROPPED

const isc::log::MessageID isc::limits::LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_DROPPED = "LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_DROPPED"
extern

Definition at line 22 of file limits_messages.h.

Referenced by isc::limits::LimitManager::pkt_receive().

◆ LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_HONORED

const isc::log::MessageID isc::limits::LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_HONORED = "LIMITS_PACKET_WITH_CLIENT_CLASSES_RATE_LIMIT_HONORED"
extern

Definition at line 23 of file limits_messages.h.

Referenced by isc::limits::LimitManager::pkt_receive().

◆ LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_DROPPED

const isc::log::MessageID isc::limits::LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_DROPPED = "LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_DROPPED"
extern

Definition at line 24 of file limits_messages.h.

Referenced by isc::limits::LimitManager::subnet_select().

◆ LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_HONORED

const isc::log::MessageID isc::limits::LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_HONORED = "LIMITS_PACKET_WITH_SUBNET_ID_RATE_LIMIT_HONORED"
extern

Definition at line 25 of file limits_messages.h.

Referenced by isc::limits::LimitManager::subnet_select().