neighbor_table¶
The neighbor_table module manages IP/MAC mapping tables, including IPv4 ARP table and IPv6 neighbor table.
This module provides APIs to create and delete static IPv4/IPv6 entries. It also provides APIs to query the configured static entries and the learned (both static/dynamic) entries on the system from IPv4 ARP table and IPv6 neighbor table.
Two handler APIs are provided to allow 3rd party agents to react to the addition and deletion of entries in the learned ARP table or neighbor table on the system.
-
namespace
eos
-
class
neighbor_table_handler
- #include <neighbor_table.h>
The neighbor table handler.
This class provides handler APIs to react to neighbor table entry deletion and addition. It works for both the IPv4 ARP table and IPv6 neighbor table.
Public Functions
-
neighbor_table_handler
(neighbor_table_mgr * mgr)
-
neighbor_table_mgr *
get_neighbor_table_mgr
() const
-
void
watch_all_neighbor_entries
(bool interest) Registers this class to receive change updates on all neighbor entries. This includes both IPv4 ARP table entries and IPv6 Neighbor Discovery table entries.
-
void
watch_neighbor_entry
(neighbor_key_t const & key, bool interest) Registers this class to receive change updates on a given neighbor entry. This includes both IPv4 ARP table entries and IPv6 Neighbor Discovery table entries.
-
virtual void
on_neighbor_entry_set
(neighbor_entry_t const & entry)
-
virtual void
on_neighbor_entry_del
(neighbor_key_t const & key)
-
-
class
neighbor_table_iter_t
- #include <neighbor_table.h>
An iterator over the configured ARP and Neighbor Discovery tables.
Private Functions
-
neighbor_table_iter_t
(neighbor_table_iter_impl * const)
Friends
-
friend class
neighbor_table_iter_impl
-
-
class
neighbor_table_status_iter_t
- #include <neighbor_table.h>
An iterator over the resolved ARP and Neighbor Discovery tables.
Private Functions
-
neighbor_table_status_iter_t
(neighbor_table_status_iter_impl * const)
Friends
-
friend class
neighbor_table_status_iter_impl
-
-
class
neighbor_table_mgr
- #include <neighbor_table.h>
The neighbor table manager.
This class provides access to the resolved MAC address for a given IP address off of an L3 interface (aka the ARP table for IPv4 addresses and the Neighbor Discovery table for IPv6 addresses). It also provides APIs to delete/add v4 static ARP entry and v6 static neighbor table entries.
Public Functions
-
virtual
~neighbor_table_mgr
()
-
virtual neighbor_table_iter_t
neighbor_table_iter
() const = 0 Iterates through the statically configured ARP and Neighbor Discovery tables. A neighbor_key_t is returned for each entry.
-
virtual neighbor_table_status_iter_t
neighbor_table_status_iter
() const = 0 Iterates through the resolved ARP and Neighbor Discovery tables. A neighbor_key_t is returned for each entry.
-
virtual neighbor_entry_t
neighbor_entry_status
(neighbor_key_t const & key) const = 0 Looks up a resolved neighbor entry for a given L3 interface and IP address.
-
virtual void
neighbor_entry_set
(neighbor_entry_t const & entry) = 0 Configures a new static entry in either ARP table for IPv4 or Neighbor table for IPv6. Note “intf_id” is needed only for v6 case, since the IP/MAC pair may not be unique. It’s not needed for v4 case.
-
virtual void
neighbor_entry_del
(neighbor_key_t const & key) = 0 Deletes a static entry in either ARP table (IPv4) or Neighbor table for IPv6. Note “intf_id” is needed only for v6 case, since the IP/MAC pair may not be unique. It’s not needed for v4 case.
-
virtual neighbor_entry_t
neighbor_entry
(neighbor_key_t const & key) const = 0 Looks up a configured neighbor entry for a given L3 interface and IP address.
Protected Functions
-
neighbor_table_mgr
()
Private Members
-
neighbor_table_mgr
Friends
-
friend class
neighbor_table_handler
-
virtual
-
class
Type definitions in neighbor_table¶
-
namespace
eos
Enums
- neighbor_entry_type_t enum
Neighbor entry types.
Values:
NEIGHBOR_ENTRY_TYPE_NULL
-NEIGHBOR_ENTRY_TYPE_DYNAMIC
-NEIGHBOR_ENTRY_TYPE_STATIC
-
-
class
neighbor_key_t
- #include <neighbor_table.h>
The neighbor entry key class. Maps an IP address to its associated MAC address on a specific interface. Note: the “intf_id” attribute is only relevant for IPv6 neighbors.
Public Functions
-
neighbor_key_t
()
-
neighbor_key_t
(ip_addr_t const & ip_addr)
-
neighbor_key_t
(ip_addr_t const & ip_addr, intf_id_t intf_id) IPv6 neighbor keys include an interface ID.
-
neighbor_key_t
(const neighbor_key_t & other)
-
neighbor_key_t &
operator=
(neighbor_key_t const & other)
-
ip_addr_t
ip_addr
() const Getter for ‘ip_addr’: the ip address of the neighbor entry.
-
intf_id_t
intf_id
() const Getter for ‘intf_id’: the interface of the neighbor entry.
-
bool
operator==
(neighbor_key_t const & other) const
-
bool
operator!=
(neighbor_key_t const & other) const
-
bool
operator<
(neighbor_key_t const & other) const
-
uint32_t
hash
() const The hash function for type neighbor_key_t.
-
void
mix_me
(hash_mix & h) const The hash mix function for type neighbor_key_t.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< neighbor_key_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of neighbor_key_t to the ostream.
-
-
class
neighbor_entry_t
- #include <neighbor_table.h>
The neighbor entry class.
Public Functions
-
neighbor_entry_t
()
-
neighbor_entry_t
(neighbor_key_t const & neighbor_key, eth_addr_t eth_addr, neighbor_entry_type_t entry_type)
-
neighbor_entry_t
(const neighbor_entry_t & other)
-
neighbor_entry_t &
operator=
(neighbor_entry_t const & other)
-
neighbor_key_t
neighbor_key
() const Getter for ‘neighbor_key’: the key of the neighbor entry.
-
eth_addr_t
eth_addr
() const Getter for ‘eth_addr’: the Ethernet address of the neighbor entry.
-
neighbor_entry_type_t
entry_type
() const Getter for ‘entry_type’: the type of neighbor entry, it will be either STATIC or DYNAMIC.
-
bool
operator==
(neighbor_entry_t const & other) const
-
bool
operator!=
(neighbor_entry_t const & other) const
-
bool
operator<
(neighbor_entry_t const & other) const
-
uint32_t
hash
() const The hash function for type neighbor_entry_t.
-
void
mix_me
(hash_mix & h) const The hash mix function for type neighbor_entry_t.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< neighbor_entry_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of neighbor_entry_t to the ostream.
-