Kea 2.7.6
isc::dhcp::PoolFreeLeaseQueueAllocationState Class Reference

Pool allocation state used by the FLQ allocator. More...

#include <flq_allocation_state.h>

+ Inheritance diagram for isc::dhcp::PoolFreeLeaseQueueAllocationState:

Public Member Functions

 PoolFreeLeaseQueueAllocationState (Lease::Type type)
 Constructor.
 
void addFreeLease (const asiolink::IOAddress &address)
 Adds a free lease to the queue.
 
void deleteFreeLease (const asiolink::IOAddress &address)
 Deletes free lease from the queue.
 
bool exhausted () const
 Checks if the pool has run out of free leases.
 
size_t getFreeLeaseCount () const
 Returns the current number of free leases in the queue.
 
asiolink::IOAddress offerFreeLease ()
 Returns next available lease.
 
- Public Member Functions inherited from isc::dhcp::AllocationState
virtual ~AllocationState ()=default
 Virtual destructor.
 

Static Public Member Functions

static PoolFreeLeaseQueueAllocationStatePtr create (const PoolPtr &pool)
 Factory function creating the state instance from a pool.
 

Detailed Description

Pool allocation state used by the FLQ allocator.

Definition at line 26 of file flq_allocation_state.h.

Constructor & Destructor Documentation

◆ PoolFreeLeaseQueueAllocationState()

isc::dhcp::PoolFreeLeaseQueueAllocationState::PoolFreeLeaseQueueAllocationState ( Lease::Type type)

Constructor.

Instantiates the allocation state for the specified lease type.

Parameters
typelease type.

Definition at line 21 of file flq_allocation_state.cc.

References isc::dhcp::Lease::TYPE_V4.

Member Function Documentation

◆ addFreeLease()

void isc::dhcp::PoolFreeLeaseQueueAllocationState::addFreeLease ( const asiolink::IOAddress & address)

Adds a free lease to the queue.

Parameters
addresslease address.

Definition at line 37 of file flq_allocation_state.cc.

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

+ Here is the call graph for this function:

◆ create()

PoolFreeLeaseQueueAllocationStatePtr isc::dhcp::PoolFreeLeaseQueueAllocationState::create ( const PoolPtr & pool)
static

Factory function creating the state instance from a pool.

Parameters
poolinstance of the pool for which the allocation state should be instantiated.
Returns
new allocation state instance.

Definition at line 17 of file flq_allocation_state.cc.

Referenced by isc::dhcp::Subnet4::createAllocators(), and isc::dhcp::Subnet6::createAllocators().

◆ deleteFreeLease()

void isc::dhcp::PoolFreeLeaseQueueAllocationState::deleteFreeLease ( const asiolink::IOAddress & address)

Deletes free lease from the queue.

Parameters
addresslease address.

Definition at line 46 of file flq_allocation_state.cc.

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

+ Here is the call graph for this function:

◆ exhausted()

bool isc::dhcp::PoolFreeLeaseQueueAllocationState::exhausted ( ) const

Checks if the pool has run out of free leases.

Returns
true if the pool has no free leases, false otherwise.

Definition at line 31 of file flq_allocation_state.cc.

◆ getFreeLeaseCount()

size_t isc::dhcp::PoolFreeLeaseQueueAllocationState::getFreeLeaseCount ( ) const

Returns the current number of free leases in the queue.

Returns
the number of free leases in the queue.

Definition at line 78 of file flq_allocation_state.cc.

◆ offerFreeLease()

IOAddress isc::dhcp::PoolFreeLeaseQueueAllocationState::offerFreeLease ( )

Returns next available lease.

Returns
next free lease address or IPv4/IPv6 zero address when there are no free leases.

Definition at line 57 of file flq_allocation_state.cc.

References isc::asiolink::IOAddress::IPV4_ZERO_ADDRESS(), and isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS().

+ Here is the call graph for this function:

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