Kea 2.5.8
isc::dhcp::Subnet4 Class Reference

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 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.
 
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.
 
virtual void createAllocators ()
 Instantiates the allocator and its state.
 
Cfg4o6get4o6 ()
 Returns DHCP4o6 configuration parameters.
 
const Cfg4o6get4o6 () const
 Returns const DHCP4o6 configuration parameters.
 
Subnet4Ptr getNextSubnet (const Subnet4Ptr &first_subnet) const
 Returns next subnet within shared network.
 
Subnet4Ptr getNextSubnet (const Subnet4Ptr &first_subnet, const ClientClasses &client_classes) const
 Returns next subnet within shared network that matches client classes.
 
virtual data::ElementPtr toElement () const
 Unparse a subnet object.
 
- Public Member Functions inherited from isc::dhcp::Subnet
void addPool (const PoolPtr &pool)
 Adds a new pool for the subnet.
 
virtual void createAllocators ()=0
 Instantiates the allocators and their states.
 
virtual isc::asiolink::IOAddress default_pool () const =0
 Returns the default address that will be used for pool selection.
 
void delPools (Lease::Type type)
 Deletes all pools of specified type.
 
std::pair< isc::asiolink::IOAddress, uint8_t > get () const
 Returns subnet parameters (prefix and prefix length).
 
SubnetAllocationStatePtr getAllocationState (Lease::Type type) const
 Returns subnet-specific allocation state.
 
AllocatorPtr getAllocator (Lease::Type type) const
 Returns lease allocator instance.
 
PoolPtr getAnyPool (Lease::Type type)
 Returns a pool without any address specified.
 
SubnetID getID () const
 Returns unique ID for that subnet.
 
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.
 
const PoolPtr getPool (Lease::Type type, const isc::asiolink::IOAddress &addr, bool anypool=true) const
 Returns a pool that specified address belongs to.
 
isc::util::uint128_t getPoolCapacity (Lease::Type type) const
 Returns the number of possible leases for specified lease type.
 
isc::util::uint128_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.
 
isc::util::uint128_t getPoolCapacity (Lease::Type type, const ClientClasses &client_classes, Allocator::PrefixLenMatchType prefix_length_match, uint8_t hint_prefix_length) const
 Returns the number of possible leases for specified lease type allowed for a client which belongs to classes and matching selection criteria relative to provided hint prefix length.
 
const PoolCollectiongetPools (Lease::Type type) const
 Returns all pools (const variant).
 
PoolCollectiongetPoolsWritable (Lease::Type type)
 Returns all pools (non-const variant).
 
template<typename SharedNetworkPtrType >
void getSharedNetwork (SharedNetworkPtrType &shared_network) const
 Retrieves pointer to a shared network associated with a subnet.
 
std::string getSharedNetworkName () const
 Returns shared network name.
 
void initAllocatorsAfterConfigure ()
 Calls initAfterConfigure for each allocator.
 
bool inPool (Lease::Type type, const isc::asiolink::IOAddress &addr) const
 checks if the specified address is in pools.
 
bool inPool (Lease::Type type, const isc::asiolink::IOAddress &addr, const ClientClasses &client_classes) const
 checks if the specified address is in allowed pools.
 
bool inRange (const isc::asiolink::IOAddress &addr) const
 checks if specified address is in range.
 
void setAllocationState (Lease::Type type, const SubnetAllocationStatePtr &allocation_state)
 Sets subnet-specific allocation state.
 
void setAllocator (Lease::Type type, const AllocatorPtr &allocator)
 Sets new allocator instance.
 
void setSharedNetwork (const NetworkPtr &shared_network)
 Assigns shared network to a subnet.
 
void setSharedNetworkName (const std::string &shared_network_name)
 Sets new shared network name.
 
