SatCat5
satcat5::eth::SwitchLogMessage Struct Reference

Detailed Description

A single 24-byte packet-log message.

Definition at line 74 of file eth_sw_log.h.

#include <eth_sw_log.h>

Collaboration diagram for satcat5::eth::SwitchLogMessage:
[legend]

Public Member Functions

 SwitchLogMessage (const SwitchLogMessage &t)=default
 
SwitchLogMessageoperator= (const SwitchLogMessage &t)=default
 
u8 reason () const
 Coded reason for a dropped packet, if applicable. More...
 
const char * reason_str () const
 Human-readable reason for a dropped packet, if applicable.
 
SATCAT5_PMASK_TYPE dstmask () const
 Destination mask (KEEP messages only). More...
 
u16 count_drop () const
 Count dropped packets.
 
u16 count_keep () const
 Count delivered packets.
 
u8 srcport () const
 < Source port index.
 
u8 type () const
 < Message type.
 
void init_keep (const satcat5::eth::Header &hdr, u8 src, u32 dst)
 Initialize a KEEP message.
 
void init_drop (const satcat5::eth::Header &hdr, u8 src, u8 why)
 Initialize a DROP message.
 
void init_skip (u16 drop, u16 keep)
 Initialize a SKIP message.
 
void log_to (satcat5::log::LogBuffer &wr) const
 Format this field as a human-readable string.
 
void write_to (satcat5::io::Writeable *wr) const
 Write descriptor to the designated stream.
 
bool read_from (satcat5::io::Readable *rd)
 Read descriptor from the designated stream. More...
 

Public Attributes

u32 tstamp
 Timestamp in microseconds.
 
u8 type_src
 Type and source port.
 
satcat5::eth::Header hdr
 Ethernet packet header.
 
u32 meta
 Additional metadata.
 

Static Public Attributes

static constexpr u8 REASON_KEEP = 0x00
 Packet accepted / not dropped.
 
static constexpr u8 DROP_OVERFLOW = 0x01
 FIFO overflow (Rx or Tx)
 
static constexpr u8 DROP_BADFCS = 0x02
 Invalid frame check sequence.
 
static constexpr u8 DROP_BADFRM = 0x03
 Frame length, source MAC, etc.
 
static constexpr u8 DROP_MCTRL = 0x04
 Link-local control packet.
 
static constexpr u8 DROP_VLAN = 0x05
 Virtual-LAN policy.
 
static constexpr u8 DROP_VRATE = 0x06
 Virtual-LAN rate limits.
 
static constexpr u8 DROP_PTPERR = 0x07
 PTP error (no timestamp)
 
static constexpr u8 DROP_NO_ROUTE = 0x08
 No destination or null route.
 
static constexpr u8 DROP_DISABLED = 0x09
 Ingress or egress port disabled.
 
static constexpr u8 DROP_UNKNOWN = 0xFF
 Other unspecified error.
 
static constexpr u8 SRC_MASK = 0x1F
 Mask for source index.
 
static constexpr u8 TYPE_MASK = 0xE0
 Mask for message type.
 
static constexpr u8 TYPE_KEEP = (0 << 5)
 Message type: KEEP (delivered)
 
static constexpr u8 TYPE_DROP = (1 << 5)
 Message type: DROP (dropped)
 
static constexpr u8 TYPE_SKIP = (2 << 5)
 Message type: SKIP (summary)
 
static constexpr u32 TIME_MASK = 0xFFFFFF
 Timestamp wraparound at 2^24.
 
static constexpr unsigned LEN_BYTES = 24
 Message length, in bytes.
 

Member Function Documentation

◆ dstmask()

SATCAT5_PMASK_TYPE satcat5::eth::SwitchLogMessage::dstmask ( ) const
inline

Destination mask (KEEP messages only).

This bit-mask sets a '1' for each destination port.

Definition at line 122 of file eth_sw_log.h.

◆ read_from()

bool SwitchLogMessage::read_from ( satcat5::io::Readable rd)

Read descriptor from the designated stream.

(Returns true on success, false otherwise.)

Definition at line 122 of file eth_sw_log.cc.

◆ reason()

u8 SwitchLogMessage::reason ( ) const

Coded reason for a dropped packet, if applicable.

See also
DROP_OVERFLOW, DROP_BADFCS, DROP_BADFRM, DROP_MCTRL, etc.

Definition at line 37 of file eth_sw_log.cc.


The documentation for this struct was generated from the following files: