Example #1
0
 /// <summary>
 /// Instantiates a message with the given header and question
 /// </summary>
 /// <param name="header">the header - take as is, assumed configured correctly</param>
 /// <param name="question">question to ask</param>        
 protected DnsMessage(DnsHeader header, DnsQuestion question)
 {
     if (header == null || question == null)
     {
         throw new ArgumentNullException();
     }
     m_header = header;
     m_header.QuestionCount = 1;
     m_question = question;
 }
Example #2
0
 /// <summary>
 /// Instantiates a Dns message
 /// </summary>
 /// <param name="question"></param>
 protected DnsMessage(DnsQuestion question)
     : this(new DnsHeader(), question)
 {
     m_header.Init();  // Since we created the header, we'll init it with some defaults
 }
Example #3
0
 /// <summary>
 /// Deserialize this message
 /// </summary>
 /// <param name="reader"></param>        
 protected virtual void Deserialize(ref DnsBufferReader reader)
 {
     m_header = new DnsHeader(ref reader);
     m_question = new DnsQuestion(ref reader);
 }
Example #4
0
        /// <summary>
        /// Initializes an instance from the specified question parameter. 
        /// </summary>
        /// <param name="question">
        /// The question used to initialize the new question instance.
        /// </param>
        public DnsQuestion(DnsQuestion question)
        {
            if (question == null)
            {
                throw new ArgumentNullException("question"); 
            }

            this.Domain = question.Domain;
            this.Type = question.Type;
            this.Class = question.Class; 
        }
Example #5
0
 /// <summary>
 /// Tests this instance for equality with the other <paramref name="question"/>
 /// </summary>
 /// <param name="question">The other question.</param>
 /// <returns><c>true</c> if the instances represent the same question, <c>false</c> otherwise.</returns>
 public bool Equals(DnsQuestion question)
 {
     if (question == null)
     {
         return false;
     }
     
     return (
                DnsStandard.Equals(question.Domain, this.Domain)
                &&  question.Type == this.Type
                &&  question.Class == this.Class
            );
 }
Example #6
0
 /// <summary>
 /// Instantiates a Dns message
 /// </summary>
 /// <param name="question"></param>
 protected DnsMessage(DnsQuestion question)
     : this(new DnsHeader(), question)
 {
     m_header.Init();  // Since we created the header, we'll init it with some defaults
 }
Example #7
0
 /// <summary>
 /// Deserialize this message
 /// </summary>
 /// <param name="reader"></param>
 protected virtual void Deserialize(ref DnsBufferReader reader)
 {
     m_header   = new DnsHeader(ref reader);
     m_question = new DnsQuestion(ref reader);
 }