Skip to main content
Pigweed's logo Pigweed
  1. Home
  2. Reference
  3. C/C++
  4. pw_transport
Loading...
Searching...
No Matches
pw_transport

Overview

Asynchronous datagram-oriented transport interface.

Main docs: Home

Classes

class  pw::transport::ReliableDatagramSocket
 
class  pw::transport::WriteReservation
 
class  pw::transport::ReadFuture
 
class  pw::transport::ReserveWriteFuture
 
class  pw::transport::CloseFuture
 Future representing waiting for a ReliableDatagramSocket to close. More...
 
class  pw::transport::ReliableDatagramSocketImpl
 
class  pw::transport::ReliableDatagramListener
 
class  pw::transport::ReliableDatagramConnector
 

Functions

size_t pw::transport::ReliableDatagramSocket::max_write_message_size_bytes () const
 The maximum size in bytes that can be requested in a ReserveWrite.
 
size_t pw::transport::ReliableDatagramSocket::max_read_message_size_bytes () const
 The maximum size in bytes of a single datagram received from the peer.
 
ReadFuture pw::transport::ReliableDatagramSocket::Read () const
 
ReserveWriteFuture pw::transport::ReliableDatagramSocket::ReserveWrite (size_t min_size_bytes) const
 
std::optional< WriteReservationpw::transport::ReliableDatagramSocket::TryReserveWrite (size_t min_size_bytes) const
 
CloseFuture pw::transport::ReliableDatagramSocket::Close () const
 
CloseFuture pw::transport::ReliableDatagramSocket::WhenClosed () const
 

Function Documentation

◆ Close()

CloseFuture pw::transport::ReliableDatagramSocket::Close ( ) const
inline

Terminally closes the socket, resolving once it has been fully torn down. If the socket is already closed, this is a no-op.

◆ Read()

ReadFuture pw::transport::ReliableDatagramSocket::Read ( ) const
inline

Receives a single datagram from the peer, resolving to a ConstBuf view of its data. Resolves to a null ConstBuf when the socket is closed.

Only one Read operation may be pended at a time. Pending a second ReadFuture while one is active will assert.

◆ ReserveWrite()

ReserveWriteFuture pw::transport::ReliableDatagramSocket::ReserveWrite ( size_t  min_size_bytes) const
inline

Requests to write a datagram of size at least min_size_bytes, waiting for space to become available.

Resolves to a std::optional<WriteReservation> that allows writing to that buffer, or std::nullopt if the socket has closed.

Multiple reservations or reservation requests can be outstanding at once. If multiple pending requests exist, the order in which they are resolved is not specified.

Requesting larger than max_write_message_size_bytes will assert.

◆ TryReserveWrite()

std::optional< WriteReservation > pw::transport::ReliableDatagramSocket::TryReserveWrite ( size_t  min_size_bytes) const
inline

Synchronously attempts to reserve space for writing a datagram of at least min_size_bytes. Returns std::nullopt if space is not immediately available or if the socket is closed.

◆ WhenClosed()

CloseFuture pw::transport::ReliableDatagramSocket::WhenClosed ( ) const
inline

Returns a future that resolves when the socket is terminally closed or disconnected.