 |
Kea
1.5.0
|
Go to the documentation of this file.
20 #include <boost/multi_index/mem_fun.hpp>
21 #include <boost/multi_index/indexed_by.hpp>
22 #include <boost/multi_index/ordered_index.hpp>
23 #include <boost/multi_index/random_access_index.hpp>
24 #include <boost/multi_index_container.hpp>
25 #include <boost/date_time/posix_time/posix_time.hpp>
26 #include <boost/pointer_cast.hpp>
27 #include <boost/shared_ptr.hpp>
119 std::pair<isc::asiolink::IOAddress, uint8_t>
get()
const {
172 bool anypool =
true)
const;
224 virtual std::string
toText()
const;
251 template<
typename SharedNetworkPtrType>
253 shared_network = boost::dynamic_pointer_cast<
266 void setSharedNetwork(
const NetworkPtr& shared_network) {
395 static std::pair<asiolink::IOAddress, uint8_t>
549 void setSname(
const std::string& sname);
554 const std::string&
getSname()
const;
591 static std::pair<asiolink::IOAddress, uint8_t>
617 std::string filename_;
710 static std::pair<asiolink::IOAddress, uint8_t>
770 typedef boost::multi_index_container<
774 boost::multi_index::indexed_by<
777 boost::multi_index::random_access<
778 boost::multi_index::tag<SubnetRandomAccessIndexTag>
781 boost::multi_index::ordered_unique<
782 boost::multi_index::tag<SubnetSubnetIdIndexTag>,
783 boost::multi_index::const_mem_fun<Subnet, SubnetID, &Subnet::getID>
786 boost::multi_index::ordered_unique<
787 boost::multi_index::tag<SubnetPrefixIndexTag>,
788 boost::multi_index::const_mem_fun<Subnet, std::string, &Subnet::toText>
792 boost::multi_index::ordered_non_unique<
793 boost::multi_index::tag<SubnetServerIdIndexTag>,
822 typedef boost::multi_index_container<
826 boost::multi_index::indexed_by<
829 boost::multi_index::random_access<
830 boost::multi_index::tag<SubnetRandomAccessIndexTag>
833 boost::multi_index::ordered_unique<
834 boost::multi_index::tag<SubnetSubnetIdIndexTag>,
835 boost::multi_index::const_mem_fun<Subnet, SubnetID, &Subnet::getID>
838 boost::multi_index::ordered_unique<
839 boost::multi_index::tag<SubnetPrefixIndexTag>,
840 boost::multi_index::const_mem_fun<Subnet, std::string, &Subnet::toText>
void delPools(Lease::Type type)
Deletes all pools of specified type.
virtual void checkType(Lease::Type type) const =0
Checks if used pool type is valid.
boost::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, 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 > > >> Subnet6Collection
A collection of Subnet6 objects.
Subnet6(const isc::asiolink::IOAddress &prefix, uint8_t length, const Triplet< uint32_t > &t1, const Triplet< uint32_t > &t2, const Triplet< uint32_t > &preferred_lifetime, const Triplet< uint32_t > &valid_lifetime, const SubnetID id=0)
Constructor with all parameters.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
PoolPtr getAnyPool(Lease::Type type)
Returns a pool without any address specified.
Represents a network that can be associated with a subnet.
static void resetSubnetID()
Resets subnet-id counter to its initial value (1)
virtual ~Subnet()
virtual destructor
static SubnetID generateNextID()
returns the next unique Subnet-ID
std::map< Lease::Type, boost::posix_time::ptime > last_allocated_time_
Timestamp indicating when a lease of a specified type has been last allocated from this subnet.
The IOAddress class represents an IP addresses (version agnostic)
A configuration holder for IPv4 subnet.
Abstract class for configuration Cfg_* classes.
Base class for user context.
Tag for the index for searching by server identifier.
Type
Type of lease or pool.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
void setSname(const std::string &sname)
Sets server hostname for the Subnet4.
virtual isc::asiolink::IOAddress default_pool() const =0
Returns the default address that will be used for pool selection.
Subnet4(const isc::asiolink::IOAddress &prefix, uint8_t length, const Triplet< uint32_t > &t1, const Triplet< uint32_t > &t2, const Triplet< uint32_t > &valid_lifetime, const SubnetID id=0)
Constructor with all parameters.
std::string shared_network_name_
Shared network name.
const PoolCollection & getPools(Lease::Type type) const
Returns all pools (const variant)
virtual data::ElementPtr toElement() const
Unparse a subnet object.
virtual std::string toText() const
Returns textual representation of the subnet (e.g.
const std::string & getSname() const
Returns server hostname for this subnet.
isc::asiolink::IOAddress last_allocated_ia_
last allocated address
Defines the logger used by the top-level component of kea-dhcp-ddns.
void setSiaddr(const isc::asiolink::IOAddress &siaddr)
Sets siaddr for the Subnet4.
Specialization of the Network object for DHCPv6 case.
uint8_t prefix_len_
a prefix length of the subnet
const PoolPtr getPool(Lease::Type type, const isc::asiolink::IOAddress &addr, bool anypool=true) const
Returns a pool that specified address belongs to.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
std::pair< isc::asiolink::IOAddress, uint8_t > get() const
Returns subnet parameters (prefix and prefix length)
std::string iface_
Name of the network interface (if connected directly)
static std::pair< asiolink::IOAddress, uint8_t > parsePrefixCommon(const std::string &prefix)
Converts subnet prefix to a pair of prefix/length pair.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
bool poolOverlaps(const Lease::Type &pool_type, const PoolPtr &pool) const
Checks if the specified pool overlaps with an existing pool.
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
virtual data::ElementPtr toElement() const
Unparse a subnet object.
static SubnetID static_id_
keeps the subnet-id value
uint64_t getPoolCapacity(Lease::Type type) const
Returns the number of possible leases for specified lease type.
Tag for the index for searching by subnet prefix.
A configuration holder for IPv6 subnet.
virtual asiolink::IOAddress getServerId() const
Returns binary representation of the dhcp-server-identifier option (54).
void getSharedNetwork(SharedNetworkPtrType &shared_network) const
Retrieves pointer to a shared network associated with a subnet.
isc::asiolink::IOAddress last_allocated_ta_
last allocated temporary address
isc::asiolink::IOAddress prefix_
a prefix of the subnet
PoolCollection pools_
collection of IPv4 or non-temporary IPv6 pools in that subnet
const Cfg4o6 & get4o6() const
Returns const DHCP4o6 configuration parameters.
Subnet6Ptr getNextSubnet(const Subnet6Ptr &first_subnet) const
Returns next subnet within shared network.
void setLastAllocated(Lease::Type type, const isc::asiolink::IOAddress &addr)
sets the last address that was tried from this subnet
PoolCollection & getPoolsWritable(Lease::Type type)
Returns all pools (non-const variant)
std::string getSharedNetworkName() const
Returns shared network name.
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...
virtual data::ElementPtr toElement() const
Unparse a subnet object.
boost::posix_time::ptime getLastAllocatedTime(const Lease::Type &lease_type) const
Returns the timestamp when the setLastAllocated function was called.
const std::string & getFilename() const
Returns boot file name for this subnet.
PoolCollection pools_ta_
collection of IPv6 temporary address pools in that subnet
Tag for the random access index.
Cfg4o6 & get4o6()
Returns DHCP4o6 configuration parameters.
SubnetID getID() const
Returns unique ID for that subnet.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
bool inRange(const isc::asiolink::IOAddress &addr) const
checks if specified address is in range
boost::weak_ptr< Network > WeakNetworkPtr
Weak pointer to the Network object.
void setSharedNetworkName(const std::string &shared_network_name)
Sets new shared network name.
bool inPool(Lease::Type type, const isc::asiolink::IOAddress &addr) const
checks if the specified address is in pools
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...
std::vector< PoolPtr > PoolCollection
a container for either IPv4 or IPv6 Pools
Subnet4Ptr getNextSubnet(const Subnet4Ptr &first_subnet) const
Returns next subnet within shared network.
boost::shared_ptr< Element > ElementPtr
WeakNetworkPtr shared_network_
Pointer to a shared network that subnet belongs to.
Tag for the index for searching by subnet identifier.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
uint64_t sumPoolCapacity(const PoolCollection &pools) const
Returns a sum of possible leases in all pools.
Specialization of the Network object for DHCPv4 case.
Subnet(const isc::asiolink::IOAddress &prefix, uint8_t len, const SubnetID id)
Protected constructor.
isc::asiolink::IOAddress getSiaddr() const
Returns siaddr for this subnet.
static std::pair< asiolink::IOAddress, uint8_t > parsePrefix(const std::string &prefix)
Converts subnet prefix to a pair of prefix/length pair.
void addPool(const PoolPtr &pool)
Adds a new pool for the subnet.
static std::pair< asiolink::IOAddress, uint8_t > parsePrefix(const std::string &prefix)
Converts subnet prefix to a pair of prefix/length pair.
void setFilename(const std::string &filename)
Sets boot file name for the Subnet4.
Container for storing client class names.
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
PoolCollection pools_pd_
collection of IPv6 prefix pools in that subnet
isc::asiolink::IOAddress last_allocated_pd_
last allocated IPv6 prefix
isc::asiolink::IOAddress getLastAllocated(Lease::Type type) const
returns the last address that was tried from this subnet
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, 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 > > >> Subnet4Collection
A collection of Subnet4 objects.
This structure contains information about DHCP4o6 (RFC7341)