示例#1
0
        /// <summary>
        /// Add a new candidate to the list
        /// </summary>
        /// <param name="localPriority"></param>
        /// <param name="component"></param>
        /// <param name="foundation"></param>
        /// <param name="generation"></param>
        /// <param name="id"></param>
        /// <param name="ip"></param>
        /// <param name="network"></param>
        /// <param name="port"></param>
        /// <param name="protocol"></param>
        /// <param name="type"></param>
        /// <param name="relatedAddress"></param>
        /// <param name="relatedPort"></param>
        /// <returns></returns>
        public JingleIceCandidate AddCandidate(UInt16 localPriority, Byte component, Byte foundation, Byte generation, String id, Byte network, IPAddress ip, UInt16 port, IceProtocolType protocol, IceCandidateType type, IPAddress relatedAddress, UInt16 relatedPort)
        {
            Debug.Assert(component > 0);
            Debug.Assert(foundation > 0);
            Debug.Assert(!String.IsNullOrEmpty(id));
            Debug.Assert(!String.IsNullOrEmpty(ip.ToString()));
            Debug.Assert(network > 0);
            Debug.Assert(port > 1024);
            Debug.Assert(protocol != IceProtocolType.UNSPECIFIED);
            Debug.Assert(type != IceCandidateType.UNSPECIFIED);

            JingleIceCandidate cndt = CreateChildElement<JingleIceCandidate>();
            cndt.Component = component;
            cndt.Foundation = foundation;
            cndt.Generation = generation;
            cndt.ID = id;
            cndt.IP = ip;
            cndt.Network = network;
            cndt.Port = port;
            cndt.Protocol = protocol;

            Double priority = Math.Pow(2, 24) * (Int32)type +
                              Math.Pow(2, 8) * localPriority +
                              Math.Pow(2, 0) * (256 - component);

            cndt.Priority = (UInt32)priority;

            if (relatedAddress != null)
                cndt.RelatedAddress = relatedAddress;

            if (relatedPort != 0)
                cndt.RelatedPort = relatedPort;

            cndt.Type = type;

            return cndt;
        }
示例#2
0
        /// <summary>
        /// Add a new candidate to the list
        /// </summary>
        /// <param name="localPriority"></param>
        /// <param name="component"></param>
        /// <param name="foundation"></param>
        /// <param name="generation"></param>
        /// <param name="id"></param>
        /// <param name="ip"></param>
        /// <param name="network"></param>
        /// <param name="port"></param>
        /// <param name="protocol"></param>
        /// <param name="type"></param>
        /// <param name="relatedAddress"></param>
        /// <param name="relatedPort"></param>
        /// <returns></returns>
        public JingleIceCandidate AddCandidate(UInt16 localPriority, Byte component, Byte foundation, Byte generation, String id, Byte network, IPAddress ip, UInt16 port, IceProtocolType protocol, IceCandidateType type, IPAddress relatedAddress, UInt16 relatedPort)
        {
            Debug.Assert(component > 0);
            Debug.Assert(foundation > 0);
            Debug.Assert(!String.IsNullOrEmpty(id));
            Debug.Assert(!String.IsNullOrEmpty(ip.ToString()));
            Debug.Assert(network > 0);
            Debug.Assert(port > 1024);
            Debug.Assert(protocol != IceProtocolType.UNSPECIFIED);
            Debug.Assert(type != IceCandidateType.UNSPECIFIED);

            JingleIceCandidate cndt = CreateChildElement <JingleIceCandidate>();

            cndt.Component  = component;
            cndt.Foundation = foundation;
            cndt.Generation = generation;
            cndt.ID         = id;
            cndt.IP         = ip;
            cndt.Network    = network;
            cndt.Port       = port;
            cndt.Protocol   = protocol;

            Double priority = Math.Pow(2, 24) * (Int32)type +
                              Math.Pow(2, 8) * localPriority +
                              Math.Pow(2, 0) * (256 - component);

            cndt.Priority = (UInt32)priority;

            if (relatedAddress != null)
            {
                cndt.RelatedAddress = relatedAddress;
            }

            if (relatedPort != 0)
            {
                cndt.RelatedPort = relatedPort;
            }

            cndt.Type = type;

            return(cndt);
        }
示例#3
0
 /// <summary>
 /// Add a new candidate to the list
 /// </summary>
 /// <param name="localPriority"></param>
 /// <param name="component"></param>
 /// <param name="foundation"></param>
 /// <param name="generation"></param>
 /// <param name="id"></param>
 /// <param name="ip"></param>
 /// <param name="network"></param>
 /// <param name="port"></param>
 /// <param name="protocol"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public JingleIceCandidate AddCandidate(UInt16 localPriority, Byte component, Byte foundation, Byte generation, String id, Byte network, IPAddress ip, UInt16 port, IceProtocolType protocol, IceCandidateType type)
 {
     return AddCandidate(localPriority, component, foundation, generation, id, network, ip, port, protocol, type, null, 0);
 }
示例#4
0
 /// <summary>
 /// Add a new candidate to the list
 /// </summary>
 /// <param name="localPriority"></param>
 /// <param name="component"></param>
 /// <param name="foundation"></param>
 /// <param name="generation"></param>
 /// <param name="id"></param>
 /// <param name="ip"></param>
 /// <param name="network"></param>
 /// <param name="port"></param>
 /// <param name="protocol"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public JingleIceCandidate AddCandidate(UInt16 localPriority, Byte component, Byte foundation, Byte generation, String id, Byte network, IPAddress ip, UInt16 port, IceProtocolType protocol, IceCandidateType type)
 {
     return(AddCandidate(localPriority, component, foundation, generation, id, network, ip, port, protocol, type, null, 0));
 }