Kea  2.3.5-git
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 
16 namespace isc {
17 namespace dhcp {
18 
25 class IterativeAllocator : public Allocator {
26 public:
27 
32  IterativeAllocator(Lease::Type type, const WeakSubnetPtr& subnet);
33 
34 private:
35 
45  virtual asiolink::IOAddress pickAddressInternal(const ClientClasses& client_classes,
46  const DuidPtr& duid,
47  const asiolink::IOAddress& hint);
48 
65  pickPrefixInternal(const ClientClasses& client_classes,
66  Pool6Ptr& pool,
67  const DuidPtr& duid,
68  PrefixLenMatchType prefix_length_match,
69  const isc::asiolink::IOAddress& hint,
70  uint8_t hint_prefix_length);
71 
78  SubnetIterativeAllocationStatePtr getSubnetState() const;
79 
87  PoolIterativeAllocationStatePtr getPoolState(const PoolPtr& pool) const;
88 
89 protected:
90 
103  const uint8_t prefix_len);
104 
116  bool prefix,
117  const uint8_t prefix_len);
118 };
119 
120 } // namespace dhcp
121 } // end of namespace isc
122 
123 #endif // ITERATIVE_ALLOCATOR_H
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
Base class for all address/prefix allocation algorithms.
Definition: allocator.h:56
boost::shared_ptr< PoolIterativeAllocationState > PoolIterativeAllocationStatePtr
Type of the pointer to the PoolIterativeAllocationState.
IterativeAllocator(Lease::Type type, const WeakSubnetPtr &subnet)
Constructor.
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
Definition: pool.h:298
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
Definition: pool.h:491
Address/prefix allocator that iterates over all addresses.
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition: allocator.h:60
boost::weak_ptr< Subnet > WeakSubnetPtr
Weak pointer to the Subnet.
Definition: allocator.h:28
boost::shared_ptr< SubnetIterativeAllocationState > SubnetIterativeAllocationStatePtr
Type of the pointer to the SubnetIterativeAllocationState.
static asiolink::IOAddress increaseAddress(const asiolink::IOAddress &address, bool prefix, const uint8_t prefix_len)
Returns the next address or prefix.
Defines the logger used by the top-level component of kea-lfc.
static asiolink::IOAddress increasePrefix(const asiolink::IOAddress &prefix, const uint8_t prefix_len)
Returns the next prefix.
Type
Type of lease or pool.
Definition: lease.h:46
Container for storing client class names.
Definition: classify.h:108