Kea: subnet.h Source File

| Kea 3.2.0-git

subnet.h
Go to the documentation of this file.
1// Copyright (C) 2012-2026 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 SUBNET_H
8#define SUBNET_H
9
10#include <asiolink/io_address.h>
11#include <cc/data.h>
12#include <cc/user_context.h>
13#include <dhcp/option_space_container.h>
14#include <dhcpsrv/allocator.h>
15#include <dhcpsrv/allocation_state.h>
16#include <dhcpsrv/lease.h>
17#include <dhcpsrv/network.h>
18#include <dhcpsrv/pool.h>
19#include <dhcpsrv/subnet_id.h>
20#include <util/bigints.h>
21#include <util/dhcp_space.h>
22#include <util/triplet.h>
23
24#include <boost/enable_shared_from_this.hpp>
25#include <boost/multi_index/mem_fun.hpp>
26#include <boost/multi_index/indexed_by.hpp>
27#include <boost/multi_index/ordered_index.hpp>
28#include <boost/multi_index/random_access_index.hpp>
29#include <boost/multi_index_container.hpp>
30#include <boost/date_time/posix_time/posix_time.hpp>
31#include <boost/pointer_cast.hpp>
32#include <boost/shared_ptr.hpp>
33
34#include <cstdint>
35#include <map>
36#include <utility>
37
38namespace isc {
39namespace dhcp {
40
41 class Subnet : public virtual Network {
42public:
43
49 bool inRange(const isc::asiolink::IOAddress& addr) const;
50
65 bool inPool(Lease::Type type, const isc::asiolink::IOAddress& addr) const;
66
76 bool inPool(Lease::Type type,
77 const isc::asiolink::IOAddress& addr,
78 const ClientClasses& client_classes) const;
79
83 SubnetID getID() const {
84 return (id_);
85 }
86
90 std::pair<isc::asiolink::IOAddress, uint8_t> get() const {
91 return (std::make_pair(prefix_, prefix_len_));
92 }
93
115 void addPool(const PoolPtr& pool);
116
122 void delPools(Lease::Type type);
123
142 const PoolPtr getPool(Lease::Type type, const isc::asiolink::IOAddress& addr,
143 bool anypool = true) const;
144
152 const PoolPtr getPool(Lease::Type type,
153 const ClientClasses& client_classes,
154 const isc::asiolink::IOAddress& addr) const;
155
160 PoolPtr getAnyPool(Lease::Type type) {
161 return (getPool(type, default_pool()));
162 }
163
168 virtual isc::asiolink::IOAddress default_pool() const = 0;
169
176 const PoolCollection& getPools(Lease::Type type) const;
177
181 isc::util::uint128_t getPoolCapacity(Lease::Type type) const;
182
189 isc::util::uint128_t getPoolCapacity(Lease::Type type,
190 const ClientClasses& client_classes) const;
191
203 isc::util::uint128_t getPoolCapacity(Lease::Type type,
204 const ClientClasses& client_classes,
205 Allocator::PrefixLenMatchType prefix_length_match,
206 uint8_t hint_prefix_length) const;
207
212 virtual std::string toText() const;
213
230 template<typename SharedNetworkPtrType>
231 void getSharedNetwork(SharedNetworkPtrType& shared_network) const {
232 shared_network = boost::dynamic_pointer_cast<
233 typename SharedNetworkPtrType::element_type>(parent_network_.lock());
234 }
235
243 void setSharedNetwork(const NetworkPtr& shared_network) {
244 parent_network_ = shared_network;
245 }
246
250 std::string getSharedNetworkName() const {
251 return (shared_network_name_);
252 }
253
266 void setSharedNetworkName(const std::string& shared_network_name) {
267 shared_network_name_ = shared_network_name;
268 }
269
276 PoolCollection& getPoolsWritable(Lease::Type type);
277
288 AllocatorPtr getAllocator(Lease::Type type) const;
289
297 void setAllocator(Lease::Type type, const AllocatorPtr& allocator);
298
305 SubnetAllocationStatePtr getAllocationState(Lease::Type type) const;
306
311 void setAllocationState(Lease::Type type, const SubnetAllocationStatePtr& allocation_state);
312
320 virtual void createAllocators() = 0;
321
323 void initAllocatorsAfterConfigure();
324
325protected:
326
328 //
335 Subnet(const isc::asiolink::IOAddress& prefix, uint8_t len,
336 const SubnetID id);
337
342 virtual ~Subnet() { }
343
352 virtual void checkType(Lease::Type type) const = 0;
353
358 isc::util::uint128_t sumPoolCapacity(const PoolCollection& pools) const;
359
365 isc::util::uint128_t sumPoolCapacity(const PoolCollection& pools,
366 const ClientClasses& client_classes) const;
367
380 isc::util::uint128_t sumPoolCapacity(const PoolCollection& pools,
381 const ClientClasses& client_classes,
382 Allocator::PrefixLenMatchType prefix_length_match,
383 uint8_t hint_prefix_length) const;
384
393 bool poolOverlaps(const Lease::Type& pool_type, const PoolPtr& pool) const;
394
398 virtual data::ElementPtr toElement() const;
399
400 virtual std::string getLabel() const {
401 std::stringstream ss;
402 ss << "subnet-id " << id_;
403 return (ss.str());
404 }
405
414 static std::pair<asiolink::IOAddress, uint8_t>
415 parsePrefixCommon(const std::string& prefix);
416
421 SubnetID id_;
422
424 PoolCollection pools_;
425
427 PoolCollection pools_pd_;
428
430 isc::asiolink::IOAddress prefix_;
431
433 uint8_t prefix_len_;
434
436 std::string shared_network_name_;
437
439 std::map<Lease::Type, AllocatorPtr> allocators_;
440
442 std::map<Lease::Type, SubnetAllocationStatePtr> allocation_states_;
443};
444
446 typedef boost::shared_ptr<Subnet> SubnetPtr;
447
449 typedef boost::shared_ptr<const Subnet> ConstSubnetPtr;
450
451
452class Subnet4;
453
455 typedef boost::shared_ptr<const Subnet4> ConstSubnet4Ptr;
456
458 typedef boost::shared_ptr<Subnet4> Subnet4Ptr;
459
465 class Subnet4 : public virtual Subnet, public virtual Network4, public boost::enable_shared_from_this<Subnet4> {
466public:
467
478 Subnet4(const isc::asiolink::IOAddress& prefix, uint8_t length,
479 const util::Triplet<uint32_t>& t1,
480 const util::Triplet<uint32_t>& t2,
481 const util::Triplet<uint32_t>& valid_lifetime,
482 const SubnetID id);
483
503 static Subnet4Ptr
504 create(const isc::asiolink::IOAddress& prefix, uint8_t length,
505 const util::Triplet<uint32_t>& t1,
506 const util::Triplet<uint32_t>& t2,
507 const util::Triplet<uint32_t>& valid_lifetime,
508 const SubnetID id);
509
522 ConstSubnet4Ptr getNextSubnet(const ConstSubnet4Ptr& first_subnet) const;
523
536 ConstSubnet4Ptr getNextSubnet(const ConstSubnet4Ptr& first_subnet,
537 const ClientClasses& client_classes) const;
538
550 virtual bool
551 clientSupported(const isc::dhcp::ClientClasses& client_classes) const;
552
557 Cfg4o6& get4o6() {
558 return (dhcp4o6_);
559 }
560
565 const Cfg4o6& get4o6() const {
566 return (dhcp4o6_);
567 }
568
572 virtual data::ElementPtr toElement() const;
573
581 virtual void createAllocators();
582
587 static std::pair<asiolink::IOAddress, uint8_t>
588 parsePrefix(const std::string& prefix);
589
590private:
591
593 Subnet4(const Subnet4&) = delete;
594
596 Subnet4& operator=(const Subnet4&) = delete;
597
601 virtual isc::asiolink::IOAddress default_pool() const {
602 return (isc::asiolink::IOAddress("0.0.0.0"));
603 }
604
611 virtual void checkType(Lease::Type type) const;
612
614 Cfg4o6 dhcp4o6_;
615};
616
617class Subnet6;
618
620 typedef boost::shared_ptr<const Subnet6> ConstSubnet6Ptr;
621
623 typedef boost::shared_ptr<Subnet6> Subnet6Ptr;
624
630 class Subnet6 : public virtual Subnet, public virtual Network6, public boost::enable_shared_from_this<Subnet6> {
631public:
632
645 Subnet6(const isc::asiolink::IOAddress& prefix, uint8_t length,
646 const util::Triplet<uint32_t>& t1,
647 const util::Triplet<uint32_t>& t2,
648 const util::Triplet<uint32_t>& preferred_lifetime,
649 const util::Triplet<uint32_t>& valid_lifetime,
650 const SubnetID id);
651
672 static Subnet6Ptr
673 create(const isc::asiolink::IOAddress& prefix, uint8_t length,
674 const util::Triplet<uint32_t>& t1,
675 const util::Triplet<uint32_t>& t2,
676 const util::Triplet<uint32_t>& preferred_lifetime,
677 const util::Triplet<uint32_t>& valid_lifetime,
678 const SubnetID id);
679
692 ConstSubnet6Ptr getNextSubnet(const ConstSubnet6Ptr& first_subnet) const;
693
706 ConstSubnet6Ptr getNextSubnet(const ConstSubnet6Ptr& first_subnet,
707 const ClientClasses& client_classes) const;
708
720 virtual bool
721 clientSupported(const isc::dhcp::ClientClasses& client_classes) const;
722
730 virtual void createAllocators();
731
735 virtual data::ElementPtr toElement() const;
736
741 static std::pair<asiolink::IOAddress, uint8_t>
742 parsePrefix(const std::string& prefix);
743
744private:
745
747 Subnet6(const Subnet6&) = delete;
748
750 Subnet6& operator=(const Subnet6&) = delete;
751
755 virtual isc::asiolink::IOAddress default_pool() const {
756 return (isc::asiolink::IOAddress("::"));
757 }
758
765 virtual void checkType(Lease::Type type) const;
766
767};
768
771
772
774 struct SubnetSubnetIdIndexTag { };
775
777 struct SubnetPrefixIndexTag { };
778
780 struct SubnetServerIdIndexTag { };
781
783 struct SubnetModificationTimeIndexTag { };
784
791typedef boost::multi_index_container<
792 // Multi index container holds pointers to the subnets.
793 Subnet4Ptr,
794 // The following holds all indexes.
795 boost::multi_index::indexed_by<
796 // First index allows for searching using subnet identifier.
797 boost::multi_index::ordered_unique<
798 boost::multi_index::tag<SubnetSubnetIdIndexTag>,
799 boost::multi_index::const_mem_fun<Subnet, SubnetID, &Subnet::getID>
800 >,
801 // Second index allows for searching using an output from toText function.
802 boost::multi_index::ordered_unique<
803 boost::multi_index::tag<SubnetPrefixIndexTag>,
804 boost::multi_index::const_mem_fun<Subnet, std::string, &Subnet::toText>
805 >
806 >
807> Subnet4SimpleCollection;
808
832typedef boost::multi_index_container<
833 // Multi index container holds pointers to the subnets.
834 Subnet4Ptr,
835 // The following holds all indexes.
836 boost::multi_index::indexed_by<
837 // First index allows for searching using subnet identifier.
838 boost::multi_index::ordered_unique<
839 boost::multi_index::tag<SubnetSubnetIdIndexTag>,
840 boost::multi_index::const_mem_fun<Subnet, SubnetID, &Subnet::getID>
841 >,
842 // Second index allows for searching using an output from toText function.
843 boost::multi_index::ordered_unique<
844 boost::multi_index::tag<SubnetPrefixIndexTag>,
845 boost::multi_index::const_mem_fun<Subnet, std::string, &Subnet::toText>
846 >,
847
848 // Third index allows for searching using an output from getServerId.
849 boost::multi_index::ordered_non_unique<
850 boost::multi_index::tag<SubnetServerIdIndexTag>,
851 boost::multi_index::const_mem_fun<Network4, asiolink::IOAddress,
852 &Network4::getServerId>
853 >,
854
855 // Forth index allows for searching using subnet modification time.
856 boost::multi_index::ordered_non_unique<
857 boost::multi_index::tag<SubnetModificationTimeIndexTag>,
858 boost::multi_index::const_mem_fun<data::BaseStampedElement,
859 boost::posix_time::ptime,
860 &data::BaseStampedElement::getModificationTime>
861 >
862 >
863> Subnet4Collection;
864
871typedef boost::multi_index_container<
872 // Multi index container holds pointers to the subnets.
873 Subnet6Ptr,
874 // The following holds all indexes.
875 boost::multi_index::indexed_by<
876 // First index allows for searching using subnet identifier.
877 boost::multi_index::ordered_unique<
878 boost::multi_index::tag<SubnetSubnetIdIndexTag>,
879 boost::multi_index::const_mem_fun<Subnet, SubnetID, &Subnet::getID>
880 >,
881 // Second index allows for searching using an output from toText function.
882 boost::multi_index::ordered_unique<
883 boost::multi_index::tag<SubnetPrefixIndexTag>,
884 boost::multi_index::const_mem_fun<Subnet, std::string, &Subnet::toText>
885 >
886 >
887> Subnet6SimpleCollection;
888
911typedef boost::multi_index_container<
912 // Multi index container holds pointers to the subnets.
913 Subnet6Ptr,
914 // The following holds all indexes.
915 boost::multi_index::indexed_by<
916 // First index allows for searching using subnet identifier.
917 boost::multi_index::ordered_unique<
918 boost::multi_index::tag<SubnetSubnetIdIndexTag>,
919 boost::multi_index::const_mem_fun<Subnet, SubnetID, &Subnet::getID>
920 >,
921 // Second index allows for searching using an output from toText function.
922 boost::multi_index::ordered_unique<
923 boost::multi_index::tag<SubnetPrefixIndexTag>,
924 boost::multi_index::const_mem_fun<Subnet, std::string, &Subnet::toText>
925 >,
926 // Third index allows for searching using subnet modification time.
927 boost::multi_index::ordered_non_unique<
928 boost::multi_index::tag<SubnetModificationTimeIndexTag>,
929 boost::multi_index::const_mem_fun<data::BaseStampedElement,
930 boost::posix_time::ptime,
931 &data::BaseStampedElement::getModificationTime>
932 >
933 >
934> Subnet6Collection;
935
943template<typename ReturnPtrType, typename CollectionType>
944 class SubnetFetcher {
945public:
946
954 static ReturnPtrType get(const CollectionType& collection,
955 const SubnetID& subnet_id) {
956 auto& index = collection.template get<SubnetSubnetIdIndexTag>();
957 auto s = index.find(subnet_id);
958 if (s != index.end()) {
959 return (*s);
960 }
961 // No subnet found. Return null pointer.
962 return (ReturnPtrType());
963 }
964};
965
967 using SubnetFetcher4 = SubnetFetcher<Subnet4Ptr, Subnet4Collection>;
968
970 using SubnetFetcher6 = SubnetFetcher<Subnet6Ptr, Subnet6Collection>;
972
975namespace {
976
977template <isc::util::DhcpSpace D>
978struct AdapterSubnet {};
979
980template <>
981struct AdapterSubnet<isc::util::DHCPv4> {
982 using type = Subnet4;
983};
984
985template <>
986struct AdapterSubnet<isc::util::DHCPv6> {
987 using type = Subnet6;
988};
989
990} // namespace
991
992template <isc::util::DhcpSpace D>
993 using SubnetT = typename AdapterSubnet<D>::type;
994
995template <isc::util::DhcpSpace D>
996 using SubnetTPtr = boost::shared_ptr<SubnetT<D>>;
997
998template <isc::util::DhcpSpace D>
999 using ConstSubnetTPtr = boost::shared_ptr<const SubnetT<D>>;
1001
1002} // end of isc::dhcp namespace
1003} // end of isc namespace
1004
1005#endif // SUBNET_H
allocation_state.h
allocator.h
bigints.h
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:53
isc::data::BaseStampedElement
This class represents configuration element which is associated with database identifier and the modi...
Definition base_stamped_element.h:30
isc::data::BaseStampedElement::getModificationTime
boost::posix_time::ptime getModificationTime() const
Returns timestamp.
Definition base_stamped_element.h:61
isc::dhcp::Allocator::PrefixLenMatchType
PrefixLenMatchType
Type of preferred PD-pool prefix length selection criteria.
Definition allocator.h:61
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:110
isc::dhcp::Network4
Specialization of the Network object for DHCPv4 case.
Definition network.h:1350
isc::dhcp::Network4::getServerId
virtual asiolink::IOAddress getServerId() const
Returns binary representation of the dhcp-server-identifier option (54).
Definition network.cc:344
isc::dhcp::Network4::Network4
Network4()
Constructor.
Definition network.h:1354
isc::dhcp::Network6::Network6
Network6()
Constructor.
Definition network.h:1515
isc::dhcp::Network::Network
Network()
Constructor.
Definition network.h:213
isc::dhcp::Network::parent_network_
WeakNetworkPtr parent_network_
Pointer to another network that this network belongs to.
Definition network.h:1342
isc::dhcp::Subnet4
A configuration holder for IPv4 subnet.
Definition subnet.h:465
isc::dhcp::Subnet4::clientSupported
virtual bool clientSupported(const isc::dhcp::ClientClasses &client_classes) const
Checks whether this subnet and parent shared network supports the client that belongs to specified cl...
Definition subnet.cc:315
isc::dhcp::Subnet4::get4o6
Cfg4o6 & get4o6()
Returns DHCP4o6 configuration parameters.
Definition subnet.h:557
isc::dhcp::Subnet4::getNextSubnet
ConstSubnet4Ptr getNextSubnet(const ConstSubnet4Ptr &first_subnet) const
Returns next subnet within shared network.
Definition subnet.cc:276
isc::dhcp::Subnet4::createAllocators
virtual void createAllocators()
Instantiates the allocator and its state.
Definition subnet.cc:740
isc::dhcp::Subnet4::toElement
virtual data::ElementPtr toElement() const
Unparse a subnet object.
Definition subnet.cc:785
isc::dhcp::Subnet4::create
static Subnet4Ptr create(const isc::asiolink::IOAddress &prefix, uint8_t length, const util::Triplet< uint32_t > &t1, const util::Triplet< uint32_t > &t2, const util::Triplet< uint32_t > &valid_lifetime, const SubnetID id)
Factory function creating an instance of the Subnet4.
Definition subnet.cc:259
isc::dhcp::Subnet4::Subnet4
Subnet4(const isc::asiolink::IOAddress &prefix, uint8_t length, const util::Triplet< uint32_t > &t1, const util::Triplet< uint32_t > &t2, const util::Triplet< uint32_t > &valid_lifetime, const SubnetID id)
Constructor with all parameters.
Definition subnet.cc:242
isc::dhcp::Subnet4::get4o6
const Cfg4o6 & get4o6() const
Returns const DHCP4o6 configuration parameters.
Definition subnet.h:565
isc::dhcp::Subnet4::parsePrefix
static std::pair< asiolink::IOAddress, uint8_t > parsePrefix(const std::string &prefix)
Converts subnet prefix to a pair of prefix/length pair.
Definition subnet.cc:809
isc::dhcp::Subnet6
A configuration holder for IPv6 subnet.
Definition subnet.h:630
isc::dhcp::Subnet6::clientSupported
virtual bool clientSupported(const isc::dhcp::ClientClasses &client_classes) const
Checks whether this subnet and parent shared network supports the client that belongs to specified cl...
Definition subnet.cc:712
isc::dhcp::Subnet6::create
static Subnet6Ptr create(const isc::asiolink::IOAddress &prefix, uint8_t length, const util::Triplet< uint32_t > &t1, const util::Triplet< uint32_t > &t2, const util::Triplet< uint32_t > &preferred_lifetime, const util::Triplet< uint32_t > &valid_lifetime, const SubnetID id)
Factory function creating an instance of the Subnet4.
Definition subnet.cc:642
isc::dhcp::Subnet6::parsePrefix
static std::pair< asiolink::IOAddress, uint8_t > parsePrefix(const std::string &prefix)
Converts subnet prefix to a pair of prefix/length pair.
Definition subnet.cc:924
isc::dhcp::Subnet6::createAllocators
virtual void createAllocators()
Instantiates the allocators and their states.
Definition subnet.cc:819
isc::dhcp::Subnet6::toElement
virtual data::ElementPtr toElement() const
Unparse a subnet object.
Definition subnet.cc:895
isc::dhcp::Subnet6::getNextSubnet
ConstSubnet6Ptr getNextSubnet(const ConstSubnet6Ptr &first_subnet) const
Returns next subnet within shared network.
Definition subnet.cc:674
isc::dhcp::Subnet6::Subnet6
Subnet6(const isc::asiolink::IOAddress &prefix, uint8_t length, const util::Triplet< uint32_t > &t1, const util::Triplet< uint32_t > &t2, const util::Triplet< uint32_t > &preferred_lifetime, const util::Triplet< uint32_t > &valid_lifetime, const SubnetID id)
Constructor with all parameters.
Definition subnet.cc:622
isc::dhcp::SubnetFetcher
A class containing static convenience methods to fetch the subnets from the containers.
Definition subnet.h:944
isc::dhcp::SubnetFetcher::get
static ReturnPtrType get(const CollectionType &collection, const SubnetID &subnet_id)
Fetches subnets by id.
Definition subnet.h:954
isc::dhcp::Subnet::getPoolCapacity
isc::util::uint128_t getPoolCapacity(Lease::Type type) const
Returns the number of possible leases for specified lease type.
Definition subnet.cc:99
isc::dhcp::Subnet::setSharedNetworkName
void setSharedNetworkName(const std::string &shared_network_name)
Sets new shared network name.
Definition subnet.h:266
isc::dhcp::Subnet::prefix_
isc::asiolink::IOAddress prefix_
a prefix of the subnet.
Definition subnet.h:430
isc::dhcp::Subnet::getID
SubnetID getID() const
Returns unique ID for that subnet.
Definition subnet.h:83
isc::dhcp::Subnet::prefix_len_
uint8_t prefix_len_
a prefix length of the subnet.
Definition subnet.h:433
isc::dhcp::Subnet::sumPoolCapacity
isc::util::uint128_t sumPoolCapacity(const PoolCollection &pools) const
Returns a sum of possible leases in all pools.
Definition subnet.cc:146
isc::dhcp::Subnet::toElement
virtual data::ElementPtr toElement() const
Unparse a subnet object.
Definition subnet.cc:723
isc::dhcp::Subnet::getAllocator
AllocatorPtr getAllocator(Lease::Type type) const
Returns lease allocator instance.
Definition subnet.cc:358
isc::dhcp::Subnet::getSharedNetwork
void getSharedNetwork(SharedNetworkPtrType &shared_network) const
Retrieves pointer to a shared network associated with a subnet.
Definition subnet.h:231
isc::dhcp::Subnet::initAllocatorsAfterConfigure
void initAllocatorsAfterConfigure()
Calls initAfterConfigure for each allocator.
Definition subnet.cc:429
isc::dhcp::Subnet::id_
SubnetID id_
subnet-id
Definition subnet.h:421
isc::dhcp::Subnet::getAllocationState
SubnetAllocationStatePtr getAllocationState(Lease::Type type) const
Returns subnet-specific allocation state.
Definition subnet.cc:374
isc::dhcp::Subnet::getAnyPool
PoolPtr getAnyPool(Lease::Type type)
Returns a pool without any address specified.
Definition subnet.h:160
isc::dhcp::Subnet::addPool
void addPool(const PoolPtr &pool)
Adds a new pool for the subnet.
Definition subnet.cc:464
isc::dhcp::Subnet::~Subnet
virtual ~Subnet()
virtual destructor.
Definition subnet.h:342
isc::dhcp::Subnet::inRange
bool inRange(const isc::asiolink::IOAddress &addr) const
checks if specified address is in range.
Definition subnet.cc:84
isc::dhcp::Subnet::allocators_
std::map< Lease::Type, AllocatorPtr > allocators_
Lease allocators used by the subnet.
Definition subnet.h:439
isc::dhcp::Subnet::toText
virtual std::string toText() const
Returns textual representation of the subnet (e.g.
Definition subnet.cc:92
isc::dhcp::Subnet::delPools
void delPools(Lease::Type type)
Deletes all pools of specified type.
Definition subnet.cc:518
isc::dhcp::Subnet::get
std::pair< isc::asiolink::IOAddress, uint8_t > get() const
Returns subnet parameters (prefix and prefix length).
Definition subnet.h:90
isc::dhcp::Subnet::getLabel
virtual std::string getLabel() const
Generates an identifying label for logging.
Definition subnet.h:400
isc::dhcp::Subnet::parsePrefixCommon
static std::pair< asiolink::IOAddress, uint8_t > parsePrefixCommon(const std::string &prefix)
Converts subnet prefix to a pair of prefix/length pair.
Definition subnet.cc:217
isc::dhcp::Subnet::setAllocator
void setAllocator(Lease::Type type, const AllocatorPtr &allocator)
Sets new allocator instance.
Definition subnet.cc:369
isc::dhcp::Subnet::getSharedNetworkName
std::string getSharedNetworkName() const
Returns shared network name.
Definition subnet.h:250
isc::dhcp::Subnet::pools_
PoolCollection pools_
collection of IPv4 or non-temporary IPv6 pools in that subnet.
Definition subnet.h:424
isc::dhcp::Subnet::getPoolsWritable
PoolCollection & getPoolsWritable(Lease::Type type)
Returns all pools (non-const variant).
Definition subnet.cc:341
isc::dhcp::Subnet::getPool
const PoolPtr getPool(Lease::Type type, const isc::asiolink::IOAddress &addr, bool anypool=true) const
Returns a pool that specified address belongs to.
Definition subnet.cc:389
isc::dhcp::Subnet::Subnet
Subnet(const isc::asiolink::IOAddress &prefix, uint8_t len, const SubnetID id)
Protected constructor.
Definition subnet.cc:70
isc::dhcp::Subnet::shared_network_name_
std::string shared_network_name_
Shared network name.
Definition subnet.h:436
isc::dhcp::Subnet::poolOverlaps
bool poolOverlaps(const Lease::Type &pool_type, const PoolPtr &pool) const
Checks if the specified pool overlaps with an existing pool.
Definition subnet.cc:564
isc::dhcp::Subnet::default_pool
virtual isc::asiolink::IOAddress default_pool() const =0
Returns the default address that will be used for pool selection.
isc::dhcp::Subnet::pools_pd_
PoolCollection pools_pd_
collection of IPv6 prefix pools in that subnet.
Definition subnet.h:427
isc::dhcp::Subnet::getPools
const PoolCollection & getPools(Lease::Type type) const
Returns all pools (const variant).
Definition subnet.cc:325
isc::dhcp::Subnet::checkType
virtual void checkType(Lease::Type type) const =0
Checks if used pool type is valid.
isc::dhcp::Subnet::allocation_states_
std::map< Lease::Type, SubnetAllocationStatePtr > allocation_states_
Holds subnet-specific allocation state.
Definition subnet.h:442
isc::dhcp::Subnet::createAllocators
virtual void createAllocators()=0
Instantiates the allocators and their states.
isc::dhcp::Subnet::inPool
bool inPool(Lease::Type type, const isc::asiolink::IOAddress &addr) const
checks if the specified address is in pools.
Definition subnet.cc:523
isc::dhcp::Subnet::setSharedNetwork
void setSharedNetwork(const NetworkPtr &shared_network)
Assigns shared network to a subnet.
Definition subnet.h:243
isc::dhcp::Subnet::setAllocationState
void setAllocationState(Lease::Type type, const SubnetAllocationStatePtr &allocation_state)
Sets subnet-specific allocation state.
Definition subnet.cc:385
isc::util::Triplet
This template specifies a parameter value.
Definition triplet.h:37
data.h
dhcp_space.h
io_address.h
lease.h
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::SubnetPtr
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition subnet.h:446
isc::dhcp::Subnet4Ptr
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition subnet.h:458
isc::dhcp::ConstSubnet6Ptr
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition subnet.h:620
isc::dhcp::SubnetFetcher6
SubnetFetcher< Subnet6Ptr, Subnet6Collection > SubnetFetcher6
Type of the SubnetFetcher used for IPv6.
Definition subnet.h:970
isc::dhcp::ConstSubnet4Ptr
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition subnet.h:455
isc::dhcp::SubnetTPtr
boost::shared_ptr< SubnetT< D > > SubnetTPtr
Definition subnet.h:996
isc::dhcp::Subnet6Ptr
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition subnet.h:623
isc::dhcp::Subnet6Collection
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet6Collection
A collection of Subnet6 objects.
Definition subnet.h:934
isc::dhcp::ConstSubnetTPtr
boost::shared_ptr< const SubnetT< D > > ConstSubnetTPtr
Definition subnet.h:999
isc::dhcp::PoolCollection
std::vector< PoolPtr > PoolCollection
a container for either IPv4 or IPv6 Pools
Definition pool.h:729
isc::dhcp::Subnet4SimpleCollection
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > > > Subnet4SimpleCollection
A simple collection of Subnet4 objects.
Definition subnet.h:807
isc::dhcp::PoolPtr
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
Definition pool.h:726
isc::dhcp::Subnet4Collection
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet4Collection
A collection of Subnet4 objects.
Definition subnet.h:863
isc::dhcp::SubnetID
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
isc::dhcp::Subnet6SimpleCollection
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > > > > Subnet6SimpleCollection
A simple collection of Subnet6 objects.
Definition subnet.h:887
isc::dhcp::ConstSubnetPtr
boost::shared_ptr< const Subnet > ConstSubnetPtr
A generic pointer to either const Subnet4 or const Subnet6 object.
Definition subnet.h:449
isc::dhcp::NetworkPtr
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
Definition network.h:73
isc::dhcp::AllocatorPtr
boost::shared_ptr< Allocator > AllocatorPtr
Defines a pointer to an allocator.
Definition allocator.h:269
isc::dhcp::SubnetAllocationStatePtr
boost::shared_ptr< SubnetAllocationState > SubnetAllocationStatePtr
Definition allocation_state.h:80
isc::dhcp::SubnetFetcher4
SubnetFetcher< Subnet4Ptr, Subnet4Collection > SubnetFetcher4
Type of the SubnetFetcher used for IPv4.
Definition subnet.h:967
isc::dhcp::SubnetT
typename AdapterSubnet< D >::type SubnetT
Definition subnet.h:993
isc::util::DHCPv6
@ DHCPv6
Definition dhcp_space.h:19
isc::util::DHCPv4
@ DHCPv4
Definition dhcp_space.h:18
isc::util::uint128_t
boost::multiprecision::checked_uint128_t uint128_t
Definition bigints.h:21
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
network.h
option_space_container.h
pool.h
isc::dhcp::Cfg4o6
This structure contains information about DHCP4o6 (RFC7341).
Definition cfg_4o6.h:22
isc::dhcp::Lease::Type
Type
Type of lease or pool.
Definition lease.h:46
isc::dhcp::SubnetModificationTimeIndexTag
Tag for the index for searching by subnet modification time.
Definition subnet.h:783
isc::dhcp::SubnetPrefixIndexTag
Tag for the index for searching by subnet prefix.
Definition subnet.h:777
isc::dhcp::SubnetServerIdIndexTag
Tag for the index for searching by server identifier.
Definition subnet.h:780
isc::dhcp::SubnetSubnetIdIndexTag
Tag for the index for searching by subnet identifier.
Definition subnet.h:774
subnet_id.h
triplet.h
user_context.h