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 v4 ARP table and v6 neighbor table.

Public Functions

neighbor_table_handler(neighbor_table_mgr * mgr)
neighbor_table_mgr * get_neighbor_table_mgr() const
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_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_entry_t neighbor_entry_status(neighbor_key_t const & key) const = 0

Lookup a resolved neighbor entry for a given L3 interface and IP address.

virtual void neighbor_entry_set(neighbor_entry_t const & entry) = 0

Programmatically specify neighbor table entries.

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
virtual neighbor_entry_t neighbor_entry(neighbor_key_t const & key) const = 0

Lookup 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

Type definitions in neighbor_table

namespace eos

Enums

neighbor_entry_type_t enum

Neighbor entry types.

Values:

  • 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.

Public Functions

neighbor_key_t()
neighbor_key_t(ip_addr_t ip_addr, intf_id_t intf_id)
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
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

ip_addr_t ip_addr_
intf_id_t intf_id_

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_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
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

neighbor_key_t neighbor_key_
eth_addr_t eth_addr_
neighbor_entry_type_t entry_type_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of neighbor_entry_t to the ostream.

Table Of Contents

Previous topic

mpls_route

Next topic

nexthop_group