Kea 3.1.1
alloc_engine.h
Go to the documentation of this file.
1// Copyright (C) 2012-2025 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/pkt4.h>
15#include <dhcp/pkt6.h>
16#include <dhcp/option6_ia.h>
17#include <dhcp/option6_iaaddr.h>
19#include <dhcpsrv/allocator.h>
21#include <dhcpsrv/host.h>
22#include <dhcpsrv/subnet.h>
23#include <dhcpsrv/lease_mgr.h>
24#include <dhcpsrv/srv_config.h>
28
29#include <boost/shared_ptr.hpp>
30#include <boost/noncopyable.hpp>
31
32#include <functional>
33#include <list>
34#include <map>
35#include <mutex>
36#include <set>
37#include <utility>
38
39namespace isc {
40namespace dhcp {
41
47class AllocEngine : public boost::noncopyable {
48public:
49
59 AllocEngine(isc::util::uint128_t const& attempts);
60
62 virtual ~AllocEngine() { }
63
64private:
65
67 isc::util::uint128_t attempts_;
68
70 int hook_index_lease4_select_;
71 int hook_index_lease6_select_;
72
73public:
74
83 class Resource {
84 public:
85
95 const uint8_t prefix_len = 128,
96 const uint32_t preferred = 0,
97 const uint32_t valid = 0)
98 : address_(address), prefix_len_(prefix_len),
99 preferred_(preferred), valid_(valid) {
100 }
101
106 return (address_);
107 }
108
112 uint8_t getPrefixLength() const {
113 return (prefix_len_);
114 }
115
119 uint32_t getPreferred() const {
120 return (preferred_);
121 }
122
126 uint32_t getValid() const {
127 return (valid_);
128 }
129
135 bool equals(const Resource& other) const {
136 return (address_ == other.address_ &&
137 prefix_len_ == other.prefix_len_);
138 }
139
145 bool operator==(const Resource& other) const {
146 return (equals(other));
147 }
148
149 protected:
150
153
155 uint8_t prefix_len_;
156
158 uint32_t preferred_;
159
161 uint32_t valid_;
162 };
163
175 bool operator() (const Resource& lhr, const Resource& rhr) const {
176 if (lhr.getAddress() == rhr.getAddress()) {
177 return (lhr.getPrefixLength() < rhr.getPrefixLength());
178 } else {
179 return (lhr.getAddress() < rhr.getAddress());
180 }
181 }
182 };
183
185 typedef std::vector<Resource> HintContainer;
186
188 typedef std::set<Resource, ResourceCompare> ResourceContainer;
189
191 typedef std::pair<Host::IdentifierType, std::vector<uint8_t> > IdentifierPair;
192
194 typedef std::list<IdentifierPair> IdentifierList;
195
218 struct ClientContext6 : public boost::noncopyable {
219
221
222
227
234
239
242
247
250
253
257
263 std::map<SubnetID, ConstHostPtr> hosts_;
264
269
274
279 std::string hostname_;
280
283
286
289
291
293 struct IAContext {
294
297 uint32_t iaid_;
298
301
307
316
324
327
332
336
340 IAContext();
341
348 void addHint(const asiolink::IOAddress& prefix,
349 const uint8_t prefix_len = 128,
350 const uint32_t preferred = 0,
351 const uint32_t valid = 0);
352
358 void addHint(const Option6IAAddrPtr& iaaddr);
359
365 void addHint(const Option6IAPrefixPtr& iaprefix);
366
371 void addNewResource(const asiolink::IOAddress& prefix,
372 const uint8_t prefix_len = 128);
373
378 bool isNewResource(const asiolink::IOAddress& prefix,
379 const uint8_t prefix_len = 128) const;
380 };
381
383 std::vector<IAContext> ias_;
384
393
398 void addAllocatedResource(const asiolink::IOAddress& prefix,
399 const uint8_t prefix_len = 128);
400
405 bool isAllocated(const asiolink::IOAddress& prefix,
406 const uint8_t prefix_len = 128) const;
407
414 const std::vector<uint8_t>& identifier) {
415 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
416 }
417
424 if (ias_.empty()) {
426 }
427 return (ias_.back());
428 }
429
430 std::vector<IAContext>& getIAContexts() {
431 return (ias_);
432 }
433
439 ias_.push_back(IAContext());
440 }
441
449
458 ConstHostPtr globalHost() const;
459
465 bool hasGlobalReservation(const IPv6Resrv& resv) const;
466
469
491 ClientContext6(const ConstSubnet6Ptr& subnet, const DuidPtr& duid,
492 const bool fwd_dns, const bool rev_dns,
493 const std::string& hostname, const bool fake_allocation,
494 const Pkt6Ptr& query,
495 const hooks::CalloutHandlePtr& callout_handle =
497
498 private:
502 DdnsParamsPtr ddns_params_;
503 };
504
587 allocateLeases6(ClientContext6& ctx);
588
609 Lease6Collection renewLeases6(ClientContext6& ctx);
610
659 void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout,
660 const bool remove_lease,
661 const uint16_t max_unwarned_cycles = 0);
662
675 void reclaimExpiredLeases6Internal(const size_t max_leases,
676 const uint16_t timeout,
677 const bool remove_lease,
678 const uint16_t max_unwarned_cycles = 0);
679
685 void deleteExpiredReclaimedLeases6(const uint32_t secs);
686
735 void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout,
736 const bool remove_lease,
737 const uint16_t max_unwarned_cycles = 0);
738
751 void reclaimExpiredLeases4Internal(const size_t max_leases,
752 const uint16_t timeout,
753 const bool remove_lease,
754 const uint16_t max_unwarned_cycles = 0);
755
761 void deleteExpiredReclaimedLeases4(const uint32_t secs);
762
776 static void findReservation(ClientContext6& ctx);
777
788 static ConstHostPtr findGlobalReservation(ClientContext6& ctx);
789
795 static IPv6Resrv makeIPv6Resrv(const Lease6& lease) {
796 if (lease.type_ == Lease::TYPE_NA) {
797 return (IPv6Resrv(IPv6Resrv::TYPE_NA, lease.addr_,
798 (lease.prefixlen_ ? lease.prefixlen_ : 128)));
799 }
800
801 return (IPv6Resrv(IPv6Resrv::TYPE_PD, lease.addr_, lease.prefixlen_));
802 }
803
804public:
821 static void getLifetimes6(ClientContext6& ctx, uint32_t& preferred,
822 uint32_t& valid);
823
837 static void getMinLifetimes6(ClientContext6& ctx, uint32_t& preferred,
838 uint32_t& valid);
839private:
840
876 Lease6Ptr createLease6(ClientContext6& ctx,
877 const isc::asiolink::IOAddress& addr,
878 const uint8_t prefix_len,
880
895 Lease6Collection allocateUnreservedLeases6(ClientContext6& ctx);
896
937 Lease6Ptr allocateBestMatch(ClientContext6& ctx,
938 Lease6Ptr& hint_lease,
939 bool& search_hint_lease,
940 const isc::asiolink::IOAddress& hint,
941 uint8_t hint_prefix_length,
942 ConstSubnet6Ptr original_subnet,
943 SharedNetwork6Ptr& network,
944 uint64_t& total_attempts,
945 uint64_t& subnets_with_unavail_leases,
946 uint64_t& subnets_with_unavail_pools,
948 Allocator::PrefixLenMatchType prefix_length_match);
949
966 void
967 allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
968
982 void
983 allocateGlobalReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
984
993 void
994 removeNonmatchingReservedLeases6(ClientContext6& ctx,
995 Lease6Collection& existing_leases);
996
1004 void
1005 removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
1006 Lease6Collection& existing_leases);
1007
1021 void
1022 removeNonreservedLeases6(ClientContext6& ctx,
1023 Lease6Collection& existing_leases);
1024
1057 Lease6Ptr
1058 reuseExpiredLease(Lease6Ptr& expired,
1059 ClientContext6& ctx,
1060 uint8_t prefix_len,
1062
1081 Lease6Collection updateLeaseData(ClientContext6& ctx,
1082 const Lease6Collection& leases);
1083
1089 static bool
1090 removeLeases(Lease6Collection& container,
1091 const asiolink::IOAddress& addr);
1092
1105 void extendLease6(ClientContext6& ctx, Lease6Ptr lease);
1106
1114 enum DbReclaimMode {
1115 DB_RECLAIM_REMOVE,
1116 DB_RECLAIM_UPDATE,
1117 DB_RECLAIM_LEAVE_UNCHANGED
1118 };
1119
1131 template<typename LeasePtrType>
1132 void reclaimExpiredLease(const LeasePtrType& lease,
1133 const bool remove_lease,
1134 const hooks::CalloutHandlePtr& callout_handle);
1135
1146 template<typename LeasePtrType>
1147 void reclaimExpiredLease(const LeasePtrType& lease,
1148 const hooks::CalloutHandlePtr& callout_handle);
1149
1160 void reclaimExpiredLease(const Lease6Ptr& lease,
1161 const DbReclaimMode& reclaim_mode,
1162 const hooks::CalloutHandlePtr& callout_handle);
1163
1174 void reclaimExpiredLease(const Lease4Ptr& lease,
1175 const DbReclaimMode& reclaim_mode,
1176 const hooks::CalloutHandlePtr& callout_handle);
1177
1196 template<typename LeasePtrType>
1197 void reclaimLeaseInDatabase(const LeasePtrType& lease,
1198 const bool remove_lease,
1199 const std::function<void (const LeasePtrType&)>&
1200 lease_update_fun) const;
1201
1214 bool reclaimDeclined(const Lease4Ptr& lease);
1215
1228 bool reclaimDeclined(const Lease6Ptr& lease);
1229
1230public:
1231
1249 struct ClientContext4 : public boost::noncopyable {
1254
1257
1260
1263
1269
1272
1275
1280 std::string hostname_;
1281
1284
1291
1294 uint32_t offer_lft_;
1295
1298
1301
1307 std::map<SubnetID, ConstHostPtr> hosts_;
1308
1315
1321
1325
1329
1338
1339
1346 const std::vector<uint8_t>& identifier) {
1347 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
1348 }
1349
1356 ConstHostPtr currentHost() const;
1357
1366 ConstHostPtr globalHost() const;
1367
1370
1387 ClientContext4(const ConstSubnet4Ptr& subnet,
1388 const ClientIdPtr& clientid,
1389 const HWAddrPtr& hwaddr,
1390 const asiolink::IOAddress& requested_addr,
1391 const bool fwd_dns_update, const bool rev_dns_update,
1392 const std::string& hostname, const bool fake_allocation,
1393 const uint32_t offer_lft = 0);
1394 private:
1398 DdnsParamsPtr ddns_params_;
1399 };
1400
1402 typedef boost::shared_ptr<ClientContext4> ClientContext4Ptr;
1403
1510
1523 static void findReservation(ClientContext4& ctx);
1524
1536
1554 static uint32_t getValidLft(const ClientContext4& ctx);
1555
1569 static void getMinValidLft(const ClientContext4& ctx, uint32_t& valid);
1570
1587 static uint32_t getOfferLft(const ClientContext4& ctx,
1588 bool only_on_discover = true);
1593 static void getRemaining(const Lease4Ptr& lease, uint32_t& valid);
1594
1600 static void getRemaining(const Lease6Ptr& lease, uint32_t& preferred,
1601 uint32_t& valid);
1602
1603private:
1604
1635 Lease4Ptr discoverLease4(ClientContext4& ctx);
1636
1674 Lease4Ptr requestLease4(ClientContext4& ctx);
1675
1705 Lease4Ptr createLease4(const ClientContext4& ctx,
1706 const isc::asiolink::IOAddress& addr,
1708
1722 Lease4Ptr renewLease4(const Lease4Ptr& lease, ClientContext4& ctx);
1723
1740 Lease4Ptr
1741 reuseExpiredLease4(Lease4Ptr& expired, ClientContext4& ctx,
1743
1759 Lease4Ptr
1760 allocateOrReuseLease4(const asiolink::IOAddress& address,
1761 ClientContext4& ctx,
1763
1782 Lease4Ptr allocateUnreservedLease4(ClientContext4& ctx);
1783
1806 bool updateLease4Information(const Lease4Ptr& lease,
1807 ClientContext4& ctx) const;
1808
1809protected:
1826 bool updateLease4ExtendedInfo(const Lease4Ptr& lease,
1827 const ClientContext4& ctx) const;
1828
1844 void updateLease6ExtendedInfo(const Lease6Ptr& lease,
1845 const ClientContext6& ctx) const;
1846
1850 void clearReclaimedExtendedInfo(const Lease4Ptr& lease) const;
1851
1855 void clearReclaimedExtendedInfo(const Lease6Ptr& lease) const;
1856
1857private:
1858
1872 void setLeaseReusable(const Lease4Ptr& lease,
1873 const ClientContext4& ctx) const;
1874
1889 void setLeaseReusable(const Lease6Ptr& lease,
1890 uint32_t current_preferred_lft,
1891 const ClientContext6& ctx) const;
1892
1893private:
1894
1897 uint16_t incomplete_v4_reclamations_;
1898
1901 uint16_t incomplete_v6_reclamations_;
1902
1903public:
1904
1913
1916
1925 static std::string labelNetworkOrSubnet(ConstSubnetPtr subnet);
1926};
1927
1929typedef boost::shared_ptr<AllocEngine> AllocEnginePtr;
1930
1931} // namespace dhcp
1932} // namespace isc
1933
1934#endif // ALLOC_ENGINE_H
Defines elements for storing the names of client classes.
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:61
IdentifierType
Type of the host identifier.
Definition host.h:337
IPv6 reservation for a host.
Definition host.h:163
CalloutNextStep
Specifies allowed next steps.
Defines the D2ClientConfig class.
An abstract API for lease database.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition subnet.h:623
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition subnet.h:458
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:528
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition lease.h:693
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:154
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:840
boost::shared_ptr< const Subnet > ConstSubnetPtr
A generic pointer to either const Subnet4 or const Subnet6 object.
Definition subnet.h:452
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:315
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.
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.
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:536
Lease::Type type_
Lease type.
Definition lease.h:541
uint8_t prefixlen_
IPv6 prefix length.
Definition lease.h:546
Type
Type of lease or pool.
Definition lease.h:46
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition lease.h:47
isc::asiolink::IOAddress addr_
IPv4 ot IPv6 address.
Definition lease.h:126