protected virtual void OnRCodeNonZero(DnsClient.Response response) { switch (response.Header.RCODE) { case DnsClient.DNS.RCODE.NameError: // "The name '{0}' does not exist." LogMessageCreate(Logging.LogMessageText.RESPONSE.ERROR.NameNotExisting(Resolver.Domain)); break; case DnsClient.DNS.RCODE.NotImplemented: // "The name server does not support queries of type '{0}'." LogMessageCreate(Logging.LogMessageText.RESPONSE.ERROR.QueryNotImplemented(Question)); break; case DnsClient.DNS.RCODE.Refused: // "The name server refuses to perform the specified operation for policy easons." LogMessageCreate(Logging.LogMessageText.RESPONSE.ERROR.ServerRefused()); break; case DnsClient.DNS.RCODE.ServerFailure: // "The name server was unable to process this query due to a problem with the name server." LogMessageCreate(Logging.LogMessageText.RESPONSE.ERROR.ServerFailure()); break; default: // "Unexpected RCODE value {0} '{1}' received." LogMessageCreate(Logging.LogMessageText.RESPONSE.ERROR.UnexpectedRCode(response.Header.RCODEValue, response.Header.RCODE)); break; } }
//protected virtual void OnResolutionCompleted(DnsClient.DNS.QTYPE question, DnsClient.Response response) //{ // IEnumerable<DnsClient.DNS.RR> requested = response.AnswerRecords.OfQuestion(question); // if (requested.Any()) // { // // The requested record type was found. // LogMessageCreate(Logging.LogMessageText.RESPONSE.ResolutionSucceded(Resolver.Domain, Question, requested)); // } // else // { // // The requested record type was NOT found. // if (question == DnsClient.DNS.QTYPE.ANY) // { // // The question is ANY, so the result is acceptable. // LogMessageCreate(Logging.LogMessageText.RESPONSE.AnyResolutionSucceded(response.AnswerRecords)); // } // else // { // // maybe CNAME // } // } //} #endregion #region private private Results.ResolutionResult Request(NameServerCollection authorities, out bool isCompleted) { // perform name server request DnsClient.Request request; IPAddress address = authorities.Selected.GetFirstAddress(Resolver.Options.IPVersion); DnsClient.Response response = Resolver.LookUp(address, Question, out request); Results.ResolutionResult result = new Results.ResolutionResult(this.NestingLevel, request, response, authorities); // "Request took {0}ms." LogMessageCreate(Logging.LogMessageText.RESPONSE.INFO.RequestDuration(result.Duration.TotalMilliseconds)); if (response.Header.AA) { // authoritative response isCompleted = true; } else { // [RFC 1035] // Name Error - Meaningful only for responses from an authoritative name server, // this code signifies that the domain name referenced in the query does not exist. // stop if the response was any other than NoError or NameError isCompleted = !( response.Header.RCODE == DnsClient.DNS.RCODE.NoError || response.Header.RCODE == DnsClient.DNS.RCODE.NameError); } return(result); }
internal ResolutionResult(int nestingLevel, DnsClient.Request request, DnsClient.Response response, NameServerCollection authorities) { this.NestingLevel = nestingLevel; this.Request = request; this.Response = response; _Authorities = authorities; }
internal ResolutionResult(int nestingLevel, DnsClient.Request request, DnsClient.Response response, NameServerCollection authorities) { this.NestingLevel = nestingLevel; this.Request = request; this.Response = response; _Authorities = authorities; }
protected virtual void OnResolutionSucceeded(DnsClient.Response response, IEnumerable <DnsClient.DNS.RR> matching) { foreach (DnsClient.DNS.RR rr in matching) { Logging.LogMessage message; // try to find logging method by QTYPE string methodName = String.Format( "ResourceRecordFound{0}", rr.Base.TYPE.ToString()); MethodInfo method; if (!object.ReferenceEquals(null, (method = typeof( Logging.LogMessageText.RESPONSE.INFO).GetMethod(methodName, BindingFlags.Static | BindingFlags.Public)))) { message = (Logging.LogMessage)method.Invoke(null, new object[] { response, rr }); } else { message = Logging.LogMessageText.RESPONSE.INFO.ResourceRecordFound(response, rr); } LogMessageCreate(message); } }
protected virtual void OnMissingRecords(DnsClient.Response response) { // "No Resource Record of type {0} was found." LogMessageCreate(Logging.LogMessageText.RESPONSE.ERROR.MissingRecords(Question)); }
internal AddressResolutionResult(int nestingLevel, DnsClient.Request request, DnsClient.Response response, NameServerCollection authorities) : base(nestingLevel, request, response, authorities) { }
public QueryProcessor(DnsDomain sname, DnsClient.DNS.QTYPE stype, DnsClient.Response response) { this.SNAME = sname; this.STYPE = stype; this.Response = response; }
public QueryProcessor(DnsDomain sname, DnsClient.DNS.QTYPE stype, DnsClient.Response response) { this.SNAME = sname; this.STYPE = stype; this.Response = response; }
public static LogMessage ResourceRecordFoundNS(DnsClient.Response response, DnsClient.DNS.Records.NS rr) { return(Create(Resources.LogMessages.ResourceRecordFoundNS, new object[] { (DnsDomain)rr.NSDNAME })); }
public static LogMessage ResourceRecordFoundPTR(DnsClient.Response response, DnsClient.DNS.Records.PTR rr) { return(Create(Resources.LogMessages.ResourceRecordFoundPTR, new object[] { (DnsDomain)rr.Base.NAME, (DnsDomain)rr.PTRDNAME })); }
public static LogMessage ResourceRecordFoundAAAA(DnsClient.Response response, DnsClient.DNS.Records.AAAA rr) { return(Create(Resources.LogMessages.ResourceRecordFoundAAAA, new object[] { (DnsDomain)rr.Base.NAME, rr.ADDRESS })); }
public static LogMessage ResourceRecordFound(DnsClient.Response response, DnsClient.DNS.RR rr) { return(Create(Resources.LogMessages.ResourceRecordFound, new object[] { rr.Base.TYPE, (DnsDomain)rr.Base.NAME })); }