netstack3_datagram

Trait DualStackDatagramBoundStateContext

Source
pub trait DualStackDatagramBoundStateContext<I: IpExt, BC, S: DatagramSocketSpec>: DeviceIdContext<AnyDevice> {
    type IpSocketsCtx<'a>: TransportIpContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + TransportIpContext<I::OtherVersion, BC>;

    // Required methods
    fn dual_stack_enabled(
        &self,
        state: &impl AsRef<IpOptions<I, Self::WeakDeviceId, S>>,
    ) -> bool;
    fn to_other_socket_options<'a>(
        &self,
        state: &'a IpOptions<I, Self::WeakDeviceId, S>,
    ) -> &'a DatagramIpSpecificSocketOptions<I::OtherVersion, Self::WeakDeviceId>;
    fn ds_converter(&self) -> impl DualStackConverter<I, Self::WeakDeviceId, S>;
    fn to_other_bound_socket_id(
        &self,
        id: &S::SocketId<I, Self::WeakDeviceId>,
    ) -> <S::SocketMapSpec<I::OtherVersion, Self::WeakDeviceId> as DatagramSocketMapSpec<I::OtherVersion, Self::WeakDeviceId, S::AddrSpec>>::BoundSocketId;
    fn with_both_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundSockets<I, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, <S as DatagramSocketSpec>::AddrSpec, <S as DatagramSocketSpec>::SocketMapSpec<I, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId>>, &mut BoundSockets<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, <S as DatagramSocketSpec>::AddrSpec, <S as DatagramSocketSpec>::SocketMapSpec<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId>>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_other_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundSockets<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, <S as DatagramSocketSpec>::AddrSpec, <S as DatagramSocketSpec>::SocketMapSpec<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId>>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_transport_context<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>) -> O>(
        &mut self,
        cb: F,
    ) -> O;

    // Provided method
    fn assert_dual_stack_enabled(
        &self,
        state: &impl AsRef<IpOptions<I, Self::WeakDeviceId, S>>,
    ) { ... }
}
Expand description

Provides access to dual-stack socket state.

Required Associated Types§

Source

type IpSocketsCtx<'a>: TransportIpContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + TransportIpContext<I::OtherVersion, BC>

The core context passed to the callbacks to methods.

Required Methods§

Source

fn dual_stack_enabled( &self, state: &impl AsRef<IpOptions<I, Self::WeakDeviceId, S>>, ) -> bool

Returns if the socket state indicates dual-stack operation is enabled.

Source

fn to_other_socket_options<'a>( &self, state: &'a IpOptions<I, Self::WeakDeviceId, S>, ) -> &'a DatagramIpSpecificSocketOptions<I::OtherVersion, Self::WeakDeviceId>

Returns the DatagramIpSpecificSocketOptions to use for packets in the other stack.

Source

fn ds_converter(&self) -> impl DualStackConverter<I, Self::WeakDeviceId, S>

Returns an instance of a type that implements DualStackConverter for addresses.

Source

fn to_other_bound_socket_id( &self, id: &S::SocketId<I, Self::WeakDeviceId>, ) -> <S::SocketMapSpec<I::OtherVersion, Self::WeakDeviceId> as DatagramSocketMapSpec<I::OtherVersion, Self::WeakDeviceId, S::AddrSpec>>::BoundSocketId

Converts a socket ID to a bound socket ID.

Converts a socket ID for IP version I into a bound socket ID that can be inserted into the demultiplexing map for IP version I::OtherVersion.

Source

fn with_both_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundSockets<I, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, <S as DatagramSocketSpec>::AddrSpec, <S as DatagramSocketSpec>::SocketMapSpec<I, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId>>, &mut BoundSockets<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, <S as DatagramSocketSpec>::AddrSpec, <S as DatagramSocketSpec>::SocketMapSpec<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId>>) -> O>( &mut self, cb: F, ) -> O

Calls the provided callback with mutable access to both the demultiplexing maps.

Source

fn with_other_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundSockets<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, <S as DatagramSocketSpec>::AddrSpec, <S as DatagramSocketSpec>::SocketMapSpec<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId>>) -> O>( &mut self, cb: F, ) -> O

Calls the provided callback with mutable access to the demultiplexing map for the other IP version.

Source

fn with_transport_context<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>) -> O>( &mut self, cb: F, ) -> O

Calls the provided callback with access to the IpSocketsCtx.

Provided Methods§

Source

fn assert_dual_stack_enabled( &self, state: &impl AsRef<IpOptions<I, Self::WeakDeviceId, S>>, )

Asserts that the socket state indicates dual-stack operation is enabled.

Provided trait function.

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.

Implementors§