Package io.netty.handler.codec.dns
Interface DnsMessage
- All Superinterfaces:
ReferenceCounted
- All Known Subinterfaces:
DnsQuery
,DnsResponse
- All Known Implementing Classes:
AbstractDnsMessage
,DatagramDnsQuery
,DatagramDnsResponse
,DefaultDnsQuery
,DefaultDnsResponse
The superclass which contains core information concerning a
DnsQuery
and a DnsResponse
.-
Method Summary
Modifier and TypeMethodDescriptionaddRecord
(DnsSection section, int index, DnsRecord record) Adds the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message.addRecord
(DnsSection section, DnsRecord record) Adds the specifiedrecord
at the end of the specifiedsection
of this DNS message.clear()
Removes all the records in this DNS message.clear
(DnsSection section) Removes all the records in the specifiedsection
of this DNS message.int
count()
Returns the number of records in this DNS message.int
count
(DnsSection section) Returns the number of records in the specifiedsection
of this DNS message.int
id()
Returns theID
of this DNS message.boolean
Returns theRD
(recursion desired} field of this DNS message.opCode()
Returns theopCode
of this DNS message.<T extends DnsRecord>
TrecordAt
(DnsSection section) Returns the first record in the specifiedsection
of this DNS message.<T extends DnsRecord>
TrecordAt
(DnsSection section, int index) Returns the record at the specifiedindex
of the specifiedsection
of this DNS message.<T extends DnsRecord>
TremoveRecord
(DnsSection section, int index) Removes the record at the specifiedindex
of the specifiedsection
from this DNS message.retain()
Increases the reference count by1
.retain
(int increment) Increases the reference count by the specifiedincrement
.setId
(int id) Sets theID
of this DNS message.Sets theopCode
of this DNS message.<T extends DnsRecord>
TsetRecord
(DnsSection section, int index, DnsRecord record) Sets the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message.setRecord
(DnsSection section, DnsRecord record) Sets the specifiedsection
of this DNS message to the specifiedrecord
, making it a single-record section.setRecursionDesired
(boolean recursionDesired) Sets theRD
(recursion desired} field of this DNS message.setZ
(int z) Sets theZ
(reserved for future use) field of this DNS message.touch()
Records the current access location of this object for debugging purposes.Records the current access location of this object with an additional arbitrary information for debugging purposes.int
z()
Returns theZ
(reserved for future use) field of this DNS message.Methods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
Method Details
-
id
int id()Returns theID
of this DNS message. -
setId
Sets theID
of this DNS message. -
opCode
DnsOpCode opCode()Returns theopCode
of this DNS message. -
setOpCode
Sets theopCode
of this DNS message. -
isRecursionDesired
boolean isRecursionDesired()Returns theRD
(recursion desired} field of this DNS message. -
setRecursionDesired
Sets theRD
(recursion desired} field of this DNS message. -
z
int z()Returns theZ
(reserved for future use) field of this DNS message. -
setZ
Sets theZ
(reserved for future use) field of this DNS message. -
count
Returns the number of records in the specifiedsection
of this DNS message. -
count
int count()Returns the number of records in this DNS message. -
recordAt
Returns the first record in the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the type of the returned record is alwaysDnsQuestion
.- Returns:
null
if this message doesn't have any records in the specifiedsection
-
recordAt
Returns the record at the specifiedindex
of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the type of the returned record is alwaysDnsQuestion
.- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is out of bounds
-
setRecord
Sets the specifiedsection
of this DNS message to the specifiedrecord
, making it a single-record section. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
. -
setRecord
Sets the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
.- Returns:
- the old record
- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is out of bounds
-
addRecord
Adds the specifiedrecord
at the end of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
. -
addRecord
Adds the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
.- Throws:
IndexOutOfBoundsException
- if the specifiedindex
is out of bounds
-
removeRecord
Removes the record at the specifiedindex
of the specifiedsection
from this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the type of the returned record is alwaysDnsQuestion
.- Returns:
- the removed record
-
clear
Removes all the records in the specifiedsection
of this DNS message. -
clear
DnsMessage clear()Removes all the records in this DNS message. -
touch
DnsMessage touch()Description copied from interface:ReferenceCounted
Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCounted
Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
.- Specified by:
touch
in interfaceReferenceCounted
-
retain
DnsMessage retain()Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceReferenceCounted
-