Class IceAgent
A full ICE agent for one component over UDP, IPv4 and IPv6, as WebRTC's bundled, RTCP-multiplexed media needs: gathers candidates, checks pairs with the peer, selects one, and carries datagrams over it.
Namespace: Uniform.Matrix.WebRtc.Ice
Assembly: Uniform.Matrix.WebRtc.dll
public sealed class IceAgent : IAsyncDisposable
Constructors
|
Edit this page
View Source
Open the socket, and start reading it.
Declaration
public IceAgent(IceOptions options)
Parameters
Properties
|
Edit this page
View Source
Whether this agent is the controlling one now; a role conflict may change it.
Declaration
public bool Controlling { get; }
Property Value
|
Edit this page
View Source
The candidates gathered so far.
Declaration
public IReadOnlyList<IceCandidate> LocalCandidates { get; }
Property Value
|
Edit this page
View Source
This agent's password, for the SDP's a=ice-pwd.
Declaration
public string LocalPassword { get; }
Property Value
|
Edit this page
View Source
This agent's username fragment, for the SDP's a=ice-ufrag.
Declaration
public string LocalUfrag { get; }
Property Value
|
Edit this page
View Source
The local candidate of the selected pair, once connected.
Declaration
public IceCandidate? SelectedLocal { get; }
Property Value
|
Edit this page
View Source
The remote candidate of the selected pair, once connected.
Declaration
public IceCandidate? SelectedRemote { get; }
Property Value
|
Edit this page
View Source
Declaration
public IceState State { get; }
Property Value
Methods
|
Edit this page
View Source
Add a candidate of the peer, and pair it with the local bases of its family; ignored when it is not usable, e.g. IPv6 without an IPv6 socket.
Declaration
public void AddRemoteCandidate(IceCandidate candidate)
Parameters
|
Edit this page
View Source
Check pairs until one is selected; return whether one was before timeout.
Declaration
public Task<bool> ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
Stop, release the allocations, and close the socket.
Declaration
public ValueTask DisposeAsync()
Returns
|
Edit this page
View Source
Gather host candidates, then reflexive and relayed ones from the servers; return when all servers answered or timed out.
Declaration
public Task GatherAsync(CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
Send a datagram to the peer over the selected pair.
Declaration
public ValueTask SendAsync(ReadOnlyMemory<byte> datagram, CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
Set the peer's username fragment and password, from its SDP; checks wait for them.
Declaration
public void SetRemoteCredentials(string ufrag, string password)
Parameters
Events
|
Edit this page
View Source
Raised for each local candidate as it is gathered, to trickle it to the peer.
Declaration
public event Action<IceCandidate>? CandidateGathered
Event Type
|
Edit this page
View Source
Raised on the read loop for each datagram from the peer that is not STUN, e.g. DTLS or SRTP.
Declaration
public event Action<byte[]>? DataReceived
Event Type
|
Edit this page
View Source
Raised when State changes.
Declaration
public event Action<IceState>? StateChanged
Event Type
Implements