Trait netstack3_ip::icmp::InnerIcmpContext

source ·
pub trait InnerIcmpContext<I: IpExt, BC: IcmpBindingsTypes>: IpSocketHandler<I, BC> {
    type EchoTransportContext: IpTransportContext<I, BC, Self> + EchoTransportContextMarker;

    // Required methods
    fn receive_icmp_error(
        &mut self,
        bindings_ctx: &mut BC,
        device: &Self::DeviceId,
        original_src_ip: Option<SpecifiedAddr<I::Addr>>,
        original_dst_ip: SpecifiedAddr<I::Addr>,
        original_proto: I::Proto,
        original_body: &[u8],
        err: I::ErrorCode,
    );
    fn with_error_send_bucket_mut<O, F: FnOnce(&mut TokenBucket<BC::Instant>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
}
Expand description

The execution context shared by ICMP(v4) and ICMPv6 for the internal operations of the IP stack.

Required Associated Types§

source

type EchoTransportContext: IpTransportContext<I, BC, Self> + EchoTransportContextMarker

A type implementing IpTransportContext that handles ICMP Echo replies.

Required Methods§

source

fn receive_icmp_error( &mut self, bindings_ctx: &mut BC, device: &Self::DeviceId, original_src_ip: Option<SpecifiedAddr<I::Addr>>, original_dst_ip: SpecifiedAddr<I::Addr>, original_proto: I::Proto, original_body: &[u8], err: I::ErrorCode, )

Receives an ICMP error message and demultiplexes it to a transport layer protocol.

All arguments beginning with original_ are fields from the IP packet that triggered the error. The original_body is provided here so that the error can be associated with a transport-layer socket. device identifies the device on which the packet was received.

While ICMPv4 error messages are supposed to contain the first 8 bytes of the body of the offending packet, and ICMPv6 error messages are supposed to contain as much of the offending packet as possible without violating the IPv6 minimum MTU, the caller does NOT guarantee that either of these hold. It is receive_icmp_error’s responsibility to handle any length of original_body, and to perform any necessary validation.

source

fn with_error_send_bucket_mut<O, F: FnOnce(&mut TokenBucket<BC::Instant>) -> O>( &mut self, cb: F, ) -> O

Calls the function with a mutable reference to ICMP error send tocket bucket.

Object Safety§

This trait is not object safe.

Implementors§