Beispiel #1
0
        public STUNMessage(byte[] bytes)
        {
            int sizeToSkip = 0;
            STUNMessageHeader header = new STUNMessageHeader(bytes);
            this.MessageHeader = header;

            sizeToSkip = this.MessageHeader.SizeInBytes;
            if (header.Length > 0)
            {
                while(sizeToSkip < bytes.Length)
                {
                    STUNAttributeTLV attribute = new STUNAttributeTLV(bytes.Skip(sizeToSkip).ToArray());
                    AddAttribute(attribute);
                    sizeToSkip += attribute.SizeInBytes;
                }                
            }
        }
Beispiel #2
0
        public void AddAttribute(STUNAttributeTLV attribute)
        {
            Attributes.Add(attribute);
            MessageHeader.Length += attribute.Length;

        }