SatCat5
satcat5::net::Protocol Class Referenceabstract

Detailed Description

A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream, identified by an associated net::Type.

The Dispatch layer maintains a list of active Protocols, and inspects each incoming packet to route it to the appropriate destination. Protocols may be endpoints with application-layer functionality. They may also be middleware that does additional sorting. e.g., The udp::Dispatch class is both a Protocol (it accepts all UDP traffic from ip::Dispatch) and a Dispatch (it routes UDP packets to the appropriate port).

See also
net_dispatch.h

Definition at line 28 of file net_protocol.h.

#include <net_protocol.h>

Inheritance diagram for satcat5::net::Protocol:
[legend]
Collaboration diagram for satcat5::net::Protocol:
[legend]

Public Member Functions

virtual void frame_rcvd (satcat5::io::LimitedRead &src)=0
 Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value. More...
 

Protected Member Functions

 Protocol (const satcat5::net::Type &type)
 Constructor and destructor access restricted to children. More...
 
 ~Protocol ()
 Constructor and destructor access restricted to children. More...
 

Protected Attributes

satcat5::net::Type m_filter
 Incoming packet filter.
 

Private Attributes

satcat5::net::Protocolm_next
 Linked list of Protocols.
 

Constructor & Destructor Documentation

◆ Protocol()

satcat5::net::Protocol::Protocol ( const satcat5::net::Type type)
inlineexplicitprotected

Constructor and destructor access restricted to children.

Note: Child MUST call Dispatch::add and Dispatch::remove.

Definition at line 47 of file net_protocol.h.

◆ ~Protocol()

satcat5::net::Protocol::~Protocol ( )
inlineprotected

Constructor and destructor access restricted to children.

Note: Child MUST call Dispatch::add and Dispatch::remove.

Definition at line 49 of file net_protocol.h.

Member Function Documentation

◆ frame_rcvd()

virtual void satcat5::net::Protocol::frame_rcvd ( satcat5::io::LimitedRead src)
pure virtual

Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.

The child class SHOULD read the frame contents from the provided "src" object, which is only valid until the function returns.

To send a reply:

  • Call m_iface->open_reply() to obtain a Writable object. (This also writes out any applicable frame headers.)
  • Write frame contents, then call write_finalize().

The child class MUST override this method.

Implemented in satcat5::udp::TftpServerCore, satcat5::udp::TftpTransfer, satcat5::udp::KeepAlive, satcat5::udp::Dispatch, satcat5::ntp::Client, satcat5::net::Tpipe, satcat5::net::SocketCore, satcat5::net::ProtoEcho, satcat5::net::ProtoConfig, satcat5::log::FromCbor, satcat5::ip::ProtoIcmp, satcat5::ip::Dispatch, satcat5::ip::DhcpServer, satcat5::ip::DhcpClient, satcat5::igmp::Client, satcat5::eth::SwitchLogReader, satcat5::eth::ChatEcho, satcat5::eth::ChatProto, satcat5::eth::ProtoArp, satcat5::coap::Endpoint, satcat5::coap::Connection, satcat5::cfg::ConfigBusRemote, satcat5::ccsds_spp::SppToBytes, satcat5::ccsds_aos::Channel, satcat5::test::LogProtocol, satcat5::net::AeroFtpServer, satcat5::udp::TelemetryRx, satcat5::eth::TelemetryRx, and satcat5::util::ChatPrinter.


The documentation for this class was generated from the following file: