9 #include <satcat5/ethernet.h>
16 ETYPE_CHAT_HEARTBEAT = {0x999B},
17 ETYPE_CHAT_TEXT = {0x999C},
18 ETYPE_CHAT_DATA = {0x999D};
39 {m_callback = callback;}
46 unsigned nbytes,
const char* msg);
52 unsigned nbytes,
const void* msg);
75 const char*
const m_username;
76 const unsigned m_userlen;
94 void log_event(s8 priority,
unsigned nbytes,
const char* msg)
override;
Service for echoing ChatProto text messages.
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
ChatEcho(satcat5::eth::ChatProto *service)
Bind to the designated ChatProto object.
Protocol handler for a simple text-messaging protocol This class implements a simple as-hoc text-mess...
ChatProto(satcat5::eth::Dispatch *dispatch, const char *username, const satcat5::eth::VlanTag &vtag=satcat5::eth::VTAG_NONE)
Bind this handler to a specified Ethernet interface.
void send_data(const satcat5::eth::MacAddr &dst, unsigned nbytes, const void *msg)
Send machine-readable data.
satcat5::io::Writeable * open_reply(unsigned len)
Open a reply to the sender of the most recent message.
void send_text(const satcat5::eth::MacAddr &dst, unsigned nbytes, const char *msg)
Send a human-readable text message.
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
void set_callback(satcat5::net::Protocol *callback)
Set callback for processing incoming messages.
void timer_event() override
Child class MUST override this method.
satcat5::eth::MacAddr local_mac() const
Get the local device's source MAC address.
void send_heartbeat()
Send a heartbeat message indicating our presence on the LAN.
satcat5::eth::MacAddr reply_mac() const
Source MAC address of the most recent received message.
satcat5::io::Writeable * open_text(const satcat5::eth::MacAddr &dst, unsigned len)
As "open_reply", but to any destination address.
Implemention of "net::Dispatch" for Ethernet frames.
Service for forwarding Log events as text messages.
void log_event(s8 priority, unsigned nbytes, const char *msg) override
Event handler for the log::EventHandler API.
LogToChat(satcat5::eth::ChatProto *dst, const satcat5::eth::MacAddr &addr=satcat5::eth::MACADDR_BROADCAST)
Bind to the designated ChatProto object.
Accept incoming Ethernet packets by EtherType.
Limited read of next N bytes.
Abstract API for writing byte-streams and packets.
Defines the interface for accepting Log messages.
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Timer objects are polled after a fixed delay or at a regular interval.
Diagnostic logging to UART and/or Ethernet ports.
Core event-processing loop for SatCat5 software.
An Ethernet MAC address (with serializable interface).
EtherType field (uint16) is used a protocol-ID [1536..65535].
Header contents for an 802.1Q Virtual-LAN tag.
Multipurpose filter for matching fields in network packets.