10 #include <satcat5/eth_dispatch.h>
12 #include <satcat5/ip_core.h>
13 #include <satcat5/ip_icmp.h>
20 #ifndef SATCAT5_IP_TTL
21 #define SATCAT5_IP_TTL 128
79 u8 ttl = SATCAT5_IP_TTL);
103 {
return m_route->
route_static(subnet, gateway, dstmac); }
125 {
return m_iface->macaddr(); }
127 {
return m_iface->reply_vtag(); }
129 {
return m_iface->reply_mac(); }
130 inline bool reply_is_multicast()
const
133 {
return m_reply_src; }
135 {
return m_reply_hdr; }
Callback interface for responding to ARP and ICMP events.
Implemention of "net::Dispatch" for Ethernet frames.
void set_macaddr(const satcat5::eth::MacAddr &macaddr)
Set the local MAC-address.
Protocol handler for Ethernet-to-IPv4 ARP queries and replies.
Host/Client for the Internet Group Management Protocol (IGMP).
Limited read of next N bytes.
Abstract API for writing byte-streams and packets.
Protocol handler and dispatch unit for Internet Protocol v4 (IPv4).
bool route_cache(const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac)
Routing table shortcuts.
bool route_default(const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE)
Routing table shortcuts.
satcat5::io::Writeable * open_write(const satcat5::eth::MacAddr &mac, const satcat5::eth::VlanTag &vtag, const satcat5::ip::Addr &ip, u8 protocol, unsigned len)
Get Writeable object for sending to a specific IP/MAC address.
satcat5::ip::Route route_lookup(const satcat5::ip::Addr &dstaddr) const
Routing table shortcuts.
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
bool route_remove(const satcat5::ip::Subnet &subnet)
Routing table shortcuts.
satcat5::io::Writeable * open_reply(const satcat5::net::Type &type, unsigned len) override
Get Writeable object for reply to the last received datagram.
void arp_event(const satcat5::eth::MacAddr &mac, const satcat5::ip::Addr &ip) override
Callback for any announced MAC/IP address pair.
bool route_static(const satcat5::ip::Subnet &subnet, const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE)
Routing table shortcuts.
void set_addr(const satcat5::ip::Addr &addr)
Set the local IP-address.
bool route_simple(const satcat5::ip::Addr &gateway, const satcat5::ip::Mask &subnet=satcat5::ip::MASK_24)
Routing table shortcuts.
satcat5::ip::Header next_header(u8 protocol, const satcat5::ip::Addr &dst, unsigned inner_bytes, u8 ttl=SATCAT5_IP_TTL)
Create a basic IPv4 header with the specified information.
void route_clear(bool lockdown=true)
Routing table shortcuts.
bool route_remove(const satcat5::ip::Addr &addr)
Routing table shortcuts.
bool route_local(const satcat5::ip::Subnet &subnet)
Routing table shortcuts.
void set_ident(u16 ident)
For testing purposes only, reset the "ident" field.
Protocol handler for the Internet Control Message Protocol (ICMP).
bool route_default(const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE, u8 port=0, u8 flags=0)
Set the default behavior when no other routes match.
satcat5::ip::Route route_lookup(const satcat5::ip::Addr &dstaddr) const
Next-hop routing lookup for the given destination address.
void route_clear(bool lockdown=true)
Clear all routes, including the default.
bool route_static(const satcat5::ip::Subnet &subnet, const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE, u8 port=0, u8 flags=0)
Create or update a single static route.
bool route_local(const satcat5::ip::Subnet &subnet, u8 port=0, u8 flags=0)
Create or update a local static route.
bool route_cache(const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac)
Update matching MAC address cache entries.
bool route_remove(const satcat5::ip::Subnet &subnet)
Remove a single static route.
bool route_simple(const satcat5::ip::Addr &gateway, const satcat5::ip::Mask &subnet=satcat5::ip::MASK_24)
Simplified one-step setup for a typical home network.
The "Dispatch" is a generic interface that knows how to read a designated protocol layer and sort inc...
Dispatch()
Constructor and destructor access restricted to children.
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Protocol handler for the Address Resolution Protocol (ARP)
Client-side implementation of the Internet Group Management Protocol (IGMP)
Internet Protocol v4 (IPv4) forwarding table.
Generic network Dispatch API.
An Ethernet MAC address (with serializable interface).
Header contents for an 802.1Q Virtual-LAN tag.
IPv4 address is a 32-bit unsigned integer.
bool is_multicast() const
IP multicast (224.*.*.*)
IPv4 subnet masks share functionality with a basic address, but are constructed differently to match ...
A single entry in the static routing table.
An IPv4 subnet consists of a base address and a subnet mask.
Multipurpose filter for matching fields in network packets.
Miscellaneous mathematical utility functions.