Ejemplo n.º 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;
 }
Ejemplo n.º 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());
            }
        }
Ejemplo n.º 3
0
 public RecordNS(RecordReader rr)
 {
     NSDNAME = rr.ReadDomainName();
 }
Ejemplo n.º 4
0
 public Question(RecordReader rr)
 {
     QName  = rr.ReadDomainName();
     QType  = (QType)rr.ReadUInt16();
     QClass = (QClass)rr.ReadUInt16();
 }
Ejemplo n.º 5
0
 public RecordDNAME(RecordReader rr)
 {
     TARGET = rr.ReadDomainName();
 }
Ejemplo n.º 6
0
 public RecordMX(RecordReader rr)
 {
     PREFERENCE = rr.ReadUInt16();
     EXCHANGE   = rr.ReadDomainName();
 }
Ejemplo n.º 7
0
 public RecordCNAME(RecordReader rr)
 {
     CNAME = rr.ReadDomainName();
 }
Ejemplo n.º 8
0
 public RecordPTR(RecordReader rr)
 {
     PTRDNAME = rr.ReadDomainName();
 }