A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
a11::net::WebRtcWireStream Class Referencefinal

A WireStream that carries A11 traffic over a WebRTC data channel. More...

#include <cpp/a11/net/webrtc_wire_stream.h>

Inheritance diagram for a11::net::WebRtcWireStream:
[legend]

Public Member Functions

 ~WebRtcWireStream () override
 
std::shared_ptr< rtc::DataChannel > data_channel () const
 
std::shared_ptr< rtc::PeerConnection > peer_connection () const
 
std::shared_ptr< SignallingTransportsignalling_endpoint () const
 
 WebRtcWireStream (ConstructorToken, std::shared_ptr< State > state, std::shared_ptr< rtc::DataChannel > data_channel, std::shared_ptr< rtc::PeerConnection > connection, std::shared_ptr< SignallingTransport > signalling_endpoint)
 
- Public Member Functions inherited from a11::net::ChannelWireStream
 ~ChannelWireStream () override
 
absl::Status Send (data::WireMessage message) override
 Enqueue a message for delivery to the peer.
 
a11::Task Start (OnMessage on_message, OnDone on_done) override
 Begin the stream as the initiating ("start") side.
 
a11::Task Accept (OnMessage on_message, OnDone on_done) override
 Begin the stream as the accepting ("accept") side.
 
absl::Status HalfClose (data::ByteMap trailers) override
 Signal that this side will send no more messages.
 
a11::Task DrainOutgoingMessages () override
 Await delivery of all buffered outbound messages.
 
absl::Status Abort (absl::Status status) override
 Abort the stream, discarding buffered work.
 
absl::Status SetDeadline (absl::Time deadline) override
 Set the absolute deadline after which the stream is aborted.
 
absl::Time deadline () const override
 
absl::Status GetStatus () const override
 
std::optional< data::ByteMapGetTrailers () const override
 
std::string GetId () const override
 
void *absl_nullable GetImpl () const override
 
absl::Status HalfClose ()
 Half-close with no trailers.
 
virtual absl::Status HalfClose (data::ByteMap trailers)=0
 Signal that this side will send no more messages.
 
absl::Status SetDeadline ()
 Clear any deadline (equivalent to an infinite deadline).
 
virtual absl::Status SetDeadline (absl::Time deadline)=0
 Set the absolute deadline after which the stream is aborted.
 
- Public Member Functions inherited from a11::net::WireStream
virtual ~WireStream ()=default
 
absl::Status HalfClose ()
 Half-close with no trailers.
 
absl::Status SetDeadline ()
 Clear any deadline (equivalent to an infinite deadline).
 

Static Public Member Functions

static absl::StatusOr< std::shared_ptr< WebRtcWireStream > > CreateClient (std::string identity, std::string peer_identity, std::shared_ptr< SignallingService > signalling, WebRtcConfiguration configuration={}, WireStreamOptions options={})
 Dials a peer over a shared in-process signalling service.
 
static absl::StatusOr< std::shared_ptr< WebRtcWireStream > > CreateClient (std::string peer_identity, std::shared_ptr< SignallingTransport > signalling, WebRtcConfiguration configuration={}, WireStreamOptions options={})
 Dials a peer over an explicit signalling transport.
 
static absl::StatusOr< std::shared_ptr< WebRtcWireStream > > Create (std::shared_ptr< rtc::DataChannel > data_channel, std::shared_ptr< rtc::PeerConnection > connection, std::shared_ptr< SignallingTransport > signalling_endpoint, ChannelEndpointRole role, WireStreamOptions options={}, OpenOperation open_operation={}, size_t split_size=48 *1024)
 Adopts an already-established data channel as a WireStream.
 
static absl::StatusOr< std::shared_ptr< WebRtcWireStream > > BuildMultiplexedStream (std::shared_ptr< internal::BinaryChannel > channel, std::shared_ptr< rtc::DataChannel > primary_channel, std::shared_ptr< rtc::PeerConnection > connection, std::shared_ptr< SignallingTransport > signalling_endpoint, std::string id, ChannelEndpointRole role, WireStreamOptions options={}, OpenOperation open_operation={}, size_t split_size=48 *1024)
 Adopts an already-built binary channel (possibly multiplexed).
 

Additional Inherited Members

- Public Types inherited from a11::net::ChannelWireStream
using OpenOperation = std::function< absl::Status()>
 Transport-specific operation that initiates or accepts the channel.
 
- Protected Member Functions inherited from a11::net::ChannelWireStream
 ChannelWireStream (std::shared_ptr< State > state)
 
- Static Protected Member Functions inherited from a11::net::ChannelWireStream
static absl::StatusOr< std::shared_ptr< State > > MakeState (std::shared_ptr< internal::BinaryChannel > channel, std::string id, ChannelEndpointRole role, OpenOperation open_operation, WireStreamOptions options, ChannelFramingOptions framing={})
 

