internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData)
        {
            int numBytesWritten = NextDomainName.Write(buffer, dnsOffset, compressionData, offsetInDns);

            TypeBitmap.Write(buffer, dnsOffset + offsetInDns + numBytesWritten);

            return(numBytesWritten + TypeBitmap.Length);
        }
        /// <summary>
        /// True iff the given type exists in the bitmap.
        /// </summary>
        public bool IsTypePresentForOwner(DnsType dnsType)
        {
            if (dnsType >= MaxTypeBitmapDnsType)
            {
                throw new ArgumentOutOfRangeException("dnsType", dnsType,
                                                      string.Format(CultureInfo.InvariantCulture, "Cannot be bigger than {0}.", MaxTypeBitmapDnsType));
            }

            int  byteOffset;
            byte mask;

            DnsTypeToByteOffsetAndMask(out byteOffset, out mask, dnsType);
            if (byteOffset > TypeBitmap.Length)
            {
                return(false);
            }

            return(TypeBitmap.ReadBool(byteOffset, mask));
        }
 /// <summary>
 /// Two DnsResourceDataNextDomain are equal iff their next domain name and type bitmap fields are equal.
 /// </summary>
 public bool Equals(DnsResourceDataNextDomain other)
 {
     return(other != null &&
            NextDomainName.Equals(other.NextDomainName) &&
            TypeBitmap.Equals(other.TypeBitmap));
 }