SatCat5
satcat5::eth::PluginPacket Struct Reference

Detailed Description

Ephemeral data structure provided to plugin callbacks.

New fields may be added to this structure in future versions.

See also
eth_plugin.h, eth::PluginCore, eth::PluginPort.

Definition at line 48 of file eth_plugin.h.

#include <eth_plugin.h>

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

Public Member Functions

constexpr PluginPacket ()
 Default constructor only, with no copy-constructor. More...
 
 PluginPacket (const PluginPacket &t)=delete
 
PluginPacketoperator= (const PluginPacket &t)=delete
 
bool read_from (satcat5::io::MultiPacket *packet)
 Read metadata from a packet object. More...
 
void write_to (satcat5::io::Writeable *wr) const
 Copy packet headers to the specified destination. More...
 
void adjust ()
 Notify parent that header contents have changed. More...
 
void divert ()
 Divert this frame for deferred processing. More...
 
void drop (u8 reason)
 Drop this frame, indicating why. More...
 
bool is_adjusted () const
 Accessors and shortcuts for packet metadata. More...
 
bool is_diverted () const
 Accessors and shortcuts for packet metadata. More...
 
bool is_ip () const
 Accessors and shortcuts for packet metadata. More...
 
bool is_arp () const
 Accessors and shortcuts for packet metadata. More...
 
bool is_tcp () const
 Accessors and shortcuts for packet metadata. More...
 
bool is_udp () const
 Accessors and shortcuts for packet metadata. More...
 
unsigned length () const
 Accessors and shortcuts for packet metadata. More...
 
SATCAT5_PMASK_TYPE src_mask () const
 Accessors and shortcuts for packet metadata. More...
 
unsigned src_port () const
 Accessors and shortcuts for packet metadata. More...
 
satcat5::eth::VtagPolicy port_vcfg () const
 Accessors and shortcuts for packet metadata. More...
 
u8 reason () const
 Accessors and shortcuts for packet metadata. More...
 

Public Attributes

satcat5::io::MultiPacketpkt
 Complete packet contents.
 
satcat5::eth::Header hdr
 Copy of Ethernet header fields. More...
 
SATCAT5_PMASK_TYPE dst_mask
 Destination mask for which port(s) receive this packet. More...
 
u16 hlen
 Original header length.
 
u16 flags
 Additional status flags indicating packet status.
 
satcat5::eth::ArpHeader arp
 Copy of additional header fields, if present. More...
 
satcat5::ip::Header ip
 Copy of additional header fields, if present. More...
 
satcat5::tcp::Header tcp
 Copy of additional header fields, if present. More...
 
satcat5::udp::Header udp
 Copy of additional header fields, if present. More...
 

Protected Member Functions

bool read_internal (satcat5::io::Readable *rd)
 Internal use only.
 

Static Protected Attributes

static const u16 FLAG_DIVERT = (1u << 8)
 Packet diverted from normal processing. More...
 
static const u16 FLAG_HEADER_CHANGE = (1u << 9)
 Header contents changed. More...
 

Constructor & Destructor Documentation

◆ PluginPacket()

constexpr satcat5::eth::PluginPacket::PluginPacket ( )
inlineconstexpr

Default constructor only, with no copy-constructor.

Use read_from to initialize this data structure.

Definition at line 85 of file eth_plugin.h.

Member Function Documentation

◆ adjust()

void satcat5::eth::PluginPacket::adjust ( )
inline

Notify parent that header contents have changed.

Plugins that change frame-header parameters MUST call this method before returning from egress(), ingress(), or query(). When set, the SwitchCore rewrites buffer contents based on the new contents of hdr, ip, arp, tcp, and udp.

Definition at line 105 of file eth_plugin.h.

◆ divert()

void satcat5::eth::PluginPacket::divert ( )
inline

Divert this frame for deferred processing.

Setting this flag diverts this frame for exclusive use by the plugin itself, skipping any subsequent plugins and SwitchCore processing. In such cases, the plugin takes responsibility, and it MUST eventually call MultiBuffer::free_packet(). The plugin SHOULD NOT call free_packet() before returning.

Definition at line 114 of file eth_plugin.h.

◆ drop()

void satcat5::eth::PluginPacket::drop ( u8  reason)
inline

Drop this frame, indicating why.

See also
SwitchLogMessage.

Definition at line 118 of file eth_plugin.h.

◆ is_adjusted()

bool satcat5::eth::PluginPacket::is_adjusted ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 125 of file eth_plugin.h.

◆ is_arp()

