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§
sourcetype IpSocketsCtx<'a>: TransportIpContext<I, BC> + DeviceIdContext<AnyDevice, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + TransportIpContext<I::OtherVersion, BC>
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§
sourcefn dual_stack_enabled(
&self,
state: &impl AsRef<IpOptions<I, Self::WeakDeviceId, S>>,
) -> bool
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.
sourcefn to_other_socket_options<'a>(
&self,
state: &'a IpOptions<I, Self::WeakDeviceId, S>,
) -> &'a DatagramIpSpecificSocketOptions<I::OtherVersion, Self::WeakDeviceId>
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.
sourcefn ds_converter(&self) -> impl DualStackConverter<I, Self::WeakDeviceId, S>
fn ds_converter(&self) -> impl DualStackConverter<I, Self::WeakDeviceId, S>
Returns an instance of a type that implements DualStackConverter
for addresses.
sourcefn 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 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
.
sourcefn 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_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.
sourcefn 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_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.
sourcefn with_transport_context<O, F: FnOnce(&mut Self::IpSocketsCtx<'_>) -> O>(
&mut self,
cb: F,
) -> O
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§
sourcefn assert_dual_stack_enabled(
&self,
state: &impl AsRef<IpOptions<I, Self::WeakDeviceId, S>>,
)
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.