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  /**
19   * A DNS response message.
20   */
21  public interface DnsResponse extends DnsMessage {
22  
23      /**
24       * Returns {@code true} if responding server is authoritative for the domain
25       * name in the query message.
26       */
27      boolean isAuthoritativeAnswer();
28  
29      /**
30       * Set to {@code true} if responding server is authoritative for the domain
31       * name in the query message.
32       *
33       * @param authoritativeAnswer flag for authoritative answer
34       */
35      DnsResponse setAuthoritativeAnswer(boolean authoritativeAnswer);
36  
37      /**
38       * Returns {@code true} if response has been truncated, usually if it is
39       * over 512 bytes.
40       */
41      boolean isTruncated();
42  
43      /**
44       * Set to {@code true} if response has been truncated (usually happens for
45       * responses over 512 bytes).
46       *
47       * @param truncated flag for truncation
48       */
49      DnsResponse setTruncated(boolean truncated);
50  
51      /**
52       * Returns {@code true} if DNS server can handle recursive queries.
53       */
54      boolean isRecursionAvailable();
55  
56      /**
57       * Set to {@code true} if DNS server can handle recursive queries.
58       *
59       * @param recursionAvailable flag for recursion availability
60       */
61      DnsResponse setRecursionAvailable(boolean recursionAvailable);
62  
63      /**
64       * Returns the 4 bit return code.
65       */
66      DnsResponseCode code();
67  
68      /**
69       * Sets the response code for this message.
70       *
71       * @param code the response code
72       */
73      DnsResponse setCode(DnsResponseCode code);
74  
75      @Override
76      DnsResponse setId(int id);
77  
78      @Override
79      DnsResponse setOpCode(DnsOpCode opCode);
80  
81      @Override
82      DnsResponse setRecursionDesired(boolean recursionDesired);
83  
84      @Override
85      DnsResponse setZ(int z);
86  
87      @Override
88      DnsResponse setRecord(DnsSection section, DnsRecord record);
89  
90      @Override
91      DnsResponse addRecord(DnsSection section, DnsRecord record);
92  
93      @Override
94      DnsResponse addRecord(DnsSection section, int index, DnsRecord record);
95  
96      @Override
97      DnsResponse clear(DnsSection section);
98  
99      @Override
100     DnsResponse clear();
101 
102     @Override
103     DnsResponse touch();
104 
105     @Override
106     DnsResponse touch(Object hint);
107 
108     @Override
109     DnsResponse retain();
110 
111     @Override
112     DnsResponse retain(int increment);
113 }