virtual std::string toText () const
 Returns textual representation of the subnet (e.g.
 
- Public Member Functions inherited from isc::dhcp::Network
 Network ()
 Constructor.
 
virtual ~Network ()
 Virtual destructor.
 
void addRelayAddress (const asiolink::IOAddress &addr)
 Adds an address to the list addresses in the network's relay info.
 
void allowClientClass (const isc::dhcp::ClientClass &class_name)
 Sets the supported class to class class_name.
 
virtual bool clientSupported (const isc::dhcp::ClientClasses &client_classes) const
 Checks whether this network supports client that belongs to specified classes.
 
util::Optional< std::string > getAllocatorType (const Inheritance &inheritance=Inheritance::ALL) const
 Returns allocator type.
 
util::Optional< uint32_t > getCacheMaxAge (const Inheritance &inheritance=Inheritance::ALL) const
 Returns value in seconds to use as cache maximum age.
 
util::Optional< double > getCacheThreshold (const Inheritance &inheritance=Inheritance::ALL) const
 Returns percentage to use as cache threshold.
 
util::Optional< bool > getCalculateTeeTimes (const Inheritance &inheritance=Inheritance::ALL) const
 Returns whether or not T1/T2 calculation is enabled.
 
CfgOptionPtr getCfgOption ()
 Returns pointer to the option data configuration for this network.
 
ConstCfgOptionPtr getCfgOption () const
 Returns const pointer to the option data configuration for this network.
 
util::Optional< ClientClassgetClientClass (const Inheritance &inheritance=Inheritance::ALL) const
 returns the client class
 
util::Optional< std::string > getDdnsConflictResolutionMode (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ib-ddns-conflict-resolution-mode.
 
util::Optional< std::string > getDdnsGeneratedPrefix (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-generated-prefix.
 
util::Optional< bool > getDdnsOverrideClientUpdate (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-override-client-update.
 
util::Optional< bool > getDdnsOverrideNoUpdate (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-override-no-update.
 
util::Optional< std::string > getDdnsQualifyingSuffix (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-qualifying-suffix.
 
util::Optional< D2ClientConfig::ReplaceClientNameModegetDdnsReplaceClientNameMode (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-replace-client-name-mode.
 
util::Optional< bool > getDdnsSendUpdates (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-send-updates.
 
util::Optional< double > getDdnsTtlPercent (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-ttl-percent.
 
util::Optional< bool > getDdnsUpdateOnRenew (const Inheritance &inheritance=Inheritance::ALL) const
 Returns ddns-update-on-renew.
 
util::Optional< std::string > getDefaultAllocatorType (const Inheritance &inheritance=Inheritance::ALL) const
 Returns a default allocator type.
 
util::Optional< std::string > getHostnameCharReplacement (const Inheritance &inheritance=Inheritance::ALL) const
 Return the invalid char replacement used to sanitize client hostnames.
 
util::Optional< std::string > getHostnameCharSet (const Inheritance &inheritance=Inheritance::ALL) const
 Return the char set regexp used to sanitize client hostnames.
 
util::Optional< std::string > getIface (const Inheritance &inheritance=Inheritance::ALL) const
 Returns name of the local interface for which this network is selected.
 
virtual std::string getLabel () const
 Generates an identifying label for logging.
 
const IOAddressListgetRelayAddresses () const
 Returns the list of relay addresses from the network's relay info.
 
const RelayInfogetRelayInfo () const
 Returns const reference to relay information.
 
const ClientClassesgetRequiredClasses () const
 Returns classes which are required to be evaluated.
 
util::Optional< bool > getReservationsGlobal (const Inheritance &inheritance=Inheritance::ALL) const
 Returns whether global reservations should be fetched.
 
util::Optional< bool > getReservationsInSubnet (const Inheritance &inheritance=Inheritance::ALL) const
 Returns whether subnet reservations should be fetched.
 
util::Optional< bool > getReservationsOutOfPool (const Inheritance &inheritance=Inheritance::ALL) const
 Returns whether only out-of-pool reservations are allowed.
 
util::Optional< bool > getStoreExtendedInfo (const Inheritance &inheritance=Inheritance::ALL) const
 Returns store-extended-info.
 
isc::util::Triplet< uint32_t > getT1 (const Inheritance &inheritance=Inheritance::ALL) const
 Returns T1 (renew timer), expressed in seconds.
 
util::Optional< double > getT1Percent (const Inheritance &inheritance=Inheritance::ALL) const
 Returns percentage to use when calculating the T1 (renew timer).
 
isc::util::Triplet< uint32_t > getT2 (const Inheritance &inheritance=Inheritance::ALL) const
 Returns T2 (rebind timer), expressed in seconds.
 
util::Optional< double > getT2Percent (const Inheritance &inheritance=Inheritance::ALL) const
 Returns percentage to use when calculating the T2 (rebind timer).
 
isc::util::Triplet< uint32_t > getValid (const Inheritance &inheritance=Inheritance::ALL) const
 Return valid-lifetime for addresses in that prefix.
 
bool hasFetchGlobalsFn () const
 Checks if the network is associated with a function used to fetch globally configured parameters.
 
bool hasRelayAddress (const asiolink::IOAddress &address) const
 Tests if the network's relay info contains the given address.
 
bool hasRelays () const
 Indicates if network's relay info has relay addresses.
 
void requireClientClass (const isc::dhcp::ClientClass &class_name)
 Adds class class_name to classes required to be evaluated.
 
void setAllocatorType (const util::Optional< std::string > &allocator_type)
 Sets new allocator type.
 
void setCacheMaxAge (const util::Optional< uint32_t > &cache_max_age)
 Sets cache max for a network.
 
void setCacheThreshold (const util::Optional< double > &cache_threshold)
 Sets cache threshold for a network.
 
void setCalculateTeeTimes (const util::Optional< bool > &calculate_tee_times)
 Sets whether or not T1/T2 calculation is enabled.
 
void setDdnsConflictResolutionMode (const util::Optional< std::string > &ddns_conflict_resolution_mode)
 Sets new ib-ddns-conflict-resolution-mode.
 
void setDdnsGeneratedPrefix (const util::Optional< std::string > &ddns_generated_prefix)
 Sets new ddns-generated-prefix.
 
void setDdnsOverrideClientUpdate (const util::Optional< bool > &ddns_override_client_update)
 Sets new ddns-override-client-update.
 
void setDdnsOverrideNoUpdate (const util::Optional< bool > &ddns_override_no_update)
 Sets new ddns-override-no-update.
 
void setDdnsQualifyingSuffix (const util::Optional< std::string > &ddns_qualifying_suffix)
 Sets new ddns-qualifying-suffix.
 
void setDdnsReplaceClientNameMode (const util::Optional< D2ClientConfig::ReplaceClientNameMode > &ddns_replace_client_name_mode)
 Sets new ddns-replace-client-name-mode.
 
void setDdnsSendUpdates (const util::Optional< bool > &ddns_send_updates)
 Sets new ddns-send-updates.
 
void setDdnsTtlPercent (const util::Optional< double > &ddns_ttl_percent)
 Sets new ddns-ttl-percent.
 
void setDdnsUpdateOnRenew (const util::Optional< bool > &ddns_update_on_renew)
 Sets new ddns-update-on-renew.
 
void setDefaultAllocatorType (const std::string &allocator_type)
 Sets a defalt allocator type.
 
void setFetchGlobalsFn (FetchNetworkGlobalsFn fetch_globals_fn)
 Sets the optional callback function used to fetch globally configured parameters.
 
void setHostnameCharReplacement (const util::Optional< std::string > &hostname_char_replacement)
 Sets new hostname-char-replacement.
 
void setHostnameCharSet (const util::Optional< std::string > &hostname_char_set)
 Sets new hostname-char-set.
 
void setIface (const util::Optional< std::string > &iface_name)
 Sets local name of the interface for which this network is selected.
 
void setRelayInfo (const RelayInfo &relay)
 Sets information about relay.
 
void setReservationsGlobal (const util::Optional< bool > &reservations_global)
 Sets whether global reservations should be fetched.
 
void setReservationsInSubnet (const util::Optional< bool > &reservations_in_subnet)
 Sets whether subnet reservations should be fetched.
 
void setReservationsOutOfPool (const util::Optional< bool > &reservations_out_of_pool)
 Sets whether only out-of-pool reservations are allowed.
 
void setStoreExtendedInfo (const util::Optional< bool > &store_extended_info)
 Sets new store-extended-info.
 
void setT1 (const isc::util::Triplet< uint32_t > &t1)
 Sets new renew timer for a network.
 
void setT1Percent (const util::Optional< double > &t1_percent)
 Sets new percentage for calculating T1 (renew timer).
 
void setT2 (const isc::util::Triplet< uint32_t > &t2)
 Sets new rebind timer for a network.
 
void setT2Percent (const util::Optional< double > &t2_percent)
 Sets new percentage for calculating T2 (rebind timer).
 
void setValid (const isc::util::Triplet< uint32_t > &valid)
 Sets new valid lifetime for a network.
 
virtual data::ElementPtr toElement () const
 Unparses network object.
 
- Public Member Functions inherited from isc::data::StampedElement
 StampedElement ()
 Constructor.
 
void delServerTag (const std::string &server_tag)
 Deletes server tag.
 
isc::data::ElementPtr getMetadata () const
 Returns an object representing metadata to be returned with objects from the configuration backend.
 
std::set< ServerTaggetServerTags () const
 Returns server tags.
 
bool hasAllServerTag () const
 Checks if the element has 'all' server tag.
 
bool hasServerTag (const ServerTag &server_tag) const
 Checks if the element has the given server tag.
 
void setServerTag (const std::string &server_tag)
 Adds new server tag.
 
- Public Member Functions inherited from isc::data::BaseStampedElement
 BaseStampedElement ()
 Constructor.
 
uint64_t getId () const
 Returns element's database identifier.
 
boost::posix_time::ptime getModificationTime () const
 Returns timestamp.
 
void setId (const uint64_t id)
 Sets element's database identifier.
 
void setModificationTime (const boost::posix_time::ptime &timestamp)
 Sets timestamp to the explicitly provided value.
 
void updateModificationTime ()
 Sets timestamp to the current time.
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object.
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context.
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 
virtual isc::data::ElementPtr toElement () const =0
 Unparse a configuration object.
 
- Public Member Functions inherited from isc::dhcp::Network4
 Network4 ()
 Constructor.
 
util::Optional< bool > getAuthoritative (const Inheritance &inheritance=Inheritance::ALL) const
 Returns the flag indicating if requests for unknown IP addresses should be rejected with DHCPNAK instead of ignored.
 
util::Optional< std::string > getFilename (const Inheritance &inheritance=Inheritance::ALL) const
 Returns boot file name for this subnet.
 
util::Optional< bool > getMatchClientId (const Inheritance &inheritance=Inheritance::ALL) const
 Returns the flag indicating if the client identifiers should be used to identify the client's lease.
 
util::Optional< uint32_t > getOfferLft (const Inheritance &inheritance=Inheritance::ALL) const
 Returns offer lifetime for the network.
 
virtual asiolink::IOAddress getServerId () const
 Returns binary representation of the dhcp-server-identifier option (54).
 
util::Optional< asiolink::IOAddressgetSiaddr (const Inheritance &inheritance=Inheritance::ALL) const
 Returns siaddr for this network.
 
util::Optional< std::string > getSname (const Inheritance &inheritance=Inheritance::ALL) const
 Returns server hostname for this network.
 
void setAuthoritative (const util::Optional< bool > &authoritative)
 Sets the flag indicating if requests for unknown IP addresses should be rejected with DHCPNAK instead of ignored.
 
void setFilename (const util::Optional< std::string > &filename)
 Sets boot file name for the network.
 
void setMatchClientId (const util::Optional< bool > &match)
 Sets the flag indicating if the client identifier should be used to identify the client's lease.
 
void setOfferLft (const util::Optional< uint32_t > &offer_lft)
 Sets offer lifetime for the network.
 
void setSiaddr (const util::Optional< asiolink::IOAddress > &siaddr)
 Sets siaddr for the network.
 
void setSname (const util::Optional< std::string > &sname)
 Sets server hostname for the network.
 
virtual data::ElementPtr toElement () const
 Unparses network object.
 

Static Public Member Functions

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.
 
static std::pair< asiolink::IOAddress, uint8_t > parsePrefix (const std::string &prefix)
 Converts subnet prefix to a pair of prefix/length pair.
 
- Static Public Member Functions inherited from isc::dhcp::Subnet
static void resetSubnetID ()
 Resets subnet-id counter to its initial value (1).
 
- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map.
 

Additional Inherited Members

- Public Types inherited from isc::dhcp::Network
enum class  Inheritance { NONE , PARENT_NETWORK , GLOBAL , ALL }
 Inheritance "mode" used when fetching an optional Network parameter. More...
 
typedef boost::shared_ptr< Network::RelayInfoRelayInfoPtr
 Pointer to the RelayInfo structure.
 
- Protected Member Functions inherited from isc::dhcp::Subnet
 Subnet (const isc::asiolink::IOAddress &prefix, uint8_t len, const SubnetID id)
 Protected constructor.
 
virtual ~Subnet ()
 virtual destructor.
 
virtual void checkType (Lease::Type type) const =0
 Checks if used pool type is valid.
 
virtual std::string getLabel () const
 Generates an identifying label for logging.
 
bool poolOverlaps (const Lease::Type &pool_type, const PoolPtr &pool) const
 Checks if the specified pool overlaps with an existing pool.
 
isc::util::uint128_t sumPoolCapacity (const PoolCollection &pools) const
 Returns a sum of possible leases in all pools.
 
isc::util::uint128_t sumPoolCapacity (const PoolCollection &pools, const ClientClasses &client_classes) const
 Returns a sum of possible leases in all pools allowing classes.
 
isc::util::uint128_t sumPoolCapacity (const PoolCollection &pools, const ClientClasses &client_classes, Allocator::PrefixLenMatchType prefix_length_match, uint8_t hint_prefix_length) const
 Returns a sum of possible leases in all pools allowing classes and matching selection criteria relative to provided hint prefix length.
 
virtual data::ElementPtr toElement () const
 Unparse a subnet object.
 
- Protected Member Functions inherited from isc::dhcp::Network
FetchNetworkGlobalsFn getFetchGlobalsFn () const
 Gets the optional callback function used to fetch globally configured parameters.
 
template<typename NumType >
isc::util::Triplet< NumType > getGlobalProperty (isc::util::Triplet< NumType > property, const int global_index, const int min_index=-1, const int max_index=-1) const
 The getGlobalProperty specialization for isc::util::Triplet<T>.
 
template<typename ReturnType >
ReturnType getGlobalProperty (ReturnType property, const int global_index, const int min_index=-1, const int max_index=-1) const
 Returns a value of global configuration parameter with a given index.
 
util::Optional< asiolink::IOAddressgetGlobalProperty (util::Optional< asiolink::IOAddress > property, const int global_index, const int min_index=-1, const int max_index=-1) const
 The getGlobalProperty specialization for Optional<IOAddress>.
 
template<typename BaseType >
OptionPtr getOptionProperty (OptionPtr(BaseType::*MethodPointer)(const Inheritance &inheritance) const, OptionPtr property, const Inheritance &inheritance) const
 Returns option pointer associated with a network using inheritance.
 
template<typename BaseType , typename ReturnType >
ReturnType getProperty (ReturnType(BaseType::*MethodPointer)(const Inheritance &) const, ReturnType property, const Inheritance &inheritance, const int global_index=-1, const int min_index=-1, const int max_index=-1) const
 Returns a value associated with a network using inheritance.
 
- Static Protected Member Functions inherited from isc::dhcp::Subnet
static SubnetID generateNextID ()
 returns the next unique Subnet-ID.
 
static std::pair< asiolink::IOAddress, uint8_t > parsePrefixCommon (const std::string &prefix)
 Converts subnet prefix to a pair of prefix/length pair.
 
- Protected Attributes inherited from isc::dhcp::Subnet
std::map< Lease::Type, SubnetAllocationStatePtrallocation_states_
 Holds subnet-specific allocation state.
 
std::map< Lease::Type, AllocatorPtrallocators_
 Lease allocators used by the subnet.
 
SubnetID id_
 subnet-id
 
PoolCollection pools_
 collection of IPv4 or non-temporary IPv6 pools in that subnet.
 
PoolCollection pools_pd_
 collection of IPv6 prefix pools in that subnet.
 
PoolCollection pools_ta_
 collection of IPv6 temporary address pools in that subnet.
 
isc::asiolink::IOAddress prefix_
 a prefix of the subnet.
 
uint8_t prefix_len_
 a prefix length of the subnet.
 
std::string shared_network_name_
 Shared network name.
 
- Protected Attributes inherited from isc::dhcp::Network
util::Optional< std::string > allocator_type_
 Allocator used for IP address allocations.
 
util::Optional< uint32_t > cache_max_age_
 Value in seconds to use as cache maximal age.
 
util::Optional< double > cache_threshold_
 Percentage of the lease lifetime to use as cache threshold.
 
util::Optional< bool > calculate_tee_times_
 Enables calculation of T1 and T2 timers.
 
CfgOptionPtr cfg_option_
 Pointer to the option data configuration for this subnet.
 
util::Optional< ClientClassclient_class_
 Optional definition of a client class.
 
util::Optional< std::string > ddns_conflict_resolution_mode_
 DDNS conflict resolution mode.
 
util::Optional< std::string > ddns_generated_prefix_
 Prefix Kea should use when generating domain-names.
 
util::Optional< bool > ddns_override_client_update_
 Should Kea perform updates, even if client requested delegation.
 
util::Optional< bool > ddns_override_no_update_
 Should Kea perform updates, even if client requested no updates.
 
util::Optional< std::string > ddns_qualifying_suffix_
 Suffix Kea should use when to qualify partial domain-names.
 
util::Optional< D2ClientConfig::ReplaceClientNameModeddns_replace_client_name_mode_
 How Kea should handle the domain-name supplied by the client.
 
util::Optional< bool > ddns_send_updates_
 Should Kea perform DNS updates.
 
util::Optional< double > ddns_ttl_percent_
 Percentage of the lease lifetime to use for DNS TTL.
 
util::Optional< bool > ddns_update_on_renew_
 Should Kea perform updates when leases are extended.
 
util::Optional< std::string > default_allocator_type_
 Default allocator type.
 
FetchNetworkGlobalsFn fetch_globals_fn_
 Pointer to the optional callback used to fetch globally configured parameters inherited to the Network object.
 
util::Optional< std::string > hostname_char_replacement_
 A string to replace invalid characters when scrubbing hostnames.
 
util::Optional< std::string > hostname_char_set_
 Regular expression describing invalid characters for client hostnames.
 
util::Optional< std::string > iface_name_
 Holds interface name for which this network is selected.
 
WeakNetworkPtr parent_network_
 Pointer to another network that this network belongs to.
 
RelayInfo relay_
 Relay information.
 
ClientClasses required_classes_
 Required classes.
 
util::Optional< bool > reservations_global_
 Enables global reservations.
 
util::Optional< bool > reservations_in_subnet_
 Enables subnet reservations.
 
util::Optional< bool > reservations_out_of_pool_
 Enables out-of-pool reservations optimization.
 
util::Optional< bool > store_extended_info_
 Should Kea store additional client query data (e.g.
 
isc::util::Triplet< uint32_t > t1_
 a isc::util::Triplet (min/default/max) holding allowed renew timer values
 
util::Optional< double > t1_percent_
 Percentage of the lease lifetime to use when calculating T1 timer.
 
isc::util::Triplet< uint32_t > t2_
 a isc::util::Triplet (min/default/max) holding allowed rebind timer values
 
util::Optional< double > t2_percent_
 Percentage of the lease lifetime to use when calculating T2 timer.
 
isc::util::Triplet< uint32_t > valid_
 a isc::util::Triplet (min/default/max) holding allowed valid lifetime values
 
- Protected Attributes inherited from isc::data::BaseStampedElement
uint64_t id_
 Database identifier of the configuration element.
 
boost::posix_time::ptime timestamp_
 Holds timestamp value.
 
- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL)
 
- Static Protected Attributes inherited from isc::dhcp::Subnet
static SubnetID static_id_ = 1
 keeps the subnet-id value.
 

Detailed Description

A configuration holder for IPv4 subnet.

This class represents an IPv4 subnet.

Note
Subnet and Network use virtual inheritance to avoid a diamond issue with UserContext

Definition at line 505 of file subnet.h.

Constructor & Destructor Documentation

◆ Subnet4()

isc::dhcp::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.

This constructor calls Subnet::Subnet, where subnet-id is generated.

Parameters
prefixSubnet4 prefix
lengthprefix length
t1renewal timer (in seconds)
t2rebind timer (in seconds)
valid_lifetimepreferred lifetime of leases (in seconds)
idarbitrary subnet id, no default value

Definition at line 253 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:

Member Function Documentation

◆ clientSupported()

bool isc::dhcp::Subnet4::clientSupported ( const isc::dhcp::ClientClasses client_classes) const
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.

Parameters
client_classesList of classes the client belongs to.
Returns
true if client can be supported, false otherwise.

Reimplemented from isc::dhcp::Network.

Definition at line 326 of file subnet.cc.

References isc::dhcp::Network::clientSupported(), and isc::dhcp::Subnet::getSharedNetwork().

+ Here is the call graph for this function:

◆ create()

Subnet4Ptr isc::dhcp::Subnet4::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 
)
static

Factory function creating an instance of the Subnet4.

This function should be used to create an instance of the subnet object within a hooks library in cases when the library may be unloaded before the object is destroyed. This ensures that the ownership of the object by the Kea process is retained.

It associates the subnet with the default, iterative, allocator. Therefore, using this function should be preferred over the constructor whenever the subnet needs a default allocator.

Parameters
prefixSubnet4 prefix
lengthprefix length
t1renewal timer (in seconds)
t2rebind timer (in seconds)
valid_lifetimepreferred lifetime of leases (in seconds)
idarbitrary subnet id, no default value
Returns
Pointer to the Subnet4 instance.

Definition at line 270 of file subnet.cc.

References isc::dhcp::SubnetIterativeAllocationState::create(), and isc::dhcp::Lease::TYPE_V4.

Referenced by isc::dhcp::Subnet4ConfigParser::initSubnet().

+ Here is the call graph for this function:

◆ createAllocators()

void isc::dhcp::Subnet4::createAllocators ( )
virtual

Instantiates the allocator and its state.

It uses the type of the allocator specified with the Network::setAllocatorType method.

This function is called from the subnet parsers and after fetching the subnet configuration from a configuration backend.

Implements isc::dhcp::Subnet.

Definition at line 762 of file subnet.cc.

References isc::dhcp::PoolFreeLeaseQueueAllocationState::create(), isc::dhcp::PoolIterativeAllocationState::create(), isc::dhcp::PoolRandomAllocationState::create(), isc::dhcp::SubnetIterativeAllocationState::create(), isc::dhcp::Network::getAllocatorType(), isc::dhcp::Network::getDefaultAllocatorType(), isc::dhcp::Subnet::pools_, isc::dhcp::Subnet::setAllocationState(), isc::dhcp::Subnet::setAllocator(), and isc::dhcp::Lease::TYPE_V4.

+ Here is the call graph for this function:

◆ get4o6() [1/2]

Cfg4o6 & isc::dhcp::Subnet4::get4o6 ( )
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 597 of file subnet.h.

Referenced by toElement().

◆ get4o6() [2/2]

const Cfg4o6 & isc::dhcp::Subnet4::get4o6 ( ) const
inline

Returns const 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 605 of file subnet.h.

◆ getNextSubnet() [1/2]

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.

Parameters
first_subnetPointer to the subnet from which iterations have started.
Returns
Pointer to the next subnet or NULL pointer if the next subnet is the first subnet or if the current subnet doesn't belong to a shared network.

Definition at line 287 of file subnet.cc.

References isc::dhcp::Subnet::getID(), and isc::dhcp::Subnet::getSharedNetwork().

+ Here is the call graph for this function:

◆ getNextSubnet() [2/2]

Subnet4Ptr isc::dhcp::Subnet4::getNextSubnet ( const Subnet4Ptr first_subnet,
const ClientClasses client_classes 
) const

Returns next subnet within shared network that matches client classes.

Parameters
first_subnetPointer to the subnet from which iterations have started.
client_classesList of classes that the client belongs to. The subnets not matching the classes aren't returned by this method.
Returns
Pointer to the next subnet or NULL pointer if the next subnet is the first subnet or if the current subnet doesn't belong to a shared network.

Definition at line 298 of file subnet.cc.

References isc::dhcp::Subnet::getID(), and isc::dhcp::Subnet::getSharedNetwork().

+ Here is the call graph for this function:

◆ parsePrefix()

std::pair< IOAddress, uint8_t > isc::dhcp::Subnet4::parsePrefix ( const std::string &  prefix)
static

Converts subnet prefix to a pair of prefix/length pair.

Parameters
prefixPrefix to be parsed.
Exceptions
BadValueif provided invalid IPv4 prefix.

Definition at line 825 of file subnet.cc.

References isc_throw, and isc::dhcp::Subnet::parsePrefixCommon().

+ Here is the call graph for this function:

◆ toElement()

data::ElementPtr isc::dhcp::Subnet4::toElement ( ) const
virtual

Unparse a subnet object.

Returns
A pointer to unparsed subnet configuration.

Reimplemented from isc::dhcp::Network4.

Definition at line 801 of file subnet.cc.

References isc::data::Element::createList(), get4o6(), isc::dhcp::Subnet::getPools(), isc::data::merge(), isc::dhcp::Cfg4o6::toElement(), isc::dhcp::Network4::toElement(), isc::dhcp::Subnet::toElement(), and isc::dhcp::Lease::TYPE_V4.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: