public final class DnsResponseHeader extends DnsHeader
OPCODE_IQUERY, OPCODE_QUERY, TYPE_QUERY, TYPE_RESPONSE
Constructor and Description |
---|
DnsResponseHeader(DnsMessage parent,
int id)
Constructor for a DNS packet response header.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isAuthoritativeAnswer()
Returns
true if responding server is authoritative for the domain
name in the query message. |
boolean |
isRecursionAvailable()
Returns
true if DNS server can handle recursive queries. |
boolean |
isTruncated()
Returns
true if response has been truncated, usually if it is
over 512 bytes. |
DnsResponseCode |
responseCode()
Returns the 4 bit return code.
|
DnsResponseHeader |
setAuthoritativeAnswer(boolean authoritativeAnswer)
Set to
true if responding server is authoritative for the domain
name in the query message. |
DnsResponseHeader |
setId(int id)
Sets the id for this
DnsMessage . |
DnsResponseHeader |
setOpcode(int opcode)
Sets the opcode for this
DnsMessage . |
DnsResponseHeader |
setRecursionAvailable(boolean recursionAvailable)
Set to
true if DNS server can handle recursive queries. |
DnsHeader |
setRecursionDesired(boolean recursionDesired)
Sets whether a name server is directed to pursue a query recursively or
not.
|
DnsResponseHeader |
setResponseCode(DnsResponseCode responseCode)
Sets the response code for this message.
|
DnsResponseHeader |
setTruncated(boolean truncated)
Set to
true if response has been truncated (usually happens for
responses over 512 bytes). |
DnsResponseHeader |
setType(int type)
Sets the
DnsHeader type. |
DnsResponseHeader |
setZ(int z)
Sets the field Z.
|
int |
type()
Returns the
DnsMessage type. |
additionalResourceCount, answerCount, authorityResourceCount, id, isRecursionDesired, opcode, questionCount, z
public DnsResponseHeader(DnsMessage parent, int id)
DnsQuery
and is sent back to the client.parent
- the DnsMessage
this header belongs toid
- a 2 bit unsigned identification number received from clientpublic boolean isAuthoritativeAnswer()
true
if responding server is authoritative for the domain
name in the query message.public boolean isTruncated()
true
if response has been truncated, usually if it is
over 512 bytes.public boolean isRecursionAvailable()
true
if DNS server can handle recursive queries.public DnsResponseCode responseCode()
public int type()
DnsMessage
type. This will always return
TYPE_RESPONSE
.type
in class DnsHeader
DnsHeader.TYPE_QUERY
public DnsResponseHeader setAuthoritativeAnswer(boolean authoritativeAnswer)
true
if responding server is authoritative for the domain
name in the query message.authoritativeAnswer
- flag for authoritative answerpublic DnsResponseHeader setTruncated(boolean truncated)
true
if response has been truncated (usually happens for
responses over 512 bytes).truncated
- flag for truncationpublic DnsResponseHeader setRecursionAvailable(boolean recursionAvailable)
true
if DNS server can handle recursive queries.recursionAvailable
- flag for recursion availabilitypublic DnsResponseHeader setResponseCode(DnsResponseCode responseCode)
responseCode
- the response codepublic DnsResponseHeader setType(int type)
DnsHeader
type. Must be TYPE_RESPONSE
.public DnsResponseHeader setId(int id)
DnsHeader
DnsMessage
.public DnsHeader setRecursionDesired(boolean recursionDesired)
DnsHeader
setRecursionDesired
in class DnsHeader
recursionDesired
- if set to true
, pursues query recursivelypublic DnsResponseHeader setOpcode(int opcode)
DnsHeader
DnsMessage
.public DnsResponseHeader setZ(int z)
DnsHeader
Copyright © 2008–2015 The Netty Project. All rights reserved.