void BuildAttribute(ushort nType, byte[] bAttribute, bool bDwordAlign, STUNMessage parentmessage) { if (nType == (ushort)StunAttributeType.MappedAddress) { m_objParsedAttribute = new MappedAddressAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.AlternateServer) { m_objParsedAttribute = new AlternateServerAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.ErrorCode) { m_objParsedAttribute = new ErrorCodeAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.MessageIntegrity) { m_objParsedAttribute = new MessageIntegrityAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.Fingerprint) { m_objParsedAttribute = new FingerPrintAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.Nonce) { m_objParsedAttribute = new NonceAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.Realm) { m_objParsedAttribute = new RealmAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.Software) { m_objParsedAttribute = new SoftwareAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.UserName) { m_objParsedAttribute = new UserNameAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.Password) { m_objParsedAttribute = new PasswordAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.XorMappedAddress) { m_objParsedAttribute = new XORMappedAddressAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.LegacySourceAddress) { m_objParsedAttribute = new LegacySourceAddressAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.LegacyResponseAddress) { m_objParsedAttribute = new LegacyResponseAddressAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.LegacyChangeAddress) { m_objParsedAttribute = new LegacyChangeAddressAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.LegacyChangedAddress) { m_objParsedAttribute = new LegacyChangedAddressAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.Priority) { m_objParsedAttribute = new PriorityAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.UseCandidate) { m_objParsedAttribute = new UseCandidateAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.IceControlled) { m_objParsedAttribute = new IceControlledAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else if (nType == (ushort)StunAttributeType.IceControlling) { m_objParsedAttribute = new IceControllingAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } else { m_objParsedAttribute = new STUNAttribute(); m_objParsedAttribute.SetBytes(bAttribute, parentmessage); } }
public STUNAttributeContainer(STUNAttribute attr) { SetAttribute(attr); }
void SetAttribute(STUNAttribute attr) { StunAttributeType = attr.Type; m_objParsedAttribute = attr; }
public void AddAttribute(STUNAttribute attr) { STUNAttributeContainer cont = new STUNAttributeContainer(attr); Attributes.Add(cont); }