Kea 2.7.6
iterative_allocator.h
Go to the documentation of this file.
1// Copyright (C) 2022-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 ITERATIVE_ALLOCATOR_H
8#define ITERATIVE_ALLOCATOR_H
9
10#include <dhcpsrv/allocator.h>
12#include <dhcpsrv/lease.h>
13
14#include <cstdint>
15
16namespace isc {
17namespace dhcp {
18
26public:
27
32 IterativeAllocator(Lease::Type type, const WeakSubnetPtr& subnet);
33
37 virtual std::string getType() const {
38 return ("iterative");
39 }
40
41private:
42
52 virtual asiolink::IOAddress pickAddressInternal(const ClientClasses& client_classes,
53 const IdentifierBaseTypePtr& duid,
54 const asiolink::IOAddress& hint);
55
71 virtual asiolink::IOAddress pickPrefixInternal(const ClientClasses& client_classes,
72 Pool6Ptr& pool,
73 const IdentifierBaseTypePtr& duid,
74 PrefixLenMatchType prefix_length_match,
75 const asiolink::IOAddress& hint,
76 uint8_t hint_prefix_length);
77
84 SubnetIterativeAllocationStatePtr getSubnetState() const;
85
93 PoolIterativeAllocationStatePtr getPoolState(const PoolPtr& pool) const;
94
95protected:
96
109 const uint8_t prefix_len);
110
122 bool prefix,
123 const uint8_t prefix_len);
124};
125
126} // namespace dhcp
127} // end of namespace isc
128
129#endif // ITERATIVE_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:109
Address/prefix allocator that iterates over all addresses.
static asiolink::IOAddress increasePrefix(const asiolink::IOAddress &prefix, const uint8_t prefix_len)
Returns the next prefix.
static asiolink::IOAddress increaseAddress(const asiolink::IOAddress &address, bool prefix, const uint8_t prefix_len)
Returns the next address or prefix.
virtual std::string getType() const
Returns the allocator type string.
IterativeAllocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
boost::weak_ptr< Subnet > WeakSubnetPtr
Weak pointer to the Subnet.
Definition allocator.h:32
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:485
boost::shared_ptr< PoolIterativeAllocationState > PoolIterativeAllocationStatePtr
Type of the pointer to the PoolIterativeAllocationState.
boost::shared_ptr< SubnetIterativeAllocationState > SubnetIterativeAllocationStatePtr
Type of the pointer to the SubnetIterativeAllocationState.
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
Definition pool.h:295
Defines the logger used by the top-level component of kea-lfc.
Type
Type of lease or pool.
Definition lease.h:46