Public Member Functions | |
Candidate (CandidateType candidateType, Candidate baseCandidate, IPEndPoint transportEndPoint, IPEndPoint relatedEndPoint=null, byte[] foundation=null) | |
Candidate (CandidateType candidateType, Stun.Controller stunController, IPEndPoint transportEndPoint, IPEndPoint relatedEndPoint=null, byte[] foundation=null) | |
Candidate (byte[] bytes, ref int i) | |
Construct a candidate from a sip message More... | |
void | Serialize (BufferView buffer) |
Serialize a candidate to a buffer More... | |
IPEndPoint | GetTransportEndPoint (AddressFamily family, bool allowNonMatching=false) |
Get the end point with the specified address family More... | |
void | AddRemoteCredentials (Candidate remoteCandidate, Credentials cred) |
Add credentials to communicate with a remote candidate More... | |
bool | HasEndPoint (IPEndPoint endPoint) |
Check if the candidate has the provided end point More... | |
string | ToString (bool includePriority) |
A human readable representation of a candidate, with the option to include priority More... | |
override string | ToString () |
A human readable representation of a candidate More... | |
Static Public Member Functions | |
static Candidate | CreateHostCandidate (Stun.Controller stunController) |
static Candidate | CreateRelayedCandidate (Stun.Controller stunController, IPEndPoint transportEndPoint, IPEndPoint relatedEndPoint) |
static Candidate | CreateServerReflexiveCandidate (Candidate baseCandidate, IPEndPoint transportEndPoint) |
static Candidate | CreatePeerReflexiveCandidateFromResponse (Candidate baseCandidate, IPEndPoint transportEndPoint, uint priority) |
static Candidate | CreatePeerReflexiveCandidateFromRequest (Stun.Controller stunController, IPEndPoint transportEndPoint, uint priority) |
static uint | CalculatePriority (CandidateType candidateType, ushort localPreference) |
Calculate candidate priority based on candidate type and local preference More... | |
static bool | IsValidCandidateBytes (byte[] bytes, int i) |
Determine if some bytes look like a valid candidate More... | |
Public Attributes | |
CandidateType | candidateType |
Candidate | baseCandidate |
IPEndPoint | transportEndPoint = null |
The primary endpoint that peers will try and connect to. More... | |
IPEndPoint | transportEndPointDualStack = null |
A secondary endpoint that peers may try and connect to. More... | |
IPEndPoint | relatedEndPoint |
The related address. See RFC 5245 Section 15.1 More... | |
readonly ReadOnlyByteArray | foundation |
A hash of base address, candidate type, and stun server endpoint. If two candidates have the same foundation they are a good match More... | |
uint | priority |
Higher priority candidates are more likely to be used More... | |
byte | localPreference |
Preference based on the format of the local address. More... | |
bool | isDefault |
Static Public Attributes | |
const ushort | MIN_SDP_BYTES = 24 |
The minimum number of bytes that can be required to encode a Candidate in an sdp message More... | |
const ushort | MAX_SDP_BYTES = 50 |
The maximum number of bytes that can be required to encode a Candidate in an sdp message More... | |
static readonly Dictionary< CandidateType, byte > | CandidateTypePreferences |
Determines the priority of each candidate type. More direct connections are preferred. Relay is not preferred. More... | |
Properties | |
bool | IsDualStack [get] |
Dual stack candidates have a second endpoint, transportEndPointDualStack. More... | |
IPAddress? | TransportAddress [get] |
ushort? | TransportPort [get] |
IPAddress? | TransportAddressDualStack [get] |
ushort? | TransportPortDualStack [get] |
Stun.Controller | stunController [get] |
NobleConnect.Ice.Candidate.Candidate | ( | CandidateType | candidateType, |
Candidate | baseCandidate, | ||
IPEndPoint | transportEndPoint, | ||
IPEndPoint | relatedEndPoint = null , |
||
byte[] | foundation = null |
||
) |
NobleConnect.Ice.Candidate.Candidate | ( | CandidateType | candidateType, |
Stun.Controller | stunController, | ||
IPEndPoint | transportEndPoint, | ||
IPEndPoint | relatedEndPoint = null , |
||
byte[] | foundation = null |
||
) |
NobleConnect.Ice.Candidate.Candidate | ( | byte[] | bytes, |
ref int | i | ||
) |
Construct a candidate from a sip message
void NobleConnect.Ice.Candidate.AddRemoteCredentials | ( | Candidate | remoteCandidate, |
Credentials | cred | ||
) |
Add credentials to communicate with a remote candidate
Adds credentials for both transport end point and dual stack end point for both candidates
remoteCandidate | |
cred |
|
static |
Calculate candidate priority based on candidate type and local preference
candidateType | |
localPreference |
|
static |
|
static |
|
static |
|
static |
|
static |
IPEndPoint NobleConnect.Ice.Candidate.GetTransportEndPoint | ( | AddressFamily | family, |
bool | allowNonMatching = false |
||
) |
Get the end point with the specified address family
For dual stack support candidates can have multiple end points. This method can be used to get the end point of a specific family. Throws an exception if neither address matches.
family |
bool NobleConnect.Ice.Candidate.HasEndPoint | ( | IPEndPoint | endPoint | ) |
Check if the candidate has the provided end point
Returns true if either the transportEndPoint or transportEndPointDualStack match the provided endpoint.
endPoint |
|
static |
Determine if some bytes look like a valid candidate
Looks at local preference, encoded byte, and candidate type to check for valid values
bytes | |
i |
void NobleConnect.Ice.Candidate.Serialize | ( | BufferView | buffer | ) |
Serialize a candidate to a buffer
Serialized foundation, encoded byte, transport end point, and dual stack transport end point. The encoded byte contains the transport address family, the dual stack flag, and the candidate type.
buffer |
override string NobleConnect.Ice.Candidate.ToString | ( | ) |
A human readable representation of a candidate
Format is: candidateType transportEndPoint [transportEndPointDualStack] base: baseCandidate.transportEndPoint related: relatedEndPoint [DEFAULT]
string NobleConnect.Ice.Candidate.ToString | ( | bool | includePriority | ) |
A human readable representation of a candidate, with the option to include priority
Format is: candidateType transportEndPoint [transportEndPointDualStack] base: baseCandidate.transportEndPoint related: relatedEndPoint [DEFAULT] priority
Candidate NobleConnect.Ice.Candidate.baseCandidate |
CandidateType NobleConnect.Ice.Candidate.candidateType |
|
static |
Determines the priority of each candidate type. More direct connections are preferred. Relay is not preferred.
readonly ReadOnlyByteArray NobleConnect.Ice.Candidate.foundation |
A hash of base address, candidate type, and stun server endpoint. If two candidates have the same foundation they are a good match
bool NobleConnect.Ice.Candidate.isDefault |
byte NobleConnect.Ice.Candidate.localPreference |
Preference based on the format of the local address.
IPv6 is favored over IPv4 unless it's some weird set of IPv6 like toredo.
|
static |
The maximum number of bytes that can be required to encode a Candidate in an sdp message
|
static |
The minimum number of bytes that can be required to encode a Candidate in an sdp message
uint NobleConnect.Ice.Candidate.priority |
Higher priority candidates are more likely to be used
This is calculated from local preference and candidate type.
IPEndPoint NobleConnect.Ice.Candidate.relatedEndPoint |
The related address. See RFC 5245 Section 15.1
This is only used for diagnostic purposes. For Host candidates this will be unset. For reflexive candidates this will be the host address. For relay candidates this will be the reflexive address that is received with the allocate response.
IPEndPoint NobleConnect.Ice.Candidate.transportEndPoint = null |
The primary endpoint that peers will try and connect to.
Local candidates get their endpoints from probing the OS and opening sockets (for host candidates) or from the allocation response in OnAllocateSuccess (for server reflexive and relay candidates). Remote candidates get their endpoints from the sip invite or response.
IPEndPoint NobleConnect.Ice.Candidate.transportEndPointDualStack = null |
A secondary endpoint that peers may try and connect to.
Dual stack relays have two endpoints, one for ipv4 and one for ipv6. Both ipv4 and ipv6 local candidates can be paired with dual stack remote candidates and vice versa. The same credentials are used to communicate with either end point. When sending bind requests or other messages to a remote candidate, we send to whichever endpoint matches the address family of the sending socket. When a messages is received from either end point it will be recognized as coming from the same remote candidate.
Local candidates get their endpoints from probing the OS and opening sockets(for host candidates) or from the allocation response in OnAllocateSuccess(for server reflexive and relay candidates). Remote candidates get their endpoints from the sip invite or response.
|
get |
Dual stack candidates have a second endpoint, transportEndPointDualStack.
If the transportEndPoint is IPv4 the transportEndPointDualStack will be IPv6 and vice-versa Either end point can be used to communicate with this candidate.
|
get |
|
get |
|
get |
|
get |
|
get |