Class DefaultDnsResponse
java.lang.Object
io.netty.util.AbstractReferenceCounted
io.netty.handler.codec.dns.AbstractDnsMessage
io.netty.handler.codec.dns.DefaultDnsResponse
- All Implemented Interfaces:
DnsMessage, DnsResponse, ReferenceCounted
- Direct Known Subclasses:
DatagramDnsResponse
The default
DnsResponse implementation.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultDnsResponse(int id) DefaultDnsResponse(int id, DnsOpCode opCode) Creates a new instance with theDnsResponseCode.NOERRORRCODE.DefaultDnsResponse(int id, DnsOpCode opCode, DnsResponseCode code) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddRecord(DnsSection section, int index, DnsRecord record) Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.addRecord(DnsSection section, DnsRecord record) Adds the specifiedrecordat the end of the specifiedsectionof this DNS message.clear()Removes all the records in this DNS message.clear(DnsSection section) Removes all the records in the specifiedsectionof this DNS message.code()Returns the 4 bit return code.booleanReturnstrueif responding server is authoritative for the domain name in the query message.booleanReturnstrueif DNS server can handle recursive queries.booleanReturnstrueif response has been truncated, usually if it is over 512 bytes.retain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.setAuthoritativeAnswer(boolean authoritativeAnswer) Set totrueif responding server is authoritative for the domain name in the query message.setCode(DnsResponseCode code) Sets the response code for this message.setId(int id) Sets theIDof this DNS message.Sets theopCodeof this DNS message.setRecord(DnsSection section, DnsRecord record) Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section.setRecursionAvailable(boolean recursionAvailable) Set totrueif DNS server can handle recursive queries.setRecursionDesired(boolean recursionDesired) Sets theRD(recursion desired} field of this DNS message.setTruncated(boolean truncated) Set totrueif response has been truncated (usually happens for responses over 512 bytes).setZ(int z) Sets theZ(reserved for future use) field of this DNS message.toString()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.Methods inherited from class AbstractDnsMessage
count, count, deallocate, equals, hashCode, id, isRecursionDesired, opCode, recordAt, recordAt, removeRecord, setRecord, zModifier and TypeMethodDescriptionintcount()Returns the number of records in this DNS message.intcount(DnsSection section) Returns the number of records in the specifiedsectionof this DNS message.protected voidCalled onceAbstractReferenceCounted.refCnt()is equals 0.booleaninthashCode()intid()Returns theIDof this DNS message.booleanReturns theRD(recursion desired} field of this DNS message.opCode()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.<T extends DnsRecord>
TsetRecord(DnsSection section, int index, DnsRecord record) Sets the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.intz()Returns theZ(reserved for future use) field of this DNS message.Methods inherited from class AbstractReferenceCounted
refCnt, release, release, setRefCntModifier and TypeMethodDescriptionintrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement) Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.protected voidsetRefCnt(int refCnt) An unsafe operation intended for use by a subclass that sets the reference count of the object directly
-
Constructor Details
-
DefaultDnsResponse
public DefaultDnsResponse(int id) - Parameters:
id- theIDof the DNS response
-
DefaultDnsResponse
Creates a new instance with theDnsResponseCode.NOERRORRCODE.- Parameters:
id- theIDof the DNS responseopCode- theopCodeof the DNS response
-
DefaultDnsResponse
Creates a new instance.- Parameters:
id- theIDof the DNS responseopCode- theopCodeof the DNS responsecode- theRCODEof the DNS response
-
-
Method Details
-
isAuthoritativeAnswer
public boolean isAuthoritativeAnswer()Description copied from interface:DnsResponseReturnstrueif responding server is authoritative for the domain name in the query message.- Specified by:
isAuthoritativeAnswerin interfaceDnsResponse
-
setAuthoritativeAnswer
Description copied from interface:DnsResponseSet totrueif responding server is authoritative for the domain name in the query message.- Specified by:
setAuthoritativeAnswerin interfaceDnsResponse- Parameters:
authoritativeAnswer- flag for authoritative answer
-
isTruncated
public boolean isTruncated()Description copied from interface:DnsResponseReturnstrueif response has been truncated, usually if it is over 512 bytes.- Specified by:
isTruncatedin interfaceDnsResponse
-
setTruncated
Description copied from interface:DnsResponseSet totrueif response has been truncated (usually happens for responses over 512 bytes).- Specified by:
setTruncatedin interfaceDnsResponse- Parameters:
truncated- flag for truncation
-
isRecursionAvailable
public boolean isRecursionAvailable()Description copied from interface:DnsResponseReturnstrueif DNS server can handle recursive queries.- Specified by:
isRecursionAvailablein interfaceDnsResponse
-
setRecursionAvailable
Description copied from interface:DnsResponseSet totrueif DNS server can handle recursive queries.- Specified by:
setRecursionAvailablein interfaceDnsResponse- Parameters:
recursionAvailable- flag for recursion availability
-
code
Description copied from interface:DnsResponseReturns the 4 bit return code.- Specified by:
codein interfaceDnsResponse
-
setCode
Description copied from interface:DnsResponseSets the response code for this message.- Specified by:
setCodein interfaceDnsResponse- Parameters:
code- the response code
-
setId
Description copied from interface:DnsMessageSets theIDof this DNS message.- Specified by:
setIdin interfaceDnsMessage- Specified by:
setIdin interfaceDnsResponse- Overrides:
setIdin classAbstractDnsMessage
-
setOpCode
Description copied from interface:DnsMessageSets theopCodeof this DNS message.- Specified by:
setOpCodein interfaceDnsMessage- Specified by:
setOpCodein interfaceDnsResponse- Overrides:
setOpCodein classAbstractDnsMessage
-
setRecursionDesired
Description copied from interface:DnsMessageSets theRD(recursion desired} field of this DNS message.- Specified by:
setRecursionDesiredin interfaceDnsMessage- Specified by:
setRecursionDesiredin interfaceDnsResponse- Overrides:
setRecursionDesiredin classAbstractDnsMessage
-
setZ
Description copied from interface:DnsMessageSets theZ(reserved for future use) field of this DNS message.- Specified by:
setZin interfaceDnsMessage- Specified by:
setZin interfaceDnsResponse- Overrides:
setZin classAbstractDnsMessage
-
setRecord
Description copied from interface:DnsMessageSets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
setRecordin interfaceDnsMessage- Specified by:
setRecordin interfaceDnsResponse- Overrides:
setRecordin classAbstractDnsMessage
-
addRecord
Description copied from interface:DnsMessageAdds the specifiedrecordat the end of the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
addRecordin interfaceDnsMessage- Specified by:
addRecordin interfaceDnsResponse- Overrides:
addRecordin classAbstractDnsMessage
-
addRecord
Description copied from interface:DnsMessageAdds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message. When the specifiedsectionisDnsSection.QUESTION, the specifiedrecordmust be aDnsQuestion.- Specified by:
addRecordin interfaceDnsMessage- Specified by:
addRecordin interfaceDnsResponse- Overrides:
addRecordin classAbstractDnsMessage
-
clear
Description copied from interface:DnsMessageRemoves all the records in the specifiedsectionof this DNS message.- Specified by:
clearin interfaceDnsMessage- Specified by:
clearin interfaceDnsResponse- Overrides:
clearin classAbstractDnsMessage
-
clear
Description copied from interface:DnsMessageRemoves all the records in this DNS message.- Specified by:
clearin interfaceDnsMessage- Specified by:
clearin interfaceDnsResponse- Overrides:
clearin classAbstractDnsMessage
-
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 interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classAbstractDnsMessage
-
touch
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 interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classAbstractDnsMessage
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceDnsResponse- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractDnsMessage
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceDnsResponse- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classAbstractDnsMessage
-
toString
-