1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.handler.codec.dns;
17
18 import static io.netty.util.internal.ObjectUtil.checkNotNull;
19
20
21
22
23 public class DefaultDnsResponse extends AbstractDnsMessage implements DnsResponse {
24
25 private boolean authoritativeAnswer;
26 private boolean truncated;
27 private boolean recursionAvailable;
28 private DnsResponseCode code;
29
30
31
32
33
34
35
36 public DefaultDnsResponse(int id) {
37 this(id, DnsOpCode.QUERY, DnsResponseCode.NOERROR);
38 }
39
40
41
42
43
44
45
46 public DefaultDnsResponse(int id, DnsOpCode opCode) {
47 this(id, opCode, DnsResponseCode.NOERROR);
48 }
49
50
51
52
53
54
55
56
57 public DefaultDnsResponse(int id, DnsOpCode opCode, DnsResponseCode code) {
58 super(id, opCode);
59 setCode(code);
60 }
61
62 @Override
63 public boolean isAuthoritativeAnswer() {
64 return authoritativeAnswer;
65 }
66
67 @Override
68 public DnsResponse setAuthoritativeAnswer(boolean authoritativeAnswer) {
69 this.authoritativeAnswer = authoritativeAnswer;
70 return this;
71 }
72
73 @Override
74 public boolean isTruncated() {
75 return truncated;
76 }
77
78 @Override
79 public DnsResponse setTruncated(boolean truncated) {
80 this.truncated = truncated;
81 return this;
82 }
83
84 @Override
85 public boolean isRecursionAvailable() {
86 return recursionAvailable;
87 }
88
89 @Override
90 public DnsResponse setRecursionAvailable(boolean recursionAvailable) {
91 this.recursionAvailable = recursionAvailable;
92 return this;
93 }
94
95 @Override
96 public DnsResponseCode code() {
97 return code;
98 }
99
100 @Override
101 public DnsResponse setCode(DnsResponseCode code) {
102 this.code = checkNotNull(code, "code");
103 return this;
104 }
105
106 @Override
107 public DnsResponse setId(int id) {
108 return (DnsResponse) super.setId(id);
109 }
110
111 @Override
112 public DnsResponse setOpCode(DnsOpCode opCode) {
113 return (DnsResponse) super.setOpCode(opCode);
114 }
115
116 @Override
117 public DnsResponse setRecursionDesired(boolean recursionDesired) {
118 return (DnsResponse) super.setRecursionDesired(recursionDesired);
119 }
120
121 @Override
122 public DnsResponse setZ(int z) {
123 return (DnsResponse) super.setZ(z);
124 }
125
126 @Override
127 public DnsResponse setRecord(DnsSection section, DnsRecord record) {
128 return (DnsResponse) super.setRecord(section, record);
129 }
130
131 @Override
132 public DnsResponse addRecord(DnsSection section, DnsRecord record) {
133 return (DnsResponse) super.addRecord(section, record);
134 }
135
136 @Override
137 public DnsResponse addRecord(DnsSection section, int index, DnsRecord record) {
138 return (DnsResponse) super.addRecord(section, index, record);
139 }
140
141 @Override
142 public DnsResponse clear(DnsSection section) {
143 return (DnsResponse) super.clear(section);
144 }
145
146 @Override
147 public DnsResponse clear() {
148 return (DnsResponse) super.clear();
149 }
150
151 @Override
152 public DnsResponse touch() {
153 return (DnsResponse) super.touch();
154 }
155
156 @Override
157 public DnsResponse touch(Object hint) {
158 return (DnsResponse) super.touch(hint);
159 }
160
161 @Override
162 public DnsResponse retain() {
163 return (DnsResponse) super.retain();
164 }
165
166 @Override
167 public DnsResponse retain(int increment) {
168 return (DnsResponse) super.retain(increment);
169 }
170
171 @Override
172 public String toString() {
173 return DnsMessageUtil.appendResponse(new StringBuilder(128), this).toString();
174 }
175 }