-
- 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 aDnsQueryand aDnsResponse.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DnsMessageaddRecord(DnsSection section, int index, DnsRecord record)Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.DnsMessageaddRecord(DnsSection section, DnsRecord record)Adds the specifiedrecordat the end of the specifiedsectionof this DNS message.DnsMessageclear()Removes all the records in this DNS message.DnsMessageclear(DnsSection section)Removes all the records in the specifiedsectionof this DNS message.intcount()Returns the number of records in this DNS message.intcount(DnsSection section)Returns the number of records in the specifiedsectionof this DNS message.intid()Returns theIDof this DNS message.booleanisRecursionDesired()Returns theRD(recursion desired} field of this DNS message.DnsOpCodeopCode()Returns theopCodeof this DNS message.<T extends DnsRecord>
TrecordAt(DnsSection section)Returns the first record in the specifiedsectionof this DNS message.<T extends DnsRecord>
TrecordAt(DnsSection section, int index)Returns the record at the specifiedindexof the specifiedsectionof this DNS message.<T extends DnsRecord>
TremoveRecord(DnsSection section, int index)Removes the record at the specifiedindexof the specifiedsectionfrom this DNS message.DnsMessageretain()Increases the reference count by1.DnsMessageretain(int increment)Increases the reference count by the specifiedincrement.DnsMessagesetId(int id)Sets theIDof this DNS message.DnsMessagesetOpCode(DnsOpCode opCode)Sets theopCodeof this DNS message.<T extends DnsRecord>
TsetRecord(DnsSection section, int index, DnsRecord record)Sets the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.DnsMessagesetRecord(DnsSection section, DnsRecord record)Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section.DnsMessagesetRecursionDesired(boolean recursionDesired)Sets theRD(recursion desired} field of this DNS message.DnsMessagesetZ(int z)Sets theZ(reserved for future use) field of this DNS message.DnsMessagetouch()Records the current access location of this object for debugging purposes.DnsMessagetouch(Object hint)Records the current access location of this object with an additional arbitrary information for debugging purposes.intz()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 theIDof this DNS message.
-
setId
DnsMessage setId(int id)
Sets theIDof this DNS message.
-
opCode
DnsOpCode opCode()
Returns theopCodeof this DNS message.
-
setOpCode
DnsMessage setOpCode(DnsOpCode opCode)
Sets theopCodeof 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 specifiedsectionof 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 specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Returns:
nullif 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 specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Throws:
IndexOutOfBoundsException- if the specifiedindexis out of bounds
-
setRecord
DnsMessage setRecord(DnsSection section, DnsRecord record)
Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.
-
setRecord
<T extends DnsRecord> T setRecord(DnsSection section, int index, DnsRecord record)
Sets the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Returns:
- the old record
- Throws:
IndexOutOfBoundsException- if the specifiedindexis out of bounds
-
addRecord
DnsMessage addRecord(DnsSection section, DnsRecord record)
Adds the specifiedrecordat the end of the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.
-
addRecord
DnsMessage addRecord(DnsSection section, int index, DnsRecord record)
Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Throws:
IndexOutOfBoundsException- if the specifiedindexis out of bounds
-
removeRecord
<T extends DnsRecord> T removeRecord(DnsSection section, int index)
Removes the record at the specifiedindexof the specifiedsectionfrom this DNS message. When the specifiedsectionisDnsSection.QUESTION, the type of the returned record is alwaysDnsQuestion.- Returns:
- the removed record
-
clear
DnsMessage clear(DnsSection section)
Removes all the records in the specifiedsectionof this DNS message.
-
clear
DnsMessage clear()
Removes all the records in this DNS message.
-
touch
DnsMessage touch()
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceReferenceCounted
-
touch
DnsMessage touch(Object hint)
Description copied from interface:ReferenceCountedRecords 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:
touchin interfaceReferenceCounted
-
retain
DnsMessage retain()
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceReferenceCounted
-
retain
DnsMessage retain(int increment)
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceReferenceCounted
-
-