SatCat5
eth_switch.h File Reference

Detailed Description

Software-defined Ethernet switch.

This file defines a layer-2 Ethernet switch, using a shared-memory architecture defined by the MultiBuffer class (multi_buffer.h). The SwitchCore class supports a maximum of 32 ports by default.

Connected ports implement the "eth::SwitchPort" API, defined below. For examples suitable for use with various SatCat5 I/O objects, see the classes defined in "port_adapter.h".

An extensible plugin system directs packets to the appropriate destination(s).

See also
eth_plugin.h.

Typically a SwitchCore is instantiated along side SwitchCache:

satcat5::eth::SwitchCache<64> cache(&my_sw_switch);
A shared-memory Ethernet switch based on the MultiBuffer class.
Definition: eth_switch.h:93

If the SwitchCore be instantiated by itself, it will act like a hub.

Precision Time Protocol (PTP) is not currently supported.

Definition in file eth_switch.h.

#include <satcat5/list.h>
#include <satcat5/multi_buffer.h>
#include <satcat5/switch_cfg.h>
#include <satcat5/types.h>
Include dependency graph for eth_switch.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::eth::SwitchLogHandler
 Define the API for packet-logging callbacks from eth::SwitchCore. More...
 
class  satcat5::eth::SwitchCore
 A shared-memory Ethernet switch based on the MultiBuffer class. More...
 
class  satcat5::eth::SwitchCoreStatic< BSIZE >
 Wrapper for SwitchCore with a statically-allocated working buffer. More...
 
class  satcat5::eth::SwitchPort
 Generic packetized I/O interface for use with SwitchCore. More...
 

Macros

#define SATCAT5_PMASK_TYPE   u32
 Set the integer type used to identify source and destination ports. More...
 

Functions

constexpr SATCAT5_PMASK_TYPE satcat5::eth::PMASK_ALL (-1)
 Global port-mask indicating every port (i.e., broadcast).
 
constexpr SATCAT5_PMASK_TYPE satcat5::eth::PMASK_NONE (0)
 Global port-mask indicating no ports (i.e., drop).
 
constexpr SATCAT5_PMASK_TYPE satcat5::eth::idx2mask (unsigned idx)
 Macro converting port-index to a bit-mask.
 
constexpr unsigned satcat5::eth::PMASK_SIZE ()
 Maximum number of switch ports, based on SATCAT5_PMASK_TYPE. More...
 

Macro Definition Documentation

◆ SATCAT5_PMASK_TYPE

#define SATCAT5_PMASK_TYPE   u32

Set the integer type used to identify source and destination ports.

The size of the "pmask" data type sets the maximum number of ports for SatCat5 switches and routers (e.g., default "u32" = max 32 ports). Supported alternate sizes are u8, u16, u32, and u64.

Definition at line 41 of file eth_switch.h.

Function Documentation

◆ PMASK_SIZE()

constexpr unsigned satcat5::eth::PMASK_SIZE ( )
constexpr

Maximum number of switch ports, based on SATCAT5_PMASK_TYPE.

The maximum number of ports is limited by the size of bit-mask SATCAT5_PMASK_TYPE (e.g., "u32" = up to 32 ports).

Definition at line 59 of file eth_switch.h.