6 #include <satcat5/udp_dispatch.h>
7 #include <satcat5/udp_keep_alive.h>
15 : Protocol(satcat5::net::Type(port.value))
20 m_addr.
connect(satcat5::ip::ADDR_BROADCAST, port, port);
23 KeepAlive::~KeepAlive() {
31 auto dstport = m_addr.dstport();
32 m_addr.
connect(dstaddr, dstport, dstport, vtag);
36 unsigned len = msg ? strlen(msg) : 0;
Limited read of next N bytes.
void write_str(const char *str)
Write the contents of a null-terminated string.
void add(satcat5::net::Protocol *proto)
Register a Protocol object.
void remove(satcat5::net::Protocol *proto)
Unregister a Protocol object.
satcat5::net::Dispatch * iface() const override
Fetch a pointer to the underlying interface.
satcat5::io::Writeable * open_write(unsigned len) override
Open a new frame to the designated address and type.
void connect(const satcat5::udp::Addr &dstaddr, const satcat5::eth::MacAddr &dstmac, const satcat5::udp::Port &dstport, const satcat5::udp::Port &srcport=satcat5::udp::PORT_NONE, const satcat5::eth::VlanTag &vtag=satcat5::eth::VTAG_NONE)
Manual address resolution (user supplies IP + MAC).
Dispatcher sorts incoming UDP messages by port index.
Send and receive keep-alive messages.
void timer_event() override
Child class MUST override this method.
void send_now(const char *msg)
Immediately send a keep-alive, with an optional message.
void connect(const satcat5::ip::Addr &dstaddr, const satcat5::eth::VlanTag &vtag=satcat5::eth::VTAG_NONE)
Connect to a specific destination address.
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
Header contents for an 802.1Q Virtual-LAN tag.
IPv4 address is a 32-bit unsigned integer.
UDP and TCP ports are both 16-bit unsigned integers.