mac_table¶
MAC address table management module.
This module offers a MAC address table manager, used to define MAC addresses in system configuration.
This module also offers a handler that provides notifications when a MAC address has been learned (or forgotten).
Please refer to examples/SimpleMac.cpp for an example.
-
namespace
eos
-
class
mac_table_handler
: public eos::base_handler<mac_table_mgr, mac_table_handler>¶ - #include <mac_table.h>
Handler for the MAC table.
This handler provides notifications when MAC addresses are learned on or removed from an interface. Note: This handler currently only provides notifications for unicast MAC addresses.
Public Functions
-
explicit
mac_table_handler
(mac_table_mgr *mgr)¶
-
inline mac_table_mgr *
get_mac_table_mgr
() const¶
-
void
watch_all_mac_entries
(bool)¶ Registers this class to receive change updates from the MAC table.
Expects a boolean signifying whether notifications should be propagated to this instance or not.
-
void
watch_mac_entry
(mac_key_t const &key, bool)¶ Registers this class to receive change updates on the given MAC entry.
Expects the key of the corresponding MAC address and a boolean signifying whether notifications should be propagated to this instance or not.
-
virtual void
on_mac_entry_set
(mac_entry_t const &entry)¶ This handler is called when a unicast MAC entry is learned for the first time, or when a unicast MAC entry has moved to a different interface.
-
explicit
-
class
mac_table_iter_t
: public eos::iter_base<mac_key_t, mac_table_iter_impl>¶ Private Functions
-
explicit
mac_table_iter_t
(mac_table_iter_impl*const)¶
Friends
- friend class mac_table_iter_impl
-
explicit
-
class
mac_table_status_iter_t
: public eos::iter_base<mac_key_t, mac_table_status_iter_impl>¶ Private Functions
-
explicit
mac_table_status_iter_t
(mac_table_status_iter_impl*const)¶
Friends
- friend class mac_table_status_iter_impl
-
explicit
-
class
mac_table_mgr
: public eos::base_mgr<mac_table_handler, mac_key_t>¶ - #include <mac_table.h>
Manager for the MAC address table.
Public Functions
-
virtual
~mac_table_mgr
()¶
-
virtual mac_table_iter_t
mac_table_iter
() const = 0¶ Iterator for all configured MAC addresses.
-
virtual mac_table_status_iter_t
mac_table_status_iter
() const = 0¶ Iterator for the MAC address table.
-
virtual mac_entry_t
mac_entry
(mac_key_t const &key) const = 0¶ Retrieves a mac_entry_t given the VLAN and MAC address key from the collection of configured entries.
This entry contains the interface (or, for multicast entries, the interfaces) that the given key was configured on. If the entry has not been configured, an empty mac_entry_t() is returned.
- Parameters
mac_key_t – The MAC address key object, consisting of a VLAN and a MAC address, which are used to retrieve that unique MAC entry.
-
virtual mac_entry_t
mac_entry
(vlan_id_t vlan, eth_addr_t mac) const = 0¶ Returns a mac_entry_t given a VLAN and MAC address from the collection of configured entries.
- Deprecated:
, please use mac_entry(mac_key_t const & key) method instead.
-
virtual mac_entry_t
mac_entry_status
(mac_key_t const &key) const = 0¶ Retrieves a mac_entry_t given the VLAN and MAC address key from the collection of entries either learned dynamically or explicitly configured.
This entry contains the interface (or, for multicast entries, the interfaces) that the given key has been learned on. If the entry has not been learned, an empty mac_entry_t() is returned. Note: At this time, a multicast MAC entry’s status directly mirrors its configuration and does not reflect whether or not the entry has been programmed into hardware.
- Parameters
mac_key_t – The MAC address key object, consisting of a VLAN and a MAC address, which are used to retrieve that unique MAC entry.
-
virtual mac_entry_type_t
type
(mac_key_t const &key) const = 0¶ Returns the type of the programmed MAC entry.
-
virtual uint32_t
moves
(mac_key_t const &key) const = 0¶ Returns the number of times the MAC entry has moved.
-
virtual seconds_t
last_move_time
(mac_key_t const &key) const = 0¶ Returns the time at which the MAC entry last moved (since boot).
-
virtual void
mac_entry_set
(mac_entry_t const &entry) = 0¶ Configure a MAC address statically as “learned” on a given interface (or set of interfaces for multicast MAC entries).
Protected Functions
-
mac_table_mgr
()¶
Private Members
-
mac_table_mgr
Friends
- friend class mac_table_handler
-
virtual
-
class
Type definitions in mac_table¶
-
namespace
eos
Enums
-
enum
mac_entry_type_t
¶ Types of MAC entries.
Values:
-
enumerator
MAC_ENTRY_NULL
¶
-
enumerator
MAC_ENTRY_LEARNED_DYNAMIC
¶
-
enumerator
MAC_ENTRY_LEARNED_SECURE
¶
-
enumerator
MAC_ENTRY_CONFIGURED_DYNAMIC
¶
-
enumerator
MAC_ENTRY_CONFIGURED_SECURE
¶
-
enumerator
MAC_ENTRY_CONFIGURED_STATIC
¶
-
enumerator
MAC_ENTRY_PEER_DYNAMIC
¶
-
enumerator
MAC_ENTRY_PEER_STATIC
¶
-
enumerator
MAC_ENTRY_PEER_SECURE
¶
-
enumerator
MAC_ENTRY_LEARNED_REMOTE
¶
-
enumerator
MAC_ENTRY_CONFIGURED_REMOTE
¶
-
enumerator
MAC_ENTRY_RECEIVED_REMOTE
¶
-
enumerator
MAC_ENTRY_PEER_LEARNED_REMOTE
¶
-
enumerator
MAC_ENTRY_PEER_CONFIGURED_REMOTE
¶
-
enumerator
MAC_ENTRY_PEER_RECEIVED_REMOTE
¶
-
enumerator
MAC_ENTRY_EVPN_DYNAMIC_REMOTE
¶
-
enumerator
MAC_ENTRY_EVPN_CONFIGURED_REMOTE
¶
-
enumerator
MAC_ENTRY_PEER_EVPN_REMOTE
¶
-
enumerator
MAC_ENTRY_CONFIGURED_ROUTER
¶
-
enumerator
MAC_ENTRY_PEER_ROUTER
¶
-
enumerator
MAC_ENTRY_EVPN_INTF
¶ Deprecated.
-
enumerator
MAC_ENTRY_EVPN_REMOTE_MAC
¶ Deprecated.
-
enumerator
MAC_ENTRY_PEER_EVPN_REMOTE_MAC
¶ Deprecated.
-
enumerator
MAC_ENTRY_EVPN_INTF_DYNAMIC
¶
-
enumerator
MAC_ENTRY_EVPN_INTF_STATIC
¶
-
enumerator
MAC_ENTRY_AUTHENTICATED
¶
-
enumerator
MAC_ENTRY_PEER_AUTHENTICATED
¶
-
enumerator
MAC_ENTRY_PENDING_SECURE
¶
-
enumerator
MAC_ENTRY_VPLS_DYNAMIC_REMOTE
¶
-
enumerator
MAC_ENTRY_SOFTWARE_LEARNED_DYNAMIC
¶
-
enumerator
MAC_ENTRY_DFW_CONFIGURED_STATIC
¶ Deprecated.
-
enumerator
MAC_ENTRY_PROGRAMMED_STATIC
¶
-
enumerator
MAC_ENTRY_EVPN_VESPA_DYNAMIC
¶
-
enumerator
-
class
mac_key_t
¶ - #include <mac_table.h>
The MAC entry key class. Maps a MAC address with a specific VLAN ID to an interface.
Public Functions
-
mac_key_t
()¶ Default constructor.
-
mac_key_t
(vlan_id_t vlan_id, eth_addr_t const ð_addr)¶
-
eth_addr_t
eth_addr
() const¶ Getter for ‘eth_addr’: the Ethernet address of the MAC entry.
-
bool
operator!
() const¶ Non-existent keys are effectively false(so this returns true).
Public Static Functions
-
static void
operator delete
(void*) noexcept¶
-
-
class
mac_entry_t
¶ - #include <mac_table.h>
An entry from the MAC address table.
Public Functions
-
mac_entry_t
()¶ Default constructor.
-
mac_entry_t
(mac_key_t const &mac_key, intf_id_t intf)¶ Constructor for unicast MAC entry and interface.
-
mac_entry_t
(mac_key_t const &mac_key, std::set<intf_id_t> const &intfs)¶ Constructor for multicast MAC entry and interfaces.
-
mac_entry_t
(vlan_id_t vlan_id, eth_addr_t eth_addr)¶ Deprecated constructor.
-
mac_entry_t
(eth_addr_t eth_addr, intf_id_t intf)¶ Deprecated constructor. Default VLAN identifier is 0. Please use method mac_key_is with a VLAN ID and the eth_addr attribute to set a valid VLAN ID.
-
mac_entry_t
(const mac_entry_t &other)¶
-
mac_entry_t &
operator=
(mac_entry_t const &other)¶
-
mac_entry_t
(mac_entry_t &&other) noexcept¶
-
mac_entry_t &
operator=
(mac_entry_t &&other) noexcept¶
-
std::set<intf_id_t> const &
intfs
() const¶ Getter for ‘intfs’: the set of interfaces that this key forwards to. For unicast MAC entries, this expects a set with either 1 interface or 0 interfaces to signify a drop. If passed a multicast MAC address, ‘intfs’ can contain one or more output interfaces.
-
bool
operator!
() const¶ Returns ‘true’ if this key is “empty”, that is if neither the VLAN nor the MAC address is set.
-
eth_addr_t
eth_addr
() const¶ The Ethernet address of the MAC entry.
-
intf_id_t
intf
() const¶ Return the interface of the unicast MAC entry, the first interface of a multicast MAC entry, or an empty object if the entry is a drop entry.
-
bool
operator==
(mac_entry_t const &other) const¶
-
bool
operator!=
(mac_entry_t const &other) const¶
-
uint32_t
hash
() const¶ The hash function for type mac_entry_t.
-
void
mix_me
(hash_mix &h) const¶ The hash mix function for type mac_entry_t.
Public Static Functions
-
static void
operator delete
(void*) noexcept¶
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, const mac_entry_t &obj)¶ A utility stream operator that adds a string representation of mac_entry_t to the ostream.
-
-
enum