1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Receiving and sending Icmp messages.
//!
//! Only supports Icmpv4 for now.
//!
//! Tuned to automate most parts of the icmp procedures *internally*. Nevertheless it will has an
//! optional interface to forward unhandled messages to a custom receiver. This is in accorance
//! with RFC1812, and extends it to unhandled packets, which states:
//!
//! > 4.3.2.1 Unknown Message Types
//!
//! If an ICMP message of unknown type is received, it MUST be passed to
//! the ICMP user interface (if the router has one) or silently discarded
//! (if the router does not have one).
//!
//! ## Icmp ping
//!
//! To answer pings there are two strategies:
//!
//! 1. Reuse the received buffer to queue a response instantly.
//! 2. Copy the payload into a temporary buffer and send a response at some later point.
//!
//! The implementation will try to reinitialize the buffer to perform a zero-copy answer, or one
//! that simply moves the payload in memory a bit. If that fails due to being unsupported for that
//! nic, it will try to store it into an internal buffer. If there is not enough space it will try
//! to forward it to the optional upper layer receiver. If that fails, the packet is discarded.
//!
//! ## Other message types
//!
//! All other message types can be received in an upper layer or are simply discarded if there is
//! no upper handler that is ready to inspect packets.
use cratePayload;
pub use ;
pub use ;
/// An ICMP receiver.
///
/// Processes incoming ICMP traffic with the option of generating automatic answers or some basic
/// customized handling.
/// A ICMP sender.
///
/// Utilize raw packet buffers to send ICMP probes such as echo request or advertisements, or to
/// advise remotes of unreachable routes where `ethox` does not do so in a satisfactory manner
/// itself.