Beispiel #1
0
        internal override void ReadRDATA(Internal.ByteReader reader)
        {
            if (Base.RDLENGTH != 16)
            throw new InvalidResponseException(String.Format(
              "Invalid RDLENGTH value {0}: expected 16.",
              Base.RDLENGTH));

              byte[] buf = reader.ReadBytes(16);
              ADDRESS = new IPAddress(buf);
              if (ADDRESS.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)
            throw new InvalidResponseException(String.Format(
              "Not an IPv6 address: {0}.", ADDRESS.ToString()));
        }
Beispiel #2
0
 internal override void ReadRDATA(Internal.ByteReader reader)
 {
     RDATA = reader.ReadBytes(Base.RDLENGTH);
 }
Beispiel #3
0
        internal override void ReadRDATA(Internal.ByteReader reader)
        {
            // The format of the data within a DNS TXT record is one or more
              // strings, packed together in memory without any intervening gaps
              // or padding bytes for word alignment.
              //
              // The format of each constituent string within the DNS TXT record is
              // a single length byte, followed by 0-255 bytes of text data.

              // TXT-DATA strings are not guaranteed to consist purely of ASCII printable
              // characters though this is usually the case.

              List<Datagram> strings = new List<Datagram>();
              for (int total = 0; total < Base.RDLENGTH; )
              {
            byte length = reader.ReadByte();
            if (length > 0)
            {
              if (total + length >= Base.RDLENGTH)
            throw new InvalidResponseException(
              "Invalid length byte in TXT record: String data would exceed RDLENGTH.");
              strings.Add(reader.ReadBytes(length));
            }
            total += (length + 1);
              }
              Strings = strings.ToArray();
        }