/// <summary> /// Construit une requête standard (nom vers type) /// </summary> /// <param name="name">Nom du domaine à requêter</param> /// <param name="Type"></param> public DNSRequest(string name, string Type) { header = new DNSHeader(); header.Standart = true; header.RecursionDesired = true; header.QuestionCount = 1; header.AnswerCount = 0; header.NSCount = 0; header.ARCount = 0; // On dimensionne es différents éléments en fonction des besoins questions = new DNSQuestion[header.QuestionCount]; answers = new DNSResourceRecord[header.AnswerCount]; authorities = new DNSResourceRecord[header.NSCount]; additionals = new DNSResourceRecord[header.ARCount]; // On créé la question questions[0] = new DNSQuestion(name, Type, DNSClass.ALL); }
/// <summary> /// Lit le flux sous-jacent /// </summary> public override void Read(DNSRequest request) { Message.Position = 0; // On lit la réponse du serveur header = new DNSHeader(); header.Read(request); // On dimensionne les espace servant à lire les réponses questions = new DNSQuestion[header.QuestionCount]; answers = new DNSResourceRecord[header.AnswerCount]; authorities = new DNSResourceRecord[header.NSCount]; additionals = new DNSResourceRecord[header.ARCount]; // On lit les questions for (int i = 0; i < questions.Length; i++) { questions[i] = new DNSQuestion(); questions[i].Read(request); } // On lit les réponses for (int i = 0; i < answers.Length; i++) { answers[i] = new DNSResourceRecord(); answers[i].Read(request); } // On lit les réponses d'authorités for (int i = 0; i < authorities.Length; i++) { authorities[i] = new DNSResourceRecord(); authorities[i].Read(request); } // On lit les réponses additionnelles for (int i = 0; i < additionals.Length; i++) { additionals[i] = new DNSResourceRecord(); additionals[i].Read(request); } }