Kea  2.1.7-git
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>
18 #include <dhcp/option6_iaprefix.h>
19 #include <dhcpsrv/d2_client_cfg.h>
20 #include <dhcpsrv/host.h>
21 #include <dhcpsrv/subnet.h>
22 #include <dhcpsrv/lease_mgr.h>
23 #include <dhcpsrv/srv_config.h>
24 #include <hooks/callout_handle.h>
26 #include <util/readwrite_mutex.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 
38 namespace isc {
39 namespace dhcp {
40 
43 class AllocFailed : public isc::Exception {
44 public:
45 
51  AllocFailed(const char* file, size_t line, const char* what)
52  : isc::Exception(file, line, what) {}
53 };
54 
63 class AllocEngine : public boost::noncopyable {
64 protected:
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) {
102  if (isc::util::MultiThreadingMgr::instance().getMode()) {
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 
148  class IterativeAllocator : public Allocator {
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 
187  increasePrefix(const isc::asiolink::IOAddress& prefix,
188  const uint8_t prefix_len);
189 
201  increaseAddress(const isc::asiolink::IOAddress& address,
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 
265 public:
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
272  } AllocType;
273 
285  AllocEngine(AllocType engine_type, uint64_t attempts, bool ipv6 = true);
286 
288  virtual ~AllocEngine() { }
289 
297  AllocatorPtr getAllocator(Lease::Type type);
298 
299 private:
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 
314 public:
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 
497  IdentifierList host_identifiers_;
498 
504  std::map<SubnetID, ConstHostPtr> hosts_;
505 
510 
515 
520  std::string hostname_;
521 
524 
526  ResourceContainer allocated_resources_;
527 
530 
532 
534  struct IAContext {
535 
538  uint32_t iaid_;
539 
542 
547  HintContainer hints_;
548 
557 
565 
569  ResourceContainer new_resources_;
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 
630  DdnsParamsPtr getDdnsParams();
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()) {
663  createIAContext();
664  }
665  return (ias_.back());
666  }
667 
673  ias_.push_back(IAContext());
674  };
675 
682  ConstHostPtr currentHost() const;
683 
692  ConstHostPtr globalHost() const;
693 
699  bool hasGlobalReservation(const IPv6Resrv& resv) const;
700 
702  ClientContext6();
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 
1004 public:
1021  static void getLifetimes6(ClientContext6& ctx, uint32_t& preferred,
1022  uint32_t& valid);
1023 private:
1024 
1060  Lease6Ptr createLease6(ClientContext6& ctx,
1061  const isc::asiolink::IOAddress& addr,
1062  const uint8_t prefix_len,
1063  hooks::CalloutHandle::CalloutNextStep& callout_status);
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,
1192  hooks::CalloutHandle::CalloutNextStep& callout_status);
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 
1361 public:
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 
1451  IdentifierList host_identifiers_;
1452 
1456 
1464  DdnsParamsPtr getDdnsParams();
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 
1496  ClientContext4();
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 
1633  Lease4Ptr allocateLease4(ClientContext4& ctx);
1634 
1647  static void findReservation(ClientContext4& ctx);
1648 
1659  static ConstHostPtr findGlobalReservation(ClientContext4& ctx);
1660 
1678  static uint32_t getValidLft(const ClientContext4& ctx);
1679 
1680 private:
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,
1784  hooks::CalloutHandle::CalloutNextStep& callout_status);
1785 
1799  Lease4Ptr renewLease4(const Lease4Ptr& lease, ClientContext4& ctx);
1800 
1817  Lease4Ptr
1818  reuseExpiredLease4(Lease4Ptr& expired, ClientContext4& ctx,
1819  hooks::CalloutHandle::CalloutNextStep& callout_status);
1820 
1836  Lease4Ptr
1837  allocateOrReuseLease4(const asiolink::IOAddress& address,
1838  ClientContext4& ctx,
1839  hooks::CalloutHandle::CalloutNextStep& callout_status);
1840 
1859  Lease4Ptr allocateUnreservedLease4(ClientContext4& ctx);
1860 
1883  bool updateLease4Information(const Lease4Ptr& lease,
1884  ClientContext4& ctx) const;
1885 
1886 protected:
1903  bool updateLease4ExtendedInfo(const Lease4Ptr& lease,
1904  const ClientContext4& ctx) const;
1905 
1923  bool updateLease6ExtendedInfo(const Lease6Ptr& lease,
1924  const ClientContext6& ctx) const;
1925 
1926 private:
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 
1962 private:
1963 
1966  uint16_t incomplete_v4_reclamations_;
1967 
1970  uint16_t incomplete_v6_reclamations_;
1971 
1972 public:
1973 
1980  return (rw_mutex_);
1981  }
1982 
1985 };
1986 
1988 typedef boost::shared_ptr<AllocEngine> AllocEnginePtr;
1989 
1990 } // namespace dhcp
1991 } // namespace isc
1992 
1993 #endif // ALLOC_ENGINE_H
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
Defines the D2ClientConfig class.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
bool fake_allocation_
Indicates if this is a real or fake allocation.
boost::shared_ptr< DUID > DuidPtr
Definition: duid.h:20
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
Standard implementation of read-write mutexes with writer preference using C++11 mutex and condition ...
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
Definition: alloc_engine.h:493
Defines a single hint.
Definition: alloc_engine.h:324
Lease6Collection changed_leases_
A pointer to any leases that have changed FQDN information.
Definition: alloc_engine.h:564
HintContainer hints_
Client&#39;s hints.
Definition: alloc_engine.h:547
AllocFailed(const char *file, size_t line, const char *what)
Constructor.
Definition: alloc_engine.h:51
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
Definition: hwaddr.h:154
isc::util::ReadWriteMutex rw_mutex_
The read-write mutex.
static IPv6Resrv makeIPv6Resrv(const Lease6 &lease)
Creates an IPv6Resrv instance from a Lease6.
Definition: alloc_engine.h:995
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
An abstract API for lease database.
Defines elements for storing the names of client classes.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:524
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
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
DuidPtr duid_
Client identifier.
Definition: alloc_engine.h:490
Read-Write Mutex.
isc::asiolink::IOAddress getAddress() const
Returns the address.
Definition: alloc_engine.h:346
uint8_t prefix_len_
The prefix length (128 for an address).
Definition: alloc_engine.h:396
IPv6 reservation for a host.
Definition: host.h:161
std::list< IdentifierPair > IdentifierList
Map holding values to be used as host identifiers.
Definition: alloc_engine.h:435
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client&#39;s message.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
boost::shared_ptr< AllocEngine > AllocEnginePtr
A pointer to the AllocEngine object.
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
An exception that is thrown when allocation module fails (e.g.
Definition: alloc_engine.h:43
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
Definition: srv_config.h:172
asiolink::IOAddress requested_address_
An address that the client desires.
AllocType
Specifies allocation type.
Definition: alloc_engine.h:268
boost::shared_ptr< Option6IA > Option6IAPtr
A pointer to the Option6IA object.
Definition: option6_ia.h:17
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
Definition: alloc_engine.h:479
ResourceContainer new_resources_
Holds addresses and prefixes allocated for this IA.
Definition: alloc_engine.h:569
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition: pkt6.h:28
Subnet6Ptr subnet_
Subnet selected for the client by the server.
Definition: alloc_engine.h:482
ResourceContainer allocated_resources_
Holds addresses and prefixes allocated for all IAs.
Definition: alloc_engine.h:526
Lease4Ptr conflicting_lease_
A pointer to the object representing a lease in conflict.
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:278
Lease4Ptr old_lease_
A pointer to an old lease that the client had before update.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
Definition: alloc_engine.h:504
Random allocator that picks address randomly.
Definition: alloc_engine.h:238
std::vector< IAContext > ias_
Container holding IA specific contexts.
Definition: alloc_engine.h:621
Context information for the DHCPv6 leases allocation.
Definition: alloc_engine.h:459
Subnet6Ptr host_subnet_
Subnet from which host reservations should be retrieved.
Definition: alloc_engine.h:487
boost::shared_ptr< ClientContext4 > ClientContext4Ptr
Pointer to the ClientContext4.
Subnet4Ptr subnet_
Subnet selected for the client by the server.
uint32_t getValid() const
Returns the optional valid lifetime.
Definition: alloc_engine.h:367
bool unknown_requested_addr_
True when the address DHCPREQUEST&#39;ed by client is not within a dynamic pool the server knows about...
Pkt4Ptr query_
A pointer to the client&#39;s message.
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
Definition: alloc_engine.h:573
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:544
CalloutNextStep
Specifies allowed next steps.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
Definition: host.h:788
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
Structure that holds a lease for IPv6 address and/or prefix.
Definition: lease.h:498
Address/prefix allocator that iterates over all addresses.
Definition: alloc_engine.h:148
std::vector< Resource > HintContainer
Container for client&#39;s hints.
Definition: alloc_engine.h:426
Lease::Type type_
Lease type.
Definition: lease.h:503
virtual ~Allocator()
Virtual destructor.
Definition: alloc_engine.h:118
uint8_t prefixlen_
IPv6 prefix length.
Definition: lease.h:508
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition: lease.h:635
uint32_t valid_
The valid lifetime (0 when not set).
Definition: alloc_engine.h:402
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
Definition: duid.h:103
isc::util::ReadWriteMutex & getReadWriteMutex()
Get the read-write mutex.
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
the lease contains non-temporary IPv6 address
Definition: lease.h:46
bool fake_allocation_
Indicates if this is a real or fake allocation.
Definition: alloc_engine.h:474
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
Lease6Collection new_leases_
A collection of newly allocated leases.
Definition: alloc_engine.h:529
ClientIdPtr clientid_
Client identifier from the DHCP message.
uint32_t iaid_
The IAID field from IA_NA or IA_PD that is being processed.
Definition: alloc_engine.h:538
Lease::Type type_
Lease type (IA or PD)
Definition: alloc_engine.h:541
boost::shared_ptr< Allocator > AllocatorPtr
defines a pointer to allocator
Definition: alloc_engine.h:140
bool equals(const Resource &other) const
Compares two AllocEngine::Resource objects for equality.
Definition: alloc_engine.h:376
Address/prefix allocator that gets an address based on a hash.
Definition: alloc_engine.h:208
Pkt6Ptr query_
A pointer to the client&#39;s message.
Definition: alloc_engine.h:467
Parameters pertaining to individual IAs.
Definition: alloc_engine.h:534
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
Lease4Ptr new_lease_
A pointer to a newly allocated lease.
isc::asiolink::IOAddress address_
The address or prefix.
Definition: alloc_engine.h:393
Type
Type of lease or pool.
Definition: lease.h:45
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
bool fwd_dns_update_
Perform forward DNS update.
Base class for all address/prefix allocation algorithms.
Definition: alloc_engine.h:70
uint32_t getPreferred() const
Returns the optional preferred lifetime.
Definition: alloc_engine.h:360
isc::asiolink::IOAddress addr_
IPv4 ot IPv6 address.
Definition: lease.h:114
void createIAContext()
Creates new IA context.
Definition: alloc_engine.h:672
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
Definition: alloc_engine.h:661
uint8_t getPrefixLength() const
Returns the prefix length.
Definition: alloc_engine.h:353
Lease::Type pool_type_
Defines pool type allocation.
Definition: alloc_engine.h:131
uint32_t preferred_
The preferred lifetime (0 when not set).
Definition: alloc_engine.h:399
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition: subnet.h:672
virtual ~AllocEngine()
Destructor.
Definition: alloc_engine.h:288
IdentifierType
Type of the host identifier.
Definition: host.h:307
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client&#39;s message.
Definition: alloc_engine.h:523
bool operator==(const Resource &other) const
Equality operator.
Definition: alloc_engine.h:386
HWAddrPtr hwaddr_
HW address from the DHCP message.
Context information for the DHCPv4 lease allocation.
DHCPv4 and DHCPv6 allocation engine.
Definition: alloc_engine.h:63
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition: lease.h:487
std::set< Resource, ResourceCompare > ResourceContainer
Container holding allocated prefixes or addresses.
Definition: alloc_engine.h:429
Allocator(Lease::Type pool_type)
Default constructor.
Definition: alloc_engine.h:114
std::pair< Host::IdentifierType, std::vector< uint8_t > > IdentifierPair
A tuple holding host identifier type and value.
Definition: alloc_engine.h:432
Container for storing client class names.
Definition: classify.h:68
boost::shared_ptr< Option6IAAddr > Option6IAAddrPtr
A pointer to the isc::dhcp::Option6IAAddr object.
bool rev_dns_update_
Perform reverse DNS update.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition: subnet.h:515
IdentifierList host_identifiers_
A list holding host identifiers extracted from a message received by the server.
Definition: alloc_engine.h:497