View Javadoc
1   /*
2    * Copyright 2015 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec.dns;
17  
18  import io.netty.util.internal.UnstableApi;
19  
20  /**
21   * A DNS response message.
22   */
23  @UnstableApi
24  public interface DnsResponse extends DnsMessage {
25  
26      /**
27       * Returns {@code true} if responding server is authoritative for the domain
28       * name in the query message.
29       */
30      boolean isAuthoritativeAnswer();
31  
32      /**
33       * Set to {@code true} if responding server is authoritative for the domain
34       * name in the query message.
35       *
36       * @param authoritativeAnswer flag for authoritative answer
37       */
38      DnsResponse setAuthoritativeAnswer(boolean authoritativeAnswer);
39  
40      /**
41       * Returns {@code true} if response has been truncated, usually if it is
42       * over 512 bytes.
43       */
44      boolean isTruncated();
45  
46      /**
47       * Set to {@code true} if response has been truncated (usually happens for
48       * responses over 512 bytes).
49       *
50       * @param truncated flag for truncation
51       */
52      DnsResponse setTruncated(boolean truncated);
53  
54      /**
55       * Returns {@code true} if DNS server can handle recursive queries.
56       */
57      boolean isRecursionAvailable();
58  
59      /**
60       * Set to {@code true} if DNS server can handle recursive queries.
61       *
62       * @param recursionAvailable flag for recursion availability
63       */
64      DnsResponse setRecursionAvailable(boolean recursionAvailable);
65  
66      /**
67       * Returns the 4 bit return code.
68       */
69      DnsResponseCode code();
70  
71      /**
72       * Sets the response code for this message.
73       *
74       * @param code the response code
75       */
76      DnsResponse setCode(DnsResponseCode code);
77  
78      @Override
79      DnsResponse setId(int id);
80  
81      @Override
82      DnsResponse setOpCode(DnsOpCode opCode);
83  
84      @Override
85      DnsResponse setRecursionDesired(boolean recursionDesired);
86  
87      @Override
88      DnsResponse setZ(int z);
89  
90      @Override
91      DnsResponse setRecord(DnsSection section, DnsRecord record);
92  
93      @Override
94      DnsResponse addRecord(DnsSection section, DnsRecord record);
95  
96      @Override
97      DnsResponse addRecord(DnsSection section, int index, DnsRecord record);
98  
99      @Override
100     DnsResponse clear(DnsSection section);
101 
102     @Override
103     DnsResponse clear();
104 
105     @Override
106     DnsResponse touch();
107 
108     @Override
109     DnsResponse touch(Object hint);
110 
111     @Override
112     DnsResponse retain();
113 
114     @Override
115     DnsResponse retain(int increment);
116 }