Struct webrtc_ice::agent::Agent
source · pub struct Agent { /* private fields */ }
Expand description
Represents the ICE agent.
Implementations§
source§impl Agent
impl Agent
sourcepub async fn dial(
&self,
cancel_rx: Receiver<()>,
remote_ufrag: String,
remote_pwd: String
) -> Result<Arc<impl Conn>, Error>
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.
sourcepub async fn accept(
&self,
cancel_rx: Receiver<()>,
remote_ufrag: String,
remote_pwd: String
) -> Result<Arc<impl Conn>, Error>
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
impl Agent
sourcepub async fn new(config: AgentConfig) -> Result<Self, Error>
pub async fn new(config: AgentConfig) -> Result<Self, Error>
Creates a new Agent.
pub fn get_bytes_received(&self) -> usize
pub fn get_bytes_sent(&self) -> usize
sourcepub fn on_connection_state_change(&self, f: OnConnectionStateChangeHdlrFn)
pub fn on_connection_state_change(&self, f: OnConnectionStateChangeHdlrFn)
Sets a handler that is fired when the connection state changes.
sourcepub fn on_selected_candidate_pair_change(
&self,
f: OnSelectedCandidatePairChangeHdlrFn
)
pub fn on_selected_candidate_pair_change( &self, f: OnSelectedCandidatePairChangeHdlrFn )
Sets a handler that is fired when the final candidate pair is selected.
sourcepub fn on_candidate(&self, f: OnCandidateHdlrFn)
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.
sourcepub fn add_remote_candidate(
&self,
c: &Arc<dyn Candidate + Send + Sync>
) -> Result<(), Error>
pub fn add_remote_candidate( &self, c: &Arc<dyn Candidate + Send + Sync> ) -> Result<(), Error>
Adds a new remote candidate.
sourcepub async fn get_local_candidates(
&self
) -> Result<Vec<Arc<dyn Candidate + Send + Sync>>, Error>
pub async fn get_local_candidates( &self ) -> Result<Vec<Arc<dyn Candidate + Send + Sync>>, Error>
Returns the local candidates.
sourcepub async fn get_local_user_credentials(&self) -> (String, String)
pub async fn get_local_user_credentials(&self) -> (String, String)
Returns the local user credentials.
sourcepub async fn get_remote_user_credentials(&self) -> (String, String)
pub async fn get_remote_user_credentials(&self) -> (String, String)
Returns the remote user credentials.
sourcepub fn get_selected_candidate_pair(&self) -> Option<Arc<CandidatePair>>
pub fn get_selected_candidate_pair(&self) -> Option<Arc<CandidatePair>>
Returns the selected pair or nil if there is none
sourcepub async fn set_remote_credentials(
&self,
remote_ufrag: String,
remote_pwd: String
) -> Result<(), Error>
pub async fn set_remote_credentials( &self, remote_ufrag: String, remote_pwd: String ) -> Result<(), Error>
Sets the credentials of the remote agent.
sourcepub async fn restart(&self, ufrag: String, pwd: String) -> Result<(), Error>
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.
sourcepub fn gather_candidates(&self) -> Result<(), Error>
pub fn gather_candidates(&self) -> Result<(), Error>
Initiates the trickle based gathering process.
sourcepub async fn get_candidate_pairs_stats(&self) -> Vec<CandidatePairStats>
pub async fn get_candidate_pairs_stats(&self) -> Vec<CandidatePairStats>
Returns a list of candidate pair stats.
sourcepub async fn get_local_candidates_stats(&self) -> Vec<CandidateStats>
pub async fn get_local_candidates_stats(&self) -> Vec<CandidateStats>
Returns a list of local candidates stats.
sourcepub async fn get_remote_candidates_stats(&self) -> Vec<CandidateStats>
pub async fn get_remote_candidates_stats(&self) -> Vec<CandidateStats>
Returns a list of remote candidates stats.