Kea  1.5.0
isc::dhcp::AllocEngine::Allocator Class Referenceabstract

base class for all address/prefix allocation algorithms More...

#include <alloc_engine.h>

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

Public Member Functions

 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)=0
 picks one address out of available pools in a given subnet More...
 

Protected Attributes

Lease::Type pool_type_
 defines pool type allocation More...
 

Detailed Description

base class for all address/prefix allocation algorithms

This is an abstract class that should not be used directly, but rather specialized implementations should be used instead.

Definition at line 63 of file alloc_engine.h.

Constructor & Destructor Documentation

◆ Allocator()

isc::dhcp::AllocEngine::Allocator::Allocator ( Lease::Type  pool_type)
inline

Default constructor.

Specifies which type of leases this allocator will assign

Parameters
pool_typespecifies pool type (addresses, temp. addr or prefixes)

Definition at line 100 of file alloc_engine.h.

◆ ~Allocator()

virtual isc::dhcp::AllocEngine::Allocator::~Allocator ( )
inlinevirtual

virtual destructor

Definition at line 105 of file alloc_engine.h.

Member Function Documentation

◆ pickAddress()

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

picks one address out of available pools in a given subnet

This method returns one address from the available pools in the specified subnet. It should not check if the address is used or reserved - AllocEngine will check that and will call pickAddress again if necessary. The number of times this method is called will increase as the number of available leases will decrease.

This method can also be used to pick a prefix. We should not rename it to pickLease(), because at this early stage there is no concept of a lease yet. Here it is a matter of selecting one address or prefix from the defined pool, without going into details who it is for or who uses it. I thought that pickAddress() is less confusing than pickResource(), because nobody would immediately know what the resource means in this context.

Pools which are not allowed for client classes are skipped.

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

Implemented in isc::dhcp::AllocEngine::RandomAllocator, isc::dhcp::AllocEngine::HashedAllocator, and isc::dhcp::AllocEngine::IterativeAllocator.

Member Data Documentation

◆ pool_type_

Lease::Type isc::dhcp::AllocEngine::Allocator::pool_type_
protected

defines pool type allocation

Definition at line 110 of file alloc_engine.h.


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