SatCat5
net_echo.h
Go to the documentation of this file.
1 // Copyright 2021-2024 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
8 
9 #pragma once
10 
11 #include <satcat5/ethernet.h>
12 #include <satcat5/udp_core.h>
13 
14 namespace satcat5 {
15  namespace net {
21  protected:
24  ProtoEcho(
26  const satcat5::net::Type& type_req,
27  const satcat5::net::Type& type_ack);
28  ~ProtoEcho() SATCAT5_OPTIONAL_DTOR;
30 
32  void frame_rcvd(satcat5::io::LimitedRead& src) override;
33 
36  };
37  }
38 
39  namespace eth {
45  public:
46  ProtoEcho(
48  satcat5::eth::MacType type_req,
49  satcat5::eth::MacType type_ack);
50  };
51  }
52 
53  namespace udp {
57  public:
58  ProtoEcho(
60  satcat5::udp::Port port = satcat5::udp::PORT_ECHO);
61  };
62  }
63 }
Implemention of "net::Dispatch" for Ethernet frames.
Definition: eth_dispatch.h:21
Thin wrapper for echo of ethernet frames through eth::Dispatch.
Definition: net_echo.h:44
Limited read of next N bytes.
Definition: io_readable.h:255
The "Dispatch" is a generic interface that knows how to read a designated protocol layer and sort inc...
Definition: net_dispatch.h:36
The Echo protocol can be attached to any Dispatch object.
Definition: net_echo.h:20
satcat5::net::Type const m_replytype
Type for replies.
Definition: net_echo.h:35
ProtoEcho(satcat5::net::Dispatch *iface, const satcat5::net::Type &type_req, const satcat5::net::Type &type_ack)
Only children can safely access constructor/destructor.
Definition: net_echo.cc:39
~ProtoEcho() SATCAT5_OPTIONAL_DTOR
Only children can safely access constructor/destructor.
Definition: net_echo.cc:51
void frame_rcvd(satcat5::io::LimitedRead &src) override
Event handler to process incoming frames and respond.
Definition: net_echo.cc:57
satcat5::net::Dispatch *const m_iface
Registered iface.
Definition: net_echo.h:34
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Definition: net_protocol.h:28
Dispatcher sorts incoming UDP messages by port index.
Definition: udp_dispatch.h:20
Thin wrapper for echo of UDP/IP frames through udp::Dispatch.
Definition: net_echo.h:56
EtherType field (uint16) is used a protocol-ID [1536..65535].
Definition: eth_header.h:96
UDP and TCP ports are both 16-bit unsigned integers.
Definition: ip_core.h:119
Multipurpose filter for matching fields in network packets.
Definition: net_type.h:38