Debian Codegraph @

minidns-iterative-resolver/src/main/java/org/minidns/iterative/IterativeClientException.java

raw
1 /*
2 * Copyright 2015-2020 the original author or authors
3 *
4 * This software is licensed under the Apache License, Version 2.0,
5 * the GNU Lesser General Public License version 2 or later ("LGPL")
6 * and the WTFPL.
7 * You may choose either license to govern your use of this software only
8 * upon the condition that you accept all of the terms of either
9 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
10 */
11 package org.minidns.iterative;
12
13 import java.net.InetAddress;
14
15 import org.minidns.MiniDnsException;
16 import org.minidns.dnsmessage.DnsMessage;
17 import org.minidns.dnsmessage.Question;
18 import org.minidns.dnsname.DnsName;
19 import org.minidns.dnsqueryresult.DnsQueryResult;
20
21 public abstract class IterativeClientException extends MiniDnsException {
22
23 /**
24 *
25 */
26 private static final long serialVersionUID = 1L;
27
28 protected IterativeClientException(String message) {
29 super(message);
30 }
31
32 public static class LoopDetected extends IterativeClientException {
33
34 /**
35 *
36 */
37 private static final long serialVersionUID = 1L;
38
39 public final InetAddress address;
40 public final Question question;
41
42 public LoopDetected(InetAddress address, Question question) {
43 super("Resolution loop detected: We already asked " + address + " about " + question);
44 this.address = address;
45 this.question = question;
46 }
47
48 }
49
50 public static class MaxIterativeStepsReached extends IterativeClientException {
51
52 /**
53 *
54 */
55 private static final long serialVersionUID = 1L;
56
57 public MaxIterativeStepsReached() {
58 super("Maxmimum steps reached");
59 }
60
61 }
62
63 public static class NotAuthoritativeNorGlueRrFound extends IterativeClientException {
64
65 /**
66 *
67 */
68 private static final long serialVersionUID = 1L;
69
70 private final DnsMessage request;
71 private final DnsQueryResult result;
72 private final DnsName authoritativeZone;
73
74 public NotAuthoritativeNorGlueRrFound(DnsMessage request, DnsQueryResult result, DnsName authoritativeZone) {
75 super("Did not receive an authoritative answer, nor did the result contain any glue records");
76 this.request = request;
77 this.result = result;
78 this.authoritativeZone = authoritativeZone;
79 }
80
81 public DnsMessage getRequest() {
82 return request;
83 }
84
85 public DnsQueryResult getResult() {
86 return result;
87 }
88
89 public DnsName getAuthoritativeZone() {
90 return authoritativeZone;
91 }
92 }
93 }