|
SatCat5
|
Dispatcher sorts incoming UDP messages by port index.
Implementation of "net::Dispatch" for UDP datagrams, which accepts incoming packets from IP-dispatch.
Definition at line 17 of file udp_dispatch.h.
#include <udp_dispatch.h>
Public Member Functions | |
| Dispatch (satcat5::ip::Dispatch *iface) | |
| Attach this protocol handler to the parent interface. | |
| satcat5::io::Writeable * | open_reply (const satcat5::net::Type &type, unsigned nbytes) override |
| Reply to the sender of the most recent received message. More... | |
| satcat5::io::Writeable * | open_write (satcat5::ip::Address &addr, const satcat5::udp::Port &src, const satcat5::udp::Port &dst, unsigned len) |
| Send a datagram to the designated UDP address and port. More... | |
| satcat5::eth::ProtoArp * | arp () const |
| satcat5::eth::Dispatch * | eth () const |
| satcat5::ip::Dispatch * | iface () const |
| satcat5::ip::Addr | ipaddr () const |
| satcat5::eth::MacAddr | macaddr () const |
| satcat5::eth::VlanTag | reply_vtag () const |
| satcat5::eth::MacAddr | reply_mac () const |
| bool | reply_is_multicast () const |
| satcat5::ip::Addr | reply_ip () const |
| satcat5::udp::Port | reply_src () const |
| satcat5::udp::Port | reply_dst () const |
| satcat5::udp::Port | next_free_port () |
| Get the next unclaimed dynamically-allocated port index. | |
| 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 | frame_rcvd (satcat5::io::LimitedRead &src) override |
| Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value. 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::ip::Dispatch *const | m_iface |
| u16 | m_next_port |
| satcat5::udp::Port | m_reply_src |
| satcat5::udp::Port | m_reply_dst |
| satcat5::net::Type | m_filter |
| Incoming packet filter. | |
| satcat5::util::List< satcat5::net::Protocol > | m_list |
| Linked list of Protocol objects. | |
Private Attributes | |
| satcat5::net::Protocol * | m_next |
| Linked list of Protocols. | |
|
protectedinherited |
Deliver current message by calling Protocol::frame_rcvd(...).
Note: Caller is responsible for read_finalize(), if required.
Definition at line 25 of file net_dispatch.cc.
|
overrideprotectedvirtual |
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:
The child class MUST override this method.
Implements satcat5::net::Protocol.
Definition at line 107 of file udp_dispatch.cc.
|
overridevirtual |
Reply to the sender of the most recent received message.
Gets Writeable object for deferred write of IPv4 frame header. Note: Argument "type" is ignored for UDP replies.
Implements satcat5::net::Dispatch.
Definition at line 69 of file udp_dispatch.cc.
| satcat5::io::Writeable * Dispatch::open_write | ( | satcat5::ip::Address & | addr, |
| const satcat5::udp::Port & | src, | ||
| const satcat5::udp::Port & | dst, | ||
| unsigned | len | ||
| ) |
Send a datagram to the designated UDP address and port.
Gets Writeable object for deferred write of IPv4 frame header.
Definition at line 84 of file udp_dispatch.cc.