Kea  1.9.9-git
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...
 
- Public Member Functions inherited from isc::dhcp::AllocEngine::Allocator
 Allocator (Lease::Type pool_type)
 Default constructor. More...
 
virtual ~Allocator ()
 Virtual destructor. More...
 
virtual isc::asiolink::IOAddress pickAddress (const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)
 Picks one address out of available pools in a given subnet. 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 148 of file alloc_engine.h.

Constructor & Destructor Documentation

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

Default constructor.

Does not do anything

Parameters
type- specifies allocation type

Definition at line 93 of file alloc_engine.cc.

Member Function Documentation

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 151 of file alloc_engine.cc.

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

+ Here is the call graph for this function:

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 98 of file alloc_engine.cc.

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

+ Here is the call graph for this function:


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