Kea 2.5.8
flq_allocator.h
Go to the documentation of this file.
1// Copyright (C) 2023 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
54private:
55
60 virtual void initAfterConfigureInternal();
61
72 template<typename LeaseCollectionType>
73 void populateFreeAddressLeases(const LeaseCollectionType& leases, const PoolCollection& pools);
74
83 void populateFreePrefixDelegationLeases(const Lease6Collection& leases, const PoolCollection& pools);
84
94 virtual asiolink::IOAddress pickAddressInternal(const ClientClasses& client_classes,
95 const IdentifierBaseTypePtr& duid,
96 const asiolink::IOAddress& hint);
97
114 pickPrefixInternal(const ClientClasses& client_classes,
115 Pool6Ptr& pool,
116 const IdentifierBaseTypePtr& duid,
117 PrefixLenMatchType prefix_length_match,
118 const isc::asiolink::IOAddress& hint,
119 uint8_t hint_prefix_length);
120
128 PoolFreeLeaseQueueAllocationStatePtr getPoolState(const PoolPtr& pool) const;
129
138 PoolPtr getLeasePool(const LeasePtr& lease) const;
139
145 void addLeaseCallback(LeasePtr lease);
146
152 void addLeaseCallbackInternal(LeasePtr lease);
153
161 void updateLeaseCallback(LeasePtr lease);
162
170 void updateLeaseCallbackInternal(LeasePtr lease);
171
177 void deleteLeaseCallback(LeasePtr lease);
178
184 void deleteLeaseCallbackInternal(LeasePtr lease);
185
193 uint64_t getRandomNumber(uint64_t limit);
194
196 std::mt19937 generator_;
197};
198
199} // end of namespace isc::dhcp
200} // end of namespace isc
201
202#endif // FLQ_ALLOCATOR_H
Base class for all address/prefix allocation algorithms.
Definition: allocator.h:57
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition: allocator.h:61
Container for storing client class names.
Definition: classify.h:108
An allocator maintaining a queue of free leases.
Definition: flq_allocator.h:38
virtual std::string getType() const
Returns the allocator type string.
Definition: flq_allocator.h:50
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:670
std::vector< PoolPtr > PoolCollection
a container for either IPv4 or IPv6 Pools
Definition: pool.h:486
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:483
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:293
Defines the logger used by the top-level component of kea-lfc.
Type
Type of lease or pool.
Definition: lease.h:46