Kea  2.3.7
alloc_engine.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2023 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef 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>
18 #include <dhcp/option6_iaprefix.h>
19 #include <dhcpsrv/allocator.h>
20 #include <dhcpsrv/d2_client_cfg.h>
21 #include <dhcpsrv/host.h>
22 #include <dhcpsrv/subnet.h>
23 #include <dhcpsrv/lease_mgr.h>
24 #include <dhcpsrv/srv_config.h>
25 #include <hooks/callout_handle.h>
27 #include <util/readwrite_mutex.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 
39 namespace isc {
40 namespace dhcp {
41 
47 class AllocEngine : public boost::noncopyable {
48 public:
49 
59  AllocEngine(uint64_t attempts);
60 
62  virtual ~AllocEngine() { }
63 
64 private:
65 
67  uint64_t attempts_;
68 
70  int hook_index_lease4_select_;
71  int hook_index_lease6_select_;
72 
73 public:
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 
329 
333 
337  IAContext();
338 
345  void addHint(const asiolink::IOAddress& prefix,
346  const uint8_t prefix_len = 128,
347  const uint32_t preferred = 0,
348  const uint32_t valid = 0);
349 
355  void addHint(const Option6IAAddrPtr& iaaddr);
356 
362  void addHint(const Option6IAPrefixPtr& iaprefix);
363 
368  void addNewResource(const asiolink::IOAddress& prefix,
369  const uint8_t prefix_len = 128);
370 
375  bool isNewResource(const asiolink::IOAddress& prefix,
376  const uint8_t prefix_len = 128) const;
377  };
378 
380  std::vector<IAContext> ias_;
381 
390 
395  void addAllocatedResource(const asiolink::IOAddress& prefix,
396  const uint8_t prefix_len = 128);
397 
402  bool isAllocated(const asiolink::IOAddress& prefix,
403  const uint8_t prefix_len = 128) const;
404 
411  const std::vector<uint8_t>& identifier) {
412  host_identifiers_.push_back(IdentifierPair(id_type, identifier));
413  }
414 
421  if (ias_.empty()) {
422  createIAContext();
423  }
424  return (ias_.back());
425  }
426 
432  ias_.push_back(IAContext());
433  };
434 
441  ConstHostPtr currentHost() const;
442 
451  ConstHostPtr globalHost() const;
452 
458  bool hasGlobalReservation(const IPv6Resrv& resv) const;
459 
461  ClientContext6();
462 
484  ClientContext6(const Subnet6Ptr& subnet, const DuidPtr& duid,
485  const bool fwd_dns, const bool rev_dns,
486  const std::string& hostname, const bool fake_allocation,
487  const Pkt6Ptr& query,
488  const hooks::CalloutHandlePtr& callout_handle =
490 
491  private:
495  DdnsParamsPtr ddns_params_;
496  };
497 
580  allocateLeases6(ClientContext6& ctx);
581 
602  Lease6Collection renewLeases6(ClientContext6& ctx);
603 
652  void reclaimExpiredLeases6(const size_t max_leases, const uint16_t timeout,
653  const bool remove_lease,
654  const uint16_t max_unwarned_cycles = 0);
655 
668  void reclaimExpiredLeases6Internal(const size_t max_leases,
669  const uint16_t timeout,
670  const bool remove_lease,
671  const uint16_t max_unwarned_cycles = 0);
672 
678  void deleteExpiredReclaimedLeases6(const uint32_t secs);
679 
728  void reclaimExpiredLeases4(const size_t max_leases, const uint16_t timeout,
729  const bool remove_lease,
730  const uint16_t max_unwarned_cycles = 0);
731 
744  void reclaimExpiredLeases4Internal(const size_t max_leases,
745  const uint16_t timeout,
746  const bool remove_lease,
747  const uint16_t max_unwarned_cycles = 0);
748 
754  void deleteExpiredReclaimedLeases4(const uint32_t secs);
755 
769  static void findReservation(ClientContext6& ctx);
770 
781  static ConstHostPtr findGlobalReservation(ClientContext6& ctx);
782 
788  static IPv6Resrv makeIPv6Resrv(const Lease6& lease) {
789  if (lease.type_ == Lease::TYPE_NA) {
790  return (IPv6Resrv(IPv6Resrv::TYPE_NA, lease.addr_,
791  (lease.prefixlen_ ? lease.prefixlen_ : 128)));
792  }
793 
794  return (IPv6Resrv(IPv6Resrv::TYPE_PD, lease.addr_, lease.prefixlen_));
795  }
796 
797 public:
814  static void getLifetimes6(ClientContext6& ctx, uint32_t& preferred,
815  uint32_t& valid);
816 private:
817 
853  Lease6Ptr createLease6(ClientContext6& ctx,
854  const isc::asiolink::IOAddress& addr,
855  const uint8_t prefix_len,
856  hooks::CalloutHandle::CalloutNextStep& callout_status);
857 
872  Lease6Collection allocateUnreservedLeases6(ClientContext6& ctx);
873 
914  Lease6Ptr allocateBestMatch(ClientContext6& ctx,
915  Lease6Ptr& hint_lease,
916  bool& search_hint_lease,
917  const isc::asiolink::IOAddress& hint,
918  uint8_t hint_prefix_length,
919  Subnet6Ptr original_subnet,
920  SharedNetwork6Ptr& network,
921  uint64_t& total_attempts,
922  uint64_t& subnets_with_unavail_leases,
923  uint64_t& subnets_with_unavail_pools,
925  Allocator::PrefixLenMatchType prefix_length_match);
926 
943  void
944  allocateReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
945 
959  void
960  allocateGlobalReservedLeases6(ClientContext6& ctx, Lease6Collection& existing_leases);
961 
970  void
971  removeNonmatchingReservedLeases6(ClientContext6& ctx,
972  Lease6Collection& existing_leases);
973 
981  void
982  removeNonmatchingReservedNoHostLeases6(ClientContext6& ctx,
983  Lease6Collection& existing_leases);
984 
998  void
999  removeNonreservedLeases6(ClientContext6& ctx,
1000  Lease6Collection& existing_leases);
1001 
1034  Lease6Ptr
1035  reuseExpiredLease(Lease6Ptr& expired,
1036  ClientContext6& ctx,
1037  uint8_t prefix_len,
1038  hooks::CalloutHandle::CalloutNextStep& callout_status);
1039 
1058  Lease6Collection updateLeaseData(ClientContext6& ctx,
1059  const Lease6Collection& leases);
1060 
1066  static bool
1067  removeLeases(Lease6Collection& container,
1068  const asiolink::IOAddress& addr);
1069 
1082  void extendLease6(ClientContext6& ctx, Lease6Ptr lease);
1083 
1091  enum DbReclaimMode {
1092  DB_RECLAIM_REMOVE,
1093  DB_RECLAIM_UPDATE,
1094  DB_RECLAIM_LEAVE_UNCHANGED
1095  };
1096 
1108  template<typename LeasePtrType>
1109  void reclaimExpiredLease(const LeasePtrType& lease,
1110  const bool remove_lease,
1111  const hooks::CalloutHandlePtr& callout_handle);
1112 
1123  template<typename LeasePtrType>
1124  void reclaimExpiredLease(const LeasePtrType& lease,
1125  const hooks::CalloutHandlePtr& callout_handle);
1126 
1137  void reclaimExpiredLease(const Lease6Ptr& lease,
1138  const DbReclaimMode& reclaim_mode,
1139  const hooks::CalloutHandlePtr& callout_handle);
1140 
1151  void reclaimExpiredLease(const Lease4Ptr& lease,
1152  const DbReclaimMode& reclaim_mode,
1153  const hooks::CalloutHandlePtr& callout_handle);
1154 
1173  template<typename LeasePtrType>
1174  void reclaimLeaseInDatabase(const LeasePtrType& lease,
1175  const bool remove_lease,
1176  const std::function<void (const LeasePtrType&)>&
1177  lease_update_fun) const;
1178 
1191  bool reclaimDeclined(const Lease4Ptr& lease);
1192 
1205  bool reclaimDeclined(const Lease6Ptr& lease);
1206 
1207 public:
1208 
1226  struct ClientContext4 : public boost::noncopyable {
1231 
1234 
1237 
1240 
1246 
1249 
1252 
1257  std::string hostname_;
1258 
1261 
1268 
1271  uint32_t offer_lft_;
1272 
1275 
1278 
1284  std::map<SubnetID, ConstHostPtr> hosts_;
1285 
1292 
1298 
1302 
1306 
1315 
1316 
1323  const std::vector<uint8_t>& identifier) {
1324  host_identifiers_.push_back(IdentifierPair(id_type, identifier));
1325  }
1326 
1333  ConstHostPtr currentHost() const;
1334 
1343  ConstHostPtr globalHost() const;
1344 
1346  ClientContext4();
1347 
1364  ClientContext4(const Subnet4Ptr& subnet, const ClientIdPtr& clientid,
1365  const HWAddrPtr& hwaddr,
1366  const asiolink::IOAddress& requested_addr,
1367  const bool fwd_dns_update, const bool rev_dns_update,
1368  const std::string& hostname, const bool fake_allocation,
1369  const uint32_t offer_lft = 0);
1370  private:
1374  DdnsParamsPtr ddns_params_;
1375  };
1376 
1378  typedef boost::shared_ptr<ClientContext4> ClientContext4Ptr;
1379 
1486 
1499  static void findReservation(ClientContext4& ctx);
1500 
1512 
1530  static uint32_t getValidLft(const ClientContext4& ctx);
1531 
1544  static uint32_t getOfferLft(const ClientContext4& ctx);
1545 
1546 private:
1547 
1578  Lease4Ptr discoverLease4(ClientContext4& ctx);
1579 
1617  Lease4Ptr requestLease4(ClientContext4& ctx);
1618 
1648  Lease4Ptr createLease4(const ClientContext4& ctx,
1649  const isc::asiolink::IOAddress& addr,
1650  hooks::CalloutHandle::CalloutNextStep& callout_status);
1651 
1665  Lease4Ptr renewLease4(const Lease4Ptr& lease, ClientContext4& ctx);
1666 
1683  Lease4Ptr
1684  reuseExpiredLease4(Lease4Ptr& expired, ClientContext4& ctx,
1685  hooks::CalloutHandle::CalloutNextStep& callout_status);
1686 
1702  Lease4Ptr
1703  allocateOrReuseLease4(const asiolink::IOAddress& address,
1704  ClientContext4& ctx,
1705  hooks::CalloutHandle::CalloutNextStep& callout_status);
1706 
1725  Lease4Ptr allocateUnreservedLease4(ClientContext4& ctx);
1726 
1749  bool updateLease4Information(const Lease4Ptr& lease,
1750  ClientContext4& ctx) const;
1751 
1752 protected:
1769  bool updateLease4ExtendedInfo(const Lease4Ptr& lease,
1770  const ClientContext4& ctx) const;
1771 
1787  void updateLease6ExtendedInfo(const Lease6Ptr& lease,
1788  const ClientContext6& ctx) const;
1789 
1793  void clearReclaimedExtendedInfo(const Lease4Ptr& lease) const;
1794 
1798  void clearReclaimedExtendedInfo(const Lease6Ptr& lease) const;
1799 
1800 private:
1801 
1815  void setLeaseReusable(const Lease4Ptr& lease,
1816  const ClientContext4& ctx) const;
1817 
1832  void setLeaseReusable(const Lease6Ptr& lease,
1833  uint32_t current_preferred_lft,
1834  const ClientContext6& ctx) const;
1835 
1836 private:
1837 
1840  uint16_t incomplete_v4_reclamations_;
1841 
1844  uint16_t incomplete_v6_reclamations_;
1845 
1846 public:
1847 
1854  return (rw_mutex_);
1855  }
1856 
1859 
1868  static std::string labelNetworkOrSubnet(SubnetPtr subnet);
1869 };
1870 
1872 typedef boost::shared_ptr<AllocEngine> AllocEnginePtr;
1873 
1874 } // namespace dhcp
1875 } // namespace isc
1876 
1877 #endif // ALLOC_ENGINE_H
Defines elements for storing the names of client classes.
Defines a single hint.
Definition: alloc_engine.h:83
uint8_t prefix_len_
The prefix length (128 for an address).
Definition: alloc_engine.h:155
uint32_t valid_
The valid lifetime (0 when not set).
Definition: alloc_engine.h:161
bool operator==(const Resource &other) const
Equality operator.
Definition: alloc_engine.h:145
Resource(const isc::asiolink::IOAddress &address, const uint8_t prefix_len=128, const uint32_t preferred=0, const uint32_t valid=0)
Default constructor.
Definition: alloc_engine.h:94
bool equals(const Resource &other) const
Compares two AllocEngine::Resource objects for equality.
Definition: alloc_engine.h:135
uint8_t getPrefixLength() const
Returns the prefix length.
Definition: alloc_engine.h:112
uint32_t preferred_
The preferred lifetime (0 when not set).
Definition: alloc_engine.h:158
uint32_t getPreferred() const
Returns the optional preferred lifetime.
Definition: alloc_engine.h:119
isc::asiolink::IOAddress getAddress() const
Returns the address.
Definition: alloc_engine.h:105
uint32_t getValid() const
Returns the optional valid lifetime.
Definition: alloc_engine.h:126
isc::asiolink::IOAddress address_
The address or prefix.
Definition: alloc_engine.h:152
DHCPv4 and DHCPv6 allocation engine.
Definition: alloc_engine.h:47
std::set< Resource, ResourceCompare > ResourceContainer
Container holding allocated prefixes or addresses.
Definition: alloc_engine.h:188
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:788
isc::util::ReadWriteMutex & getReadWriteMutex()
Get the read-write mutex.
void updateLease6ExtendedInfo(const Lease6Ptr &lease, const ClientContext6 &ctx) const
Stores additional client query parameters on a V6 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.
static uint32_t getOfferLft(const ClientContext4 &ctx)
Returns the offer lifetime based on the v4 context.
static std::string labelNetworkOrSubnet(SubnetPtr subnet)
Generates a label for subnet or shared-network from subnet.
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:191
virtual ~AllocEngine()
Destructor.
Definition: alloc_engine.h:62
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)
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.
Definition: alloc_engine.h:194
AllocEngine(uint64_t attempts)
Constructor.
Definition: alloc_engine.cc:93
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.
std::vector< Resource > HintContainer
Container for client's hints.
Definition: alloc_engine.h:185
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition: allocator.h:61
IdentifierType
Type of the host identifier.
Definition: host.h:307
IPv6 reservation for a host.
Definition: host.h:161
CalloutNextStep
Specifies allowed next steps.
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:477
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:486
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:547
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition: lease.h:509
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition: lease.h:677
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:644
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
Definition: srv_config.h:181
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: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:804
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.
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.
Definition: alloc_engine.h:293
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:315
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
Definition: alloc_engine.h:332
Lease::Type type_
Lease type (IA or PD)
Definition: alloc_engine.h:300
ResourceContainer new_resources_
Holds addresses and prefixes allocated for this IA.
Definition: alloc_engine.h:328
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:323
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:297
Context information for the DHCPv6 leases allocation.
Definition: alloc_engine.h:218
std::vector< IAContext > ias_
Container holding IA specific contexts.
Definition: alloc_engine.h:380
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:410
bool fake_allocation_
Indicates if this is a real or fake allocation.
Definition: alloc_engine.h:233
ConstHostPtr currentHost() const
Returns host from the most preferred subnet.
DuidPtr duid_
Client identifier.
Definition: alloc_engine.h:249
void addAllocatedResource(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128)
Convenience method adding allocated prefix or address.
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
Definition: alloc_engine.h:420
Lease6Collection new_leases_
A collection of newly allocated leases.
Definition: alloc_engine.h:288
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
Definition: alloc_engine.h:252
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
Definition: alloc_engine.h:282
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:241
Subnet6Ptr host_subnet_
Subnet from which host reservations should be retrieved.
Definition: alloc_engine.h:246
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:285
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
Definition: alloc_engine.h:273
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:226
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
Definition: alloc_engine.h:238
void createIAContext()
Creates new IA context.
Definition: alloc_engine.h:431
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
Definition: alloc_engine.h:256
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
Definition: alloc_engine.h:263
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
Definition: alloc_engine.h:268
bool operator()(const Resource &lhr, const Resource &rhr) const
Compare operator.
Definition: alloc_engine.h:175
Structure that holds a lease for IPv6 address and/or prefix.
Definition: lease.h:520
Lease::Type type_
Lease type.
Definition: lease.h:525
uint8_t prefixlen_
IPv6 prefix length.
Definition: lease.h:530
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