Kea 3.1.1
flq_allocator.h
Go to the documentation of this file.
1// Copyright (C) 2023-2025 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 FLQ_ALLOCATOR_H
8#define FLQ_ALLOCATOR_H
9
10#include <dhcpsrv/allocator.h>
12#include <dhcpsrv/lease.h>
13#include <cstdint>
14
15namespace isc {
16namespace dhcp {
17
39public:
40
46
50 virtual std::string getType() const {
51 return ("flq");
52 }
53
64 virtual double
66 const ClientClasses& client_classes) const;
67
79 virtual double
81 const uint8_t plen,
82 const ClientClasses& client_classes) const;
83
84private:
85
90 virtual void initAfterConfigureInternal();
91
102 template<typename LeaseCollectionType>
103 void populateFreeAddressLeases(const LeaseCollectionType& leases, const PoolCollection& pools);
104
113 void populateFreePrefixDelegationLeases(const Lease6Collection& leases, const PoolCollection& pools);
114
124 virtual asiolink::IOAddress pickAddressInternal(const ClientClasses& client_classes,
125 const IdentifierBaseTypePtr& duid,
126 const asiolink::IOAddress& hint);
127
144 pickPrefixInternal(const ClientClasses& client_classes,
145 Pool6Ptr& pool,
146 const IdentifierBaseTypePtr& duid,
147 PrefixLenMatchType prefix_length_match,
148 const isc::asiolink::IOAddress& hint,
149 uint8_t hint_prefix_length);
150
158 PoolFreeLeaseQueueAllocationStatePtr getPoolState(const PoolPtr& pool) const;
159
168 PoolPtr getLeasePool(const LeasePtr& lease) const;
169
175 void addLeaseCallback(LeasePtr lease);
176
182 void addLeaseCallbackInternal(LeasePtr lease);
183
191 void updateLeaseCallback(LeasePtr lease);
192
200 void updateLeaseCallbackInternal(LeasePtr lease);
201
207 void deleteLeaseCallback(LeasePtr lease);
208
214 void deleteLeaseCallbackInternal(LeasePtr lease);
215
223 uint64_t getRandomNumber(uint64_t limit);
224
226 std::mt19937 generator_;
227};
228
229} // end of namespace isc::dhcp
230} // end of namespace isc
231
232#endif // FLQ_ALLOCATOR_H
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
virtual std::string getType() const
Returns the allocator type string.
FreeLeaseQueueAllocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
virtual double getOccupancyRate(const asiolink::IOAddress &addr, const ClientClasses &client_classes) const
Returns the occupancy rate (v4 addresses).
boost::shared_ptr< PoolFreeLeaseQueueAllocationState > PoolFreeLeaseQueueAllocationStatePtr
Type of the pointer to the PoolFreeLeaseQueueAllocationState.
boost::weak_ptr< Subnet > WeakSubnetPtr
Weak pointer to the Subnet.
Definition allocator.h:32
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition lease.h:693
std::vector< PoolPtr > PoolCollection
a container for either IPv4 or IPv6 Pools
Definition pool.h:729
boost::shared_ptr< IdentifierBaseType > IdentifierBaseTypePtr
Shared pointer to a IdentifierType.
Definition duid.h:34
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
Definition pool.h:726
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Definition lease.h:25
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