pub struct IceAgent { /* private fields */ }Expand description
The ICE agent state machine
Implementations§
Source§impl IceAgent
impl IceAgent
pub fn new_from_answer( local_credentials: IceCredentials, remote_credentials: IceCredentials, is_controlling: bool, rtcp_mux: bool, ) -> Self
pub fn new_for_offer( local_credentials: IceCredentials, is_controlling: bool, rtcp_mux: bool, ) -> Self
Sourcepub fn set_remote_data(
&mut self,
credentials: IceCredentials,
candidates: &[IceCandidate],
rtcp_mux: bool,
)
pub fn set_remote_data( &mut self, credentials: IceCredentials, candidates: &[IceCandidate], rtcp_mux: bool, )
Set all the remote information in one step. This function is usually set once after receiving a SDP answer.
Sourcepub fn credentials(&self) -> &IceCredentials
pub fn credentials(&self) -> &IceCredentials
Return the ice-agent’s ice credentials
Sourcepub fn add_host_addr(&mut self, component: Component, addr: SocketAddr)
pub fn add_host_addr(&mut self, component: Component, addr: SocketAddr)
Register a host address for a given ICE component. This will be used to create a host candidate. For the ICE agent to work properly, all available ip addresses of the host system should be provided.
Sourcepub fn add_stun_server(&mut self, server: SocketAddr)
pub fn add_stun_server(&mut self, server: SocketAddr)
Add a STUN server which the ICE agent should use to gather additional (server-reflexive) candidates.
Sourcepub fn gathering_state(&self) -> IceGatheringState
pub fn gathering_state(&self) -> IceGatheringState
Returns the current ICE candidate gathering state
Sourcepub fn connection_state(&self) -> IceConnectionState
pub fn connection_state(&self) -> IceConnectionState
Returns the current ICE connection state
Sourcepub fn discovered_addr(
&self,
component: Component,
) -> Option<(SocketAddr, SocketAddr)>
pub fn discovered_addr( &self, component: Component, ) -> Option<(SocketAddr, SocketAddr)>
Returns the discovered local & remote address for the given component
Sourcepub fn add_remote_candidate(&mut self, candidate: &IceCandidate)
pub fn add_remote_candidate(&mut self, candidate: &IceCandidate)
Add a peer’s ice-candidate which has been received using an extern signaling protocol
Sourcepub fn receive(&mut self, now: Instant, pkt: ReceivedPkt)
pub fn receive(&mut self, now: Instant, pkt: ReceivedPkt)
Receive network packets for this ICE agent
Sourcepub fn poll(&mut self, now: Instant)
pub fn poll(&mut self, now: Instant)
Drive the ICE agent forward. This must be called after the duration returned by timeout.
Sourcepub fn pop_event(&mut self) -> Option<IceEvent>
pub fn pop_event(&mut self) -> Option<IceEvent>
Returns the next event to process
This must be called until it returns None
Sourcepub fn timeout(&self, now: Instant) -> Option<Duration>
pub fn timeout(&self, now: Instant) -> Option<Duration>
Returns a duration after which to call poll
Sourcepub fn ice_candidates(&self) -> Vec<IceCandidate>
pub fn ice_candidates(&self) -> Vec<IceCandidate>
Returns all discovered local ice agents, does not include peer-reflexive candidates