Example #1
0
 public RR(RecordReader rr)
 {
     TimeLived = 0;
     NAME      = rr.ReadDomainName();
     Type      = (Type)rr.ReadUInt16();
     Class     = (Class)rr.ReadUInt16();
     TTL       = rr.ReadUInt32();
     RDLENGTH  = rr.ReadUInt16();
     RECORD    = rr.ReadRecord(Type);
     RECORD.RR = this;
 }
Example #2
0
        public string ReadDomainName()
        {
            StringBuilder name   = new StringBuilder();
            int           length = 0;

            // get  the length of the first label
            while ((length = ReadByte()) != 0)
            {
                // top 2 bits set denotes domain name compression and to reference elsewhere
                if ((length & 0xc0) == 0xc0)
                {
                    // work out the existing domain name, copy this pointer
                    int nextLoc = (length & 0x3f) << 8 | ReadByte();

                    if (nextLoc != m_Position - 2)
                    {
                        RecordReader newRecordReader = new RecordReader(m_Data, nextLoc);
                        name.Append(newRecordReader.ReadDomainName());
                    }

                    return(name.ToString());
                }

                // if not using compression, copy a char at a time to the domain name
                while (length > 0)
                {
                    name.Append(ReadChar());
                    length--;
                }
                name.Append('.');
            }
            if (name.Length == 0)
            {
                return(".");
            }
            else
            {
                return(name.ToString());
            }
        }
Example #3
0
 public RecordNS(RecordReader rr)
 {
     NSDNAME = rr.ReadDomainName();
 }
Example #4
0
 public Question(RecordReader rr)
 {
     QName  = rr.ReadDomainName();
     QType  = (QType)rr.ReadUInt16();
     QClass = (QClass)rr.ReadUInt16();
 }
Example #5
0
 public RecordDNAME(RecordReader rr)
 {
     TARGET = rr.ReadDomainName();
 }
Example #6
0
 public RecordMX(RecordReader rr)
 {
     PREFERENCE = rr.ReadUInt16();
     EXCHANGE   = rr.ReadDomainName();
 }
Example #7
0
 public RecordCNAME(RecordReader rr)
 {
     CNAME = rr.ReadDomainName();
 }
Example #8
0
 public RecordPTR(RecordReader rr)
 {
     PTRDNAME = rr.ReadDomainName();
 }