Kea: sflq_allocator.h Source File

| Kea 3.2.0-git

sflq_allocator.h
Go to the documentation of this file.
1// Copyright (C) 2026 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef SFLQ_ALLOCATOR_H
8#define SFLQ_ALLOCATOR_H
9
10#include <dhcpsrv/allocator.h>
11#include <dhcpsrv/sflq_allocation_state.h>
12#include <dhcpsrv/lease.h>
13#include <cstdint>
14
15namespace isc {
16namespace dhcp {
17
48 class SharedFlqAllocator : public Allocator {
49public:
50
55 SharedFlqAllocator(Lease::Type type, const WeakSubnetPtr& subnet);
56
60 virtual std::string getType() const {
61 return ("shared-flq");
62 }
63
67 static void setInUse(bool in_use);
68
73 static bool inUse();
74
78 SubnetSflqAllocationStatePtr getSubnetState() const;
79
86 static void sanityChecksSflqAllocator4(Subnet4Ptr subnet);
87
94 static void sanityChecksSflqAllocator6(Subnet6Ptr subnet);
95
97 static constexpr size_t MAX_V4_POOL_SIZE = 16777216;
98
100 static constexpr size_t MAX_V6_POOL_SIZE = 16777216;
101
102private:
103
109 virtual void initAfterConfigureInternal();
110
120 virtual asiolink::IOAddress pickAddressInternal(const ClientClasses& client_classes,
121 const IdentifierBaseTypePtr& duid,
122 const asiolink::IOAddress& hint);
123
139 virtual isc::asiolink::IOAddress
140 pickPrefixInternal(const ClientClasses& client_classes,
141 Pool6Ptr& pool,
142 const IdentifierBaseTypePtr& duid,
143 PrefixLenMatchType prefix_length_match,
144 const isc::asiolink::IOAddress& hint,
145 uint8_t hint_prefix_length);
146
154 uint64_t getRandomNumber(uint64_t limit);
155
157 std::mt19937 generator_;
158};
159
160} // end of namespace isc::dhcp
161} // end of namespace isc
162
163#endif // SFLQ_ALLOCATOR_H
allocator.h
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:53
isc::dhcp::Allocator::initAfterConfigureInternal
virtual void initAfterConfigureInternal()
Allocator-specific initialization function.
Definition allocator.h:202
isc::dhcp::Allocator::PrefixLenMatchType
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition allocator.h:61
isc::dhcp::Allocator::Allocator
Allocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
Definition allocator.cc:17
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:110
isc::dhcp::SharedFlqAllocator::setInUse
static void setInUse(bool in_use)
Sets the global in-use flag.
Definition sflq_allocator.cc:32
isc::dhcp::SharedFlqAllocator::inUse
static bool inUse()
Returns the global in-use flag.
Definition sflq_allocator.cc:37
isc::dhcp::SharedFlqAllocator::sanityChecksSflqAllocator6
static void sanityChecksSflqAllocator6(Subnet6Ptr subnet)
Sanity checks the subnet and pool configuration for use with SFLQ.
Definition sflq_allocator.cc:250
isc::dhcp::SharedFlqAllocator::sanityChecksSflqAllocator4
static void sanityChecksSflqAllocator4(Subnet4Ptr subnet)
Sanity checks the subnet and pool configuration for use with SFLQ.
Definition sflq_allocator.cc:237
isc::dhcp::SharedFlqAllocator::getSubnetState
SubnetSflqAllocationStatePtr getSubnetState() const
Returns the allocation state for the subnet pool_type;.
Definition sflq_allocator.cc:219
isc::dhcp::SharedFlqAllocator::MAX_V6_POOL_SIZE
static constexpr size_t MAX_V6_POOL_SIZE
Maximum capacity of a V6 pool supported by SFLQ.
Definition sflq_allocator.h:100
isc::dhcp::SharedFlqAllocator::SharedFlqAllocator
SharedFlqAllocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
Definition sflq_allocator.cc:41
isc::dhcp::SharedFlqAllocator::MAX_V4_POOL_SIZE
static constexpr size_t MAX_V4_POOL_SIZE
Maximum capacity of a V4 pool supported by SFLQ.
Definition sflq_allocator.h:97
isc::dhcp::SharedFlqAllocator::getType
virtual std::string getType() const
Returns the allocator type string.
Definition sflq_allocator.h:60
lease.h
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::Subnet4Ptr
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition subnet.h:458
isc::dhcp::WeakSubnetPtr
boost::weak_ptr< Subnet > WeakSubnetPtr
Weak pointer to the Subnet.
Definition allocator.h:32
isc::dhcp::Subnet6Ptr
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition subnet.h:623
isc::dhcp::IdentifierBaseTypePtr
boost::shared_ptr< IdentifierBaseType > IdentifierBaseTypePtr
Shared pointer to a IdentifierType.
Definition duid.h:34
isc::dhcp::SubnetSflqAllocationStatePtr
boost::shared_ptr< SubnetSflqAllocationState > SubnetSflqAllocationStatePtr
Type of the pointer to the SubnetSflqAllocationState.
Definition sflq_allocation_state.h:25
isc::dhcp::Pool6Ptr
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
Definition pool.h:536
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
sflq_allocation_state.h
isc::dhcp::Lease::Type
Type
Type of lease or pool.
Definition lease.h:46