Example #1
0
        public void ReadFrom(BinaryReader aSrc)
        {
            this.fSequenceID = N2H(aSrc.ReadUInt16());
            this.fFlags      = N2H(aSrc.ReadUInt16());
            ushort num  = N2H(aSrc.ReadUInt16());
            ushort num2 = N2H(aSrc.ReadUInt16());
            ushort num3 = N2H(aSrc.ReadUInt16());
            ushort num4 = N2H(aSrc.ReadUInt16());
            int    num6 = num - 1;
            int    num5 = 0;

            if (num5 <= num6)
            {
                num6++;
                do
                {
                    DNSQuestion item = new DNSQuestion();
                    item.ReadFrom(aSrc);
                    this.fQuestions.Add(item);
                    num5++;
                }while (num5 != num6);
            }
            int num7 = num2 - 1;

            num5 = 0;
            if (num5 <= num7)
            {
                num7++;
                do
                {
                    this.fAnswers.Add(DNSResource.ReadFrom(aSrc));
                    num5++;
                }while (num5 != num7);
            }
            int num8 = num3 - 1;

            num5 = 0;
            if (num5 <= num8)
            {
                num8++;
                do
                {
                    this.fAuthorityRecords.Add(DNSResource.ReadFrom(aSrc));
                    num5++;
                }while (num5 != num8);
            }
            int num9 = num4 - 1;

            num5 = 0;
            if (num5 <= num9)
            {
                num9++;
                do
                {
                    this.fAdditionalRecords.Add(DNSResource.ReadFrom(aSrc));
                    num5++;
                }while (num5 != num9);
            }
        }
Example #2
0
        public DNSQuestion Clone()
        {
            DNSQuestion question = new DNSQuestion();

            question.fClass      = this.fClass;
            question.fClearCache = this.fClearCache;
            question.fName       = this.fName;
            question.fType       = this.fType;
            return(question);
        }
Example #3
0
        public void BeginRequest(DNSClass cl, DNSType type, string name, bool clearcache, Action<DNSResource> action)
        {
            DNSQuestion q= new DNSQuestion();
            q.Class = cl;
            q.ClearCache = clearcache;
            if (!name.EndsWith("."))
                name += "."; // domain names technically end with a .
            q.Name = name;
            q.Type = type;

            BeginRequest(q, action);
        }
Example #4
0
 public void BeginRequest(DNSQuestion question, Action<DNSResource> action)
 {
     DNSPacket req = new DNSPacket();
     req.QueryType = DNSQueryType.Standard;
     req.RecursionDesired = true;
     req.Questions.Add(question);
     BeginRequest(req, a =>
     {
         if (a == null || a.Answers.Count != 1)
             action(null);
         else
             action(a.Answers[0]);
     });
 }
Example #5
0
        public void BeginRequest(DNSClass cl, DNSType type, string name, bool clearcache, Action <DNSResource> action)
        {
            DNSQuestion q = new DNSQuestion();

            q.Class      = cl;
            q.ClearCache = clearcache;
            if (!name.EndsWith("."))
            {
                name += "."; // domain names technically end with a .
            }
            q.Name = name;
            q.Type = type;

            BeginRequest(q, action);
        }
Example #6
0
        public void BeginRequest(DNSQuestion question, Action <DNSResource> action)
        {
            DNSPacket req = new DNSPacket();

            req.QueryType        = DNSQueryType.Standard;
            req.RecursionDesired = true;
            req.Questions.Add(question);
            BeginRequest(req, a =>
            {
                if (a == null || a.Answers.Count != 1)
                {
                    action(null);
                }
                else
                {
                    action(a.Answers[0]);
                }
            });
        }
Example #7
0
 public DNSQuestion Clone()
 {
     DNSQuestion question = new DNSQuestion();
     question.fClass = this.fClass;
     question.fClearCache = this.fClearCache;
     question.fName = this.fName;
     question.fType = this.fType;
     return question;
 }
Example #8
0
 public void ReadFrom(BinaryReader aSrc)
 {
     this.fSequenceID = N2H(aSrc.ReadUInt16());
     this.fFlags = N2H(aSrc.ReadUInt16());
     ushort num = N2H(aSrc.ReadUInt16());
     ushort num2 = N2H(aSrc.ReadUInt16());
     ushort num3 = N2H(aSrc.ReadUInt16());
     ushort num4 = N2H(aSrc.ReadUInt16());
     int num6 = num - 1;
     int num5 = 0;
     if (num5 <= num6)
     {
         num6++;
         do
         {
             DNSQuestion item = new DNSQuestion();
             item.ReadFrom(aSrc);
             this.fQuestions.Add(item);
             num5++;
         }
         while (num5 != num6);
     }
     int num7 = num2 - 1;
     num5 = 0;
     if (num5 <= num7)
     {
         num7++;
         do
         {
             this.fAnswers.Add(DNSResource.ReadFrom(aSrc));
             num5++;
         }
         while (num5 != num7);
     }
     int num8 = num3 - 1;
     num5 = 0;
     if (num5 <= num8)
     {
         num8++;
         do
         {
             this.fAuthorityRecords.Add(DNSResource.ReadFrom(aSrc));
             num5++;
         }
         while (num5 != num8);
     }
     int num9 = num4 - 1;
     num5 = 0;
     if (num5 <= num9)
     {
         num9++;
         do
         {
             this.fAdditionalRecords.Add(DNSResource.ReadFrom(aSrc));
             num5++;
         }
         while (num5 != num9);
     }
 }