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::ReliableConnector Class Reference
pw::transport::ReliableConnector Class Referenceabstract

Overview

The establishing side of a reliable, datagram-oriented transport.

A connector opens outbound connections to a remote peer, performing any necessary protocol-level configuration and establishment, then provides a handle which is used to read to or write from that socket.

ReliableConnector derives from Connector, so any ReliableConnector can be implicitly converted to and used as a Connector.

The ReliableConnector interface does not specify any addressing or ports, as those details are protocol-dependent. A concrete ReliableConnector instance should be constructed with and internally store any such state if required.

Implementations override DoConnectReliable() and return a ReliableConnector::ConnectFuture, typically using ConnectProvider or ConnectListProvider.

If a ReliableConnector is destructed, it must resolve any pending ConnectFuture objects with a FAILED_PRECONDITION.

Inheritance diagram for pw::transport::ReliableConnector:
pw::transport::Connector pw::transport::ForwardingTransport pw::transport::internal::MockConnectorBase< ReliableConnector, kMaxQueuedResults >

Classes

class  ConnectFuture
 

Public Member Functions

ConnectFuture Connect ()
 
- Public Member Functions inherited from pw::transport::Connector
ConnectFuture Connect ()
 

Protected Types

using ConnectProvider = internal::TransportFutureProvider< ConnectFuture >
 One-to-one provider that vends ConnectFuture instances.
 
using ConnectListProvider = internal::TransportFutureListProvider< ConnectFuture >
 
- Protected Types inherited from pw::transport::Connector
using ConnectProvider = internal::TransportFutureProvider< ConnectFuture >
 One-to-one provider that vends ConnectFuture instances.
 
using ConnectListProvider = internal::TransportFutureListProvider< ConnectFuture >
 

Static Protected Member Functions

static ReliableSocket WrapSocket (ReliableSocketImpl &impl)
 Creates a ReliableSocket handle from an implementation.
 
- Static Protected Member Functions inherited from pw::transport::Connector
static Socket WrapSocket (SocketImpl &impl)
 Creates a Socket handle from an implementation.
 

Private Member Functions

Connector::ConnectFuture DoConnect () final
 Implements opening an outbound connection to the peer.
 
virtual ConnectFuture DoConnectReliable ()=0
 Implements opening a reliable outbound connection to the peer.
 

Member Typedef Documentation

◆ ConnectListProvider

Multi-consumer provider that vends a list of pending ConnectFuture instances.

Member Function Documentation

◆ Connect()

ConnectFuture pw::transport::ReliableConnector::Connect ( )
inline

Opens a connection to the peer, returning it once established.

It is up to the implementation to decide whether concurrent connections to the peer are allowed. If not supported, subsequent calls to Connect when a connection is active should return ALREADY_EXISTS. It must always be possible to call Connect again when no connections are active and the transport is still alive.

Returns
  • OK: The connection was established and is ready for use.
  • UNAVAILABLE: The peer could not be reached.
  • FAILED_PRECONDITION: The transport is permanently down.
  • ALREADY_EXISTS: A connection is already active and the transport does not support multiple simultaneous connections.
  • RESOURCE_EXHAUSTED: The socket object could not be allocated.

◆ DoConnect()

Connector::ConnectFuture pw::transport::ReliableConnector::DoConnect ( )
inlinefinalprivatevirtual

Implements opening an outbound connection to the peer.

Implements pw::transport::Connector.

◆ DoConnectReliable()

virtual ConnectFuture pw::transport::ReliableConnector::DoConnectReliable ( )
privatepure virtual

Implements opening a reliable outbound connection to the peer.

Implemented in pw::transport::internal::MockConnectorBase< ReliableConnector, kMaxQueuedResults >, and pw::transport::ForwardingTransport.


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