pub trait IpTransportContext<I: IpExt, BC, CC: DeviceIdContext<AnyDevice> + ?Sized> {
type EarlyDemuxSocket;
// Required methods
fn early_demux<B: ParseBuffer>(
core_ctx: &mut CC,
device: &CC::DeviceId,
src_ip: I::Addr,
dst_ip: I::Addr,
buffer: B,
) -> Option<Self::EarlyDemuxSocket>;
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>,
early_demux_socket: Option<Self::EarlyDemuxSocket>,
) -> 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 Associated Types§
Sourcetype EarlyDemuxSocket
type EarlyDemuxSocket
Type used to identify sockets for early demux.
Required Methods§
Sourcefn early_demux<B: ParseBuffer>(
core_ctx: &mut CC,
device: &CC::DeviceId,
src_ip: I::Addr,
dst_ip: I::Addr,
buffer: B,
) -> Option<Self::EarlyDemuxSocket>
fn early_demux<B: ParseBuffer>( core_ctx: &mut CC, device: &CC::DeviceId, src_ip: I::Addr, dst_ip: I::Addr, buffer: B, ) -> Option<Self::EarlyDemuxSocket>
Performs early demux.
Tries to match the packet with a connected socket that will receive the
packet. If a match is found, the socket information is passed to
LOCAL_INGRESS filters. The socket is also passed to
receive_ip_packet to avoid demuxing the packet twice.
The socket may be invalidated if the source address is changed by SNAT.
In that case, receive_ip_packet is called with early_demux_socket
set to None.
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>,
early_demux_socket: Option<Self::EarlyDemuxSocket>,
) -> 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>, early_demux_socket: Option<Self::EarlyDemuxSocket>, ) -> 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.