Kea 3.3.3
alloc_engine.h
Go to the documentation of this file.
1// Copyright (C) 2012-2026 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 ALLOC_ENGINE_H
8#define ALLOC_ENGINE_H
9
10#include <asiolink/io_address.h>
11#include <dhcp/classify.h>
12#include <dhcp/duid.h>
13#include <dhcp/hwaddr.h>
14#include <dhcp/option6_ia.h>
15#include <dhcp/option6_iaaddr.h>
17#include <dhcp/pkt4.h>
18#include <dhcp/pkt6.h>
19#include <dhcpsrv/allocator.h>
21#include <dhcpsrv/host.h>
22#include <dhcpsrv/lease_mgr.h>
23#include <dhcpsrv/srv_config.h>
24#include <dhcpsrv/subnet.h>
28
29#include <cstdint>
30#include <functional>
31#include <list>
32#include <map>
33#include <mutex>
34#include <set>
35#include <utility>
36
37#include <boost/noncopyable.hpp>
38#include <boost/shared_ptr.hpp>
39
40namespace isc {
41namespace dhcp {
42
48class AllocEngine : public boost::noncopyable {
49public:
50
60 AllocEngine(isc::util::uint128_t const& attempts);
61
63 virtual ~AllocEngine() { }
64
65private:
66
68 isc::util::uint128_t attempts_;
69
71 int hook_index_lease4_select_;
72 int hook_index_lease6_select_;
73
74public:
75
84 class Resource {
85 public:
86
96 const uint8_t prefix_len = 128,
97 const uint32_t preferred = 0,
98 const uint32_t valid = 0)
99 : address_(address), prefix_len_(prefix_len),
100 preferred_(preferred), valid_(valid) {
101 }
102
107 return (address_);
108 }
109
113 uint8_t getPrefixLength() const {
114 return (prefix_len_);
115 }
116
120 uint32_t getPreferred() const {
121 return (preferred_);
122 }
123
127 uint32_t getValid() const {
128 return (valid_);
129 }
130
136 bool equals(const Resource& other) const {
137 return (address_ == other.address_ &&
138 prefix_len_ == other.prefix_len_);
139 }
140
146 bool operator==(const Resource& other) const {
147 return (equals(other));
148 }
149
150 protected:
151
154
156 uint8_t prefix_len_;
157
159 uint32_t preferred_;
160
162 uint32_t valid_;
163 };
164
176 bool operator() (const Resource& lhr, const Resource& rhr) const {
177 if (lhr.getAddress() == rhr.getAddress()) {
178 return (lhr.getPrefixLength() < rhr.getPrefixLength());
179 } else {
180 return (lhr.getAddress() < rhr.getAddress());
181 }
182 }
183 };
184
186 typedef std::vector<Resource> HintContainer;
187
189 typedef std::set<Resource, ResourceCompare> ResourceContainer;
190
192 typedef std::pair<Host::IdentifierType, std::vector<uint8_t> > IdentifierPair;
193
195 typedef std::list<IdentifierPair> IdentifierList;
196
219 struct ClientContext6 : public boost::noncopyable {
220
222
223
228
235
240
243
248
251
254
258
264 std::map<SubnetID, ConstHostPtr> hosts_;
265
270
275
280 std::string hostname_;
281
284
287
290
292
294 struct IAContext {
295
298 uint32_t iaid_;
299
302
308
317
325
328
333
337
341 IAContext();
342
349 void addHint(const asiolink::IOAddress& prefix,
350 const uint8_t prefix_len = 128,
351 const uint32_t preferred = 0,
352 const uint32_t valid = 0);
353
359 void addHint(const Option6IAAddrPtr& iaaddr);
360
366 void addHint(const Option6IAPrefixPtr& iaprefix);
367
372 void addNewResource(const asiolink::IOAddress& prefix,
373 const uint8_t prefix_len = 128);
374
379 bool isNewResource(const asiolink::IOAddress& prefix,
380 const uint8_t prefix_len = 128) const;
381 };
382
384 std::vector<IAContext> ias_;
385
394
399 void addAllocatedResource(const asiolink::IOAddress& prefix,
400 const uint8_t prefix_len = 128);
401
406 bool isAllocated(const asiolink::IOAddress& prefix,
407 const uint8_t prefix_len = 128) const;
408
416 const std::vector<uint8_t>& identifier) {
417 if (identifier.empty()) {
418 isc_throw(BadValue, "identifier is empty");
419 }
420 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
421 }
422
429 if (ias_.empty()) {
431 }
432 return (ias_.back());
433 }
434
435 std::vector<IAContext>& getIAContexts() {
436 return (ias_);
437 }
438
444 ias_.push_back(IAContext());
445 }
446
454
463 ConstHostPtr globalHost() const;
464
470 bool hasGlobalReservation(const IPv6Resrv& resv) const;
471
474
496 ClientContext6(const ConstSubnet6Ptr& subnet, const DuidPtr& duid,
497 const bool fwd_dns, const bool rev_dns,
498 const std::string& hostname, const bool fake_allocation,
499 const Pkt6Ptr& query,
500 const hooks::CalloutHandlePtr& callout_handle =
502
503 private:
507 DdnsParamsPtr ddns_params_;
508 };
509
592 allocateLeases6(ClientContext6& ctx);
593
614 Lease6Collection renewLeases6(ClientContext6& ctx);
615
664 void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout,
665 const bool remove_lease,
666 const uint16_t max_unwarned_cycles = 0);
667
680 void reclaimExpiredLeases6Internal(const size_t max_leases,
681 const uint16_t timeout,
682 const bool remove_lease,
683 const uint16_t max_unwarned_cycles = 0);
684
690 void deleteExpiredReclaimedLeases6(const uint32_t secs);
691
740 void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout,
741 const bool remove_lease,
742 const uint16_t max_unwarned_cycles = 0);
743
756 void reclaimExpiredLeases4Internal(const size_t max_leases,
757 const uint16_t timeout,
758 const bool remove_lease,
759 const uint16_t max_unwarned_cycles = 0);
760
766 void deleteExpiredReclaimedLeases4(const uint32_t secs);
767
781 static void findReservation(ClientContext6& ctx);
782
793 static ConstHostPtr findGlobalReservation(ClientContext6& ctx);
794
800 static IPv6Resrv makeIPv6Resrv(const Lease6& lease) {
801 if (lease.type_ == Lease::TYPE_NA) {
802 return (IPv6Resrv(IPv6Resrv::TYPE_NA, lease.addr_,
803 (lease.prefixlen_ ? lease.prefixlen_ : 128)));
804 }
805
806 return (IPv6Resrv(IPv6Resrv::TYPE_PD, lease.addr_, lease.prefixlen_));
807 }
808
809public:
826 static void getLifetimes6(ClientContext6& ctx, uint32_t& preferred,
827 uint32_t& valid);
828
842 static void getMinLifetimes6(ClientContext6& ctx, uint32_t& preferred,
843 uint32_t& valid);
844private:
845
881 Lease6Ptr createLease6(ClientContext6& ctx,
882 const isc::asiolink::IOAddress& addr,
883 const uint8_t prefix_len,
885
900 Lease6Collection allocateUnreservedLeases6(ClientContext6& ctx);
901
942 Lease6Ptr allocateBestMatch(ClientContext6& ctx,
943 Lease6Ptr& hint_lease,
944 bool& search_hint_lease,
945 const isc::asiolink::IOAddress& hint,
946 uint8_t hint_prefix_length,
947 ConstSubnet6Ptr original_subnet,
948 SharedNetwork6Ptr& network,
949 uint64_t& total_attempts,
950 uint64_t& subnets_with_unavail_leases,
951 uint64_t& subnets_with_unavail_pools,
953 Allocator::PrefixLenMatchType prefix_length_match);
954
971 void
972 allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
973
987 void
988 allocateGlobalReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
989
998 void
999 removeNonmatchingReservedLeases6(ClientContext6& ctx,
1000 Lease6Collection& existing_leases);
1001
1009 void
1010 removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
1011 Lease6Collection& existing_leases);
1012
1026 void
1027 removeNonreservedLeases6(ClientContext6& ctx,
1028 Lease6Collection& existing_leases);
1029
1062 Lease6Ptr
1063 reuseExpiredLease(Lease6Ptr& expired,
1064 ClientContext6& ctx,
1065 uint8_t prefix_len,
1067
1086 Lease6Collection updateLeaseData(ClientContext6& ctx,
1087 const Lease6Collection& leases);
1088
1094 static bool
1095 removeLeases(Lease6Collection& container,
1096 const asiolink::IOAddress& addr);
1097
1110 void extendLease6(ClientContext6& ctx, Lease6Ptr lease);
1111
1119 enum DbReclaimMode : uint16_t {
1120 DB_RECLAIM_REMOVE,
1121 DB_RECLAIM_UPDATE,
1122 DB_RECLAIM_LEAVE_UNCHANGED
1123 };
1124
1136 template<typename LeasePtrType>
1137 void reclaimExpiredLease(const LeasePtrType& lease,
1138 const bool remove_lease,
1139 const hooks::CalloutHandlePtr& callout_handle);
1140
1151 template<typename LeasePtrType>
1152 void reclaimExpiredLease(const LeasePtrType& lease,
1153 const hooks::CalloutHandlePtr& callout_handle);
1154
1165 void reclaimExpiredLease(const Lease6Ptr& lease,
1166 const DbReclaimMode& reclaim_mode,
1167 const hooks::CalloutHandlePtr& callout_handle);
1168
1179 void reclaimExpiredLease(const Lease4Ptr& lease,
1180 const DbReclaimMode& reclaim_mode,
1181 const hooks::CalloutHandlePtr& callout_handle);
1182
1201 template<typename LeasePtrType>
1202 void reclaimLeaseInDatabase(const LeasePtrType& lease,
1203 const bool remove_lease,
1204 const std::function<void (const LeasePtrType&)>&
1205 lease_update_fun) const;
1206
1219 bool reclaimDeclined(const Lease4Ptr& lease);
1220
1233 bool reclaimDeclined(const Lease6Ptr& lease);
1234
1235public:
1236
1254 struct ClientContext4 : public boost::noncopyable {
1259
1262
1265
1268
1274
1277
1280
1285 std::string hostname_;
1286
1289
1296
1299 uint32_t offer_lft_;
1300
1303
1306
1312 std::map<SubnetID, ConstHostPtr> hosts_;
1313
1320
1326
1330
1334
1338 if (!subnet_ ||
1339 (subnet_ && subnet_->getMatchClientId()) ||
1340 !hwaddr_ || hwaddr_->hwaddr_.empty()) {
1341 return (clientid_);
1342 } else {
1343 return (ClientIdPtr());
1344 }
1345 }
1346
1355
1363 const std::vector<uint8_t>& identifier) {
1364 if (identifier.empty()) {
1365 isc_throw(BadValue, "identifier is empty");
1366 }
1367 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
1368 }
1369
1376 ConstHostPtr currentHost() const;
1377
1386 ConstHostPtr globalHost() const;
1387
1390
1407 ClientContext4(const ConstSubnet4Ptr& subnet,
1408 const ClientIdPtr& clientid,
1409 const HWAddrPtr& hwaddr,
1410 const asiolink::IOAddress& requested_addr,
1411 const bool fwd_dns_update, const bool rev_dns_update,
1412 const std::string& hostname, const bool fake_allocation,
1413 const uint32_t offer_lft = 0);
1414 private:
1418 DdnsParamsPtr ddns_params_;
1419 };
1420
1422 typedef boost::shared_ptr<ClientContext4> ClientContext4Ptr;
1423
1530
1543 static void findReservation(ClientContext4& ctx);
1544
1556
1574 static uint32_t getValidLft(const ClientContext4& ctx);
1575
1589 static void getMinValidLft(const ClientContext4& ctx, uint32_t& valid);
1590
1607 static uint32_t getOfferLft(const ClientContext4& ctx,
1608 bool only_on_discover = true);
1613 static void getRemaining(const Lease4Ptr& lease, uint32_t& valid);
1614
1620 static void getRemaining(const Lease6Ptr& lease, uint32_t& preferred,
1621 uint32_t& valid);
1622
1623private:
1624
1655 Lease4Ptr discoverLease4(ClientContext4& ctx);
1656
1694 Lease4Ptr requestLease4(ClientContext4& ctx);
1695
1725 Lease4Ptr createLease4(const ClientContext4& ctx,
1726 const isc::asiolink::IOAddress& addr,
1728
1742 Lease4Ptr renewLease4(const Lease4Ptr& lease, ClientContext4& ctx);
1743
1760 Lease4Ptr
1761 reuseExpiredLease4(Lease4Ptr& expired, ClientContext4& ctx,
1763
1779 Lease4Ptr
1780 allocateOrReuseLease4(const asiolink::IOAddress& address,
1781 ClientContext4& ctx,
1783
1802 Lease4Ptr allocateUnreservedLease4(ClientContext4& ctx);
1803
1826 bool updateLease4Information(const Lease4Ptr& lease,
1827 ClientContext4& ctx) const;
1828
1829protected:
1846 bool updateLease4ExtendedInfo(const Lease4Ptr& lease,
1847 const ClientContext4& ctx) const;
1848
1864 void updateLease6ExtendedInfo(const Lease6Ptr& lease,
1865 const ClientContext6& ctx) const;
1866
1870 void clearReclaimedExtendedInfo(const Lease4Ptr& lease) const;
1871
1875 void clearReclaimedExtendedInfo(const Lease6Ptr& lease) const;
1876
1877private:
1878
1892 void setLeaseReusable(const Lease4Ptr& lease,
1893 const ClientContext4& ctx) const;
1894
1909 void setLeaseReusable(const Lease6Ptr& lease,
1910 uint32_t current_preferred_lft,
1911 const ClientContext6& ctx) const;
1912
1913private:
1914
1917 uint16_t incomplete_v4_reclamations_;
1918
1921 uint16_t incomplete_v6_reclamations_;
1922
1923public:
1924
1933
1936
1945 static std::string labelNetworkOrSubnet(ConstSubnetPtr subnet);
1946};
1947
1949typedef boost::shared_ptr<AllocEngine> AllocEnginePtr;
1950
1951} // namespace dhcp
1952} // namespace isc
1953
1954#endif // ALLOC_ENGINE_H
Defines elements for storing the names of client classes.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
Defines a single hint.
uint8_t prefix_len_
The prefix length (128 for an address).
uint32_t valid_
The valid lifetime (0 when not set).
bool operator==(const Resource &other) const
Equality operator.
Resource(const isc::asiolink::IOAddress &address, const uint8_t prefix_len=128, const uint32_t preferred=0, const uint32_t valid=0)
Default constructor.
bool equals(const Resource &other) const
Compares two AllocEngine::Resource objects for equality.
uint8_t getPrefixLength() const
Returns the prefix length.
uint32_t preferred_
The preferred lifetime (0 when not set).
uint32_t getPreferred() const
Returns the optional preferred lifetime.
isc::asiolink::IOAddress getAddress() const
Returns the address.
uint32_t getValid() const
Returns the optional valid lifetime.
isc::asiolink::IOAddress address_
The address or prefix.
std::set< Resource, ResourceCompare > ResourceContainer
Container holding allocated prefixes or addresses.
boost::shared_ptr< ClientContext4 > ClientContext4Ptr
Pointer to the ClientContext4.
static IPv6Resrv makeIPv6Resrv(const Lease6 &lease)
Creates an IPv6Resrv instance from a Lease6.
void updateLease6ExtendedInfo(const Lease6Ptr &lease, const ClientContext6 &ctx) const
Stores additional client query parameters on a V6 lease.
static void getMinValidLft(const ClientContext4 &ctx, uint32_t &valid)
Returns the valid lifetime based on the v4 context when the pool occupancy is over the adaptive lease...
void reclaimExpiredLeases6Internal(const size_t max_leases, const uint16_t timeout, const bool remove_lease, const uint16_t max_unwarned_cycles=0)
Body of reclaimExpiredLeases6.
bool updateLease4ExtendedInfo(const Lease4Ptr &lease, const ClientContext4 &ctx) const
Stores additional client query parameters on a V4 lease.
isc::util::ReadWriteMutex & getReadWriteMutex()
Get the read-write mutex.
static ConstHostPtr findGlobalReservation(ClientContext6 &ctx)
Attempts to find the host reservation for the client.
AllocEngine(isc::util::uint128_t const &attempts)
Constructor.
std::pair< Host::IdentifierType, std::vector< uint8_t > > IdentifierPair
A tuple holding host identifier type and value.
virtual ~AllocEngine()
Destructor.
void clearReclaimedExtendedInfo(const Lease4Ptr &lease) const
Clear extended info from a reclaimed V4 lease.
isc::util::ReadWriteMutex rw_mutex_
The read-write mutex.
static void getLifetimes6(ClientContext6 &ctx, uint32_t &preferred, uint32_t &valid)
Determines the preferred and valid v6 lease lifetimes.
static void findReservation(ClientContext6 &ctx)
static uint32_t getOfferLft(const ClientContext4 &ctx, bool only_on_discover=true)
Returns the offer lifetime based on the v4 context.
void reclaimExpiredLeases4Internal(const size_t max_leases, const uint16_t timeout, const bool remove_lease, const uint16_t max_unwarned_cycles=0)
Body of reclaimExpiredLeases4.
void deleteExpiredReclaimedLeases4(const uint32_t secs)
Deletes reclaimed leases expired more than specified amount of time ago.
static uint32_t getValidLft(const ClientContext4 &ctx)
Returns the valid lifetime based on the v4 context.
void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout, const bool remove_lease, const uint16_t max_unwarned_cycles=0)
Reclaims expired IPv6 leases.
std::list< IdentifierPair > IdentifierList
Map holding values to be used as host identifiers.
static std::string labelNetworkOrSubnet(ConstSubnetPtr subnet)
Generates a label for subnet or shared-network from subnet.
void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout, const bool remove_lease, const uint16_t max_unwarned_cycles=0)
Reclaims expired IPv4 leases.
static void getMinLifetimes6(ClientContext6 &ctx, uint32_t &preferred, uint32_t &valid)
Determines the preferred and valid v6 lease lifetimes when the pool occupancy is over the adaptive le...
static void getRemaining(const Lease4Ptr &lease, uint32_t &valid)
Set remaining valid life time.
Lease4Ptr allocateLease4(ClientContext4 &ctx)
Returns IPv4 lease.
void deleteExpiredReclaimedLeases6(const uint32_t secs)
Deletes reclaimed leases expired more than specified amount of time ago.
Lease6Collection allocateLeases6(ClientContext6 &ctx)
Allocates IPv6 leases for a given IA container.
Lease6Collection renewLeases6(ClientContext6 &ctx)
Renews existing DHCPv6 leases for a given IA.
std::vector< Resource > HintContainer
Container for client's hints.
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition allocator.h:64
IdentifierType
Type of the host identifier.
Definition host.h:340
IPv6 reservation for a host.
Definition host.h:166
CalloutNextStep
Specifies allowed next steps.
Defines the D2ClientConfig class.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
An abstract API for lease database.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition subnet.h:620
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition subnet.h:455
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition pkt4.h:556
boost::shared_ptr< DUID > DuidPtr
Definition duid.h:136
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition lease.h:530
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition lease.h:695
boost::shared_ptr< AllocEngine > AllocEnginePtr
A pointer to the AllocEngine object.
boost::shared_ptr< Option6IA > Option6IAPtr
A pointer to the Option6IA object.
Definition option6_ia.h:20
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
Definition hwaddr.h:166
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
Definition duid.h:216
boost::shared_ptr< Option6IAAddr > Option6IAAddrPtr
A pointer to the isc::dhcp::Option6IAAddr object.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Definition host.h:843
boost::shared_ptr< const Subnet > ConstSubnetPtr
A generic pointer to either const Subnet4 or const Subnet6 object.
Definition subnet.h:449
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition pkt6.h:31
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition lease.h:317
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
boost::multiprecision::checked_uint128_t uint128_t
Definition bigints.h:21
Defines the logger used by the top-level component of kea-lfc.
Standard implementation of read-write mutexes with writer preference using C++11 mutex and condition ...
Context information for the DHCPv4 lease allocation.
ClientIdPtr clientid_
Client identifier from the DHCP message.
DdnsParamsPtr getDdnsParams()
Returns the set of DDNS behavioral parameters based on the selected subnet.
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
ClientIdPtr getClientId() const
Returns the client identifier when the subnet match-client-id flag is true or the HW address empty.
ConstHostPtr currentHost() const
Returns host for currently selected subnet.
Pkt4Ptr query_
A pointer to the client's message.
Lease4Ptr new_lease_
A pointer to a newly allocated lease.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
ConstSubnet4Ptr subnet_
Subnet selected for the client by the server.
bool rev_dns_update_
Perform reverse DNS update.
uint32_t offer_lft_
If not zero, then we will allocate on DISCOVER for this amount of time.
bool fake_allocation_
Indicates if this is a real or fake allocation.
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
bool unknown_requested_addr_
True when the address DHCPREQUEST'ed by client is not within a dynamic pool the server knows about.
Lease4Ptr old_lease_
A pointer to an old lease that the client had before update.
ConstHostPtr globalHost() const
Returns global host reservation if there is one.
bool fwd_dns_update_
Perform forward DNS update.
asiolink::IOAddress requested_address_
An address that the client desires.
Lease4Ptr conflicting_lease_
A pointer to the object representing a lease in conflict.
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
HWAddrPtr hwaddr_
HW address from the DHCP message.
Parameters pertaining to individual IAs.
Lease6Collection old_leases_
A pointer to any old leases that the client had before update but are no longer valid after the updat...
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
Lease::Type type_
Lease type (IA or PD).
ResourceContainer new_resources_
Holds addresses and prefixes allocated for this IA.
bool isNewResource(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) const
Checks if specified address or prefix was new.
Lease6Collection changed_leases_
A pointer to any leases that have changed FQDN information.
void addHint(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128, const uint32_t preferred=0, const uint32_t valid=0)
Convenience method adding new hint.
void addNewResource(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Convenience method adding new prefix or address.
Lease6Collection reused_leases_
Set of leases marked for reuse by lease caching.
uint32_t iaid_
The IAID field from IA_NA or IA_PD that is being processed.
Context information for the DHCPv6 leases allocation.
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
std::vector< IAContext > ias_
Container holding IA specific contexts.
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
bool fake_allocation_
Indicates if this is a real or fake allocation.
ConstHostPtr currentHost() const
Returns host from the most preferred subnet.
DuidPtr duid_
Client identifier.
void addAllocatedResource(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Convenience method adding allocated prefix or address.
Lease6Collection new_leases_
A collection of newly allocated leases.
std::vector< IAContext > & getIAContexts()
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL).
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
bool isAllocated(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) const
Checks if specified address or prefix was allocated.
bool hasGlobalReservation(const IPv6Resrv &resv) const
Determines if a global reservation exists.
ResourceContainer allocated_resources_
Holds addresses and prefixes allocated for all IAs.
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
DdnsParamsPtr getDdnsParams()
Returns the set of DDNS behavioral parameters based on the selected subnet.
ConstHostPtr globalHost() const
Returns global host reservation if there is one.
Pkt6Ptr query_
A pointer to the client's message.
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
void createIAContext()
Creates new IA context.
ConstSubnet6Ptr host_subnet_
Subnet from which host reservations should be retrieved.
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
ConstSubnet6Ptr subnet_
Subnet selected for the client by the server.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
bool operator()(const Resource &lhr, const Resource &rhr) const
Compare operator.
Structure that holds a lease for IPv6 address and/or prefix.
Definition lease.h:538
Lease::Type type_
Lease type.
Definition lease.h:543
uint8_t prefixlen_
IPv6 prefix length.
Definition lease.h:548
Type
Type of lease or pool.
Definition lease.h:48
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition lease.h:49
isc::asiolink::IOAddress addr_
IPv4 ot IPv6 address.
Definition lease.h:128