Kea  1.5.0
isc::dhcp::SharedNetwork6 Class Reference

Shared network holding IPv6 subnets. More...

#include <shared_network.h>

+ Inheritance diagram for isc::dhcp::SharedNetwork6:

Public Member Functions

 SharedNetwork6 (const std::string &name)
 Constructor. More...
 
void add (const Subnet6Ptr &subnet)
 Adds IPv6 subnet to a shared network. More...
 
void del (const SubnetID &subnet_id)
 Removes subnet from a shared network. More...
 
void delAll ()
 Removes all subnets from a shared network. More...
 
const Subnet6CollectiongetAllSubnets () const
 Returns a pointer to the collection of subnets within this shared network. More...
 
std::string getName () const
 Returns a name of the shared network. More...
 
Subnet6Ptr getNextSubnet (const Subnet6Ptr &first_subnet, const SubnetID &current_subnet) const
 Retrieves next available IPv6 subnet within shared network. More...
 
Subnet6Ptr getPreferredSubnet (const Subnet6Ptr &selected_subnet, const Lease::Type &lease_type) const
 Attempts to find a subnet which is more likely to include available leases than selected subnet. More...
 
Subnet6Ptr getSubnet (const SubnetID &subnet_id) const
 Returns a subnet for a specified subnet id. More...
 
void setName (const std::string &name)
 Sets new name for the shared network. More...
 
virtual NetworkPtr sharedFromThis ()
 Returns shared pointer to this network. More...
 
virtual data::ElementPtr toElement () const
 Unparses shared network object. More...
 
- Public Member Functions inherited from isc::dhcp::Network6
 Network6 ()
 Constructor. More...
 
OptionPtr getInterfaceId () const
 Returns interface-id value (if specified) More...
 
Triplet< uint32_t > getPreferred () const
 Returns preferred lifetime (in seconds) More...
 
bool getRapidCommit () const
 Returns boolean value indicating that the Rapid Commit option is supported or unsupported for the subnet. More...
 
void setInterfaceId (const OptionPtr &ifaceid)
 sets interface-id option (if defined) More...
 
void setPreferred (const Triplet< uint32_t > &preferred)
 Sets new preferred lifetime for a network. More...
 
void setRapidCommit (const bool rapid_commit)
 Enables or disables Rapid Commit option support for the subnet. 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...
 
virtual bool clientSupported (const isc::dhcp::ClientClasses &client_classes) const
 Checks whether this network supports client that belongs to specified classes. 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::ClientClassgetClientClass () 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 IOAddressListgetRelayAddresses () const
 Returns the list of relay addresses from the network's relay info. More...
 
const RelayInfogetRelayInfo () const
 Returns const reference to relay information. More...
 
const isc::dhcp::ClientClassesgetRequiredClasses () 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 &timestamp)
 Sets timestamp to the explicitly provided value. More...
 
void updateModificationTime ()
 Sets timestmp to the current time. 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...
 

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::RelayInfoRelayInfoPtr
 Pointer to the RelayInfo structure. More...
 
- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy extracting comments an Element map. More...
 
- Protected Member Functions inherited from isc::dhcp::AssignableNetwork
virtual ~AssignableNetwork ()
 Virtual destructor. More...
 
template<typename SubnetPtr >
void clearSharedNetwork (const SubnetPtr &subnet)
 Removes association of a subnet with a network. More...
 
template<typename SubnetPtr >
void setSharedNetwork (const SubnetPtr &subnet)
 Associates a subnet with this network. 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...
 
- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL) More...
 

Detailed Description

Shared network holding IPv6 subnets.

Specialization of the Network6 class for IPv6 shared networks.

Definition at line 199 of file shared_network.h.

Constructor & Destructor Documentation

◆ SharedNetwork6()

isc::dhcp::SharedNetwork6::SharedNetwork6 ( const std::string &  name)
inlineexplicit

Constructor.

Sets name of the shared network.

Definition at line 207 of file shared_network.h.

Member Function Documentation

◆ add()

void isc::dhcp::SharedNetwork6::add ( const Subnet6Ptr subnet)

Adds IPv6 subnet to a shared network.

