pub struct Connection { /* private fields */ }Expand description
Per-peer state machine for one FCP connection attempt.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new(
federation: FederationId,
attempt: AttemptId,
local: EndpointIdentity,
remote: EndpointIdentity,
) -> Result<Self, Error>
pub fn new( federation: FederationId, attempt: AttemptId, local: EndpointIdentity, remote: EndpointIdentity, ) -> Result<Self, Error>
Creates an idle connection pinned to one federation, attempt and complete remote identity.
Sourcepub const fn federation(&self) -> FederationId
pub const fn federation(&self) -> FederationId
Returns the federation namespace pinned for this attempt.
Sourcepub const fn attempt(&self) -> AttemptId
pub const fn attempt(&self) -> AttemptId
Returns the application-provided attempt identifier pinned for this connection.
Sourcepub const fn local_endpoint(&self) -> EndpointIdentity
pub const fn local_endpoint(&self) -> EndpointIdentity
Returns the complete local FCP endpoint identity pinned for this connection.
Sourcepub const fn remote_endpoint(&self) -> EndpointIdentity
pub const fn remote_endpoint(&self) -> EndpointIdentity
Returns the complete remote FCP endpoint identity pinned for this connection.
Sourcepub fn begin_offer<S: EndpointSigner>(
&mut self,
signer: &S,
binding: WebRtcBinding,
description: Vec<u8>,
) -> Result<Vec<Action>, Error>
pub fn begin_offer<S: EndpointSigner>( &mut self, signer: &S, binding: WebRtcBinding, description: Vec<u8>, ) -> Result<Vec<Action>, Error>
Starts a local offer from Idle.
Sourcepub fn answer<S: EndpointSigner>(
&mut self,
signer: &S,
binding: WebRtcBinding,
description: Vec<u8>,
) -> Result<Action, Error>
pub fn answer<S: EndpointSigner>( &mut self, signer: &S, binding: WebRtcBinding, description: Vec<u8>, ) -> Result<Action, Error>
Answers one accepted remote offer.
Sourcepub fn candidate<S: EndpointSigner>(
&self,
signer: &S,
sequence: u32,
candidate: Vec<u8>,
) -> Result<Action, Error>
pub fn candidate<S: EndpointSigner>( &self, signer: &S, sequence: u32, candidate: Vec<u8>, ) -> Result<Action, Error>
Creates a candidate bound to the active negotiation.
Sourcepub fn cfr_control<S: EndpointSigner>(
&self,
signer: &S,
payload: Vec<u8>,
) -> Result<Action, Error>
pub fn cfr_control<S: EndpointSigner>( &self, signer: &S, payload: Vec<u8>, ) -> Result<Action, Error>
Emits one bounded raw CFR control envelope after WebRTC connection is established.
Sourcepub fn close<S: EndpointSigner>(
&mut self,
signer: &S,
reason: CloseCode,
) -> Result<Action, Error>
pub fn close<S: EndpointSigner>( &mut self, signer: &S, reason: CloseCode, ) -> Result<Action, Error>
Emits a local close and closes the core attempt.
Sourcepub fn receive(&mut self, envelope: Envelope) -> Result<Vec<Action>, Error>
pub fn receive(&mut self, envelope: Envelope) -> Result<Vec<Action>, Error>
Processes a received envelope only after exact binding and signature validation.
Sourcepub fn transport_connected(&mut self) -> Result<Vec<Action>, Error>
pub fn transport_connected(&mut self) -> Result<Vec<Action>, Error>
Records that the platform adapter reached a connected WebRTC control channel.
Sourcepub fn transport_failed(&mut self) -> Result<(), Error>
pub fn transport_failed(&mut self) -> Result<(), Error>
Records a local platform failure and stops this attempt without manufacturing a remote close.