![]() |
Kea
1.5.0
|
A configuration holder for IPv4 subnet. More...
#include <subnet.h>
Inheritance diagram for isc::dhcp::Subnet4:Public Member Functions | |
| 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. More... | |
| 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 classes. More... | |
| Cfg4o6 & | get4o6 () |
| Returns DHCP4o6 configuration parameters. More... | |
| const Cfg4o6 & | get4o6 () const |
| Returns const DHCP4o6 configuration parameters. More... | |
| const std::string & | getFilename () const |
| Returns boot file name for this subnet. More... | |
| Subnet4Ptr | getNextSubnet (const Subnet4Ptr &first_subnet) const |
| Returns next subnet within shared network. More... | |
| Subnet4Ptr | getNextSubnet (const Subnet4Ptr &first_subnet, const ClientClasses &client_classes) const |
| Returns next subnet within shared network that matches client classes. More... | |
| isc::asiolink::IOAddress | getSiaddr () const |
| Returns siaddr for this subnet. More... | |
| const std::string & | getSname () const |
| Returns server hostname for this subnet. More... | |
| void | setFilename (const std::string &filename) |
| Sets boot file name for the Subnet4. More... | |
| void | setSiaddr (const isc::asiolink::IOAddress &siaddr) |
| Sets siaddr for the Subnet4. More... | |
| void | setSname (const std::string &sname) |
| Sets server hostname for the Subnet4. More... | |
| virtual data::ElementPtr | toElement () const |
| Unparse a subnet object. More... | |
Public Member Functions inherited from isc::dhcp::Subnet | |
| void | addPool (const PoolPtr &pool) |
| Adds a new pool for the subnet. More... | |
| void | delPools (Lease::Type type) |
| Deletes all pools of specified type. More... | |
| std::pair< isc::asiolink::IOAddress, uint8_t > | get () const |
| Returns subnet parameters (prefix and prefix length) More... | |
| PoolPtr | getAnyPool (Lease::Type type) |
| Returns a pool without any address specified. More... | |
| SubnetID | getID () const |
| Returns unique ID for that subnet. More... | |
| isc::asiolink::IOAddress | getLastAllocated (Lease::Type type) const |
| returns the last address that was tried from this subnet More... | |
| boost::posix_time::ptime | getLastAllocatedTime (const Lease::Type &lease_type) const |
Returns the timestamp when the setLastAllocated function was called. More... | |
| const PoolPtr | getPool (Lease::Type type, const ClientClasses &client_classes, const isc::asiolink::IOAddress &addr) const |
| Returns a pool that specified address belongs to with classes. More... | |
| const PoolPtr | getPool (Lease::Type type, const isc::asiolink::IOAddress &addr, bool anypool=true) const |
| Returns a pool that specified address belongs to. More... | |
| uint64_t | getPoolCapacity (Lease::Type type) const |
| Returns the number of possible leases for specified lease type. More... | |
| uint64_t | getPoolCapacity (Lease::Type type, const ClientClasses &client_classes) const |
| Returns the number of possible leases for specified lease type allowed for a client which belongs to classes. More... | |
| const PoolCollection & | getPools (Lease::Type type) const |
| Returns all pools (const variant) More... | |
| template<typename SharedNetworkPtrType > | |
| void | getSharedNetwork (SharedNetworkPtrType &shared_network) const |
| Retrieves pointer to a shared network associated with a subnet. More... | |
| std::string | getSharedNetworkName () const |
| Returns shared network name. More... | |
| bool | inPool (Lease::Type type, const isc::asiolink::IOAddress &addr) const |
| checks if the specified address is in pools More... | |
| bool | inPool (Lease::Type type, const isc::asiolink::IOAddress &addr, const ClientClasses &client_classes) const |
| checks if the specified address is in allowed pools More... | |
| bool | inRange (const isc::asiolink::IOAddress &addr) const |
| checks if specified address is in range More... | |
| void | setLastAllocated (Lease::Type type, const isc::asiolink::IOAddress &addr) |
| sets the last address that was tried from this subnet More... | |
| void | setSharedNetworkName (const std::string &shared_network_name) |
| Sets new shared network name. More... | |
| virtual std::string | toText () const |
| Returns textual representation of the subnet (e.g. More... | |
Public Member Functions inherited from isc::data::UserContext | |
| void | contextToElement (data::ElementPtr map) const |
| Merge unparse a user_context object. More... | |
| data::ConstElementPtr | getContext () const |
| Returns const pointer to the user context. More... | |
| void | setContext (const data::ConstElementPtr &ctx) |
| Sets user context. More... | |
Public Member Functions inherited from isc::data::CfgToElement | |
| virtual | ~CfgToElement () |
| Destructor. More... | |
Public Member Functions inherited from isc::dhcp::Network4 | |
| Network4 () | |
| Constructor. More... | |
| bool | getAuthoritative () const |
| Returns the flag indicating if requests for unknown IP addresses should be rejected with DHCPNAK instead of ignored. More... | |
| bool | getMatchClientId () const |
| Returns the flag indicating if the client identifiers should be used to identify the client's lease. More... | |
| virtual asiolink::IOAddress | getServerId () const |
| Returns binary representation of the dhcp-server-identifier option (54). More... | |
| void | setAuthoritative (const bool authoritative) |
| Sets the flag indicating if requests for unknown IP addresses should be rejected with DHCPNAK instead of ignored. More... | |
| void | setMatchClientId (const bool match) |
| Sets the flag indicating if the client identifier should be used to identify the client's lease. More... | |
Public Member Functions inherited from isc::dhcp::Network | |
| Network () | |
| Constructor. More... | |
| virtual | ~Network () |
| Virtual destructor. More... | |
| void | addRelayAddress (const asiolink::IOAddress &addr) |
| Adds an address to the list addresses in the network's relay info. More... | |
| void | allowClientClass (const isc::dhcp::ClientClass &class_name) |
| Sets the supported class to class class_name. More... | |
| CfgOptionPtr | getCfgOption () |
| Returns pointer to the option data configuration for this subnet. More... | |
| ConstCfgOptionPtr | getCfgOption () const |
| Returns const pointer to the option data configuration for this subnet. More... | |
| const isc::dhcp::ClientClass & | getClientClass () const |
| returns the client class More... | |
| HRMode | getHostReservationMode () const |
| Specifies what type of Host Reservations are supported. More... | |
| std::string | getIface () const |
| Returns name of the local interface for which this network is selected. More... | |
| const IOAddressList & | getRelayAddresses () const |
| Returns the list of relay addresses from the network's relay info. More... | |
| const RelayInfo & | getRelayInfo () const |
| Returns const reference to relay information. More... | |
| const isc::dhcp::ClientClasses & | getRequiredClasses () const |
| Returns classes which are required to be evaluated. More... | |
| Triplet< uint32_t > | getT1 () const |
| Returns T1 (renew timer), expressed in seconds. More... | |
| Triplet< uint32_t > | getT2 () const |
| Returns T2 (rebind timer), expressed in seconds. More... | |
| Triplet< uint32_t > | getValid () const |
| Return valid-lifetime for addresses in that prefix. More... | |
| bool | hasRelayAddress (const asiolink::IOAddress &address) const |
| Tests if the network's relay info contains the given address. More... | |
| bool | hasRelays () const |
| Indicates if network's relay info has relay addresses. More... | |
| void | requireClientClass (const isc::dhcp::ClientClass &class_name) |
| Adds class class_name to classes required to be evaluated. More... | |
| void | setHostReservationMode (HRMode mode) |
| Sets host reservation mode. More... | |
| void | setIface (const std::string &iface_name) |
| Sets local name of the interface for which this network is selected. More... | |
| void | setRelayInfo (const RelayInfo &relay) |
| Sets information about relay. More... | |
| void | setT1 (const Triplet< uint32_t > &t1) |
| Sets new renew timer for a network. More... | |
| void | setT2 (const Triplet< uint32_t > &t2) |
| Sets new rebind timer for a network. More... | |
| void | setValid (const Triplet< uint32_t > &valid) |
| Sets new valid lifetime for a network. More... | |
Public Member Functions inherited from isc::data::StampedElement | |
| StampedElement () | |
| Constructor. More... | |
| boost::posix_time::ptime | getModificationTime () const |
| Returns timestamp. More... | |
| void | setModificationTime (const boost::posix_time::ptime ×tamp) |
| Sets timestamp to the explicitly provided value. More... | |
| void | updateModificationTime () |
| Sets timestmp to the current time. More... | |
Static Public Member Functions | |
| static std::pair< asiolink::IOAddress, uint8_t > | parsePrefix (const std::string &prefix) |
| Converts subnet prefix to a pair of prefix/length pair. More... | |
Static Public Member Functions inherited from isc::dhcp::Subnet | |
| static void | resetSubnetID () |
| Resets subnet-id counter to its initial value (1) More... | |
Static Public Member Functions inherited from isc::data::UserContext | |
| static data::ElementPtr | toElement (data::ConstElementPtr map) |
| Copy extracting comments an Element map. More... | |
Additional Inherited Members | |
Public Types inherited from isc::dhcp::Network | |
| enum | HRMode { HR_DISABLED, HR_OUT_OF_POOL, HR_GLOBAL, HR_ALL } |
| Specifies allowed host reservation mode. More... | |
| typedef boost::shared_ptr< Network::RelayInfo > | RelayInfoPtr |
| Pointer to the RelayInfo structure. More... | |
Protected Member Functions inherited from isc::dhcp::Subnet | |
| Subnet (const isc::asiolink::IOAddress &prefix, uint8_t len, const SubnetID id) | |
| Protected constructor. More... | |
| virtual | ~Subnet () |
| virtual destructor More... | |
| PoolCollection & | getPoolsWritable (Lease::Type type) |
| Returns all pools (non-const variant) More... | |
| bool | poolOverlaps (const Lease::Type &pool_type, const PoolPtr &pool) const |
| Checks if the specified pool overlaps with an existing pool. More... | |
| uint64_t | sumPoolCapacity (const PoolCollection &pools) const |
| Returns a sum of possible leases in all pools. More... | |
| uint64_t | sumPoolCapacity (const PoolCollection &pools, const ClientClasses &client_classes) const |
| Returns a sum of possible leases in all pools allowing classes. More... | |
Static Protected Member Functions inherited from isc::dhcp::Subnet | |
| static SubnetID | generateNextID () |
| returns the next unique Subnet-ID More... | |
| static std::pair< asiolink::IOAddress, uint8_t > | parsePrefixCommon (const std::string &prefix) |
| Converts subnet prefix to a pair of prefix/length pair. More... | |
Protected Attributes inherited from isc::dhcp::Subnet | |
| SubnetID | id_ |
| subnet-id More... | |
| std::string | iface_ |
| Name of the network interface (if connected directly) More... | |
| isc::asiolink::IOAddress | last_allocated_ia_ |
| last allocated address More... | |
| isc::asiolink::IOAddress | last_allocated_pd_ |
| last allocated IPv6 prefix More... | |
| isc::asiolink::IOAddress | last_allocated_ta_ |
| last allocated temporary address More... | |
| 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. More... | |
| PoolCollection | pools_ |
| collection of IPv4 or non-temporary IPv6 pools in that subnet More... | |
| PoolCollection | pools_pd_ |
| collection of IPv6 prefix pools in that subnet More... | |
| PoolCollection | pools_ta_ |
| collection of IPv6 temporary address pools in that subnet More... | |
| isc::asiolink::IOAddress | prefix_ |
| a prefix of the subnet More... | |
| uint8_t | prefix_len_ |
| a prefix length of the subnet More... | |
| WeakNetworkPtr | shared_network_ |
| Pointer to a shared network that subnet belongs to. More... | |
| std::string | shared_network_name_ |
| Shared network name. More... | |
Protected Attributes inherited from isc::data::UserContext | |
| data::ConstElementPtr | user_context_ |
| Pointer to the user context (may be NULL) More... | |
Protected Attributes inherited from isc::dhcp::Network | |
| CfgOptionPtr | cfg_option_ |
| Pointer to the option data configuration for this subnet. More... | |
| ClientClass | client_class_ |
| Optional definition of a client class. More... | |
| HRMode | host_reservation_mode_ |
| Specifies host reservation mode. More... | |
| std::string | iface_name_ |
| Holds interface name for which this network is selected. More... | |
| RelayInfo | relay_ |
| Relay information. More... | |
| ClientClasses | required_classes_ |
| Required classes. More... | |
| Triplet< uint32_t > | t1_ |
| a Triplet (min/default/max) holding allowed renew timer values More... | |
| Triplet< uint32_t > | t2_ |
| a Triplet (min/default/max) holding allowed rebind timer values More... | |
| Triplet< uint32_t > | valid_ |
| a Triplet (min/default/max) holding allowed valid lifetime values More... | |
Static Protected Attributes inherited from isc::dhcp::Subnet | |
| static SubnetID | static_id_ = 1 |
| keeps the subnet-id value More... | |
A configuration holder for IPv4 subnet.
This class represents an IPv4 subnet.
| isc::dhcp::Subnet4::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.
This constructor calls Subnet::Subnet, where subnet-id is generated.
| prefix | Subnet4 prefix |
| length | prefix length |
| t1 | renewal timer (in seconds) |
| t2 | rebind timer (in seconds) |
| valid_lifetime | preferred lifetime of leases (in seconds) |
| id | arbitrary subnet id, default value of 0 triggers autogeneration of subnet id |
Definition at line 244 of file subnet.cc.
References isc_throw, isc::asiolink::IOAddress::isV4(), isc::dhcp::Network::setT1(), isc::dhcp::Network::setT2(), isc::dhcp::Network::setValid(), and isc::asiolink::IOAddress::toText().
Here is the call graph for this function:
|
virtual |
Checks whether this subnet and parent shared network supports the client that belongs to specified classes.
This method extends the Network::clientSupported method with additional checks whether shared network owning this class supports the client belonging to specified classes. If the class doesn't belong to a shared network this method only checks if the subnet supports specified classes.
| client_classes | List of classes the client belongs to. |
Reimplemented from isc::dhcp::Network.
Definition at line 302 of file subnet.cc.
References isc::dhcp::Network::clientSupported(), and isc::dhcp::Subnet::getSharedNetwork().
Here is the call graph for this function:
|
inline |
Returns DHCP4o6 configuration parameters.
This structure is always available. If the 4o6 is not enabled, its enabled_ field will be set to false.
Definition at line 570 of file subnet.h.
Referenced by toElement().
|
inline |
| const std::string & isc::dhcp::Subnet4::getFilename | ( | ) | const |
Returns boot file name for this subnet.
Definition at line 335 of file subnet.cc.
Referenced by toElement().
| Subnet4Ptr isc::dhcp::Subnet4::getNextSubnet | ( | const Subnet4Ptr & | first_subnet | ) | const |
Returns next subnet within shared network.
If the current subnet doesn't belong to any shared network or if the next subnet is the same as first subnet (specified in the argument) a NULL pointer is returned.
| first_subnet | Pointer to the subnet from which iterations have started. |
Definition at line 263 of file subnet.cc.
References isc::dhcp::Subnet::getID(), and isc::dhcp::Subnet::getSharedNetwork().
Here is the call graph for this function:| Subnet4Ptr isc::dhcp::Subnet4::getNextSubnet | ( | const Subnet4Ptr & | first_subnet, |
| const ClientClasses & | client_classes | ||
| ) | const |
Returns next subnet within shared network that matches client classes.
| first_subnet | Pointer to the subnet from which iterations have started. |
| client_classes | List of classes that the client belongs to. The subnets not matching the classes aren't returned by this method. |
Definition at line 274 of file subnet.cc.
References isc::dhcp::Subnet::getID(), and isc::dhcp::Subnet::getSharedNetwork().
Here is the call graph for this function:| isc::asiolink::IOAddress isc::dhcp::Subnet4::getSiaddr | ( | ) | const |
Returns siaddr for this subnet.
Definition at line 320 of file subnet.cc.
Referenced by toElement().
| const std::string & isc::dhcp::Subnet4::getSname | ( | ) | const |
Returns server hostname for this subnet.
Definition at line 328 of file subnet.cc.
Referenced by toElement().
|
static |
Converts subnet prefix to a pair of prefix/length pair.
| prefix | Prefix to be parsed. |
| BadValue | if provided invalid IPv4 prefix. |
Definition at line 742 of file subnet.cc.
References isc_throw, and isc::dhcp::Subnet::parsePrefixCommon().
Here is the call graph for this function:| void isc::dhcp::Subnet4::setFilename | ( | const std::string & | filename | ) |
| void isc::dhcp::Subnet4::setSiaddr | ( | const isc::asiolink::IOAddress & | siaddr | ) |
Sets siaddr for the Subnet4.
Will be used for siaddr field (the next server) that typically is used as TFTP server. If not specified, the default value of 0.0.0.0 is used.
Definition at line 312 of file subnet.cc.
References isc_throw, and isc::asiolink::IOAddress::isV4().
Here is the call graph for this function:| void isc::dhcp::Subnet4::setSname | ( | const std::string & | sname | ) |
|
virtual |
Unparse a subnet object.
Reimplemented from isc::dhcp::Network4.
Definition at line 708 of file subnet.cc.
References get4o6(), getFilename(), isc::dhcp::Subnet::getPools(), getSiaddr(), getSname(), isc::data::merge(), isc::dhcp::Cfg4o6::toElement(), isc::dhcp::Subnet::toElement(), isc::dhcp::Network4::toElement(), isc::dhcp::Subnet::toText(), and isc::dhcp::Lease::TYPE_V4.
Here is the call graph for this function: