Trait netstack3_tcp::TcpContext

source ·
pub trait TcpContext<I: DualStackIpExt, BC: TcpBindingsTypes>: TcpDemuxContext<I, Self::WeakDeviceId, BC> + IpSocketHandler<I, BC> {
    type ThisStackIpTransportAndDemuxCtx<'a>: TransportIpContext<I, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I, BC> + TcpDemuxContext<I, Self::WeakDeviceId, BC> + CounterContext<TcpCounters<I>>;
    type SingleStackIpTransportAndDemuxCtx<'a>: TransportIpContext<I, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I, BC> + TcpDemuxContext<I, Self::WeakDeviceId, BC> + AsThisStack<Self::ThisStackIpTransportAndDemuxCtx<'a>> + CounterContext<TcpCounters<I>>;
    type SingleStackConverter: SingleStackConverter<I, Self::WeakDeviceId, BC>;
    type DualStackIpTransportAndDemuxCtx<'a>: TransportIpContext<I, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I, BC> + TcpDemuxContext<I, Self::WeakDeviceId, BC> + TransportIpContext<I::OtherVersion, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I::OtherVersion, BC> + TcpDemuxContext<I::OtherVersion, Self::WeakDeviceId, BC> + TcpDualStackContext<I, Self::WeakDeviceId, BC> + AsThisStack<Self::ThisStackIpTransportAndDemuxCtx<'a>> + CounterContext<TcpCounters<I>> + CounterContext<TcpCounters<I::OtherVersion>>;
    type DualStackConverter: DualStackConverter<I, Self::WeakDeviceId, BC>;

