-
- All Superinterfaces:
ReferenceCounted
- All Known Subinterfaces:
DnsQuery
,DnsResponse
- All Known Implementing Classes:
AbstractDnsMessage
,DatagramDnsQuery
,DatagramDnsResponse
,DefaultDnsQuery
,DefaultDnsResponse
@UnstableApi public interface DnsMessage extends ReferenceCounted
The superclass which contains core information concerning aDnsQuery
and aDnsResponse
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DnsMessage
addRecord(DnsSection section, int index, DnsRecord record)
Adds the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message.DnsMessage
addRecord(DnsSection section, DnsRecord record)
Adds the specifiedrecord
at the end of the specifiedsection
of this DNS message.DnsMessage
clear()
Removes all the records in this DNS message.DnsMessage
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
isRecursionDesired()
Returns theRD
(recursion desired} field of this DNS message.DnsOpCode
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.DnsMessage
retain()
Increases the reference count by1
.DnsMessage
retain(int increment)
Increases the reference count by the specifiedincrement
.DnsMessage
setId(int id)
Sets theID
of this DNS message.DnsMessage
setOpCode(DnsOpCode opCode)
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.DnsMessage
setRecord(DnsSection section, DnsRecord record)
Sets the specifiedsection
of this DNS message to the specifiedrecord
, making it a single-record section.DnsMessage
setRecursionDesired(boolean recursionDesired)
Sets theRD
(recursion desired} field of this DNS message.DnsMessage
setZ(int z)
Sets theZ
(reserved for future use) field of this DNS message.DnsMessage
touch()
Records the current access location of this object for debugging purposes.DnsMessage
touch(Object hint)
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.netty5.util.ReferenceCounted
refCnt, release, release
-
-
-
-
Method Detail
-
id
int id()
Returns theID
of this DNS message.
-
setId
DnsMessage setId(int id)
Sets theID
of this DNS message.
-
opCode
DnsOpCode opCode()
Returns theopCode
of this DNS message.
-
setOpCode
DnsMessage setOpCode(DnsOpCode opCode)
Sets theopCode
of this DNS message.
-
isRecursionDesired
boolean isRecursionDesired()
Returns theRD
(recursion desired} field of this DNS message.
-
setRecursionDesired
DnsMessage setRecursionDesired(boolean recursionDesired)
Sets theRD
(recursion desired} field of this DNS message.
-
z
int z()
Returns theZ
(reserved for future use) field of this DNS message.
-
setZ
DnsMessage setZ(int z)
Sets theZ
(reserved for future use) field of this DNS message.
-
count
int count(DnsSection section)
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
<T extends DnsRecord> T recordAt(DnsSection section)
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
<T extends DnsRecord> T recordAt(DnsSection section, int index)
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
DnsMessage setRecord(DnsSection section, DnsRecord record)
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
<T extends DnsRecord> T setRecord(DnsSection section, int index, DnsRecord record)
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
DnsMessage addRecord(DnsSection section, DnsRecord record)
Adds the specifiedrecord
at the end of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
.
-
addRecord
DnsMessage addRecord(DnsSection section, int index, DnsRecord record)
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
<T extends DnsRecord> T removeRecord(DnsSection section, int index)
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
DnsMessage clear(DnsSection section)
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
DnsMessage touch(Object hint)
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
DnsMessage retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceReferenceCounted
-
-