Skip to main content

Connection

Struct Connection 

Source
pub struct Connection { /* private fields */ }
Expand description

Per-peer state machine for one FCP connection attempt.

Implementations§

Source§

impl Connection

Source

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.

Source

pub const fn federation(&self) -> FederationId

Returns the federation namespace pinned for this attempt.

Source

pub const fn attempt(&self) -> AttemptId

Returns the application-provided attempt identifier pinned for this connection.

Source

pub const fn local_endpoint(&self) -> EndpointIdentity

Returns the complete local FCP endpoint identity pinned for this connection.

Source

pub const fn remote_endpoint(&self) -> EndpointIdentity

Returns the complete remote FCP endpoint identity pinned for this connection.

Source

pub const fn phase(&self) -> Phase

Returns the current lifecycle state.

Source

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.

Source

pub fn answer<S: EndpointSigner>( &mut self, signer: &S, binding: WebRtcBinding, description: Vec<u8>, ) -> Result<Action, Error>

Answers one accepted remote offer.

Source

pub fn candidate<S: EndpointSigner>( &self, signer: &S, sequence: u32, candidate: Vec<u8>, ) -> Result<Action, Error>

Creates a candidate bound to the active negotiation.

Source

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.

Source

pub fn close<S: EndpointSigner>( &mut self, signer: &S, reason: CloseCode, ) -> Result<Action, Error>

Emits a local close and closes the core attempt.

Source

pub fn receive(&mut self, envelope: Envelope) -> Result<Vec<Action>, Error>

Processes a received envelope only after exact binding and signature validation.

Source

pub fn transport_connected(&mut self) -> Result<Vec<Action>, Error>

Records that the platform adapter reached a connected WebRTC control channel.

Source

pub fn transport_failed(&mut self) -> Result<(), Error>

Records a local platform failure and stops this attempt without manufacturing a remote close.

Trait Implementations§

Source§

impl Debug for Connection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.