Parameters
subnetPointer to a subnet being added to this shared network.
Exceptions
isc::BadValueif subnet is null.
isc::DuplicateSubnetIDif a subnet with the given subnet id already exists in this shared network.
InvalidOperationif a subnet is already associated with some shared network.

Definition at line 315 of file shared_network.cc.

◆ del()

void isc::dhcp::SharedNetwork6::del ( const SubnetID subnet_id)

Removes subnet from a shared network.

Parameters
subnet_idIdentifier of a subnet to be removed.
Exceptions
BadValueWhen specified subnet doesn't exist.

Definition at line 322 of file shared_network.cc.

◆ delAll()

void isc::dhcp::SharedNetwork6::delAll ( )

Removes all subnets from a shared network.

Definition at line 328 of file shared_network.cc.

◆ getAllSubnets()

const Subnet6Collection* isc::dhcp::SharedNetwork6::getAllSubnets ( ) const
inline

Returns a pointer to the collection of subnets within this shared network.

Definition at line 253 of file shared_network.h.

◆ getName()

std::string isc::dhcp::SharedNetwork6::getName ( ) const
inline

Returns a name of the shared network.

Definition at line 219 of file shared_network.h.

◆ getNextSubnet()

Subnet6Ptr isc::dhcp::SharedNetwork6::getNextSubnet ( const Subnet6Ptr first_subnet,
const SubnetID current_subnet 
) const

Retrieves next available IPv6 subnet within shared network.

See documentation for SharedNetwork6::getNextSubnet.

Parameters
first_subnetPointer to a subnet from which the caller is iterating over subnets within shared network. This is typically a subnet selected during "subnet selection" step.
current_subnetIdentifier of a subnet for which next subnet is to be found.
Returns
Pointer to next subnet or null pointer if no more subnets found.
Exceptions
isc::BadValueif invalid arguments specified, e.g. unable to find first or current subnet within shared network.

Definition at line 340 of file shared_network.cc.

◆ getPreferredSubnet()

Subnet6Ptr isc::dhcp::SharedNetwork6::getPreferredSubnet ( const Subnet6Ptr selected_subnet,
const Lease::Type lease_type 
) const

Attempts to find a subnet which is more likely to include available leases than selected subnet.

When allocating unreserved leases from a shared network it is important to remember from which subnet within the shared network we have been recently handing out leases. The allocation engine can use that information to start trying allocation of the leases from that subnet rather than from the default subnet selected for this client. Starting from the default subnet causes a risk of having to walk over many subnets with exhausted address pools before getting to the subnet with available leases. This method attempts to find such subnet by inspecting "last allocation" timestamps. The one with most recent timestamp is selected.

The preferred subnet must also fulfil the condition of equal client classes with the selected_subnet.

Parameters
selected_subnetPointer to a currently selected subnet.
lease_typeType of the lease for which preferred subnet should be returned.
Returns
Pointer to a preferred subnet. It may be the same as selected_subnet if no better subnet was found.

Definition at line 346 of file shared_network.cc.

◆ getSubnet()

Subnet6Ptr isc::dhcp::SharedNetwork6::getSubnet ( const SubnetID subnet_id) const

Returns a subnet for a specified subnet id.

Parameters
subnet_idSubnet identifier.
Returns
Shared pointer to a subnet using this id or null pointer if such subnet doesn't exist within shared network.

Definition at line 335 of file shared_network.cc.

◆ setName()

void isc::dhcp::SharedNetwork6::setName ( const std::string &  name)
inline

Sets new name for the shared network.

Parameters
nameNew name for the shared network.

Definition at line 226 of file shared_network.h.

◆ sharedFromThis()

NetworkPtr isc::dhcp::SharedNetwork6::sharedFromThis ( )
virtual

Returns shared pointer to this network.

This method is required by the parent AssignableNetwork class.

Returns
Shared pointer to this object.

Implements isc::dhcp::AssignableNetwork.

Definition at line 310 of file shared_network.cc.

◆ toElement()

ElementPtr isc::dhcp::SharedNetwork6::toElement ( ) const
virtual

Unparses shared network object.

Returns
A pointer to unparsed shared network configuration.

Reimplemented from isc::dhcp::Network6.

Definition at line 352 of file shared_network.cc.

References isc::data::Element::create(), isc::data::Element::createList(), and name_.

+ Here is the call graph for this function:

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