Kea  1.5.0
isc::dhcp::AllocEngine::IterativeAllocator Class Reference

Address/prefix allocator that iterates over all addresses. More...

#include <alloc_engine.h>

+ Inheritance diagram for isc::dhcp::AllocEngine::IterativeAllocator:

Public Member Functions

 IterativeAllocator (Lease::Type type)
 default constructor More...
 
virtual isc::asiolink::IOAddress pickAddress (const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)
 returns the next address from pools in a subnet More...
 
- Public Member Functions inherited from isc::dhcp::AllocEngine::Allocator
 Allocator (Lease::Type pool_type)
 Default constructor. More...
 
virtual ~Allocator ()
 virtual destructor More...
 

Static Protected Member Functions

static isc::asiolink::IOAddress increaseAddress (const isc::asiolink::IOAddress &address, bool prefix, const uint8_t prefix_len)
 Returns the next address or prefix. More...
 
static isc::asiolink::IOAddress increasePrefix (const isc::asiolink::IOAddress &prefix, const uint8_t prefix_len)
 Returns the next prefix. More...
 

Additional Inherited Members

- Protected Attributes inherited from isc::dhcp::AllocEngine::Allocator
Lease::Type pool_type_
 defines pool type allocation More...
 

Detailed Description

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 122 of file alloc_engine.h.

Constructor & Destructor Documentation

◆ IterativeAllocator()

isc::dhcp::AllocEngine::IterativeAllocator::IterativeAllocator ( Lease::Type  type)

default constructor

Does not do anything

Parameters
type- specifies allocation type

Definition at line 87 of file alloc_engine.cc.

Member Function Documentation

◆ increaseAddress()

isc::asiolink::IOAddress isc::dhcp::AllocEngine::IterativeAllocator::increaseAddress ( const isc::asiolink::IOAddress address,
bool  prefix,
const uint8_t  prefix_len 
)
staticprotected

Returns the next address or prefix.

This method works for IPv4 addresses, IPv6 addresses and IPv6 prefixes.

Parameters
addressaddress or prefix to be increased
prefixtrue when the previous argument is a prefix
prefix_lenlength of the prefix
Returns
result address or prefix

Definition at line 148 of file alloc_engine.cc.

References isc::asiolink::IOAddress::increase().

+ Here is the call graph for this function:

◆ increasePrefix()

isc::asiolink::IOAddress isc::dhcp::AllocEngine::IterativeAllocator::increasePrefix ( const isc::asiolink::IOAddress prefix,
const uint8_t  prefix_len 
)
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

Parameters
prefixprefix to be increased
prefix_lenlength of the prefix to be increased
Returns
result prefix

Definition at line 92 of file alloc_engine.cc.

References isc_throw, isc::asiolink::IOAddress::isV6(), and isc::asiolink::IOAddress::toBytes().

+ Here is the call graph for this function:

◆ pickAddress()

isc::asiolink::IOAddress isc::dhcp::AllocEngine::IterativeAllocator::pickAddress ( const SubnetPtr subnet,
const ClientClasses client_classes,
const DuidPtr duid,
const isc::asiolink::IOAddress hint 
)
virtual

returns the next address from pools in a subnet

Parameters
subnetnext address will be returned from pool of that subnet
client_classeslist of classes client belongs to
duidClient's DUID (ignored)
hintclient's hint (ignored)
Returns
the next address

Implements isc::dhcp::AllocEngine::Allocator.

Definition at line 159 of file alloc_engine.cc.

References isc_throw, and isc::dhcp::Lease::TYPE_PD.


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