SIPSorcery.Net.STUNv2XORAddressAttribute.STUNv2XORAddressAttribute C# (CSharp) Méthode

STUNv2XORAddressAttribute() public méthode

public STUNv2XORAddressAttribute ( STUNv2AttributeTypesEnum attributeType, byte attributeValue ) : System
attributeType STUNv2AttributeTypesEnum
attributeValue byte
Résultat System
        public STUNv2XORAddressAttribute(STUNv2AttributeTypesEnum attributeType, byte[] attributeValue)
            : base(attributeType, attributeValue)
        {
            if (BitConverter.IsLittleEndian)
            {
                Port = Utility.ReverseEndian(BitConverter.ToUInt16(attributeValue, 2)) ^ (UInt16)(STUNv2Header.MAGIC_COOKIE >> 16);
                UInt32 address = Utility.ReverseEndian(BitConverter.ToUInt32(attributeValue, 4)) ^ STUNv2Header.MAGIC_COOKIE;
                Address = new IPAddress(Utility.ReverseEndian(address));
            }
            else
            {
                Port = BitConverter.ToUInt16(attributeValue, 2) ^ (UInt16)(STUNv2Header.MAGIC_COOKIE >> 16);
                UInt32 address = BitConverter.ToUInt32(attributeValue, 4) ^ STUNv2Header.MAGIC_COOKIE;
                Address = new IPAddress(address);
            }
        }

Same methods

STUNv2XORAddressAttribute::STUNv2XORAddressAttribute ( STUNv2AttributeTypesEnum attributeType, int port, IPAddress address ) : System