Protocol handler and dispatch unit for Internet Protocol v4 (IPv4).
This class implements the "net::Dispatch" API for IPv4 frames.
The IP dispatch subsystem must be attached to an Ethernet interface, accepting all incoming traffic with EtherType 0x0800 (IPv4). Incoming packets are checked for validity and then sorted by IP protocol number (i.e., ICMP, UDP, TCP, etc.).
The system includes static routing tables for next-hop routing, inheriting all functionality from the ip::Table class.
For an all-in-one container with ip::Dispatch and other components required for UDP communications, use ip::Stack.
Definition at line 39 of file ip_dispatch.h.
|
| | Dispatch (const satcat5::ip::Addr &addr, satcat5::eth::Dispatch *iface, satcat5::ip::Table *route) |
| | Link this object to an Ethernet interface. More...
|
| |
|
satcat5::io::Writeable * | open_reply (const satcat5::net::Type &type, unsigned len) override |
| | Get Writeable object for reply to the last received datagram.
|
| |
|
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.
|
| |
|
void | set_addr (const satcat5::ip::Addr &addr) |
| | Set the local IP-address.
|
| |
| 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. More...
|
| |
|
satcat5::eth::ProtoArp * | arp () |
| |
|
satcat5::ip::ProtoIcmp * | icmp () |
| |
|
satcat5::igmp::Client * | igmp () |
| |
|
satcat5::eth::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 |
| |
|
const satcat5::ip::Header & | reply_hdr () const |
| |
|
void | set_ipaddr (const satcat5::ip::Addr &addr) |
| |
|
void | set_macaddr (const satcat5::eth::MacAddr &macaddr) |
| |
|
satcat5::ip::Table * | table () |
| |
| void | set_ident (u16 ident) |
| | For testing purposes only, reset the "ident" field. More...
|
| |
| virtual void | gateway_change (const satcat5::ip::Addr &dstaddr, const satcat5::ip::Addr &gateway) |
| | Callback for changes to gateway configuration. More...
|
| |
|
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.
|
| |
|
| void | route_clear (bool lockdown=true) |
| | Routing table shortcuts. More...
|
| |
| bool | route_cache (const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac) |
| | Routing table shortcuts. More...
|
| |
| bool | route_default (const satcat5::ip::Addr &gateway, const satcat5::eth::MacAddr &dstmac=satcat5::eth::MACADDR_NONE) |
| | Routing table shortcuts. More...
|
| |
| bool | route_local (const satcat5::ip::Subnet &subnet) |
| | Routing table shortcuts. More...
|
| |
| bool | route_simple (const satcat5::ip::Addr &gateway, const satcat5::ip::Mask &subnet=satcat5::ip::MASK_24) |
| | Routing table shortcuts. More...
|
| |
| 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. More...
|
| |
| bool | route_remove (const satcat5::ip::Subnet &subnet) |
| | Routing table shortcuts. More...
|
| |
| bool | route_remove (const satcat5::ip::Addr &addr) |
| | Routing table shortcuts. More...
|
| |
| satcat5::ip::Route | route_lookup (const satcat5::ip::Addr &dstaddr) const |
| | Routing table shortcuts. More...
|
| |
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:
- Call m_iface->open_reply() to obtain a Writable object. (This also writes out any applicable frame headers.)
- Write frame contents, then call write_finalize().
The child class MUST override this method.
Implements satcat5::net::Protocol.
Definition at line 106 of file ip_dispatch.cc.