Kea 2.0.1
alloc_engine.h
Go to the documentation of this file.
1// Copyright (C) 2012-2021 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
478
483
486
489
493
499 std::map<SubnetID, ConstHostPtr> hosts_;
500
505
510
515 std::string hostname_;
516
519
522
525
527
529 struct IAContext {
530
533 uint32_t iaid_;
534
537
543
552
560
565
569
573 IAContext();
574
581 void addHint(const asiolink::IOAddress& prefix,
582 const uint8_t prefix_len = 128,
583 const uint32_t preferred = 0,
584 const uint32_t valid = 0);
585
591 void addHint(const Option6IAAddrPtr& iaaddr);
592
598 void addHint(const Option6IAPrefixPtr& iaprefix);
599
604 void addNewResource(const asiolink::IOAddress& prefix,
605 const uint8_t prefix_len = 128);
606
611 bool isNewResource(const asiolink::IOAddress& prefix,
612 const uint8_t prefix_len = 128) const;
613 };
614
616 std::vector<IAContext> ias_;
617
626
631 void addAllocatedResource(const asiolink::IOAddress& prefix,
632 const uint8_t prefix_len = 128);
633
638 bool isAllocated(const asiolink::IOAddress& prefix,
639 const uint8_t prefix_len = 128) const;
640
647 const std::vector<uint8_t>& identifier) {
648 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
649 }
650
657 if (ias_.empty()) {
659 }
660 return (ias_.back());
661 }
662
668 ias_.push_back(IAContext());
669 };
670
678
687 ConstHostPtr globalHost() const;
688
694 bool hasGlobalReservation(const IPv6Resrv& resv) const;
695
698
720 ClientContext6(const Subnet6Ptr& subnet, const DuidPtr& duid,
721 const bool fwd_dns, const bool rev_dns,
722 const std::string& hostname, const bool fake_allocation,
723 const Pkt6Ptr& query,
724 const hooks::CalloutHandlePtr& callout_handle =
726
727 private:
731 DdnsParamsPtr ddns_params_;
732 };
733
816 allocateLeases6(ClientContext6& ctx);
817
838 Lease6Collection renewLeases6(ClientContext6& ctx);
839
888 void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout,
889 const bool remove_lease,
890 const uint16_t max_unwarned_cycles = 0);
891
897 void deleteExpiredReclaimedLeases6(const uint32_t secs);
898
947 void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout,
948 const bool remove_lease,
949 const uint16_t max_unwarned_cycles = 0);
950
956 void deleteExpiredReclaimedLeases4(const uint32_t secs);
957
971 static void findReservation(ClientContext6& ctx);
972
983 static ConstHostPtr findGlobalReservation(ClientContext6& ctx);
984
990 static IPv6Resrv makeIPv6Resrv(const Lease6& lease) {
991 if (lease.type_ == Lease::TYPE_NA) {
992 return (IPv6Resrv(IPv6Resrv::TYPE_NA, lease.addr_,
993 (lease.prefixlen_ ? lease.prefixlen_ : 128)));
994 }
995
996 return (IPv6Resrv(IPv6Resrv::TYPE_PD, lease.addr_, lease.prefixlen_));
997 }
998
999public:
1016 static void getLifetimes6(ClientContext6& ctx, uint32_t& preferred,
1017 uint32_t& valid);
1018private:
1019
1055 Lease6Ptr createLease6(ClientContext6& ctx,
1056 const isc::asiolink::IOAddress& addr,
1057 const uint8_t prefix_len,
1059
1074 Lease6Collection allocateUnreservedLeases6(ClientContext6& ctx);
1075
1092 void
1093 allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
1094
1108 void
1109 allocateGlobalReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
1110
1119 void
1120 removeNonmatchingReservedLeases6(ClientContext6& ctx,
1121 Lease6Collection& existing_leases);
1122
1130 void
1131 removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
1132 Lease6Collection& existing_leases);
1133
1147 void
1148 removeNonreservedLeases6(ClientContext6& ctx,
1149 Lease6Collection& existing_leases);
1150
1183 Lease6Ptr
1184 reuseExpiredLease(Lease6Ptr& expired,
1185 ClientContext6& ctx,
1186 uint8_t prefix_len,
1188
1207 Lease6Collection updateLeaseData(ClientContext6& ctx,
1208 const Lease6Collection& leases);
1209
1215 static bool
1216 removeLeases(Lease6Collection& container,
1217 const asiolink::IOAddress& addr);
1218
1231 void extendLease6(ClientContext6& ctx, Lease6Ptr lease);
1232
1240 enum DbReclaimMode {
1241 DB_RECLAIM_REMOVE,
1242 DB_RECLAIM_UPDATE,
1243 DB_RECLAIM_LEAVE_UNCHANGED
1244 };
1245
1257 template<typename LeasePtrType>
1258 void reclaimExpiredLease(const LeasePtrType& lease,
1259 const bool remove_lease,
1260 const hooks::CalloutHandlePtr& callout_handle);
1261
1272 template<typename LeasePtrType>
1273 void reclaimExpiredLease(const LeasePtrType& lease,
1274 const hooks::CalloutHandlePtr& callout_handle);
1275
1286 void reclaimExpiredLease(const Lease6Ptr& lease,
1287 const DbReclaimMode& reclaim_mode,
1288 const hooks::CalloutHandlePtr& callout_handle);
1289
1300 void reclaimExpiredLease(const Lease4Ptr& lease,
1301 const DbReclaimMode& reclaim_mode,
1302 const hooks::CalloutHandlePtr& callout_handle);
1303
1322 template<typename LeasePtrType>
1323 void reclaimLeaseInDatabase(const LeasePtrType& lease,
1324 const bool remove_lease,
1325 const std::function<void (const LeasePtrType&)>&
1326 lease_update_fun) const;
1327
1340 bool reclaimDeclined(const Lease4Ptr& lease);
1341
1354 bool reclaimDeclined(const Lease6Ptr& lease);
1355
1356public:
1357
1375 struct ClientContext4 : public boost::noncopyable {
1378
1381
1384
1390
1393
1396
1401 std::string hostname_;
1402
1405
1412
1415
1418
1424 std::map<SubnetID, ConstHostPtr> hosts_;
1425
1432
1438
1442
1451
1458 const std::vector<uint8_t>& identifier) {
1459 host_identifiers_.push_back(IdentifierPair(id_type, identifier));
1460 }
1461
1468 ConstHostPtr currentHost() const;
1469
1478 ConstHostPtr globalHost() const;
1479
1482
1497 ClientContext4(const Subnet4Ptr& subnet, const ClientIdPtr& clientid,
1498 const HWAddrPtr& hwaddr,
1499 const asiolink::IOAddress& requested_addr,
1500 const bool fwd_dns_update, const bool rev_dns_update,
1501 const std::string& hostname, const bool fake_allocation);
1502
1503 private:
1507 DdnsParamsPtr ddns_params_;
1508 };
1509
1511 typedef boost::shared_ptr<ClientContext4> ClientContext4Ptr;
1512
1619
1632 static void findReservation(ClientContext4& ctx);
1633
1645
1663 static uint32_t getValidLft(const ClientContext4& ctx);
1664
1665private:
1666
1697 Lease4Ptr discoverLease4(ClientContext4& ctx);
1698
1736 Lease4Ptr requestLease4(ClientContext4& ctx);
1737
1767 Lease4Ptr createLease4(const ClientContext4& ctx,
1768 const isc::asiolink::IOAddress& addr,
1770
1784 Lease4Ptr renewLease4(const Lease4Ptr& lease, ClientContext4& ctx);
1785
1802 Lease4Ptr
1803 reuseExpiredLease4(Lease4Ptr& expired, ClientContext4& ctx,
1805
1821 Lease4Ptr
1822 allocateOrReuseLease4(const asiolink::IOAddress& address,
1823 ClientContext4& ctx,
1825
1844 Lease4Ptr allocateUnreservedLease4(ClientContext4& ctx);
1845
1868 bool updateLease4Information(const Lease4Ptr& lease,
1869 ClientContext4& ctx) const;
1870
1871protected:
1888 bool updateLease4ExtendedInfo(const Lease4Ptr& lease,
1889 const ClientContext4& ctx) const;
1890
1908 bool updateLease6ExtendedInfo(const Lease6Ptr& lease,
1909 const ClientContext6& ctx) const;
1910
1911private:
1912
1926 void setLeaseReusable(const Lease4Ptr& lease,
1927 const ClientContext4& ctx) const;
1928
1943 void setLeaseReusable(const Lease6Ptr& lease,
1944 uint32_t current_preferred_lft,
1945 const ClientContext6& ctx) const;
1946
1947private:
1948
1951 uint16_t incomplete_v4_reclamations_;
1952
1955 uint16_t incomplete_v6_reclamations_;
1956
1957public:
1958
1965 return (rw_mutex_);
1966 }
1967
1970};
1971
1973typedef boost::shared_ptr<AllocEngine> AllocEnginePtr;
1974
1975} // namespace dhcp
1976} // namespace isc
1977
1978#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:990
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:43
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:513
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:522
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:492
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition: lease.h:640
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:670
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
Definition: srv_config.h:162
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:283
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.
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.
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:529
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:551
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
Definition: alloc_engine.h:568
Lease::Type type_
Lease type (IA or PD)
Definition: alloc_engine.h:536
ResourceContainer new_resources_
Holds addresses and prefixes allocated for this IA.
Definition: alloc_engine.h:564
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:559
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:533
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:656
std::vector< IAContext > ias_
Container holding IA specific contexts.
Definition: alloc_engine.h:616
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:646
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:485
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:524
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
Definition: alloc_engine.h:488
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
Definition: alloc_engine.h:518
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:477
Subnet6Ptr host_subnet_
Subnet from which host reservations should be retrieved.
Definition: alloc_engine.h:482
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:521
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
Definition: alloc_engine.h:509
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
void createIAContext()
Creates new IA context.
Definition: alloc_engine.h:667
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
Definition: alloc_engine.h:492
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
Definition: alloc_engine.h:499
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
Definition: alloc_engine.h:504
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:503
Lease::Type type_
Lease type.
Definition: lease.h:508
uint8_t prefixlen_
IPv6 prefix length.
Definition: lease.h:513
Type
Type of lease or pool.
Definition: lease.h:50
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition: lease.h:51
isc::asiolink::IOAddress addr_
IPv4 ot IPv6 address.
Definition: lease.h:119