Kea 2.7.5
isc::dhcp::RandomAllocator Class Reference

An allocator offering addresses in a random order. More...

#include <random_allocator.h>

+ Inheritance diagram for isc::dhcp::RandomAllocator:

Public Member Functions

 RandomAllocator (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.
 

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.
 

Detailed Description

An allocator offering addresses in a random order.

This allocator uses IPRangePermutation to select random addresses or delegated prefixes from the pools. It guarantees that all offered addresses are unique (do not repeat).

The allocator also randomly picks pools to ensure that the leases are offered uniformly from the entire subnet rather than from the same pool until it exhausts. When all pools exhaust, the allocator resets their permutations and begins offering leases from these pools again.

Definition at line 30 of file random_allocator.h.

Constructor & Destructor Documentation

◆ RandomAllocator()

isc::dhcp::RandomAllocator::RandomAllocator ( Lease::Type type,
const WeakSubnetPtr & subnet )

Constructor.

Parameters
typespecifies the type of allocated leases.
subnetweak pointer to the subnet owning the allocator.

Definition at line 20 of file random_allocator.cc.

Member Function Documentation

◆ getType()

virtual std::string isc::dhcp::RandomAllocator::getType ( ) const
inlinevirtual

Returns the allocator type string.

Returns
random string.

Implements isc::dhcp::Allocator.

Definition at line 42 of file random_allocator.h.


The documentation for this class was generated from the following files: