Exemplo n.º 1
0
 /// <summary>
 /// Create Location Record from Data Buffer
 /// </summary>
 /// <param name="buffer"></param>
 public LocRecord(DataBuffer buffer)
 {
     version       = buffer.ReadShortInt();
     size          = buffer.ReadShortInt();
     horzPrecision = buffer.ReadShortInt();
     vertPrecision = buffer.ReadShortInt();
     lattitude     = buffer.ReadInt();
     longitude     = buffer.ReadInt();
     altitude      = buffer.ReadInt();
 }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
0
 public KeyRecord(DataBuffer buffer, int length)
 {
     flags     = buffer.ReadShortInt();
     protocol  = buffer.ReadByte();
     algorithm = buffer.ReadByte();
     publicKey = buffer.ReadBytes(length - 4);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Implementation Reference RFC 3658
 /// </summary>
 /// <param name="buffer"></param>
 public DSRecord(DataBuffer buffer, int length)
 {
     key        = buffer.ReadShortInt();
     algorithm  = buffer.ReadByte();
     digestType = buffer.ReadByte();
     digest     = buffer.ReadBytes(length - 4);
 }
Exemplo n.º 6
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;
            }
        }
Exemplo n.º 7
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();
 }