SatCat5
eth_protocol.h
1 // Copyright 2023-2025 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
5 // Accept incoming Ethernet packets by EtherType.
6 
7 #pragma once
8 
9 #include <satcat5/eth_header.h>
10 #include <satcat5/net_protocol.h>
11 
12 namespace satcat5 {
13  namespace eth {
25  protected:
28  Protocol(
29  satcat5::eth::Dispatch* dispatch,
30  const satcat5::eth::MacType& ethertype,
31  const satcat5::eth::VlanTag& vtag = satcat5::eth::VTAG_NONE);
32  ~Protocol() SATCAT5_OPTIONAL_DTOR;
33 
34  // Note: Child MUST override frame_rcvd(...)
35  // void frame_rcvd(satcat5::io::LimitedRead& src);
36 
39  const satcat5::eth::MacType m_etype;
40  };
41  }
42 }
Implemention of "net::Dispatch" for Ethernet frames.
Definition: eth_dispatch.h:21
Accept incoming Ethernet packets by EtherType.
Definition: eth_protocol.h:24
satcat5::eth::Dispatch *const m_iface
Parent interface (e.g., for address and I/O)
Definition: eth_protocol.h:38
Protocol(satcat5::eth::Dispatch *dispatch, const satcat5::eth::MacType &ethertype, const satcat5::eth::VlanTag &vtag=satcat5::eth::VTAG_NONE)
Register or unregister this handler with the Dispatcher.
Definition: eth_protocol.cc:15
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Definition: net_protocol.h:28
Type definitions for Ethernet frames and protocol handlers.
Generic network Protocol API.
EtherType field (uint16) is used a protocol-ID [1536..65535].
Definition: eth_header.h:96
Header contents for an 802.1Q Virtual-LAN tag.
Definition: eth_header.h:124