Detailed Description

A WireStream that carries A11 traffic over a WebRTC data channel.

Created by dialing a named peer through a signalling service or transport (CreateClient), or by adopting an already-negotiated libdatachannel channel (Create, used internally by WebRtcWireServer). Framing and fragmentation are handled by the ChannelWireStream base.

Constructor & Destructor Documentation

◆ ~WebRtcWireStream()

a11::net::WebRtcWireStream::~WebRtcWireStream ( )
override

◆ WebRtcWireStream()

a11::net::WebRtcWireStream::WebRtcWireStream ( ConstructorToken  ,
std::shared_ptr< State state,
std::shared_ptr< rtc::DataChannel >  data_channel,
std::shared_ptr< rtc::PeerConnection >  connection,
std::shared_ptr< SignallingTransport signalling_endpoint 
)
inline

Member Function Documentation

◆ BuildMultiplexedStream()

absl::StatusOr< std::shared_ptr< WebRtcWireStream > > a11::net::WebRtcWireStream::BuildMultiplexedStream ( std::shared_ptr< internal::BinaryChannel >  channel,
std::shared_ptr< rtc::DataChannel >  primary_channel,
std::shared_ptr< rtc::PeerConnection >  connection,
std::shared_ptr< SignallingTransport signalling_endpoint,
std::string  id,
ChannelEndpointRole  role,
WireStreamOptions  options = {},
OpenOperation  open_operation = {},
size_t  split_size = 48 * 1024 
)
static

Adopts an already-built binary channel (possibly multiplexed).

Lower-level than Create: the caller owns the channel and its member data channels. primary_channel is retained only for the data_channel() accessor. Used by WebRtcWireServer and the client factory to wrap a multiplexed channel that stripes across several data channels.

◆ Create()

absl::StatusOr< std::shared_ptr< WebRtcWireStream > > a11::net::WebRtcWireStream::Create ( std::shared_ptr< rtc::DataChannel >  data_channel,
std::shared_ptr< rtc::PeerConnection >  connection,
std::shared_ptr< SignallingTransport signalling_endpoint,
ChannelEndpointRole  role,
WireStreamOptions  options = {},
OpenOperation  open_operation = {},
size_t  split_size = 48 * 1024 
)
static

Adopts an already-established data channel as a WireStream.

The low-level factory used once a peer connection and data channel exist; WebRtcWireServer builds accepted streams through it.

Parameters
data_channelThe negotiated libdatachannel data channel.
connectionThe owning peer connection.
signalling_endpointTransport the handshake ran over.
roleWhether this endpoint is the channel opener or acceptor.
optionsTransport-level WireStreamOptions.
open_operationOptional operation to await channel open.
split_sizeSize at which large messages are fragmented.
Returns
The stream, or an error status.

◆ CreateClient() [1/2]

absl::StatusOr< std::shared_ptr< WebRtcWireStream > > a11::net::WebRtcWireStream::CreateClient ( std::string  identity,
std::string  peer_identity,
std::shared_ptr< SignallingService signalling,
WebRtcConfiguration  configuration = {},
WireStreamOptions  options = {} 
)
static

Dials a peer over a shared in-process signalling service.

Parameters
identityLocal identity to register with the service.
peer_identityIdentity of the peer to connect to.
signallingIn-process signalling service both peers share.
configurationICE and fragmentation settings.
optionsTransport-level WireStreamOptions.
Returns
The negotiated stream, or an error status. Drives the ICE/SDP handshake asynchronously before resolving.

◆ CreateClient() [2/2]

absl::StatusOr< std::shared_ptr< WebRtcWireStream > > a11::net::WebRtcWireStream::CreateClient ( std::string  peer_identity,
std::shared_ptr< SignallingTransport signalling,
WebRtcConfiguration  configuration = {},
WireStreamOptions  options = {} 
)
static

Dials a peer over an explicit signalling transport.

Prefer this overload when reaching a peer across a network via a remote signalling server (e.g. a WebSocketSignallingClient) rather than an in-process service.

Parameters
peer_identityIdentity of the peer to connect to.
signallingTransport that carries the SDP/ICE handshake.
configurationICE and fragmentation settings.
optionsTransport-level WireStreamOptions.
Returns
The negotiated stream, or an error status.

◆ data_channel()

std::shared_ptr< rtc::DataChannel > a11::net::WebRtcWireStream::data_channel ( ) const
Returns
The underlying libdatachannel data channel (advanced interop).

◆ peer_connection()

std::shared_ptr< rtc::PeerConnection > a11::net::WebRtcWireStream::peer_connection ( ) const
Returns
The underlying libdatachannel peer connection (advanced interop).

◆ signalling_endpoint()

std::shared_ptr< SignallingTransport > a11::net::WebRtcWireStream::signalling_endpoint ( ) const
Returns
The signalling transport this stream negotiated over.

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