Exemple #1
0
 public SOARecord(DnsReader br)
 {
     _mname = br.ReadDomain();
     _rname = br.ReadDomain();
     _serial = br.ReadInt32();
     _refresh = br.ReadInt32();
     _retry = br.ReadInt32();
     _expire = br.ReadInt32();
     _minimumTtl = br.ReadInt32();
 }
 public SOARecord(DnsReader br)
 {
     _mname      = br.ReadDomain();
     _rname      = br.ReadDomain();
     _serial     = br.ReadInt32();
     _refresh    = br.ReadInt32();
     _retry      = br.ReadInt32();
     _expire     = br.ReadInt32();
     _minimumTtl = br.ReadInt32();
 }
        public ResourceRecord(DnsReader br)
        {
            _domain = br.ReadDomain();
            _qtype = (RecordType)br.ReadInt16();
            _qclass = (RecordClass)br.ReadInt16();
            _ttl = br.ReadInt32();

            int recordLength = br.ReadInt16();
            if (recordLength != 0)
            {
                switch (_qtype)
                {
                    case RecordType.A:     _record = new ARecord(br);      break;
                    case RecordType.CNAME: _record = new CNAMERecord(br);  break;
                    case RecordType.MX:    _record = new MXRecord(br);     break;
                    case RecordType.NS:    _record = new NSRecord(br);     break;
                    case RecordType.SOA:   _record = new SOARecord(br);    break;
                    case RecordType.TXT:   _record = new TXTRecord(br);    break;
                    case RecordType.PTR:   _record = new PTRERecord(br);	break;

                    // NetBIOS related records
                    case RecordType.NB:    _record = new NBRecord(br);     break;

                    default:
                        br += recordLength;
                        break;
                }
            }
        }
        public ResourceRecord(DnsReader br)
        {
            _domain = br.ReadDomain();
            _qtype = (RecordType)br.ReadInt16();
            _qclass = (RecordClass)br.ReadInt16();
            _ttl = br.ReadInt32();

            int recordLength = br.ReadInt16();
            if (recordLength != 0)
            {
                switch (_qtype)
                {
                    case RecordType.A:     _record = new ARecord(br);      break;
                    case RecordType.CNAME: _record = new CNAMERecord(br);  break;
                    case RecordType.MX:    _record = new MXRecord(br);     break;
                    case RecordType.NS:    _record = new NSRecord(br);     break;
                    case RecordType.SOA:   _record = new SOARecord(br);    break;
                    case RecordType.TXT:   _record = new TXTRecord(br);    break;
					case RecordType.PTR:   _record = new PTRERecord(br);	break;

                    // NetBIOS related records
                    case RecordType.NB:    _record = new NBRecord(br);     break;
                    
                    default:
                        br += recordLength;
                        break;
                }
            }
        }
        /// <summary>
        /// Reads a domain name from the byte array. (RFC 1035 - 4.1.4.)
        /// </summary>
        public string ReadDomain()
        {
            StringBuilder domain = new StringBuilder();
            int           length = 0;

            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
                    DnsReader newPointer = Copy();

                    // and move it to where specified here
                    newPointer.Position = (length & 0x3f) << 8 | ReadByte();

                    // repeat call recursively
                    domain.Append(newPointer.ReadDomain());
                    return(domain.ToString());
                }

                // if not using compression, copy a char at a time to the domain name
                while (length > 0)
                {
                    domain.Append(ReadChar());
                    length--;
                }

                // if size of next label isn't null (end of domain name) add a period ready for next label
                if (Peek() != 0)
                {
                    domain.Append('.');
                }
            }

            return(domain.ToString());
        }
 public CNAMERecord(DnsReader br)
 {
     _domain = br.ReadDomain();
 }
Exemple #7
0
 internal Question(DnsReader br)
 {
     _domain = br.ReadDomain();
     _qtype  = (RecordType)br.ReadInt16();
     _qclass = (RecordClass)br.ReadInt16();
 }
 public PTRERecord(DnsReader br)
 {
     _domain = br.ReadDomain();
 }
 public CNAMERecord(DnsReader br)
 {
     _domain = br.ReadDomain();
 }
Exemple #10
0
 public PTRERecord(DnsReader br)
 {
     _domain = br.ReadDomain();
 }
Exemple #11
0
 public NSRecord(DnsReader br)
 {
     _domainName = br.ReadDomain();
 }
Exemple #12
0
 internal Question(DnsReader br)
 {
     _domain = br.ReadDomain();
     _qtype = (RecordType)br.ReadInt16();
     _qclass = (RecordClass)br.ReadInt16();
 }
Exemple #13
0
 public NSRecord(DnsReader br)
 {
     _domainName = br.ReadDomain();
 }
Exemple #14
0
 public MXRecord(DnsReader br)
 {
     _preference = br.ReadInt16();
     _domainName = br.ReadDomain();
 }