internal override DnsResourceData CreateInstance(DnsDatagram dns, int offsetInDns, int length) { DnsDomainName nextDomainName; int nextDomainNameLength; if (!DnsDomainName.TryParse(dns, offsetInDns, length, out nextDomainName, out nextDomainNameLength)) { return(null); } offsetInDns += nextDomainNameLength; length -= nextDomainNameLength; DnsTypeBitmaps typeBitmaps = DnsTypeBitmaps.CreateInstance(dns.Buffer, dns.StartOffset + offsetInDns, length); if (typeBitmaps == null) { return(null); } return(new DnsResourceDataNextDomainSecure(nextDomainName, typeBitmaps)); }
internal override DnsResourceData CreateInstance(DataSegment data) { DnsSecNSec3HashAlgorithm hashAlgorithm; DnsSecNSec3Flags flags; ushort iterations; DataSegment salt; if (!TryReadParameters(data, out hashAlgorithm, out flags, out iterations, out salt)) { return(null); } int nextHashedOwnerNameLengthOffset = GetParametersLength(salt.Length); if (data.Length - nextHashedOwnerNameLengthOffset < sizeof(byte)) { return(null); } int nextHashedOwnerNameOffset = nextHashedOwnerNameLengthOffset + sizeof(byte); int nextHashedOwnerNameLength = data[nextHashedOwnerNameLengthOffset]; if (data.Length - nextHashedOwnerNameOffset < nextHashedOwnerNameLength) { return(null); } DataSegment nextHashedOwnerName = data.Subsegment(nextHashedOwnerNameOffset, nextHashedOwnerNameLength); int typeBitmapsOffset = nextHashedOwnerNameOffset + nextHashedOwnerNameLength; DnsTypeBitmaps typeBitmaps = DnsTypeBitmaps.CreateInstance(data.Buffer, data.StartOffset + typeBitmapsOffset, data.Length - typeBitmapsOffset); if (typeBitmaps == null) { return(null); } return(new DnsResourceDataNextDomainSecure3(hashAlgorithm, flags, iterations, salt, nextHashedOwnerName, typeBitmaps)); }