Kea  2.1.7-git
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)
 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 70 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 114 of file alloc_engine.h.

◆ ~Allocator()

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

Virtual destructor.

Definition at line 118 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 
)
inlinevirtual

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

Definition at line 98 of file alloc_engine.h.

References isc::util::MultiThreadingMgr::instance().

+ Here is the call graph for this function:

Member Data Documentation

◆ pool_type_

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

Defines pool type allocation.

Definition at line 131 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::IterativeAllocator::increaseAddress().


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