Пример #1
0
            public static LogMessage ResolutionSucceded(
                DnsDomain domain, DnsClient.DNS.QTYPE question, IEnumerable <DnsClient.DNS.RR> requestedAnswerRecords)
            {
                // must be true:
                // requestedAnswerRecords.Any()

                int count = requestedAnswerRecords.Count();

                if (count == 1)
                {
                    DnsClient.DNS.RR rr = requestedAnswerRecords.First();
                    DnsClient.DNS.Records.Address address;
                    DnsClient.DNS.Records.PTR     pointer;

                    if (!Object.ReferenceEquals(null, (address = rr as DnsClient.DNS.Records.Address)))
                    {
                        // "The name '{0}' was successfully resolved to {1}."
                        return(RESPONSE.INFO.SingleAddressResolutionSucceeded(domain, address.ADDRESS));
                    }

                    if (!Object.ReferenceEquals(null, (pointer = rr as DnsClient.DNS.Records.PTR)))
                    {
                        // "Pointer resolution succeeded with the name '{0}'."
                        return(RESPONSE.INFO.SinglePointerResolutionSucceeded(pointer.PTRDNAME));
                    }

                    // "A Resouce Records of type {0} was found."
                    return(RESPONSE.INFO.RecordResolutionSucceeded(question));
                }

                // "{1} Resouce Records of type {0} were found."
                return(RESPONSE.INFO.RecordResolutionSucceeded(question, count));
            }
Пример #2
0
 // sub iterators: Address / CName
 protected ResolutionIterator(DomainResolver resolver, DnsClient.DNS.QTYPE question, Caching.AddressCache addressCache, int nestingLevel)
     : base(resolver, question, addressCache)
 {
     this.NestingLevel = nestingLevel;
 }
Пример #3
0
 internal ResolutionIterator(DomainResolver resolver, DnsClient.DNS.QTYPE question, Caching.AddressCache addressCache)
     : base(resolver, question, addressCache)
 {
     NestingLevel = 0;
 }
Пример #4
0
 /// <summary>
 /// Create a new request iterator for resolving the specified question.
 /// </summary>
 /// <param name="question">The question to resolve.</param>
 /// <returns></returns>
 public Iterators.ResolutionIterator GetIterator(DnsClient.DNS.QTYPE question)
 {
     return(new Iterators.ResolutionIterator(this, question, new Caching.AddressCache()));
 }
Пример #5
0
 internal NameServerEventArgs(NameServer server, DnsClient.DNS.QTYPE question, string domain)
 {
     _NameServer = server;
       _QuestionType = question;
       _Domain = domain;
 }
Пример #6
0
 internal NameServerEventArgs(NameServer server, DnsClient.DNS.QTYPE question, string domain)
 {
     _NameServer   = server;
     _QuestionType = question;
     _Domain       = domain;
 }
Пример #7
0
 public QueryProcessor(DnsDomain sname, DnsClient.DNS.QTYPE stype, DnsClient.Response response)
 {
     this.SNAME = sname;
       this.STYPE = stype;
       this.Response = response;
 }
Пример #8
0
 internal ResolutionIteratorBase(DomainResolver resolver, DnsClient.DNS.QTYPE question, Caching.AddressCache addressCache)
 {
     _Resolver    = resolver;
     _Question    = question;
     AddressCache = addressCache;
 }
Пример #9
0
 public QueryProcessor(DnsDomain sname, DnsClient.DNS.QTYPE stype, DnsClient.Response response)
 {
     this.SNAME    = sname;
     this.STYPE    = stype;
     this.Response = response;
 }
Пример #10
0
 public static LogMessage QueryNotImplemented(DnsClient.DNS.QTYPE question)
 {
     return(Create(Resources.LogMessages.QueryNotImplemented, new object[] { question }));
 }
Пример #11
0
 public static LogMessage MissingRecords(DnsClient.DNS.QTYPE question)
 {
     return(Create(Resources.LogMessages.MissingRecords, new object[] { question }));
 }
Пример #12
0
 public static LogMessage RecordResolutionSucceeded(DnsClient.DNS.QTYPE qtype, int count)
 {
     return(Create(Resources.LogMessages.RecordResolutionSucceeded2,
                   new object[] { qtype, count }));
 }
Пример #13
0
        //public static IEnumerable<DnsClient.DNS.RR> Select(this IEnumerable<DnsClient.DNS.RR> records, DnsClient.DNS.QTYPE type)
        //{
        //  return records.Where(rr => type.Equals(rr.Base.TYPE));
        //}

        public static IEnumerable <DnsClient.DNS.RR> OfQuestion(this IEnumerable <DnsClient.DNS.RR> records, DnsClient.DNS.QTYPE question)
        {
            if (question == DnsClient.DNS.QTYPE.ANY)
            {
                return(records);
            }

            return(records.Where(rr => rr.Base.TYPE.Equals(question)));
        }