Struct webrtc_ice::agent::Agent

source ·
pub struct Agent { /* private fields */ }
Expand description

Represents the ICE agent.

Implementations§

source§

impl Agent

source

pub async fn dial( &self, cancel_rx: Receiver<()>, remote_ufrag: String, remote_pwd: String ) -> Result<Arc<impl Conn>, Error>

Connects to the remote agent, acting as the controlling ice agent. The method blocks until at least one ice candidate pair has successfully connected.

The operation will be cancelled if cancel_rx either receives a message or its channel closes.

source

pub async fn accept( &self, cancel_rx: Receiver<()>, remote_ufrag: String, remote_pwd: String ) -> Result<Arc<impl Conn>, Error>

Connects to the remote agent, acting as the controlled ice agent. The method blocks until at least one ice candidate pair has successfully connected.

The operation will be cancelled if cancel_rx either receives a message or its channel closes.

source§

impl Agent

source

pub async fn new(config: AgentConfig) -> Result<Self, Error>

Creates a new Agent.

source

pub fn get_bytes_received(&self) -> usize

source

pub fn get_bytes_sent(&self) -> usize

source

pub fn on_connection_state_change(&self, f: OnConnectionStateChangeHdlrFn)

Sets a handler that is fired when the connection state changes.

source

pub fn on_selected_candidate_pair_change( &self, f: OnSelectedCandidatePairChangeHdlrFn )

Sets a handler that is fired when the final candidate pair is selected.

source

pub fn on_candidate(&self, f: OnCandidateHdlrFn)

Sets a handler that is fired when new candidates gathered. When the gathering process complete the last candidate is nil.

source

pub fn add_remote_candidate( &self, c: &Arc<dyn Candidate + Send + Sync> ) -> Result<(), Error>

Adds a new remote candidate.

source

pub async fn get_local_candidates( &self ) -> Result<Vec<Arc<dyn Candidate + Send + Sync>>, Error>

Returns the local candidates.

source

pub async fn get_local_user_credentials(&self) -> (String, String)

Returns the local user credentials.

source

pub async fn get_remote_user_credentials(&self) -> (String, String)

Returns the remote user credentials.

source

pub async fn close(&self) -> Result<(), Error>

Cleans up the Agent.

source

pub fn get_selected_candidate_pair(&self) -> Option<Arc<CandidatePair>>

Returns the selected pair or nil if there is none

source

pub async fn set_remote_credentials( &self, remote_ufrag: String, remote_pwd: String ) -> Result<(), Error>

Sets the credentials of the remote agent.

source

pub async fn restart(&self, ufrag: String, pwd: String) -> Result<(), Error>

Restarts the ICE Agent with the provided ufrag/pwd If no ufrag/pwd is provided the Agent will generate one itself.

Restart must only be called when GatheringState is GatheringStateComplete a user must then call GatherCandidates explicitly to start generating new ones.

source

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

Initiates the trickle based gathering process.

source

pub async fn get_candidate_pairs_stats(&self) -> Vec<CandidatePairStats>

Returns a list of candidate pair stats.

source

pub async fn get_local_candidates_stats(&self) -> Vec<CandidateStats>

Returns a list of local candidates stats.

source

pub async fn get_remote_candidates_stats(&self) -> Vec<CandidateStats>

Returns a list of remote candidates stats.

Auto Trait Implementations§

§

impl Freeze for Agent

§

impl !RefUnwindSafe for Agent

§

impl Send for Agent

§

impl Sync for Agent

§

impl Unpin for Agent

§

impl !UnwindSafe for Agent

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

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V