Kea 2.7.6
|
Address/prefix allocator that iterates over all addresses. More...
#include <iterative_allocator.h>
Public Member Functions | |
IterativeAllocator (Lease::Type type, const WeakSubnetPtr &subnet) | |
Constructor. | |
virtual std::string | getType () const |
Returns the allocator type string. | |
Public Member Functions inherited from isc::dhcp::Allocator | |
Allocator (Lease::Type type, const WeakSubnetPtr &subnet) | |
Constructor. | |
virtual | ~Allocator () |
Virtual destructor. | |
void | initAfterConfigure () |
Performs allocator initialization after server's reconfiguration. | |
virtual isc::asiolink::IOAddress | pickAddress (const ClientClasses &client_classes, const IdentifierBaseTypePtr &duid, const asiolink::IOAddress &hint) |
Picks an address. | |
virtual isc::asiolink::IOAddress | pickPrefix (const ClientClasses &client_classes, Pool6Ptr &pool, const IdentifierBaseTypePtr &duid, PrefixLenMatchType prefix_length_match, const asiolink::IOAddress &hint, uint8_t hint_prefix_length) |
Picks a delegated prefix. | |
Static Protected Member Functions | |
static asiolink::IOAddress | increaseAddress (const asiolink::IOAddress &address, bool prefix, const uint8_t prefix_len) |
Returns the next address or prefix. | |
static asiolink::IOAddress | increasePrefix (const asiolink::IOAddress &prefix, const uint8_t prefix_len) |
Returns the next prefix. | |
Additional Inherited Members | |
Public Types inherited from isc::dhcp::Allocator | |
enum | PrefixLenMatchType { PREFIX_LEN_EQUAL , PREFIX_LEN_LOWER , PREFIX_LEN_HIGHER } |
Type of preferred PD-pool prefix length selection criteria. More... | |
Static Public Member Functions inherited from isc::dhcp::Allocator | |
static bool | isValidPrefixPool (Allocator::PrefixLenMatchType prefix_length_match, PoolPtr pool, uint8_t hint_prefix_length) |
Check if the pool matches the selection criteria relative to the provided hint prefix length. | |
Protected Member Functions inherited from isc::dhcp::Allocator | |
virtual void | initAfterConfigureInternal () |
Allocator-specific initialization function. | |
Protected Attributes inherited from isc::dhcp::Allocator | |
bool | inited_ |
Indicates if the allocator has been initialized. | |
std::mutex | mutex_ |
The mutex to protect the allocated lease. | |
Lease::Type | pool_type_ |
Defines pool type allocation. | |
WeakSubnetPtr | subnet_ |
Weak pointer to the subnet owning the allocator. | |
SubnetID | subnet_id_ |
ID of a subnet to which the allocator belongs. | |
Address/prefix allocator that iterates over all addresses.
This class implements an iterative algorithm that returns all addresses in a pool iteratively, one after another. Once the last address is reached, it starts allocating from the beginning of the first pool (i.e. it loops over).
Definition at line 25 of file iterative_allocator.h.
isc::dhcp::IterativeAllocator::IterativeAllocator | ( | Lease::Type | type, |
const WeakSubnetPtr & | subnet ) |
Constructor.
type | specifies the type of allocated leases. |
subnet | weak pointer to the subnet owning the allocator. |
Definition at line 20 of file iterative_allocator.cc.
|
inlinevirtual |
Returns the allocator type string.
Implements isc::dhcp::Allocator.
Definition at line 37 of file iterative_allocator.h.
|
staticprotected |
Returns the next address or prefix.
This method works for IPv4 addresses, IPv6 addresses and IPv6 prefixes.
address | address or prefix to be increased |
prefix | true when the previous argument is a prefix. |
prefix_len | length of the prefix. |
Definition at line 79 of file iterative_allocator.cc.
References isc::asiolink::IOAddress::increase(), and increasePrefix().
|
staticprotected |
Returns the next prefix.
This method works for IPv6 addresses only. It increases the specified prefix by a given prefix_len. For example, 2001:db8:: increased by prefix length /32 will become 2001:db9::. This method is used to iterate over IPv6 prefix pools
prefix | prefix to be increased. |
prefix_len | length of the prefix to be increased. |
Definition at line 26 of file iterative_allocator.cc.
References isc::asiolink::IOAddress::fromBytes(), isc_throw, isc::asiolink::IOAddress::isV6(), and isc::asiolink::IOAddress::toBytes().
Referenced by increaseAddress().