pub struct ListenStack<const QUEUELEN: usize> { /* private fields */ }
Available on riot_module_sock_tcp and crate feature with_embedded_nal only.
Expand description

A view on the RIOT socket stack that is prepared for a single listening socket that can accept QUEUELEN connections simultaneously.

Note that unless CONFIG_GNRC_TCP_RCV_BUFFERS is overridden, QUEUELEN is limited to 1, anything more makes it fail at setup time.

To use it as an implementation of TcpFullStack, it needs to be pinned, eg. by pin_utils::pin_mut!(stack), and later passed as mutable refernce to the pinned item.

Note that while it would be perfectly feasible to count the number of open connection and allow this to be dropped when all connections are closed, this will only be implemented once there is any case that needs it (as most RIOT servers are up indefinitely).

Trait Implementations§

source§

impl<const QUEUELEN: usize> Default for ListenStack<QUEUELEN>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<const QUEUELEN: usize> Drop for ListenStack<QUEUELEN>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, const QUEUELEN: usize> TcpClientStack for Pin<&'a mut ListenStack<QUEUELEN>>

§

type TcpSocket = Socket<'a>

The type returned when we create a new TCP socket
§

type Error = NumericError

The type returned when we have an error
source§

fn socket(&mut self) -> Result<Self::TcpSocket, Self::Error>

Open a socket for usage as a TCP client. Read more
source§

fn connect( &mut self, _sock: &mut Self::TcpSocket, _addr: SocketAddr ) -> Result<(), Error<Self::Error>>

Connect to the given remote host and port. Read more
source§

fn is_connected(&mut self, sock: &Self::TcpSocket) -> Result<bool, Self::Error>

Check if this socket is connected
source§

fn send( &mut self, sock: &mut Self::TcpSocket, buf: &[u8] ) -> Result<usize, Error<Self::Error>>

Write to the stream. Read more
source§

fn receive( &mut self, sock: &mut Self::TcpSocket, buf: &mut [u8] ) -> Result<usize, Error<Self::Error>>

Receive data from the stream. Read more
source§

fn close(&mut self, sock: Self::TcpSocket) -> Result<(), Self::Error>

Close an existing TCP socket.
source§

impl<'a, const QUEUELEN: usize> TcpExactStack for Pin<&'a mut ListenStack<QUEUELEN>>

source§

const RECVBUFLEN: usize = 1_152usize

Capacity of the connection’s TCP buffer. Read more
source§

const SENDBUFLEN: usize = 1_152usize

Capacity of the connection’s TCP send buffer. Read more
source§

fn receive_exact( &mut self, sock: &mut Self::TcpSocket, buf: &mut [u8] ) -> Result<(), Error<Self::Error>>

Receive data from the stream. Read more
source§

fn send_all( &mut self, sock: &mut Self::TcpSocket, buf: &[u8] ) -> Result<(), Error<Self::Error>>

Send all this data to the stream. Read more
source§

impl<'a, const QUEUELEN: usize> TcpFullStack for Pin<&'a mut ListenStack<QUEUELEN>>

source§

fn bind( &mut self, sock: &mut Self::TcpSocket, port: u16 ) -> Result<(), Self::Error>

Create a new TCP socket and bind it to the specified local port. Read more
source§

fn listen(&mut self, _sock: &mut Self::TcpSocket) -> Result<(), Self::Error>

Begin listening for connection requests on a previously-bound socket. Read more
source§

fn accept( &mut self, _sock: &mut Self::TcpSocket ) -> Result<(Self::TcpSocket, SocketAddr), Error<Self::Error>>

Accept an active connection request on a listening socket. Read more

Auto Trait Implementations§

§

impl<const QUEUELEN: usize> RefUnwindSafe for ListenStack<QUEUELEN>

§

impl<const QUEUELEN: usize> !Send for ListenStack<QUEUELEN>

§

impl<const QUEUELEN: usize> !Sync for ListenStack<QUEUELEN>

§

impl<const QUEUELEN: usize> !Unpin for ListenStack<QUEUELEN>

§

impl<const QUEUELEN: usize> UnwindSafe for ListenStack<QUEUELEN>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoSwitch for T

source§

fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>

Consumes the IoPin returning a Switch of the appropriate ActiveLevel. Read more
source§

fn into_active_low_switch(self) -> Switch<Self, ActiveLow>
where Self: Sized,

Consumes the IoPin returning a Switch<IoPin, ActiveLow>. Read more
source§

fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>
where Self: Sized,

Consumes the IoPin returning a Switch<IoPin, ActiveHigh>. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.