Kea 2.2.0
alloc_engine.h
Go to the documentation of this file.
1// Copyright (C) 2012-2022 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>
20#include <dhcpsrv/host.h>
21#include <dhcpsrv/subnet.h>
22#include <dhcpsrv/lease_mgr.h>
23#include <dhcpsrv/srv_config.h>
27
28#include <boost/shared_ptr.hpp>
29#include <boost/noncopyable.hpp>
30
31#include <functional>
32#include <list>
33#include <map>
34#include <mutex>
35#include <set>
36#include <utility>
37
38namespace isc {
39namespace dhcp {
40
44public:
45
51 AllocFailed(const char* file, size_t line, const char* what)
52 : isc::Exception(file, line, what) {}
53};
54
63class AllocEngine : public boost::noncopyable {
64protected:
65
70 class Allocator {
71 public:
72
98 pickAddress(const SubnetPtr& subnet,
99 const ClientClasses& client_classes,
100 const DuidPtr& duid,
101 const isc::asiolink::IOAddress& hint) {
103 std::lock_guard<std::mutex> lock(mutex_);
104 return pickAddressInternal(subnet, client_classes, duid, hint);
105 } else {
106 return pickAddressInternal(subnet, client_classes, duid, hint);
107 }
108 }
109
114 Allocator(Lease::Type pool_type) : pool_type_(pool_type) {
115 }
116
118 virtual ~Allocator() {
119 }
120
121 private:
123 pickAddressInternal(const SubnetPtr& subnet,
124 const ClientClasses& client_classes,
125 const DuidPtr& duid,
126 const isc::asiolink::IOAddress& hint) = 0;
127
128 protected:
129
132
133 private:
134
136 std::mutex mutex_;
137 };
138
140 typedef boost::shared_ptr<Allocator> AllocatorPtr;
141
149 public:
150
156
157 private:
158
168 pickAddressInternal(const SubnetPtr& subnet,
169 const ClientClasses& client_classes,
170 const DuidPtr& duid,
171 const isc::asiolink::IOAddress& hint);
172
173 protected:
174
188 const uint8_t prefix_len);
189
202 bool prefix, const uint8_t prefix_len);
203 };
204
208 class HashedAllocator : public Allocator {
209 public:
210
215
216 private:
217
229 pickAddressInternal(const SubnetPtr& subnet,
230 const ClientClasses& client_classes,
231 const DuidPtr& duid,
232 const isc::asiolink::IOAddress& hint);
233 };
234
238 class RandomAllocator : public Allocator {
239 public:
240
245
246 private:
247
259 pickAddressInternal(const SubnetPtr& subnet,
260 const ClientClasses& client_classes,
261 const DuidPtr& duid,
262 const isc::asiolink::IOAddress& hint);
263 };
264
265public:
266
268 typedef enum {
269 ALLOC_ITERATIVE, // iterative - one address after another
270 ALLOC_HASHED, // hashed - client's DUID/client-id is hashed
271 ALLOC_RANDOM // random - an address is randomly selected
273
285 AllocEngine(AllocType engine_type, uint64_t attempts, bool ipv6 = true);
286
288 virtual ~AllocEngine() { }
289
298
299private:
300
305 std::map<Lease::Type, AllocatorPtr> allocators_;
306
308 uint64_t attempts_;
309
311 int hook_index_lease4_select_;
312 int hook_index_lease6_select_;
313
314public:
315
324 class Resource {
325 public:
326
336 const uint8_t prefix_len,
337 const uint32_t preferred = 0,
338 const uint32_t valid = 0)
339 : address_(address), prefix_len_(prefix_len),
340 preferred_(preferred), valid_(valid) {
341 }
342
347 return (address_);
348 }
349
353 uint8_t getPrefixLength() const {
354 return (prefix_len_);
355 }
356
360 uint32_t getPreferred() const {
361 return (preferred_);
362 }
363
367 uint32_t getValid() const {
368 return (valid_);
369 }
370
376 bool equals(const Resource& other) const {
377 return (address_ == other.address_ &&
378 prefix_len_ == other.prefix_len_);
379 }
380
386 bool operator==(const Resource& other) const {
387 return (equals(other));
388 }
389
390 protected:
391
394
396 uint8_t prefix_len_;
397
399 uint32_t preferred_;
400
402 uint32_t valid_;
403 };
404
416 bool operator() (const Resource& lhr, const Resource& rhr) const {
417 if (lhr.getAddress() == rhr.getAddress()) {
418 return (lhr.getPrefixLength() < rhr.getPrefixLength());
419 } else {
420 return (lhr.getAddress() < rhr.getAddress());
421 }
422 }
423 };
424
426 typedef std::vector<Resource> HintContainer;
427
429 typedef std::set<Resource, ResourceCompare> ResourceContainer;
430
432 typedef std::pair<Host::IdentifierType, std::vector<uint8_t> > IdentifierPair;
433
435 typedef std::list<IdentifierPair> IdentifierList;
436
459 struct ClientContext6 : public boost::noncopyable {
460
462
463
468
475
480
483
488
491
494
498
504 std::map<SubnetID, ConstHostPtr> hosts_;
505
510
515
520 std::string hostname_;
521
524
527
530
532
534 struct IAContext {
535
538 uint32_t iaid_;
539
542
548
557
565
570
574
578 IAContext();
579
586 void addHint(const asiolink::IOAddress& prefix,
587 const uint8_t prefix_len = 128,
588 const uint32_t preferred = 0,
589 const uint32_t valid = 0);
590
596 void addHint(const Option6IAAddrPtr& iaaddr);
597
603 void addHint(const Option6IAPrefixPtr& iaprefix);
604
609 void addNewResource(const asiolink::IOAddress& prefix,
610 const uint8_t prefix_len = 128);
611
616 bool isNewResource(const asiolink::IOAddress& prefix,
617 const uint8_t prefix_len = 128) const;
618 };
619
621 std::vector<IAContext> ias_;
622
631
636 void addAllocatedResource(const asiolink::IOAddress& prefix,
637 const uint8_t prefix_len = 128);
638
643 bool isAllocated(const asiolink::IOAddress& prefix,
644 const uint8_t prefix_len = 128) const;
645
652 const std::vector<uint8_t>& identifier) {
653 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
654 }
655
662 if (ias_.empty()) {
664 }
665 return (ias_.back());
666 }
667
673 ias_.push_back(IAContext());
674 };
675
683
692 ConstHostPtr globalHost() const;
693
699 bool hasGlobalReservation(const IPv6Resrv& resv) const;
700
703
725 ClientContext6(const Subnet6Ptr& subnet, const DuidPtr& duid,
726 const bool fwd_dns, const bool rev_dns,
727 const std::string& hostname, const bool fake_allocation,
728 const Pkt6Ptr& query,
729 const hooks::CalloutHandlePtr& callout_handle =
731
732 private:
736 DdnsParamsPtr ddns_params_;
737 };
738
821 allocateLeases6(ClientContext6& ctx);
822
843 Lease6Collection renewLeases6(ClientContext6& ctx);
844
893 void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout,
894 const bool remove_lease,
895 const uint16_t max_unwarned_cycles = 0);
896
902 void deleteExpiredReclaimedLeases6(const uint32_t secs);
903
952 void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout,
953 const bool remove_lease,
954 const uint16_t max_unwarned_cycles = 0);
955
961 void deleteExpiredReclaimedLeases4(const uint32_t secs);
962
976 static void findReservation(ClientContext6& ctx);
977
988 static ConstHostPtr findGlobalReservation(ClientContext6& ctx);
989
995 static IPv6Resrv makeIPv6Resrv(const Lease6& lease) {
996 if (lease.type_ == Lease::TYPE_NA) {
997 return (IPv6Resrv(IPv6Resrv::TYPE_NA, lease.addr_,
998 (lease.prefixlen_ ? lease.prefixlen_ : 128)));
999 }
1000
1001 return (IPv6Resrv(IPv6Resrv::TYPE_PD, lease.addr_, lease.prefixlen_));
1002 }
1003
1004public:
1021 static void getLifetimes6(ClientContext6& ctx, uint32_t& preferred,
1022 uint32_t& valid);
1023private:
1024
1060 Lease6Ptr createLease6(ClientContext6& ctx,
1061 const isc::asiolink::IOAddress& addr,
1062 const uint8_t prefix_len,
1064
1079 Lease6Collection allocateUnreservedLeases6(ClientContext6& ctx);
1080
1097 void
1098 allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
1099
1113 void
1114 allocateGlobalReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
1115
1124 void
1125 removeNonmatchingReservedLeases6(ClientContext6& ctx,
1126 Lease6Collection& existing_leases);
1127
1135 void
1136 removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
1137 Lease6Collection& existing_leases);
1138
1152 void
1153 removeNonreservedLeases6(ClientContext6& ctx,
1154 Lease6Collection& existing_leases);
1155
1188 Lease6Ptr
1189 reuseExpiredLease(Lease6Ptr& expired,
1190 ClientContext6& ctx,
1191 uint8_t prefix_len,
1193
1212 Lease6Collection updateLeaseData(ClientContext6& ctx,
1213 const Lease6Collection& leases);
1214
1220 static bool
1221 removeLeases(Lease6Collection& container,
1222 const asiolink::IOAddress& addr);
1223
1236 void extendLease6(ClientContext6& ctx, Lease6Ptr lease);
1237
1245 enum DbReclaimMode {
1246 DB_RECLAIM_REMOVE,
1247 DB_RECLAIM_UPDATE,
1248 DB_RECLAIM_LEAVE_UNCHANGED
1249 };
1250
1262 template<typename LeasePtrType>
1263 void reclaimExpiredLease(const LeasePtrType& lease,
1264 const bool remove_lease,
1265 const hooks::CalloutHandlePtr& callout_handle);
1266
1277 template<typename LeasePtrType>
1278 void reclaimExpiredLease(const LeasePtrType& lease,
1279 const hooks::CalloutHandlePtr& callout_handle);
1280
1291 void reclaimExpiredLease(const Lease6Ptr& lease,
1292 const DbReclaimMode& reclaim_mode,
1293 const hooks::CalloutHandlePtr& callout_handle);
1294
1305 void reclaimExpiredLease(const Lease4Ptr& lease,
1306 const DbReclaimMode& reclaim_mode,
1307 const hooks::CalloutHandlePtr& callout_handle);
1308
1327 template<typename LeasePtrType>
1328 void reclaimLeaseInDatabase(const LeasePtrType& lease,
1329 const bool remove_lease,
1330 const std::function<void (const LeasePtrType&)>&
1331 lease_update_fun) const;
1332
1345 bool reclaimDeclined(const Lease4Ptr& lease);
1346
1359 bool reclaimDeclined(const Lease6Ptr& lease);
1360
1361public:
1362
1380 struct ClientContext4 : public boost::noncopyable {
1385
1388
1391
1394
1400
1403
1406
1411 std::string hostname_;
1412
1415
1422
1425
1428
1434 std::map<SubnetID, ConstHostPtr> hosts_;
1435
1442
1448
1452
1456
1465
1466
1473 const std::vector<uint8_t>& identifier) {
1474 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
1475 }
1476
1483 ConstHostPtr currentHost() const;
1484
1493 ConstHostPtr globalHost() const;
1494
1497
1512 ClientContext4(const Subnet4Ptr& subnet, const ClientIdPtr& clientid,
1513 const HWAddrPtr& hwaddr,
1514 const asiolink::IOAddress& requested_addr,
1515 const bool fwd_dns_update, const bool rev_dns_update,
1516 const std::string& hostname, const bool fake_allocation);
1517
1518 private:
1522 DdnsParamsPtr ddns_params_;
1523 };
1524
1526 typedef boost::shared_ptr<ClientContext4> ClientContext4Ptr;
1527
1634
1647 static void findReservation(ClientContext4& ctx);
1648
1660
1678 static uint32_t getValidLft(const ClientContext4& ctx);
1679
1680private:
1681
1712 Lease4Ptr discoverLease4(ClientContext4& ctx);
1713
1751 Lease4Ptr requestLease4(ClientContext4& ctx);
1752
1782 Lease4Ptr createLease4(const ClientContext4& ctx,
1783 const isc::asiolink::IOAddress& addr,
1785
1799 Lease4Ptr renewLease4(const Lease4Ptr& lease, ClientContext4& ctx);
1800
1817 Lease4Ptr
1818 reuseExpiredLease4(Lease4Ptr& expired, ClientContext4& ctx,
1820
1836 Lease4Ptr
1837 allocateOrReuseLease4(const asiolink::IOAddress& address,
1838 ClientContext4& ctx,
1840
1859 Lease4Ptr allocateUnreservedLease4(ClientContext4& ctx);
1860
1883 bool updateLease4Information(const Lease4Ptr& lease,
1884 ClientContext4& ctx) const;
1885
1886protected:
1903 bool updateLease4ExtendedInfo(const Lease4Ptr& lease,
1904 const ClientContext4& ctx) const;
1905
1923 bool updateLease6ExtendedInfo(const Lease6Ptr& lease,
1924 const ClientContext6& ctx) const;
1925
1926private:
1927
1941 void setLeaseReusable(const Lease4Ptr& lease,
1942 const ClientContext4& ctx) const;
1943
1958 void setLeaseReusable(const Lease6Ptr& lease,
1959 uint32_t current_preferred_lft,
1960 const ClientContext6& ctx) const;
1961
1962private:
1963
1966 uint16_t incomplete_v4_reclamations_;
1967
1970 uint16_t incomplete_v6_reclamations_;
1971
1972public:
1973
1980 return (rw_mutex_);
1981 }
1982
1985};
1986
1988typedef boost::shared_ptr<AllocEngine> AllocEnginePtr;
1989
1990} // namespace dhcp
1991} // namespace isc
1992
1993#endif // ALLOC_ENGINE_H
Defines elements for storing the names of client classes.
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Base class for all address/prefix allocation algorithms.
Definition: alloc_engine.h:70
virtual ~Allocator()
Virtual destructor.
Definition: alloc_engine.h:118
Lease::Type pool_type_
Defines pool type allocation.
Definition: alloc_engine.h:131
Allocator(Lease::Type pool_type)
Default constructor.
Definition: alloc_engine.h:114
virtual isc::asiolink::IOAddress pickAddress(const SubnetPtr &subnet, const ClientClasses &client_classes, const DuidPtr &duid, const isc::asiolink::IOAddress &hint)
Picks one address out of available pools in a given subnet.
Definition: alloc_engine.h:98
Address/prefix allocator that gets an address based on a hash.
Definition: alloc_engine.h:208
HashedAllocator(Lease::Type type)
Default constructor (does nothing)
Address/prefix allocator that iterates over all addresses.
Definition: alloc_engine.h:148
static isc::asiolink::IOAddress increasePrefix(const isc::asiolink::IOAddress &prefix, const uint8_t prefix_len)
Returns the next prefix.
Definition: alloc_engine.cc:98
static isc::asiolink::IOAddress increaseAddress(const isc::asiolink::IOAddress &address, bool prefix, const uint8_t prefix_len)
Returns the next address or prefix.
IterativeAllocator(Lease::Type type)
Default constructor.
Definition: alloc_engine.cc:93
Random allocator that picks address randomly.
Definition: alloc_engine.h:238
RandomAllocator(Lease::Type type)
Default constructor (does nothing)
Defines a single hint.
Definition: alloc_engine.h:324
uint8_t prefix_len_
The prefix length (128 for an address).
Definition: alloc_engine.h:396
uint32_t valid_
The valid lifetime (0 when not set).
Definition: alloc_engine.h:402
bool operator==(const Resource &other) const
Equality operator.
Definition: alloc_engine.h:386
bool equals(const Resource &other) const
Compares two AllocEngine::Resource objects for equality.
Definition: alloc_engine.h:376
uint8_t getPrefixLength() const
Returns the prefix length.
Definition: alloc_engine.h:353
uint32_t preferred_
The preferred lifetime (0 when not set).
Definition: alloc_engine.h:399
uint32_t getPreferred() const
Returns the optional preferred lifetime.
Definition: alloc_engine.h:360
isc::asiolink::IOAddress getAddress() const
Returns the address.
Definition: alloc_engine.h:346
uint32_t getValid() const
Returns the optional valid lifetime.
Definition: alloc_engine.h:367
Resource(const isc::asiolink::IOAddress &address, const uint8_t prefix_len, const uint32_t preferred=0, const uint32_t valid=0)
Default constructor.
Definition: alloc_engine.h:335
isc::asiolink::IOAddress address_
The address or prefix.
Definition: alloc_engine.h:393
DHCPv4 and DHCPv6 allocation engine.
Definition: alloc_engine.h:63
bool updateLease6ExtendedInfo(const Lease6Ptr &lease, const ClientContext6 &ctx) const
Stores additional client query parameters on a V6 lease.
std::set< Resource, ResourceCompare > ResourceContainer
Container holding allocated prefixes or addresses.
Definition: alloc_engine.h:429
boost::shared_ptr< ClientContext4 > ClientContext4Ptr
Pointer to the ClientContext4.
static IPv6Resrv makeIPv6Resrv(const Lease6 &lease)
Creates an IPv6Resrv instance from a Lease6.
Definition: alloc_engine.h:995
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.
AllocType
Specifies allocation type.
Definition: alloc_engine.h:268
static ConstHostPtr findGlobalReservation(ClientContext6 &ctx)
Attempts to find the host reservation for the client.
std::pair< Host::IdentifierType, std::vector< uint8_t > > IdentifierPair
A tuple holding host identifier type and value.
Definition: alloc_engine.h:432
virtual ~AllocEngine()
Destructor.
Definition: alloc_engine.h:288
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)
boost::shared_ptr< Allocator > AllocatorPtr
defines a pointer to allocator
Definition: alloc_engine.h:140
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.
AllocEngine(AllocType engine_type, uint64_t attempts, bool ipv6=true)
Constructor.
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.
Definition: alloc_engine.h:435
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.
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.
AllocatorPtr getAllocator(Lease::Type type)
Returns allocator for a given pool type.
std::vector< Resource > HintContainer
Container for client's hints.
Definition: alloc_engine.h:426
An exception that is thrown when allocation module fails (e.g.
Definition: alloc_engine.h:43
AllocFailed(const char *file, size_t line, const char *what)
Constructor.
Definition: alloc_engine.h:51
Container for storing client class names.
Definition: classify.h:70
IdentifierType
Type of the host identifier.
Definition: host.h:307
IPv6 reservation for a host.
Definition: host.h:161
CalloutNextStep
Specifies allowed next steps.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
Defines the D2ClientConfig class.
An abstract API for lease database.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition: subnet.h:515
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:524
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:544
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition: lease.h:503
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition: lease.h:661
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:17
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition: subnet.h:672
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
Definition: srv_config.h:172
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< ClientId > ClientIdPtr
Shared pointer to a Client ID.
Definition: duid.h:103
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:788
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition: pkt6.h:28
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:284
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
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.
Subnet4Ptr subnet_
Subnet selected for the client by the server.
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.
bool rev_dns_update_
Perform reverse DNS update.
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.
Definition: alloc_engine.h:534
Lease6Collection old_leases_
A pointer to any old leases that the client had before update but are no longer valid after the updat...
Definition: alloc_engine.h:556
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
Definition: alloc_engine.h:573
Lease::Type type_
Lease type (IA or PD)
Definition: alloc_engine.h:541
ResourceContainer new_resources_
Holds addresses and prefixes allocated for this IA.
Definition: alloc_engine.h:569
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.
Definition: alloc_engine.h:564
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.
uint32_t iaid_
The IAID field from IA_NA or IA_PD that is being processed.
Definition: alloc_engine.h:538
Context information for the DHCPv6 leases allocation.
Definition: alloc_engine.h:459
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
Definition: alloc_engine.h:661
std::vector< IAContext > ias_
Container holding IA specific contexts.
Definition: alloc_engine.h:621
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
Definition: alloc_engine.h:651
bool fake_allocation_
Indicates if this is a real or fake allocation.
Definition: alloc_engine.h:474
ConstHostPtr currentHost() const
Returns host from the most preferred subnet.
DuidPtr duid_
Client identifier.
Definition: alloc_engine.h:490
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.
Definition: alloc_engine.h:529
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
Definition: alloc_engine.h:493
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
Definition: alloc_engine.h:523
bool isAllocated(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) const
Checks if specified address or prefix was allocated.
Subnet6Ptr subnet_
Subnet selected for the client by the server.
Definition: alloc_engine.h:482
Subnet6Ptr host_subnet_
Subnet from which host reservations should be retrieved.
Definition: alloc_engine.h:487
bool hasGlobalReservation(const IPv6Resrv &resv) const
Determines if a global reservation exists.
ResourceContainer allocated_resources_
Holds addresses and prefixes allocated for all IAs.
Definition: alloc_engine.h:526
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
Definition: alloc_engine.h:514
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.
Definition: alloc_engine.h:467
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
Definition: alloc_engine.h:479
void createIAContext()
Creates new IA context.
Definition: alloc_engine.h:672
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
Definition: alloc_engine.h:497
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
Definition: alloc_engine.h:504
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
Definition: alloc_engine.h:509
bool operator()(const Resource &lhr, const Resource &rhr) const
Compare operator.
Definition: alloc_engine.h:416
Structure that holds a lease for IPv6 address and/or prefix.
Definition: lease.h:514
Lease::Type type_
Lease type.
Definition: lease.h:519
uint8_t prefixlen_
IPv6 prefix length.
Definition: lease.h:524
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:120