pub trait IcmpVersion:
Sealed
+ Debug
+ Send
+ Sync
+ 'static {
type Address: Into<IpAddr> + Copy + Send + Sync;
type SocketAddr: Into<SocketAddr> + PartialEq + Eq + Debug + Copy;
const DOMAIN: Domain;
const PROTOCOL: Protocol;
const DEFAULT_BIND: Self::SocketAddr;
// Required methods
fn extract_icmp_from_recv_packet(
packet: &[u8],
) -> Result<(&[u8], Range<usize>)>;
fn checksum_required() -> bool;
}
Expand description
Trait abstracting over ICMPv4 and ICMPv6 behavior
Required Associated Constants§
Sourceconst DEFAULT_BIND: Self::SocketAddr
const DEFAULT_BIND: Self::SocketAddr
The sockaddr to bind to if none is specified in socket::SocketConfig
.
This should be 0.0.0.0
or ::
with a 0
port so that the kernel chooses a free port.
There must always be some sockaddr bound during socket init, otherwise the local port is not set until the first packet is sent.
Required Associated Types§
Sourcetype SocketAddr: Into<SocketAddr> + PartialEq + Eq + Debug + Copy
type SocketAddr: Into<SocketAddr> + PartialEq + Eq + Debug + Copy
The type of sockaddr
used with this version
Required Methods§
Sourcefn extract_icmp_from_recv_packet(packet: &[u8]) -> Result<(&[u8], Range<usize>)>
fn extract_icmp_from_recv_packet(packet: &[u8]) -> Result<(&[u8], Range<usize>)>
Extract the portion of the packet that comprises the ICMP message
Sourcefn checksum_required() -> bool
fn checksum_required() -> bool
Whether the ICMP checksum should be calculated when sending a message.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.