SatCat5
satcat5::eth::Dispatch Class Referencefinal

Detailed Description

Implemention of "net::Dispatch" for Ethernet frames.

This class listens for incoming data, reads the Ethernet frame header, and forwards the frame to a registered eth::Protocol based on the EtherType field.

Definition at line 18 of file eth_dispatch.h.

#include <eth_dispatch.h>

Inheritance diagram for satcat5::eth::Dispatch:
[legend]
Collaboration diagram for satcat5::eth::Dispatch:
[legend]

Public Member Functions

 Dispatch (const satcat5::eth::MacAddr &addr, satcat5::io::Writeable *dst, satcat5::io::Readable *src)
 Connect this network interface to a valid I/O source and sink. More...
 
satcat5::io::Writeableopen_reply (const satcat5::net::Type &type, unsigned len) override
 Send a reply to the most recent received frame. More...
 
satcat5::io::Writeableopen_write (const satcat5::eth::MacAddr &dst, const satcat5::eth::MacType &type, satcat5::eth::VlanTag vtag=satcat5::eth::VTAG_NONE)
 Send a frame to the designated Ethernet address/VLAN. More...
 
void set_macaddr (const satcat5::eth::MacAddr &macaddr)
 Set the local MAC-address.
 
satcat5::eth::MacAddr macaddr () const
 
satcat5::eth::MacAddr reply_mac () const
 
satcat5::eth::MacType reply_type () const
 
satcat5::eth::VlanTag reply_vtag () const
 
bool reply_is_multicast () const
 
void set_default_vid (const satcat5::eth::VlanTag &vtag)
 
void add (satcat5::net::Protocol *proto)
 Register a Protocol object.
 
void remove (satcat5::net::Protocol *proto)
 Unregister a Protocol object.
 
bool bound (const satcat5::net::Type &type) const
 Check if a given net::Type has a matching Protocol.
 

Protected Member Functions

void data_rcvd (satcat5::io::Readable *src) override
 The data_rcvd() callback is polled whenever data is available. More...
 
void data_unlink (satcat5::io::Readable *src) override
 Unlink this EventListener from the designated source, because the designated Readable object is being destroyed. More...
 
bool deliver (const satcat5::net::Type &type, satcat5::io::Readable *src, unsigned len)
 Deliver current message by calling Protocol::frame_rcvd(...). More...
 

Protected Attributes

satcat5::eth::MacAddr m_addr
 
satcat5::io::Writeable *const m_dst
 
satcat5::io::Readablem_src
 
satcat5::eth::MacAddr m_reply_dstaddr
 
satcat5::eth::MacAddr m_reply_srcaddr
 
satcat5::eth::MacType m_reply_type
 
satcat5::eth::VlanTag m_reply_vtag
 
satcat5::eth::VlanTag m_default_vid
 
satcat5::util::List< satcat5::net::Protocolm_list
 Linked list of Protocol objects.
 

Constructor & Destructor Documentation

◆ Dispatch()

Dispatch::Dispatch ( const satcat5::eth::MacAddr addr,
satcat5::io::Writeable dst,
satcat5::io::Readable src 
)

Connect this network interface to a valid I/O source and sink.

(e.g., satcat5::port::MailMap or satcat5::eth::SlipCodec.) If provided, optional timer object allows retry-timeout.

Definition at line 22 of file eth_dispatch.cc.

Member Function Documentation

◆ data_rcvd()

void Dispatch::data_rcvd ( satcat5::io::Readable src)
overrideprotectedvirtual

The data_rcvd() callback is polled whenever data is available.

A pointer is provided to assist handlers with multiple sources. Child objects of io::EventListener MUST override this method.

Implements satcat5::io::EventListener.

Definition at line 119 of file eth_dispatch.cc.

◆ data_unlink()

void Dispatch::data_unlink ( satcat5::io::Readable src)
overrideprotectedvirtual

Unlink this EventListener from the designated source, because the designated Readable object is being destroyed.

Child objects of io::EventListener MAY override this method if action is required.

Reimplemented from satcat5::io::EventListener.

Definition at line 159 of file eth_dispatch.cc.

◆ deliver()

bool Dispatch::deliver ( const satcat5::net::Type type,
satcat5::io::Readable src,
unsigned  len 
)
protectedinherited

Deliver current message by calling Protocol::frame_rcvd(...).

Note: Caller is responsible for read_finalize(), if required.

Returns
True if a matching Protocol is found.

Definition at line 25 of file net_dispatch.cc.

◆ open_reply()

satcat5::io::Writeable * Dispatch::open_reply ( const satcat5::net::Type type,
unsigned  len 
)
overridevirtual

Send a reply to the most recent received frame.

Write Ethernet frame header and get Writeable object.

Implements satcat5::net::Dispatch.

Definition at line 45 of file eth_dispatch.cc.

◆ open_write()

satcat5::io::Writeable * Dispatch::open_write ( const satcat5::eth::MacAddr dst,
const satcat5::eth::MacType type,
satcat5::eth::VlanTag  vtag = satcat5::eth::VTAG_NONE 
)

Send a frame to the designated Ethernet address/VLAN.

Write Ethernet frame header and get Writeable object.

Definition at line 74 of file eth_dispatch.cc.


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