Skip to main content

DualStackDatagramBoundStateContext

Trait DualStackDatagramBoundStateContext 

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

    // Required methods
    fn dual_stack_enabled(
        &self,
        ip_options: &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 BoundDatagramSocketMap<I, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, S>, &mut BoundDatagramSocketMap<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, S>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn with_other_bound_sockets_mut<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>, &mut BoundDatagramSocketMap<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, S>) -> 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,
        ip_options: &IpOptions<I, Self::WeakDeviceId, S>,
    ) { ... }
}
Expand description

Provides access to dual-stack socket state.

Required Associated Types§

Source

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

The core context passed to the callbacks to methods.

Required Methods§

Source

fn dual_stack_enabled( &self, ip_options: &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 BoundDatagramSocketMap<I, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, S>, &mut BoundDatagramSocketMap<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, S>) -> 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 BoundDatagramSocketMap<I::OtherVersion, <Self as DeviceIdContext<AnyDevice>>::WeakDeviceId, S>) -> 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, ip_options: &IpOptions<I, Self::WeakDeviceId, S>, )

Asserts that the socket options 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".

Implementors§