10 #include <satcat5/ip_core.h>
18 constexpr u16 ICMP_ECHO_REPLY = 0x0000;
19 constexpr u16 ICMP_UNREACHABLE_NET = 0x0300;
20 constexpr u16 ICMP_UNREACHABLE_HOST = 0x0301;
21 constexpr u16 ICMP_UNREACHABLE_PROTO = 0x0302;
22 constexpr u16 ICMP_UNREACHABLE_PORT = 0x0303;
23 constexpr u16 ICMP_FRAG_REQUIRED = 0x0304;
24 constexpr u16 ICMP_SRC_ROUTE_FAILED = 0x0305;
25 constexpr u16 ICMP_DST_NET_UNKNOWN = 0x0306;
26 constexpr u16 ICMP_DST_HOST_UNKNOWN = 0x0307;
27 constexpr u16 ICMP_SRC_HOST_ISOLATED = 0x0308;
28 constexpr u16 ICMP_NET_PROHIBITED = 0x0309;
29 constexpr u16 ICMP_HOST_PROHIBITED = 0x030A;
30 constexpr u16 ICMP_TOS_NET = 0x030B;
31 constexpr u16 ICMP_TOS_HOST = 0x030C;
32 constexpr u16 ICMP_COMM_PROHIBITED = 0x030D;
33 constexpr u16 ICMP_HOST_PRECEDENCE = 0x030E;
34 constexpr u16 ICMP_PRECEDENCE_CUTOFF = 0x030F;
35 constexpr u16 ICMP_REDIRECT_NET = 0x0500;
36 constexpr u16 ICMP_REDIRECT_HOST = 0x0501;
37 constexpr u16 ICMP_REDIRECT_NET_TOS = 0x0502;
38 constexpr u16 ICMP_REDIRECT_HOST_TOS = 0x0503;
39 constexpr u16 ICMP_ECHO_REQUEST = 0x0800;
40 constexpr u16 ICMP_TTL_EXPIRED = 0x0B00;
41 constexpr u16 ICMP_FRAG_TIMEOUT = 0x0B01;
42 constexpr u16 ICMP_IP_HDR_POINTER = 0x0C00;
43 constexpr u16 ICMP_IP_HDR_OPTION = 0x0C01;
44 constexpr u16 ICMP_IP_HDR_LENGTH = 0x0C02;
45 constexpr u16 ICMP_TIME_REQUEST = 0x0D00;
46 constexpr u16 ICMP_TIME_REPLY = 0x0E00;
51 constexpr u16 ICMP_TYPE_MASK = 0xFF00;
52 constexpr u16 ICMP_TYPE_UNREACHABLE = 0x0300;
53 constexpr u16 ICMP_TYPE_REDIRECT = 0x0500;
54 constexpr u16 ICMP_TYPE_TIME_EXCEED = 0x0B00;
55 constexpr u16 ICMP_TYPE_BAD_IP_HDR = 0x0C00;
59 constexpr
unsigned ICMP_ECHO_BYTES = 8;
112 { m_wait_msec = wait_msec; }
117 {m_listeners.
add(cb);}
127 unsigned wcount, u16* data);
131 unsigned m_wait_msec;
Limited read of next N bytes.
Abstract API for reading byte-streams and packets.
Abstract API for writing byte-streams and packets.
Connection metadata for an IPv4 address.
Protocol handler and dispatch unit for Internet Protocol v4 (IPv4).
Callback API for handling "ping" reponses.
virtual void ping_event(const satcat5::ip::Addr &from, u32 elapsed_usec)=0
Callback method when a ping response is received.
Protocol handler for the Internet Control Message Protocol (ICMP).
bool send_timereq(satcat5::ip::Address &dst)
Initiate a timestamp request.
void timer_event() override
Child class MUST override this method.
void set_log_cooldown(unsigned wait_msec)
Adjust the rate-limit for ICMP error logging.
void remove(satcat5::ip::PingListener *cb)
Add/remove callback handlers for Ping responses.
void add(satcat5::ip::PingListener *cb)
Add/remove callback handlers for Ping responses.
bool send_error(u16 type, satcat5::io::Readable *src, uint32_t arg=0)
Send a specific error message.
bool send_ping(satcat5::ip::Address &dst)
Initiate a ping (Echo request = Type 8.0).
void frame_rcvd(satcat5::io::LimitedRead &src) override
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
ProtoIcmp(satcat5::ip::Dispatch *iface)
Link this handler to an IPv4 network interface.
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Timer objects are polled after a fixed delay or at a regular interval.
Helper functions for manipulating singly-linked lists.
void add(T *item)
Add new item to front or back, whichever is simpler.
void remove(T *item)
Remove the designated item from the list.
Templated functions for manipulating singly-linked lists.
Generic network Dispatch API.
Core event-processing loop for SatCat5 software.
IPv4 address is a 32-bit unsigned integer.