Kea 3.1.8
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>
12#include <dhcpsrv/lease.h>
13#include <cstdint>
14
15namespace isc {
16namespace dhcp {
17
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
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
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
virtual void initAfterConfigureInternal()
Allocator-specific initialization function.
Definition allocator.h:202
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition allocator.h:61
Allocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
Definition allocator.cc:17
Container for storing client class names.
Definition classify.h:110
static void setInUse(bool in_use)
Sets the global in-use flag.
static bool inUse()
Returns the global in-use flag.
static void sanityChecksSflqAllocator6(Subnet6Ptr subnet)
Sanity checks the subnet and pool configuration for use with SFLQ.
static void sanityChecksSflqAllocator4(Subnet4Ptr subnet)
Sanity checks the subnet and pool configuration for use with SFLQ.
SubnetSflqAllocationStatePtr getSubnetState() const
Returns the allocation state for the subnet pool_type;.
static constexpr size_t MAX_V6_POOL_SIZE
Maximum capacity of a V6 pool supported by SFLQ.
SharedFlqAllocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
static constexpr size_t MAX_V4_POOL_SIZE
Maximum capacity of a V4 pool supported by SFLQ.
virtual std::string getType() const
Returns the allocator type string.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition subnet.h:461
boost::weak_ptr< Subnet > WeakSubnetPtr
Weak pointer to the Subnet.
Definition allocator.h:32
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition subnet.h:626
boost::shared_ptr< IdentifierBaseType > IdentifierBaseTypePtr
Shared pointer to a IdentifierType.
Definition duid.h:34
boost::shared_ptr< SubnetSflqAllocationState > SubnetSflqAllocationStatePtr
Type of the pointer to the SubnetSflqAllocationState.
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
Definition pool.h:536
Defines the logger used by the top-level component of kea-lfc.
Type
Type of lease or pool.
Definition lease.h:46