bool satcat5::eth::PluginPacket::is_arp ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 131 of file eth_plugin.h.

◆ is_diverted()

bool satcat5::eth::PluginPacket::is_diverted ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 127 of file eth_plugin.h.

◆ is_ip()

bool satcat5::eth::PluginPacket::is_ip ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 129 of file eth_plugin.h.

◆ is_tcp()

bool satcat5::eth::PluginPacket::is_tcp ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 133 of file eth_plugin.h.

◆ is_udp()

bool satcat5::eth::PluginPacket::is_udp ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 135 of file eth_plugin.h.

◆ length()

unsigned satcat5::eth::PluginPacket::length ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 137 of file eth_plugin.h.

◆ port_vcfg()

satcat5::eth::VtagPolicy satcat5::eth::PluginPacket::port_vcfg ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 143 of file eth_plugin.h.

◆ read_from()

bool PluginPacket::read_from ( satcat5::io::MultiPacket packet)

Read metadata from a packet object.

Always reads hdr. If present, also reads ip, arp, tcp, udp.

Returns
True if all applicable headers were parsed successfully.

Definition at line 20 of file eth_plugin.cc.

◆ reason()

u8 satcat5::eth::PluginPacket::reason ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 145 of file eth_plugin.h.

◆ src_mask()

SATCAT5_PMASK_TYPE satcat5::eth::PluginPacket::src_mask ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 139 of file eth_plugin.h.

◆ src_port()

unsigned satcat5::eth::PluginPacket::src_port ( ) const
inline

Accessors and shortcuts for packet metadata.

Some packet metadata fields are stored in "pkt->m_user[*]". These values are populated by SwitchPort::write_finalize().

Definition at line 141 of file eth_plugin.h.

◆ write_to()

void PluginPacket::write_to ( satcat5::io::Writeable wr) const

Copy packet headers to the specified destination.

Always writes hdr. If present, also writes arp, ip, tcp, and udp.

Definition at line 42 of file eth_plugin.cc.

Member Data Documentation

◆ arp

satcat5::eth::ArpHeader satcat5::eth::PluginPacket::arp

Copy of additional header fields, if present.

Use is_ip, is_arp, is_tcp, is_udp to test if these fields are present and populated. Otherwise, they are uninitialized.

Definition at line 61 of file eth_plugin.h.

◆ dst_mask

SATCAT5_PMASK_TYPE satcat5::eth::PluginPacket::dst_mask

Destination mask for which port(s) receive this packet.

The destination mask is sets one bit for each destination port eligible to receive a packet. It is initialized to all ones. Plugins may clear bits but should never set them, i.e., plugins should always bitwise-and (&=) with the previous mask value. Example: Return 0x14 = 2^4 + 2^2 = Send to ports #2 and #4. Example: Return 0xFFFF... = Send to all ports (broadcast). Example: Return 0 = Drop packet (no eligible ports).

Definition at line 75 of file eth_plugin.h.

◆ FLAG_DIVERT

const u16 satcat5::eth::PluginPacket::FLAG_DIVERT = (1u << 8)
staticprotected

Packet diverted from normal processing.

See also
divert, flags.

Definition at line 151 of file eth_plugin.h.

◆ FLAG_HEADER_CHANGE

const u16 satcat5::eth::PluginPacket::FLAG_HEADER_CHANGE = (1u << 9)
staticprotected

Header contents changed.

See also
changed, flags.

Definition at line 153 of file eth_plugin.h.

◆ hdr

satcat5::eth::Header satcat5::eth::PluginPacket::hdr

Copy of Ethernet header fields.

The Ethernet header is present in all valid packets.

Definition at line 55 of file eth_plugin.h.

◆ ip

satcat5::ip::Header satcat5::eth::PluginPacket::ip

Copy of additional header fields, if present.

Use is_ip, is_arp, is_tcp, is_udp to test if these fields are present and populated. Otherwise, they are uninitialized.

Definition at line 62 of file eth_plugin.h.

◆ tcp

satcat5::tcp::Header satcat5::eth::PluginPacket::tcp

Copy of additional header fields, if present.

Use is_ip, is_arp, is_tcp, is_udp to test if these fields are present and populated. Otherwise, they are uninitialized.

Definition at line 63 of file eth_plugin.h.

◆ udp

satcat5::udp::Header satcat5::eth::PluginPacket::udp

Copy of additional header fields, if present.

Use is_ip, is_arp, is_tcp, is_udp to test if these fields are present and populated. Otherwise, they are uninitialized.

Definition at line 64 of file eth_plugin.h.


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