|
SatCat5
|
Deferred packet-forwarding system for the IPv4 router.
To forward each packet, the router must determine the MAC address for the next hop in the chain. If that information is not already present in the combined CIDR/ARP table, then the router must defer forwarding until the ARP query/response is completed.
The router2::DeferFwd class implements deferred forwarding, retaining packet pointers from the router's primary MultiBuffer. Most incoming packets trigger an ARP query; the packet can be forwarded after a matching ARP response. If there is no response, then the query is repeated with an increasing timeout. After several failed attempts, undeliverable packets trigger an ICMP error to the original sender.
Definition at line 55 of file router2_deferfwd.h.
#include <router2_deferfwd.h>
Public Member Functions | |
| bool | accept (const satcat5::eth::PluginPacket &meta) |
| Accept this packet into the queue? | |
| virtual void | gateway_change (const satcat5::ip::Addr &dstaddr, const satcat5::ip::Addr &gateway) |
| Callback for changes to gateway configuration. More... | |
| void | timer_once (unsigned msec) |
| Configure a one-time notification after X milliseconds. | |
| void | timer_every (unsigned msec) |
| Configure a repeating notification every X milliseconds. | |
| void | timer_stop () |
| Stop all future notifications. | |
| unsigned | timer_interval () const |
| Accessor for recurring timer interval, if one is set. | |
| unsigned | timer_remaining () const |
| Accessor for time to next event, if one is set. | |
Static Public Member Functions | |
| static unsigned | count_timer () |
| Count all objects of this type, including idle timers. | |
Protected Member Functions | |
| DeferFwd (satcat5::router2::Dispatch *parent, satcat5::router2::DeferPkt *buff, unsigned bcount) | |
| Constructor should only be accessed by children, and requires a backing array of empty DeferPkt objects. | |
| void | arp_event (const satcat5::eth::MacAddr &mac, const satcat5::ip::Addr &ip) override |
| Callback for any announced MAC/IP address pair. More... | |
| void | timer_event () override |
| Child class MUST override this method. | |
| satcat5::router2::DeferPkt * | request_arp (satcat5::router2::DeferPkt *pkt) |
| satcat5::router2::DeferPkt * | request_fwd (satcat5::router2::DeferPkt *pkt, const satcat5::eth::MacAddr &dst) |
Protected Attributes | |
| satcat5::router2::Dispatch *const | m_parent |
| satcat5::eth::ProtoArp * | m_arp |
| satcat5::util::TimeVal | m_tref |
| satcat5::util::List< satcat5::router2::DeferPkt > | m_active |
| satcat5::util::List< satcat5::router2::DeferPkt > | m_empty |
Private Member Functions | |
| void | query (unsigned elapsed_msec) |
Private Attributes | |
| satcat5::eth::ArpListener * | m_next |
| unsigned | m_trem |
| unsigned | m_tnext |
|
overrideprotectedvirtual |
Callback for any announced MAC/IP address pair.
Child class MUST override this method.
Implements satcat5::eth::ArpListener.
Definition at line 84 of file router2_deferfwd.cc.
|
inlinevirtualinherited |
Callback for changes to gateway configuration.
Child class MAY override this method.
Reimplemented in satcat5::ip::Address, and satcat5::test::CountArpResponse.