    // Required methods
    fn with_all_sockets_mut<O, F: FnOnce(&mut TcpSocketSet<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        cb: F,
    ) -> O;
    fn for_each_socket<F: FnMut(&TcpSocketId<I, Self::WeakDeviceId, BC>, &TcpSocketState<I, Self::WeakDeviceId, BC>)>(
        &mut self,
        cb: F,
    );
    fn with_socket_mut_isn_transport_demux<O, F: for<'a> FnOnce(MaybeDualStack<(&'a mut Self::DualStackIpTransportAndDemuxCtx<'a>, Self::DualStackConverter), (&'a mut Self::SingleStackIpTransportAndDemuxCtx<'a>, Self::SingleStackConverter)>, &mut TcpSocketState<I, Self::WeakDeviceId, BC>, &IsnGenerator<BC::Instant>) -> O>(
        &mut self,
        id: &TcpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O;
    fn with_socket_and_converter<O, F: FnOnce(&TcpSocketState<I, Self::WeakDeviceId, BC>, MaybeDualStack<Self::DualStackConverter, Self::SingleStackConverter>) -> O>(
        &mut self,
        id: &TcpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O;

    // Provided methods
    fn with_socket<O, F: FnOnce(&TcpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        id: &TcpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O { ... }
    fn with_socket_mut_transport_demux<O, F: for<'a> FnOnce(MaybeDualStack<(&'a mut Self::DualStackIpTransportAndDemuxCtx<'a>, Self::DualStackConverter), (&'a mut Self::SingleStackIpTransportAndDemuxCtx<'a>, Self::SingleStackConverter)>, &mut TcpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        id: &TcpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O { ... }
    fn with_socket_mut<O, F: FnOnce(&mut TcpSocketState<I, Self::WeakDeviceId, BC>) -> O>(
        &mut self,
        id: &TcpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O { ... }
    fn with_socket_mut_and_converter<O, F: FnOnce(&mut TcpSocketState<I, Self::WeakDeviceId, BC>, MaybeDualStack<Self::DualStackConverter, Self::SingleStackConverter>) -> O>(
        &mut self,
        id: &TcpSocketId<I, Self::WeakDeviceId, BC>,
        cb: F,
    ) -> O { ... }
}
Expand description

Core context for TCP.

Required Associated Types§

source

type ThisStackIpTransportAndDemuxCtx<'a>: TransportIpContext<I, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I, BC> + TcpDemuxContext<I, Self::WeakDeviceId, BC> + CounterContext<TcpCounters<I>>

The core context for the current version of the IP protocol. This is used to be version agnostic when the operation is on the current stack.

source

type SingleStackIpTransportAndDemuxCtx<'a>: TransportIpContext<I, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I, BC> + TcpDemuxContext<I, Self::WeakDeviceId, BC> + AsThisStack<Self::ThisStackIpTransportAndDemuxCtx<'a>> + CounterContext<TcpCounters<I>>

The core context that will give access to this version of the IP layer.

source

type SingleStackConverter: SingleStackConverter<I, Self::WeakDeviceId, BC>

A collection of type assertions that must be true in the single stack version, associated types and concrete types must unify and we can inspect types by converting them into the concrete types.

source

type DualStackIpTransportAndDemuxCtx<'a>: TransportIpContext<I, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I, BC> + TcpDemuxContext<I, Self::WeakDeviceId, BC> + TransportIpContext<I::OtherVersion, BC, DeviceId = Self::DeviceId, WeakDeviceId = Self::WeakDeviceId> + DeviceIpSocketHandler<I::OtherVersion, BC> + TcpDemuxContext<I::OtherVersion, Self::WeakDeviceId, BC> + TcpDualStackContext<I, Self::WeakDeviceId, BC> + AsThisStack<Self::ThisStackIpTransportAndDemuxCtx<'a>> + CounterContext<TcpCounters<I>> + CounterContext<TcpCounters<I::OtherVersion>>

The core context that will give access to both versions of the IP layer.

source

type DualStackConverter: DualStackConverter<I, Self::WeakDeviceId, BC>

A collection of type assertions that must be true in the dual stack version, associated types and concrete types must unify and we can inspect types by converting them into the concrete types.

Required Methods§

source

fn with_all_sockets_mut<O, F: FnOnce(&mut TcpSocketSet<I, Self::WeakDeviceId, BC>) -> O>( &mut self, cb: F, ) -> O

Calls the function with mutable access to the set with all TCP sockets.

source

fn for_each_socket<F: FnMut(&TcpSocketId<I, Self::WeakDeviceId, BC>, &TcpSocketState<I, Self::WeakDeviceId, BC>)>( &mut self, cb: F, )

Calls the callback once for each currently installed socket.

source

fn with_socket_mut_isn_transport_demux<O, F: for<'a> FnOnce(MaybeDualStack<(&'a mut Self::DualStackIpTransportAndDemuxCtx<'a>, Self::DualStackConverter), (&'a mut Self::SingleStackIpTransportAndDemuxCtx<'a>, Self::SingleStackConverter)>, &mut TcpSocketState<I, Self::WeakDeviceId, BC>, &IsnGenerator<BC::Instant>) -> O>( &mut self, id: &TcpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with access to the socket state, ISN generator, and Transport + Demux context.

source

fn with_socket_and_converter<O, F: FnOnce(&TcpSocketState<I, Self::WeakDeviceId, BC>, MaybeDualStack<Self::DualStackConverter, Self::SingleStackConverter>) -> O>( &mut self, id: &TcpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with the immutable reference to the socket state and a converter to inspect.

Provided Methods§

source

fn with_socket<O, F: FnOnce(&TcpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &TcpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with immutable access to the socket state.

source

fn with_socket_mut_transport_demux<O, F: for<'a> FnOnce(MaybeDualStack<(&'a mut Self::DualStackIpTransportAndDemuxCtx<'a>, Self::DualStackConverter), (&'a mut Self::SingleStackIpTransportAndDemuxCtx<'a>, Self::SingleStackConverter)>, &mut TcpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &TcpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with access to the socket state and Transport + Demux context.

source

fn with_socket_mut<O, F: FnOnce(&mut TcpSocketState<I, Self::WeakDeviceId, BC>) -> O>( &mut self, id: &TcpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with mutable access to the socket state.

source

fn with_socket_mut_and_converter<O, F: FnOnce(&mut TcpSocketState<I, Self::WeakDeviceId, BC>, MaybeDualStack<Self::DualStackConverter, Self::SingleStackConverter>) -> O>( &mut self, id: &TcpSocketId<I, Self::WeakDeviceId, BC>, cb: F, ) -> O

Calls the function with the mutable reference to the socket state and a converter to inspect.

Object Safety§

This trait is not object safe.

Implementors§