/// <summary> /// Convenience constructor for cases when the application wants /// to create an ICE candidate, /// </summary> public RTCIceCandidate( RTCIceProtocol cProtocol, IPAddress cAddress, ushort cPort, RTCIceCandidateType cType) { SetAddressProperties(cProtocol, cAddress, cPort, cType, null, 0); }
/// <summary> /// Checks the candidate to identify whether it is equivalent to the specified /// protocol and IP end point. Primary use case is to check whether a candidate /// is a match for a remote end point that a message has been received from. /// </summary> /// <param name="epProtocol">The protocol to check equivalence for.</param> /// <param name="ep">The IP end point to check equivalence for.</param> /// <returns>True if the candidate is deemed equivalent or false if not.</returns> public bool IsEquivalentEndPoint(RTCIceProtocol epPotocol, IPEndPoint ep) { if (protocol == epPotocol && DestinationEndPoint != null && ep.Address.Equals(DestinationEndPoint.Address) && DestinationEndPoint.Port == ep.Port) { return(true); } else { return(false); } }
/// <summary> /// Checks the candidate to identify whether it is equivalent to the specified /// protocol and IP end point. Primary use case is to check whether a candidate /// is a match for a remote end point that a message has been received from. /// </summary> /// <param name="epProtocol">The protocol to check equivalence for.</param> /// <param name="ep">The IP end point to check equivalence for.</param> /// <returns>True if the candidate is deemed equivalent or false if not.</returns> public bool IsEquivalentEndPoint(RTCIceProtocol epPotocol, IPEndPoint ep) { if (protocol == epPotocol && ( (!string.IsNullOrEmpty(address) && ep.Address.Equals(IPAddress.Parse(address)) && port == ep.Port) || (!string.IsNullOrEmpty(relatedAddress) && ep.Address.Equals(IPAddress.Parse(relatedAddress)) && relatedPort == ep.Port) )) { return(true); } else { return(false); } }
public void SetAddressProperties( RTCIceProtocol cProtocol, IPAddress cAddress, ushort cPort, RTCIceCandidateType cType, IPAddress cRelatedAddress, ushort cRelatedPort) { protocol = cProtocol; address = cAddress.ToString(); port = cPort; type = cType; relatedAddress = cRelatedAddress?.ToString(); relatedPort = cRelatedPort; foundation = GetFoundation(); priority = GetPriority(); }
public static CandidateTransport ToSdp(this RTCIceProtocol protocol) => protocol switch {