DualStackBaseIpExt

Trait DualStackBaseIpExt 

Source
pub trait DualStackBaseIpExt:
    DualStackIpExt
    + SocketIpExt
    + IpExt
    + FilterIpExt
    + IpLayerIpExt {
    type DualStackBoundSocketId<D: WeakDeviceIdentifier, S: DatagramSocketSpec>: Clone + Debug + Eq;
    type OtherStackIpOptions<State: Clone + Debug + Default + Send + Sync>: Clone + Debug + Default + Send + Sync;
    type DualStackListenerIpAddr<LocalIdentifier: Clone + Debug + Send + Sync + Into<NonZeroU16>>: Clone + Debug + Send + Sync + Into<(Option<SpecifiedAddr<Self::Addr>>, NonZeroU16)>;
    type DualStackConnIpAddr<S: DatagramSocketSpec>: Clone + Debug + Into<ConnInfoAddr<Self::Addr, <S::AddrSpec as SocketMapAddrSpec>::RemoteIdentifier>>;
    type DualStackConnState<D: WeakDeviceIdentifier, S: DatagramSocketSpec>: Debug + Send + Sync
       where Self::OtherVersion: DualStackBaseIpExt;

    // Required methods
    fn into_dual_stack_bound_socket_id<D: WeakDeviceIdentifier, S: DatagramSocketSpec>(
        id: S::SocketId<Self, D>,
    ) -> Self::DualStackBoundSocketId<D, S>
       where Self: IpExt;
    fn conn_addr_from_state<D: WeakDeviceIdentifier, S: DatagramSocketSpec>(
        state: &Self::DualStackConnState<D, S>,
    ) -> ConnAddr<Self::DualStackConnIpAddr<S>, D>
       where Self::OtherVersion: DualStackBaseIpExt;
}
Expand description

Common features of dual-stack sockets that vary by IP version.

This trait exists to provide per-IP-version associated types that are useful for implementing dual-stack sockets. The types are intentionally asymmetric - DualStackIpExt::Xxx has a different shape for the Ipv4 and Ipv6 impls.

Required Associated Types§

Source

type DualStackBoundSocketId<D: WeakDeviceIdentifier, S: DatagramSocketSpec>: Clone + Debug + Eq

The type of socket that can receive an IP packet.

For Ipv4, this is EitherIpSocket<S>, and for Ipv6 it is just S::SocketId<Ipv6>.

[EitherIpSocket<S>]: EitherIpSocket

Source

type OtherStackIpOptions<State: Clone + Debug + Default + Send + Sync>: Clone + Debug + Default + Send + Sync

The IP options type for the other stack that will be held for a socket.

For Ipv4, this is (), and for Ipv6 it is State. For a protocol like UDP or TCP where the IPv6 socket is dual-stack capable, the generic state struct can have a field with type I::OtherStackIpOptions<Ipv4InIpv6Options>.

Source

type DualStackListenerIpAddr<LocalIdentifier: Clone + Debug + Send + Sync + Into<NonZeroU16>>: Clone + Debug + Send + Sync + Into<(Option<SpecifiedAddr<Self::Addr>>, NonZeroU16)>

A listener address for dual-stack operation.

Source

type DualStackConnIpAddr<S: DatagramSocketSpec>: Clone + Debug + Into<ConnInfoAddr<Self::Addr, <S::AddrSpec as SocketMapAddrSpec>::RemoteIdentifier>>

A connected address for dual-stack operation.

Source

type DualStackConnState<D: WeakDeviceIdentifier, S: DatagramSocketSpec>: Debug + Send + Sync where Self::OtherVersion: DualStackBaseIpExt

Connection state for a dual-stack socket.

Required Methods§

Source

fn into_dual_stack_bound_socket_id<D: WeakDeviceIdentifier, S: DatagramSocketSpec>( id: S::SocketId<Self, D>, ) -> Self::DualStackBoundSocketId<D, S>
where Self: IpExt,

Convert a socket ID into a Self::DualStackBoundSocketId.

For coherency reasons this can’t be a From bound on DualStackBoundSocketId. If more methods are added, consider moving this to its own dedicated trait that bounds DualStackBoundSocketId.

Source

fn conn_addr_from_state<D: WeakDeviceIdentifier, S: DatagramSocketSpec>( state: &Self::DualStackConnState<D, S>, ) -> ConnAddr<Self::DualStackConnIpAddr<S>, D>

Retrieves the associated connection address from the connection state.

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.

Implementations on Foreign Types§

Source§

impl DualStackBaseIpExt for Ipv4

Source§

type DualStackBoundSocketId<D: WeakDeviceIdentifier, S: DatagramSocketSpec> = EitherIpSocket<D, S>

Incoming IPv4 packets may be received by either IPv4 or IPv6 sockets.

Source§

type DualStackListenerIpAddr<LocalIdentifier: Clone + Debug + Send + Sync + Into<NonZeroU16>> = ListenerIpAddr<<Ipv4 as Ip>::Addr, LocalIdentifier>

IPv4 sockets can’t listen on dual-stack addresses.

Source§

type DualStackConnIpAddr<S: DatagramSocketSpec> = ConnIpAddrInner<SocketIpAddr<<Ipv4 as Ip>::Addr>, <<S as DatagramSocketSpec>::AddrSpec as SocketMapAddrSpec>::LocalIdentifier, <<S as DatagramSocketSpec>::AddrSpec as SocketMapAddrSpec>::RemoteIdentifier>

IPv4 sockets cannot connect on dual-stack addresses.

Source§

type DualStackConnState<D: WeakDeviceIdentifier, S: DatagramSocketSpec> = ConnState<Ipv4, D, S>

IPv4 sockets cannot connect on dual-stack addresses.

Source§

type OtherStackIpOptions<State: Clone + Debug + Default + Send + Sync> = ()

Source§

fn into_dual_stack_bound_socket_id<D: WeakDeviceIdentifier, S: DatagramSocketSpec>( id: S::SocketId<Self, D>, ) -> Self::DualStackBoundSocketId<D, S>

Source§

fn conn_addr_from_state<D: WeakDeviceIdentifier, S: DatagramSocketSpec>( state: &Self::DualStackConnState<D, S>, ) -> ConnAddr<Self::DualStackConnIpAddr<S>, D>

Source§

impl DualStackBaseIpExt for Ipv6

Source§

type DualStackBoundSocketId<D: WeakDeviceIdentifier, S: DatagramSocketSpec> = <S as DatagramSocketSpec>::SocketId<Ipv6, D>

Incoming IPv6 packets may only be received by IPv6 sockets.

Source§

type DualStackListenerIpAddr<LocalIdentifier: Clone + Debug + Send + Sync + Into<NonZeroU16>> = DualStackListenerIpAddr<<Ipv6 as Ip>::Addr, LocalIdentifier>

IPv6 listeners can listen on dual-stack addresses (if the protocol and socket are dual-stack-enabled).

Source§

type DualStackConnIpAddr<S: DatagramSocketSpec> = DualStackConnIpAddr<<Ipv6 as Ip>::Addr, <<S as DatagramSocketSpec>::AddrSpec as SocketMapAddrSpec>::LocalIdentifier, <<S as DatagramSocketSpec>::AddrSpec as SocketMapAddrSpec>::RemoteIdentifier>

IPv6 sockets can connect on dual-stack addresses (if the protocol and socket are dual-stack-enabled).

Source§

type DualStackConnState<D: WeakDeviceIdentifier, S: DatagramSocketSpec> = DualStackConnState<Ipv6, D, S>

IPv6 sockets can connect on dual-stack addresses (if the protocol and socket are dual-stack-enabled).

Source§

type OtherStackIpOptions<State: Clone + Debug + Default + Send + Sync> = State

Source§

fn into_dual_stack_bound_socket_id<D: WeakDeviceIdentifier, S: DatagramSocketSpec>( id: S::SocketId<Self, D>, ) -> Self::DualStackBoundSocketId<D, S>

Source§

fn conn_addr_from_state<D: WeakDeviceIdentifier, S: DatagramSocketSpec>( state: &Self::DualStackConnState<D, S>, ) -> ConnAddr<Self::DualStackConnIpAddr<S>, D>

Implementors§