SatCat5
satcat5::eth::SwitchCache< SIZE > Class Template Reference

Detailed Description

template<unsigned SIZE = 64>
class satcat5::eth::SwitchCache< SIZE >

Wrapper for SwitchCacheInner with the required working memory.

Most users should instantiate this instead of SwitchCacheInner.

Definition at line 105 of file eth_sw_cache.h.

#include <eth_sw_cache.h>

Inheritance diagram for satcat5::eth::SwitchCache< SIZE >:
[legend]
Collaboration diagram for satcat5::eth::SwitchCache< SIZE >:
[legend]

Public Member Functions

 SwitchCache (satcat5::eth::SwitchCore *sw)
 Link this cache to the designated SwitchCore.
 
void query (satcat5::eth::PluginPacket &pkt) override
 Implement the required SwitchPlugin API.
 
void set_miss_bcast (unsigned port_idx, bool enable)
 Enable or disable "miss-as-broadcast" flag for a specific port. More...
 
void set_miss_mask (SATCAT5_PMASK_TYPE mask)
 Enable or disable "miss-as-broadcast" flag for all ports. More...
 
SATCAT5_PMASK_TYPE get_miss_mask () const
 Identify which ports are currently in "miss-as-broadcast" mode. More...
 
unsigned mactbl_size () const
 Read or manipulate the contents of the MAC-address table. More...
 
bool mactbl_read (unsigned tbl_idx, unsigned &port_idx, satcat5::eth::MacAddr &mac_addr)
 Read or manipulate the contents of the MAC-address table. More...
 
bool mactbl_write (unsigned port_idx, const satcat5::eth::MacAddr &mac_addr)
 Read or manipulate the contents of the MAC-address table. More...
 
bool mactbl_clear ()
 Read or manipulate the contents of the MAC-address table. More...
 
bool mactbl_learn (bool enable)
 Read or manipulate the contents of the MAC-address table. More...
 
bool mactbl_learn () const
 Read or manipulate the contents of the MAC-address table. More...
 

Protected Member Functions

SATCAT5_PMASK_TYPE destination_mask (const PluginPacket &pkt)
 Destination MAC-address lookup.
 

Protected Attributes

satcat5::eth::SwitchCacheInner::CacheEntry m_table [SIZE]
 
bool m_learn
 
SATCAT5_PMASK_TYPE m_miss_mask
 
CacheEntry *const m_array
 
const unsigned m_size
 
satcat5::util::LruCache< CacheEntrym_cache
 

Private Attributes

satcat5::eth::SwitchCore *const m_switch
 Pointer to the associated SwitchCore object.
 
satcat5::eth::PluginCorem_next
 

Member Function Documentation

◆ get_miss_mask()

SATCAT5_PMASK_TYPE satcat5::eth::SwitchCacheInner::get_miss_mask ( ) const
inlineinherited

Identify which ports are currently in "miss-as-broadcast" mode.

For format description,

See also
set_miss_mask.

Definition at line 45 of file eth_sw_cache.h.

◆ mactbl_clear()

bool satcat5::eth::SwitchCacheInner::mactbl_clear ( )
inlineinherited

Read or manipulate the contents of the MAC-address table.

All functions return true if successful, false otherwise. (These mimic the API provided by satcat5::eth::SwitchConfig)

Definition at line 61 of file eth_sw_cache.h.

◆ mactbl_learn() [1/2]

bool satcat5::eth::SwitchCacheInner::mactbl_learn ( ) const
inlineinherited

Read or manipulate the contents of the MAC-address table.

All functions return true if successful, false otherwise. (These mimic the API provided by satcat5::eth::SwitchConfig)

Definition at line 65 of file eth_sw_cache.h.

◆ mactbl_learn() [2/2]

bool satcat5::eth::SwitchCacheInner::mactbl_learn ( bool  enable)
inlineinherited

Read or manipulate the contents of the MAC-address table.

All functions return true if successful, false otherwise. (These mimic the API provided by satcat5::eth::SwitchConfig)

Definition at line 63 of file eth_sw_cache.h.

◆ mactbl_read()

bool SwitchCacheInner::mactbl_read ( unsigned  tbl_idx,
unsigned &  port_idx,
satcat5::eth::MacAddr mac_addr 
)
inherited

Read or manipulate the contents of the MAC-address table.

All functions return true if successful, false otherwise. (These mimic the API provided by satcat5::eth::SwitchConfig)

Definition at line 60 of file eth_sw_cache.cc.

◆ mactbl_size()

unsigned satcat5::eth::SwitchCacheInner::mactbl_size ( ) const
inlineinherited

Read or manipulate the contents of the MAC-address table.

All functions return true if successful, false otherwise. (These mimic the API provided by satcat5::eth::SwitchConfig)

Definition at line 52 of file eth_sw_cache.h.

◆ mactbl_write()

bool SwitchCacheInner::mactbl_write ( unsigned  port_idx,
const satcat5::eth::MacAddr mac_addr 
)
inherited

Read or manipulate the contents of the MAC-address table.

All functions return true if successful, false otherwise. (These mimic the API provided by satcat5::eth::SwitchConfig)

Definition at line 67 of file eth_sw_cache.cc.

◆ set_miss_bcast()

void SwitchCacheInner::set_miss_bcast ( unsigned  port_idx,
bool  enable 
)
inherited

Enable or disable "miss-as-broadcast" flag for a specific port.

Frames with an unknown destination (i.e., destination MAC not found in cache) are sent to every port with this flag. This method sets the configuration for the specified port index.

Definition at line 55 of file eth_sw_cache.cc.

◆ set_miss_mask()

void satcat5::eth::SwitchCacheInner::set_miss_mask ( SATCAT5_PMASK_TYPE  mask)
inlineinherited

Enable or disable "miss-as-broadcast" flag for all ports.

Frames with an unknown destination (i.e., destination MAC not found in cache) are sent to every port with this flag. This method sets all ports in a single call.

See also
set_miss_bcast.

Definition at line 40 of file eth_sw_cache.h.


The documentation for this class was generated from the following file: