Esempio n. 1
0
        public Request()
        {
            header = new Header();
            header.OPCODE = OPCode.Query;
            header.QDCOUNT = 0;

            questions = new List<Question>();
        }
Esempio n. 2
0
        public Response()
        {
            Questions = new List<Question>();
            Answers = new List<AnswerRR>();
            Authorities = new List<AuthorityRR>();
            Additionals = new List<AdditionalRR>();

            Server = new IPEndpoint(new IPAddress(0), 0);
            Error = String.Empty;
            MessageSize = 0;
            TimeStamp = DateTime.Now;
            header = new Header();
        }
Esempio n. 3
0
        public Response(IPEndpoint endpoint, byte[] data)
        {
            Error = String.Empty;
            Server = endpoint;
            TimeStamp = DateTime.Now;
            MessageSize = data.Length;
            RecordReader rr = new RecordReader(data);

            Questions = new List<Question>();
            Answers = new List<AnswerRR>();
            Authorities = new List<AuthorityRR>();
            Additionals = new List<AdditionalRR>();

            header = new Header(rr);

            //if (header.RCODE != RCode.NoError)
            //	Error = header.RCODE.ToString();

            for (int intI = 0; intI < header.QDCOUNT; intI++)
            {
                Questions.Add(new Question(rr));
            }

            for (int intI = 0; intI < header.ANCOUNT; intI++)
            {
                Answers.Add(new AnswerRR(rr));
            }

            for (int intI = 0; intI < header.NSCOUNT; intI++)
            {
                Authorities.Add(new AuthorityRR(rr));
            }
            for (int intI = 0; intI < header.ARCOUNT; intI++)
            {
                Additionals.Add(new AdditionalRR(rr));
            }
        }