예제 #1
0
        public string ReadDomainName()
        {
            var sb = new StringBuilder();
            int length;

            while ((length = ReadByte()) != 0)
            {
                if ((length & 0xc0) == 0xc0)
                {
                    var helper = new RecordHelper(_data, (length & 0x3f) << 8 | ReadByte());

                    sb.Append(helper.ReadDomainName());

                    return(sb.ToString());
                }

                while (length > 0)
                {
                    sb.Append(ReadChar());
                    length--;
                }

                sb.Append('.');
            }

            return(sb.Length == 0 ? "." : sb.ToString());
        }
예제 #2
0
 public RecordReader(RecordHelper helper)
 {
     Name   = helper.ReadDomainName();
     Type   = (QueryType)helper.ReadUInt16();
     Class  = helper.ReadUInt16();
     Ttl    = helper.ReadUInt32();
     Record = helper.ReadRecord(Type, helper.ReadUInt16());
 }