ip_intf¶
Network Interface IP addressing module.
Changes to IP addresses bound to network interfaces can be reacted to using this module, providing a callback that can be used to trigger server socket binding or reconfiguration events.
-
namespace
eos
-
class
ip_intf_handler
- #include <ip_intf.h>
Event handler for interfaces with IP addresses specific events.
By default, no interfaces are watched.
Public Functions
-
ip_intf_handler
(ip_intf_mgr *)
-
ip_intf_mgr *
get_ip_intf_mgr
() const
-
void
watch_all_ip_intfs
(bool) Registers to receive updates on changes to any interface.
- Parameters
bool
-Whether or not this handler should be notified of IP address assignment changes on any interface.
-
void
watch_ip_intf
(intf_id_t, bool) Registers this class to receive change updates on the given interface.
- Parameters
intf_id_t
-Which interface to subscribe to.
bool
-Whether or not this handler should be notified of IP address assignment changes on the given interface.
-
virtual void
on_ip_addr_add
(intf_id_t, ip_addr_mask_t const &) Handler called when an IP address is added to the interface.
-
virtual void
on_ip_addr_del
(intf_id_t, ip_addr_mask_t const &) Handler called when an IP address is deleted from the interface.
-
virtual void
on_internal_vlan_id
(intf_id_t, vlan_id_t) Handler called when the internal VLAN ID for an interface changes. If the interface loses its internal vlan id (i.e. is no longer a routed port), this will be set to 0
-
-
class
ip_intf_mgr
- #include <ip_intf.h>
The IP address interface manager. For the changes to be visible, the interface may have to be passed in routed mode (see switchport_mode in eth_intf.h).
Public Functions
-
virtual
~ip_intf_mgr
()
-
virtual bool
exists
(intf_id_t) const = 0 Returns whether the given interface exists and is able to have IP addresses.
If exists returns true, then this intf_id_t can be successfully passed into every method of the ip_intf_mgr. If not, then methods of the ip_intf_mgr can throw a no_such_interface_error exception.
Note that ip_intf_mgr::exists being true does not guarantee that the underlying L2 interface, as managed by intf_mgr, eth_intf_mgr, eth_phy_intf_mgr, eth_lag_intf_mgr, or subintf_mgr, also exists.
-
virtual std::set< ip_addr_mask_t >
ip_addrs
(intf_id_t) const = 0 Returns the operational set of IP addresses of the interface.
-
virtual void
ip_addrs_is
(intf_id_t, std::set< ip_addr_mask_t > const &) = 0 Configures the IP addresses of the interface.
- Parameters
intf_id_t
-The interface ID of the interface to change the addresses of.
std::set<ip_addr_mask_t>
-The set of addresses to set.
-
virtual void
ip_addr_add
(intf_id_t, ip_addr_mask_t const &) = 0 Adds an IP address to the interface.
- Parameters
intf_id_t
-The interface ID of the interface to add the address in.
ip_addr_mask_t
-The address to add.
-
virtual void
ip_addr_del
(intf_id_t, ip_addr_mask_t const &) = 0 Deletes an IP address of the interface.
- Parameters
intf_id_t
-The interface ID of the interface to delete the address in.
ip_addr_mask_t
-The address to delete.
-
virtual void
ip_addr_merge_mode_is
(intf_id_t, bool) = 0 Whether IP address configuration for a given interface is replaced or merged with configuration from other agents. If false, configuration will be replaced by that of higher priority agents (such as the CLI). If true, configuration will be merged. Default is false.
- Parameters
intf_id_t
-The interface ID of the interface to set the merge mode of.
bool
-Whether or not IP address configuration should be merged
-
virtual bool
ip_addr_merge_mode
(intf_id_t) const = 0
-
virtual vlan_id_t
internal_vlan_id
(intf_id_t) const = 0 Returns the internal VLAN ID related to a layer 3 interface. If the interface supplied is a routed interface (i.e., is configured with “no switchport”), this function will return the internal VLAN ID for the interface. If the interface is an SVI, the VLAN ID of the SVI is returned. If the interface is a layer 2 interface, VLAN ID 0 is returned.
- Parameters
intf_id_t
-An interface ID to query the internal VLAN ID of
Protected Functions
-
ip_intf_mgr
()
Private Members
-
ip_intf_mgr
Friends
-
friend class
ip_intf_handler
-
virtual
-
class