示例#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;
 }
示例#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
 }
示例#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);
 }
示例#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; 
        }
示例#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
            );
 }
示例#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
 }
示例#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);
 }