ConOpSys V2970
P004.07
ANVILEX control operating system
|
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) |
This file implements an example for an FDB (Forwarding DataBase)
|
static |
Aging implementation of our simple fdb
References BRIDGEIF_DECL_PROTECT, BRIDGEIF_READ_PROTECT, BRIDGEIF_READ_UNPROTECT, BRIDGEIF_WRITE_PROTECT, BRIDGEIF_WRITE_UNPROTECT, bridgeif_dfdb_s::fdb, bridgeif_dfdb_s::max_fdb_entries, bridgeif_dfdb_entry_s::ts, and bridgeif_dfdb_entry_s::used.
Referenced by bridgeif_age_tmr().
bridgeif_portmask_t bridgeif_fdb_get_dst_ports | ( | void * | fdb_ptr, |
struct eth_addr * | dst_addr | ||
) |
Walk our list of auto-learnt fdb entries and return a port to forward or BR_FLOOD if unknown
References bridgeif_dfdb_entry_s::addr, BR_FLOOD, BRIDGEIF_DECL_PROTECT, BRIDGEIF_READ_PROTECT, BRIDGEIF_READ_UNPROTECT, bridgeif_dfdb_s::fdb, bridgeif_dfdb_s::max_fdb_entries, bridgeif_dfdb_entry_s::port, bridgeif_dfdb_entry_s::ts, and bridgeif_dfdb_entry_s::used.
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.
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.