Exemplo n.º 1
0
        /// <summary>
        /// Adds a listener for a given question.  The listener will have
        /// its update_record method called when information is available to
        /// answer the question.
        /// </summary>
        /// <param name="listener">Listener.</param>
        /// <param name="question">Question.</param>
        public void AddListener(IServiceListener listener, DNSQuestion question)
        {
            long now = Utilities.CurrentTimeMilliseconds();

            this.listeners.Add(listener);
            if (question != null)
            {
                foreach (DNSRecord record in this.Cache.EntriesWithName(question.Name))
                {
                    if (question.AnsweredBy(record) && !record.IsExpired(now))
                    {
                        listener.UpdateRecord(this, now, record);
                    }
                }
            }
            NotifyAll();
        }
Exemplo n.º 2
0
 public void AddQuestion(DNSQuestion record)
 {
     this.Questions.Add(record);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Writes a question to the packet
 /// </summary>
 /// <param name="question">Question.</param>
 public void WriteQuestion(DNSQuestion question)
 {
     this.bew.WriteName(question.Name);
     this.bew.Write((ushort)question.Type);
     this.bew.Write((ushort)question.Class);
 }