ConOpSys V2970  P004.07
ANVILEX control operating system
Functions
FDB example code
Collaboration diagram for FDB example code:

Functions

void bridgeif_fdb_update_src (void *fdb_ptr, struct eth_addr *src_addr, u8_t port_idx)
 
bridgeif_portmask_t bridgeif_fdb_get_dst_ports (void *fdb_ptr, struct eth_addr *dst_addr)
 
static void bridgeif_fdb_age_one_second (void *fdb_ptr)
 
void * bridgeif_fdb_init (u16_t max_fdb_entries)
 

Detailed Description

This file implements an example for an FDB (Forwarding DataBase)

Function Documentation

◆ bridgeif_fdb_age_one_second()

static void bridgeif_fdb_age_one_second ( void *  fdb_ptr)
static

◆ bridgeif_fdb_get_dst_ports()

bridgeif_portmask_t bridgeif_fdb_get_dst_ports ( void *  fdb_ptr,
struct eth_addr dst_addr 
)

◆ bridgeif_fdb_init()

void* bridgeif_fdb_init ( u16_t  max_fdb_entries)

Init our simple fdb list

References BRIDGEIF_AGE_TIMER_MS, bridgeif_age_tmr(), BRIDGEIF_DEBUG, bridgeif_dfdb_s::fdb, LWIP_ASSERT, LWIP_DEBUGF, bridgeif_dfdb_s::max_fdb_entries, mem_calloc(), and NULL.

Here is the call graph for this function:

◆ bridgeif_fdb_update_src()

void bridgeif_fdb_update_src ( void *  fdb_ptr,
struct eth_addr src_addr,
u8_t  port_idx 
)

A real simple and slow implementation of an auto-learning forwarding database that remembers known src mac addresses to know which port to send frames destined for that mac address.

ATTENTION: This is meant as an example only, in real-world use, you should provide a better implementation :-)

References bridgeif_dfdb_entry_s::addr, BR_FDB_TIMEOUT_SEC, BRIDGEIF_DECL_PROTECT, BRIDGEIF_FDB_DEBUG, BRIDGEIF_READ_PROTECT, BRIDGEIF_READ_UNPROTECT, BRIDGEIF_WRITE_PROTECT, BRIDGEIF_WRITE_UNPROTECT, bridgeif_dfdb_s::fdb, LWIP_DEBUGF, bridgeif_dfdb_s::max_fdb_entries, bridgeif_dfdb_entry_s::port, bridgeif_dfdb_entry_s::ts, and bridgeif_dfdb_entry_s::used.