Example #1
0
 public SoaRecord(DataBuffer buffer)
 {
     primaryNameServer      = buffer.ReadDomainName();
     responsibleMailAddress = buffer.ReadDomainName();
     serial     = buffer.ReadInt();
     refresh    = buffer.ReadInt();
     retry      = buffer.ReadInt();
     expire     = buffer.ReadInt();
     defaultTtl = buffer.ReadInt();
 }
Example #2
0
 /// <summary>
 /// Implementation Reference RFC 2782
 /// </summary>
 /// <param name="buffer"></param>
  public SrvRecord(DataBuffer buffer)
 {
     priority = buffer.ReadShortInt();
     weight = buffer.ReadShortUInt();
     port = buffer.ReadShortUInt();
     domain = buffer.ReadDomainName();
 }
Example #3
0
 /// <summary>
 /// Implementation Reference RFC 3363
 /// </summary>
 /// <param name="buffer"></param>
 public A6Record(DataBuffer buffer)
 {
     prefixLength = buffer.ReadByte();
     if (prefixLength == 0) //Only Address Present
     {
         ipAddress = buffer.ReadIPv6Address();
     }
     else if (prefixLength == 128)  //Only Domain Name Present
     {
         domain = buffer.ReadDomainName();
     }
     else  //Address and Domain Name Present
     {
         ipAddress = buffer.ReadIPv6Address();
         domain    = buffer.ReadDomainName();
     }
 }
Example #4
0
 public TSigRecord(DataBuffer buffer)
 {
     algorithm  = buffer.ReadDomainName();
     timeSigned = buffer.ReadLongInt();
     fudge      = buffer.ReadShortUInt();
     macSize    = buffer.ReadShortUInt();
     mac        = buffer.ReadBytes(macSize);
     originalId = buffer.ReadShortUInt();
     error      = buffer.ReadShortUInt();
     otherLen   = buffer.ReadShortUInt();
     otherData  = buffer.ReadBytes(otherLen);
 }
Example #5
0
 /// <summary>
 /// Implementation References RFC 2930
 /// </summary>
 /// <param name="buffer"></param>
 public TKeyRecord(DataBuffer buffer)
 {
     algorithm  = buffer.ReadDomainName();
     inception  = buffer.ReadUInt();
     expiration = buffer.ReadUInt();
     mode       = buffer.ReadShortUInt();
     error      = buffer.ReadShortUInt();
     keySize    = buffer.ReadShortUInt();
     keyData    = buffer.ReadBytes(keySize);
     otherSize  = buffer.ReadShortUInt();
     otherData  = buffer.ReadBytes(otherSize);
 }
Example #6
0
        /// <summary>
        /// Implementation Reference RFC 2535
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="length"></param>
        public SigRecord(DataBuffer buffer, int length)
        {
            int pos = buffer.Position;

            coveredType     = buffer.ReadShortInt();
            algorithm       = buffer.ReadByte();
            numLabels       = buffer.ReadByte();
            expiration      = buffer.ReadUInt();
            inception       = buffer.ReadUInt();
            keyTag          = buffer.ReadShortInt();
            signer          = buffer.ReadDomainName();
            buffer.Position = pos - length;
        }
Example #7
0
 /// <summary>
 /// Implementation Reference RFC 1183
 /// </summary>
 /// <param name="buffer"></param>
 public RPRecord(DataBuffer buffer)
 {
     responsibleMailbox = buffer.ReadDomainName();
     textDomain         = buffer.ReadDomainName();
 }
Example #8
0
 public PXRecord(DataBuffer buffer) : base(buffer)
 {
     x400Domain = buffer.ReadDomainName();
 }
Example #9
0
 /// <summary>
 /// Base class for all Record Types that have RDATA consisting of a single domain name
 /// </summary>
 /// <param name="buffer"></param>
 public DomainNameOnly(DataBuffer buffer)
 {
     domain = buffer.ReadDomainName();
 }
Example #10
0
 public MInfoRecord(DataBuffer buffer)
 {
     responsibleMailbox = buffer.ReadDomainName();
     errorMailbox       = buffer.ReadDomainName();
 }
