Trait netstack3_ip::IpTransportContext

source ·
pub trait IpTransportContext<I: IpExt, BC, CC: DeviceIdContext<AnyDevice> + ?Sized> {
    // Required methods
    fn receive_icmp_error(
        core_ctx: &mut CC,
        bindings_ctx: &mut BC,
        device: &CC::DeviceId,
        original_src_ip: Option<SpecifiedAddr<I::Addr>>,
        original_dst_ip: SpecifiedAddr<I::Addr>,
        original_body: &[u8],
        err: I::ErrorCode,
    );
    fn receive_ip_packet<B: BufferMut>(
        core_ctx: &mut CC,
        bindings_ctx: &mut BC,
        device: &CC::DeviceId,
        src_ip: I::RecvSrcAddr,
        dst_ip: SpecifiedAddr<I::Addr>,
        buffer: B,
        meta: ReceiveIpPacketMeta<I>,
    ) -> Result<(), (B, TransportReceiveError)>;
}
Expand description

The execution context provided by a transport layer protocol to the IP layer.

An implementation for () is provided which indicates that a particular transport layer protocol is unsupported.

Required Methods§

source

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

Receive an ICMP error message.

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 that received the ICMP error message packet.

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 receive_ip_packet<B: BufferMut>( core_ctx: &mut CC, bindings_ctx: &mut BC, device: &CC::DeviceId, src_ip: I::RecvSrcAddr, dst_ip: SpecifiedAddr<I::Addr>, buffer: B, meta: ReceiveIpPacketMeta<I>, ) -> Result<(), (B, TransportReceiveError)>

Receive a transport layer packet in an IP packet.

In the event of an unreachable port, receive_ip_packet returns the buffer in its original state (with the transport packet un-parsed) in the Err variant.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<I: IpExt, BC, CC: DeviceIdContext<AnyDevice> + ?Sized> IpTransportContext<I, BC, CC> for ()

source§

fn receive_icmp_error( _core_ctx: &mut CC, _bindings_ctx: &mut BC, _device: &CC::DeviceId, _original_src_ip: Option<SpecifiedAddr<I::Addr>>, _original_dst_ip: SpecifiedAddr<I::Addr>, _original_body: &[u8], err: I::ErrorCode, )

source§

fn receive_ip_packet<B: BufferMut>( _core_ctx: &mut CC, _bindings_ctx: &mut BC, _device: &CC::DeviceId, _src_ip: I::RecvSrcAddr, _dst_ip: SpecifiedAddr<I::Addr>, buffer: B, _meta: ReceiveIpPacketMeta<I>, ) -> Result<(), (B, TransportReceiveError)>

Implementors§