Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. Comms
  5. pw_transport
  6. pw::transport::ReliableSocketImpl Class Reference
Loading...
Searching...
No Matches
pw::transport::ReliableSocketImpl Class Reference

Overview

Implementation base class for reliable, in-order datagram sockets.

Inherits the transport lifecycle and operations of SocketImpl, adding the guarantee that datagrams are delivered reliably and in order, and that the socket closes if in-order delivery cannot be maintained.

Inheritance diagram for pw::transport::ReliableSocketImpl:
pw::transport::SocketImpl

Protected Member Functions

ReliableSocket WrapSocket ()
 
constexpr SocketImpl (Allocator &allocator, size_t max_write_message_size_bytes, size_t max_read_message_size_bytes)
 
constexpr SocketImpl (Allocator &allocator, size_t max_message_size_bytes)
 
- Protected Member Functions inherited from pw::transport::SocketImpl
constexpr SocketImpl (Allocator &allocator, size_t max_write_message_size_bytes, size_t max_read_message_size_bytes)
 
constexpr SocketImpl (Allocator &allocator, size_t max_message_size_bytes)
 
Socket WrapSocket ()
 
void MarkClosed ()
 
void WakeReader ()
 Wakes any pending ReadFuture.
 
void WakeOneWriter ()
 
void WakeAllWriters ()
 
WriteReservation CreateReservation (Buf &&buffer=Buf::ZeroLength())
 
void Adopt (WriteReservation &reservation, size_t prefix_trim=0, size_t suffix_trim=0)
 
void AdoptLocked (WriteReservation &reservation, size_t prefix_trim=0, size_t suffix_trim=0)
 

Additional Inherited Members

- Public Types inherited from pw::transport::SocketImpl
enum class  State : uint8_t { kOpen , kClosing , kClosed }
 
- Public Member Functions inherited from pw::transport::SocketImpl
virtual void lock () const =0
 
virtual void unlock () const =0
 
State state () const
 
bool is_open () const
 
bool is_closed () const
 
bool is_closing () const
 
size_t max_write_message_size_bytes () const
 
size_t max_read_message_size_bytes () const
 
ReadFuture Read ()
 
ReserveWriteFuture ReserveWrite (size_t min_size_bytes)
 Reserves write space for a datagram of at least min_size_bytes.
 
std::optional< WriteReservation > TryReserveWrite (size_t min_size_bytes)
 
CloseFuture Close ()
 Closes the socket, resolving once teardown is complete.
 
CloseFuture WhenClosed ()
 Resolves when the socket is closed.
 
bool CommitWrite (Buf buffer)
 
void CancelWrite (Buf buffer)
 

Member Function Documentation

◆ SocketImpl()

constexpr pw::transport::SocketImpl::SocketImpl ( Allocator &  allocator,
size_t  max_write_message_size_bytes,
size_t  max_read_message_size_bytes 
)
inlineconstexprprotected

Base constructor for an allocated, ref-counted socket. The socket is automatically destroyed and freed once no active Socket handles or futures reference it.


The documentation for this class was generated from the following file: