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, H: IpHeaderInfo<I>>(
core_ctx: &mut CC,
bindings_ctx: &mut BC,
device: &CC::DeviceId,
src_ip: I::RecvSrcAddr,
dst_ip: SpecifiedAddr<I::Addr>,
buffer: B,
info: &LocalDeliveryPacketInfo<I, H>,
) -> 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§
Sourcefn 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_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.
Sourcefn receive_ip_packet<B: BufferMut, H: IpHeaderInfo<I>>(
core_ctx: &mut CC,
bindings_ctx: &mut BC,
device: &CC::DeviceId,
src_ip: I::RecvSrcAddr,
dst_ip: SpecifiedAddr<I::Addr>,
buffer: B,
info: &LocalDeliveryPacketInfo<I, H>,
) -> Result<(), (B, TransportReceiveError)>
fn receive_ip_packet<B: BufferMut, H: IpHeaderInfo<I>>( core_ctx: &mut CC, bindings_ctx: &mut BC, device: &CC::DeviceId, src_ip: I::RecvSrcAddr, dst_ip: SpecifiedAddr<I::Addr>, buffer: B, info: &LocalDeliveryPacketInfo<I, H>, ) -> 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.
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.