Trait netstack3_core::transport::tcp::socket::NonSyncContext
source · pub trait NonSyncContext: TimerContext<TimerId> + TracingContext {
type ReceiveBuffer: ReceiveBuffer;
type SendBuffer: SendBuffer;
type ReturnedBuffers: Debug;
type ProvidedBuffers: Debug + Takeable + IntoBuffers<Self::ReceiveBuffer, Self::SendBuffer>;
// Required methods
fn default_buffer_sizes() -> BufferSizes;
fn on_waiting_connections_change<I: Ip>(
&mut self,
listener: ListenerId<I>,
count: usize
);
fn on_connection_status_change<I: Ip>(
&mut self,
connection: ConnectionId<I>,
status: ConnectionStatusUpdate
);
fn new_passive_open_buffers(
buffer_sizes: BufferSizes
) -> (Self::ReceiveBuffer, Self::SendBuffer, Self::ReturnedBuffers);
}
Expand description
Non-sync context for TCP.
The relationship between buffers defined in the context is as follows:
The Bindings will receive the ReturnedBuffers
so that it can: 1. give the
application a handle to read/write data; 2. Observe whatever signal required
from the application so that it can inform Core. The peer end of returned
handle will be held by the state machine inside the netstack. Specialized
receive/send buffers will be derived from ProvidedBuffers
from Bindings.
+—————————––+ | +–––––––+ | | | returned | | | | buffers | | | +——+—––+ | | | application| +–––––––+––––––––+ | +–––––––+––––––––+ | | netstack| | +—+——+—––+—+ | | | | provided | | | | | +-+- buffers -+-+ | | | +-+-+–––––––+-+-+ | | v v | |receive buffer send buffer | +—————————––+
Required Associated Types§
sourcetype ReceiveBuffer: ReceiveBuffer
type ReceiveBuffer: ReceiveBuffer
Receive buffer used by TCP.
sourcetype SendBuffer: SendBuffer
type SendBuffer: SendBuffer
Send buffer used by TCP.
sourcetype ReturnedBuffers: Debug
type ReturnedBuffers: Debug
The object that will be returned by the state machine when a passive open connection becomes established. The bindings can use this object to read/write bytes from/into the created buffers.
sourcetype ProvidedBuffers: Debug + Takeable + IntoBuffers<Self::ReceiveBuffer, Self::SendBuffer>
type ProvidedBuffers: Debug + Takeable + IntoBuffers<Self::ReceiveBuffer, Self::SendBuffer>
The object that is needed from the bindings to initiate a connection, it is provided by the bindings and will be later used to construct buffers when the connection becomes established.
Required Methods§
sourcefn default_buffer_sizes() -> BufferSizes
fn default_buffer_sizes() -> BufferSizes
The buffer sizes to use when creating new sockets.
sourcefn on_waiting_connections_change<I: Ip>(
&mut self,
listener: ListenerId<I>,
count: usize
)
fn on_waiting_connections_change<I: Ip>( &mut self, listener: ListenerId<I>, count: usize )
Called when the number of available connections on a listener changes.
This method is called when a connection is established and becomes
available for accepting, or an established connection is closed before
being accepted. count
provides the current number of waiting
connections for listener
.
sourcefn on_connection_status_change<I: Ip>(
&mut self,
connection: ConnectionId<I>,
status: ConnectionStatusUpdate
)
fn on_connection_status_change<I: Ip>( &mut self, connection: ConnectionId<I>, status: ConnectionStatusUpdate )
Called when a connection’s status changes due to external events.
See ConnectionStatusUpdate
for the set of events that may result in
this method being called.
sourcefn new_passive_open_buffers(
buffer_sizes: BufferSizes
) -> (Self::ReceiveBuffer, Self::SendBuffer, Self::ReturnedBuffers)
fn new_passive_open_buffers( buffer_sizes: BufferSizes ) -> (Self::ReceiveBuffer, Self::SendBuffer, Self::ReturnedBuffers)
Creates new buffers and returns the object that Bindings need to read/write from/into the created buffers.