![]() |
Kea
1.5.0
|
Common interface representing a network to which the DHCP clients are connected. More...
#include <network.h>
Inheritance diagram for isc::dhcp::Network:Classes | |
| class | RelayInfo |
| Holds optional information about relay. More... | |
Public Types | |
| 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... | |
Public Member Functions | |
| 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::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... | |
| virtual data::ElementPtr | toElement () const |
| Unparses network object. 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... | |
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... | |
Protected Attributes | |
| 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... | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::data::UserContext | |
| static data::ElementPtr | toElement (data::ConstElementPtr map) |
| Copy extracting comments an Element map. More... | |
Common interface representing a network to which the DHCP clients are connected.
The most common type of network, in Kea's terminology, is a subnet. The Subnet implements this interface. Another types of objects implementing this interface are SharedNetwork4 and SharedNetwork6 objects. They group multiple subnets together to provide means for extending available address pools (a single client may obtain IP address from any of the pools belonging to subnets in the shared network), or for selecting a subnet on a given link, depending on the class of the client (e.g. cable network case: different subnet is selected for cable modems, different one for routers).
The subnets and shared networks share many data structures, e.g. DHCP options, local interface name, address manipulation methods, thus this class provides an abstract interface that must be implemented by derived classes and, where appropriate, implements common methods used by the derived classes.
| typedef boost::shared_ptr<Network::RelayInfo> isc::dhcp::Network::RelayInfoPtr |
Specifies allowed host reservation mode.
| Enumerator | |
|---|---|
| HR_DISABLED | None - host reservation is disabled. No reservation types are allowed. |
| HR_OUT_OF_POOL | Only out-of-pool reservations is allowed. This mode allows AllocEngine to skip reservation checks when dealing with with addresses that are in pool. |
| HR_GLOBAL | Only global reservations are allowed. This mode instructs AllocEngine to only look at global reservations. |
| HR_ALL | Both out-of-pool and in-pool reservations are allowed. This is the most flexible mode, where sysadmin have biggest liberty. However, there is a non-trivial performance penalty for it, as the AllocEngine code has to check whether there are reservations, even when dealing with reservations from within the dynamic pools.
|
|
inlinevirtual |
| void isc::dhcp::Network::addRelayAddress | ( | const asiolink::IOAddress & | addr | ) |
Adds an address to the list addresses in the network's relay info.
| addr | address of the relay |
| BadValue | if the address is already in the list |
Definition at line 54 of file network.cc.
| void isc::dhcp::Network::allowClientClass | ( | const isc::dhcp::ClientClass & | class_name | ) |
Sets the supported class to class class_name.
| class_name | client class to be supported by this network |
Definition at line 85 of file network.cc.
Referenced by isc::dhcp::Subnet6ConfigParser::initSubnet().
|
virtual |
Checks whether this network supports client that belongs to specified classes.
This method checks whether a client that belongs to given classes can use this network. For example, if this class is reserved for client class "foo" and the client belongs to classes "foo", "bar" and "baz", it is supported. On the other hand, client belonging to classes "foobar" and "zyxxy" is not supported.
| client_classes | list of all classes the client belongs to |
Reimplemented in isc::dhcp::Subnet6, and isc::dhcp::Subnet4.
Definition at line 74 of file network.cc.
References isc::dhcp::ClientClasses::contains().
Referenced by isc::dhcp::Subnet4::clientSupported(), and isc::dhcp::Subnet6::clientSupported().
Here is the call graph for this function:
|
inline |
Returns pointer to the option data configuration for this subnet.
Definition at line 303 of file network.h.
References cfg_option_.
Referenced by isc::dhcp::Subnet6ConfigParser::initSubnet().
|
inline |
Returns const pointer to the option data configuration for this subnet.
Definition at line 309 of file network.h.
References cfg_option_.
|
inline |
returns the client class
Definition at line 240 of file network.h.
References client_class_.
|
inline |
Specifies what type of Host Reservations are supported.
Host reservations may be either in-pool (they reserve an address that is in the dynamic pool) or out-of-pool (they reserve an address that is not in the dynamic pool). HR may also be completely disabled for performance reasons.
Definition at line 289 of file network.h.
References host_reservation_mode_.
|
inline |
Returns name of the local interface for which this network is selected.
Definition at line 145 of file network.h.
References iface_name_.
| const IOAddressList & isc::dhcp::Network::getRelayAddresses | ( | ) | const |
Returns the list of relay addresses from the network's relay info.
Definition at line 69 of file network.cc.
|
inline |
| const ClientClasses & isc::dhcp::Network::getRequiredClasses | ( | ) | const |
Returns classes which are required to be evaluated.
Definition at line 97 of file network.cc.
|
inline |
|
inline |
|
inline |
| bool isc::dhcp::Network::hasRelayAddress | ( | const asiolink::IOAddress & | address | ) | const |
Tests if the network's relay info contains the given address.
| address | address to search for in the relay list |
Definition at line 64 of file network.cc.
| bool isc::dhcp::Network::hasRelays | ( | ) | const |
Indicates if network's relay info has relay addresses.
Definition at line 59 of file network.cc.
| void isc::dhcp::Network::requireClientClass | ( | const isc::dhcp::ClientClass & | class_name | ) |
Adds class class_name to classes required to be evaluated.
| class_name | client class required to be evaluated |
Definition at line 90 of file network.cc.
Referenced by isc::dhcp::Subnet6ConfigParser::initSubnet().
|
inline |
Sets host reservation mode.
See getHostReservationMode for details.
| mode | mode to be set |
Definition at line 298 of file network.h.
References host_reservation_mode_.
Referenced by isc::dhcp::Subnet6ConfigParser::initSubnet().
|
inline |
Sets local name of the interface for which this network is selected.
If the interface is specified, the server will use the network associated with this local interface to allocate IP addresses and other resources to a client.
| iface_name | Interface name. |
Definition at line 137 of file network.h.
References iface_name_.
Referenced by isc::dhcp::Subnet6ConfigParser::initSubnet().
|
inline |
Sets information about relay.
In some situations where there are shared subnets (i.e. two different subnets are available on the same physical link), there is only one relay that handles incoming requests from clients. In such a case, the usual subnet selection criteria based on relay belonging to the subnet being selected are no longer sufficient and we need to explicitly specify a relay. One notable example of such uncommon, but valid scenario is a cable network, where there is only one CMTS (one relay), but there are 2 distinct subnets behind it: one for cable modems and another one for CPEs and other user equipment behind modems. From manageability perspective, it is essential that modems get addresses from different subnet, so users won't tinker with their modems.
Setting this parameter is not needed in most deployments. This structure holds IP address only for now, but it is expected to be extended in the future.
| relay | structure that contains relay information |
Definition at line 168 of file network.h.
References relay_.
|
inline |
Sets new renew timer for a network.
| t1 | New renew timer value in seconds. |
Definition at line 264 of file network.h.
References t1_.
Referenced by isc::dhcp::Subnet4::Subnet4(), and isc::dhcp::Subnet6::Subnet6().
|
inline |
Sets new rebind timer for a network.
| t2 | New rebind timer value in seconds. |
Definition at line 276 of file network.h.
References t2_.
Referenced by isc::dhcp::Subnet4::Subnet4(), and isc::dhcp::Subnet6::Subnet6().
|
inline |
Sets new valid lifetime for a network.
| valid | New valid lifetime in seconds. |
Definition at line 252 of file network.h.
References valid_.
Referenced by isc::dhcp::Subnet4::Subnet4(), and isc::dhcp::Subnet6::Subnet6().
|
virtual |
Unparses network object.
Implements isc::data::CfgToElement.
Reimplemented in isc::dhcp::Subnet6, isc::dhcp::Subnet4, isc::dhcp::Network6, isc::dhcp::Network4, isc::dhcp::SharedNetwork6, and isc::dhcp::SharedNetwork4.
Definition at line 102 of file network.cc.
References isc::dhcp::ClientClasses::cbegin(), isc::dhcp::ClientClasses::cend(), isc::dhcp::ClientClasses::empty(), and isc_throw.
Here is the call graph for this function:
|
protected |
Pointer to the option data configuration for this subnet.
Definition at line 356 of file network.h.
Referenced by getCfgOption().
|
protected |
Optional definition of a client class.
If defined, only clients belonging to that class will be allowed to use this particular network. The default value for this is an empty string, which means that any client is allowed, regardless of its class.
Definition at line 333 of file network.h.
Referenced by getClientClass().
|
protected |
Specifies host reservation mode.
See HRMode type for details.
Definition at line 353 of file network.h.
Referenced by getHostReservationMode(), and setHostReservationMode().
|
protected |
Holds interface name for which this network is selected.
Definition at line 321 of file network.h.
Referenced by getIface(), and setIface().
|
protected |
Relay information.
See RelayInfo for detailed description.
Definition at line 326 of file network.h.
Referenced by getRelayInfo(), and setRelayInfo().
|
protected |
|
protected |
|
protected |
|
protected |
a Triplet (min/default/max) holding allowed valid lifetime values
Definition at line 348 of file network.h.
Referenced by getValid(), and setValid().