Example #11
0
        /// <summary>
        /// Create a DNSEntry record and dispatch to data constructor
        /// for thast record type
        /// </summary>
        /// <param name="buffer"></param>
        public DnsEntry(DataBuffer buffer)
        {
            try
            {
                domain = buffer.ReadDomainName();
                byte b = buffer.ReadByte();
                recType   = (RecordType)buffer.ReadShortInt();
                classType = buffer.ReadShortInt();
                ttl       = buffer.ReadInt();

                int length = buffer.ReadByte();
                switch (recType)
                {
                case RecordType.A: data = new ARecord(buffer); break;

                case RecordType.NS: data = new NSRecord(buffer); break;

                case RecordType.CNAME: data = new CNameRecord(buffer); break;

                case RecordType.SOA: data = new SoaRecord(buffer); break;

                case RecordType.MB: data = new MBRecord(buffer); break;

                case RecordType.MG: data = new MGRecord(buffer); break;

                case RecordType.MR: data = new MRRecord(buffer); break;

                case RecordType.NULL: data = new NullRecord(buffer, length); break;

                case RecordType.WKS: data = new WksRecord(buffer, length); break;

                case RecordType.PTR: data = new PtrRecord(buffer); break;

                case RecordType.HINFO: data = new HInfoRecord(buffer, length); break;

                case RecordType.MINFO: data = new MInfoRecord(buffer); break;

                case RecordType.MX: data = new MXRecord(buffer); break;

                case RecordType.TXT: data = new TxtRecord(buffer, length); break;

                case RecordType.RP: data = new RPRecord(buffer); break;

                case RecordType.AFSDB: data = new AfsdbRecord(buffer); break;

                case RecordType.X25: data = new X25Record(buffer); break;

                case RecordType.ISDN: data = new IsdnRecord(buffer); break;

                case RecordType.RT: data = new RTRecord(buffer); break;

                case RecordType.NSAP: data = new NsapRecord(buffer, length); break;

                case RecordType.SIG: data = new SigRecord(buffer, length); break;

                case RecordType.KEY: data = new KeyRecord(buffer, length); break;

                case RecordType.PX: data = new PXRecord(buffer); break;

                case RecordType.AAAA: data = new AAAARecord(buffer); break;

                case RecordType.LOC: data = new LocRecord(buffer); break;

                case RecordType.SRV: data = new SrvRecord(buffer); break;

                case RecordType.NAPTR: data = new NaptrRecord(buffer); break;

                case RecordType.KX: data = new KXRecord(buffer); break;

                case RecordType.A6: data = new A6Record(buffer); break;

                case RecordType.DNAME: data = new DNameRecord(buffer); break;

                case RecordType.DS: data = new DSRecord(buffer, length); break;

                case RecordType.TKEY: data = new TKeyRecord(buffer); break;

                case RecordType.TSIG: data = new TSigRecord(buffer); break;

                default: throw new DnsQueryException("Invalid DNS Record Type in DNS Response", null);
                }
            }
            catch (Exception ex)
            {
                data = new ExceptionRecord(ex.Message);
                throw ex;
            }
        }
Example #12
0
 /// <summary>
 /// Create data record for AFSDB type from data buffer
 /// </summary>
 /// <param name="buffer"></param>
 public AfsdbRecord(DataBuffer buffer)
 {
     subType = buffer.ReadShortInt();
     domain  = buffer.ReadDomainName();
 }
Example #13
0
 /// <summary>
 /// Create a Question record for Dns Answer
 /// </summary>
 /// <param name="buffer"></param>
 public Question(DataBuffer buffer)
 {
     domain    = buffer.ReadDomainName();
     recType   = (RecordType)buffer.ReadBEShortInt();
     classType = buffer.ReadBEShortInt();
 }
Example #14
0
 /// <summary>
 /// Common class for all record types that contain a preference and a domain name
 /// </summary>
 /// <param name="buffer"></param>
 public PrefAndDomain(DataBuffer buffer)
 {
     preference = buffer.ReadBEShortInt();
     domain     = buffer.ReadDomainName();
 }