| Kea 3.0.2-git

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>
11#include <dhcpsrv/flq_allocation_state.h>
12#include <dhcpsrv/lease.h>
13#include <cstdint>
14
15 namespace isc {
16 namespace dhcp {
17
38 class FreeLeaseQueueAllocator : public Allocator {
39 public:
40
45 FreeLeaseQueueAllocator(Lease::Type type, const WeakSubnetPtr& subnet);
46
50 virtual std::string getType() const {
51 return ("flq");
52 }
53
54 private:
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
113 virtual isc::asiolink::IOAddress
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
allocator.h
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:45
isc::dhcp::Allocator::initAfterConfigureInternal
virtual void initAfterConfigureInternal()
Allocator-specific initialization function.
Definition allocator.h:172
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:109
isc::dhcp::FreeLeaseQueueAllocator::getType
virtual std::string getType() const
Returns the allocator type string.
Definition flq_allocator.h:50
isc::dhcp::FreeLeaseQueueAllocator::FreeLeaseQueueAllocator
FreeLeaseQueueAllocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
Definition flq_allocator.cc:31
flq_allocation_state.h
lease.h
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::PoolFreeLeaseQueueAllocationStatePtr
boost::shared_ptr< PoolFreeLeaseQueueAllocationState > PoolFreeLeaseQueueAllocationStatePtr
Type of the pointer to the PoolFreeLeaseQueueAllocationState.
Definition flq_allocation_state.h:23
isc::dhcp::WeakSubnetPtr
boost::weak_ptr< Subnet > WeakSubnetPtr
Weak pointer to the Subnet.
Definition allocator.h:32
isc::dhcp::Lease6Collection
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition lease.h:693
isc::dhcp::PoolCollection
std::vector< PoolPtr > PoolCollection
a container for either IPv4 or IPv6 Pools
Definition pool.h:729
isc::dhcp::IdentifierBaseTypePtr
boost::shared_ptr< IdentifierBaseType > IdentifierBaseTypePtr
Shared pointer to a IdentifierType.
Definition duid.h:34
isc::dhcp::PoolPtr
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
Definition pool.h:726
isc::dhcp::LeasePtr
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Definition lease.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 agent_parser.cc:148
isc::dhcp::Lease::Type
Type
Type of lease or pool.
Definition lease.h:46