internal static DnsOptions Read(DataSegment data) { List <DnsOption> list = new List <DnsOption>(); int offset; for (; data.Length != 0; data = data.Subsegment(offset, data.Length - offset)) { if (data.Length < 4) { return((DnsOptions)null); } DnsOptionCode code = (DnsOptionCode)data.ReadUShort(0, Endianity.Big); ushort num = data.ReadUShort(2, Endianity.Big); offset = 4 + (int)num; if (data.Length < offset) { return((DnsOptions)null); } DnsOption instance = DnsOption.CreateInstance(code, data.Subsegment(4, (int)num)); if (instance == null) { return((DnsOptions)null); } list.Add(instance); } return(new DnsOptions((IList <DnsOption>)list)); }
internal static DnsOptions Read(DataSegment data) { List <DnsOption> options = new List <DnsOption>(); while (data.Length != 0) { if (data.Length < DnsOption.MinimumLength) { return(null); } DnsOptionCode code = (DnsOptionCode)data.ReadUShort(0, Endianity.Big); ushort optionDataLength = data.ReadUShort(sizeof(ushort), Endianity.Big); int optionLength = DnsOption.MinimumLength + optionDataLength; if (data.Length < optionLength) { return(null); } DnsOption option = DnsOption.CreateInstance(code, data.Subsegment(DnsOption.MinimumLength, optionDataLength)); if (option == null) { return(null); } options.Add(option); data = data.Subsegment(optionLength, data.Length - optionLength); } return(new DnsOptions(options)); }
internal override bool EqualsData(DnsOption other) { DnsOptionLongLivedQuery castedOther = (DnsOptionLongLivedQuery)other; return(Version.Equals(castedOther.Version) && OpCode.Equals(castedOther.OpCode) && ErrorCode.Equals(castedOther.ErrorCode) && Id.Equals(castedOther.Id) && LeaseLife.Equals(castedOther.LeaseLife)); }
internal override bool EqualsData(DnsOption other) { DnsOptionLongLivedQuery optionLongLivedQuery = (DnsOptionLongLivedQuery)other; if (this.Version.Equals(optionLongLivedQuery.Version) && this.OpCode.Equals((object)optionLongLivedQuery.OpCode) && this.ErrorCode.Equals((object)optionLongLivedQuery.ErrorCode) && this.Id.Equals(optionLongLivedQuery.Id)) { return(this.LeaseLife.Equals(optionLongLivedQuery.LeaseLife)); } return(false); }
internal override bool EqualsData(DnsOption other) { return(Data.Equals(((DnsOptionAnything)other).Data)); }
internal override bool EqualsData(DnsOption other) { return(this.Lease.Equals(((DnsOptionUpdateLease)other).Lease)); }
internal override bool EqualsData(DnsOption other) { return(EqualsData(other as DnsOptionClientSubnet)); }