SatCat5
port_adapter.cc
1 // Copyright 2024-2025 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
5 
6 #include <satcat5/log.h>
7 #include <satcat5/port_adapter.h>
8 
13 using satcat5::log::Log;
20 
21 // Set verbosity level for debugging (0/1/2)
22 static constexpr unsigned DEBUG_VERBOSE = 0;
23 
24 VlanAdapter::VlanAdapter(SwitchCore* sw, Writeable* vdst)
25  : SwitchPort(sw, vdst)
26  , m_vport(this)
27 {
28  // Nothing else to initialize.
29 }
30 
32  : VlanAdapter(sw, dst)
33  , m_rx_copy(src, this)
34 {
35  // Nothing else to initialize.
36 }
37 
39  : VlanAdapter(sw, &m_tx_fcs)
40  , m_rx_copy(src, &m_rx_cobs)
41  , m_rx_cobs(&m_rx_fcs)
42  , m_rx_fcs(this)
43  , m_tx_fcs(&m_tx_cobs)
44  , m_tx_cobs(dst)
45 {
46  // Nothing else to initialize.
47 }
48 
50  : VlanAdapter(sw, &m_tx_fcs)
51  , m_rx_copy(src, &m_rx_slip)
52  , m_rx_slip(&m_rx_fcs)
53  , m_rx_fcs(this)
54  , m_tx_fcs(&m_tx_slip)
55  , m_tx_slip(dst)
56 {
57  // Nothing else to initialize.
58 }
59 
60 NullAdapter::NullAdapter(SwitchCore* sw)
61  : SwitchPort(sw, nullptr)
62  , ReadableRedirect(&m_egress)
63 {
64  // Nothing else to initialize.
65 }
66 
67 SwitchAdapter::SwitchAdapter(SwitchCore* swa, SwitchCore* swb)
68  : m_a2b(swa, &m_b2a)
69  , m_b2a(swb, &m_a2b)
70 {
71  // Nothing else to initialize.
72 }
A shared-memory Ethernet switch based on the MultiBuffer class.
Definition: eth_switch.h:93
Abstract API for reading byte-streams and packets.
Definition: io_readable.h:68
Abstract API for writing byte-streams and packets.
Definition: io_writeable.h:24
The Log class creates and formats one log message.
Definition: log.h:195
Port adapter for COBS-encoded serial ports.
Definition: port_adapter.h:89
CobsAdapter(satcat5::eth::SwitchCore *sw, satcat5::io::Readable *src, satcat5::io::Writeable *dst)
Attach port to the Ethernet switch and its data source/sink.
Definition: port_adapter.cc:38
Port adapter for MailBox, MailMap, etc.
Definition: port_adapter.h:73
MailAdapter(satcat5::eth::SwitchCore *sw, satcat5::io::Readable *src, satcat5::io::Writeable *dst)
Attach port to the Ethernet switch and its data source/sink.
Definition: port_adapter.cc:31
Minimalist port adapter with no VLAN conversion.
Definition: port_adapter.h:148
Port adapter for SLIP-encoded serial ports.
Definition: port_adapter.h:117
SlipAdapter(satcat5::eth::SwitchCore *sw, satcat5::io::Readable *src, satcat5::io::Writeable *dst)
Attach port to the Ethernet switch and its data source/sink.
Definition: port_adapter.cc:49
Back-to-back connection of one SwitchCore to another SwitchCore.
Definition: port_adapter.h:173
Parent class for handling switch egress and VLAN functions.
Definition: port_adapter.h:57
Diagnostic logging to UART and/or Ethernet ports.
constexpr s8 DEBUG
Define basic priority codes for log messages.
Definition: log.h:109
Adapter definitions for using generic I/O objects with eth::SwitchCore.