Package io.netty.handler.codec.dns
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
public class DefaultDnsResponse extends AbstractDnsMessage implements DnsResponse
The defaultDnsResponseimplementation.
-
-
Constructor Summary
Constructors Constructor Description DefaultDnsResponse(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DnsResponseaddRecord(DnsSection section, int index, DnsRecord record)Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.DnsResponseaddRecord(DnsSection section, DnsRecord record)Adds the specifiedrecordat the end of the specifiedsectionof this DNS message.DnsResponseclear()Removes all the records in this DNS message.DnsResponseclear(DnsSection section)Removes all the records in the specifiedsectionof this DNS message.DnsResponseCodecode()Returns the 4 bit return code.booleanisAuthoritativeAnswer()Returnstrueif responding server is authoritative for the domain name in the query message.booleanisRecursionAvailable()Returnstrueif DNS server can handle recursive queries.booleanisTruncated()Returnstrueif response has been truncated, usually if it is over 512 bytes.DnsResponseretain()Increases the reference count by1.DnsResponseretain(int increment)Increases the reference count by the specifiedincrement.DnsResponsesetAuthoritativeAnswer(boolean authoritativeAnswer)Set totrueif responding server is authoritative for the domain name in the query message.DnsResponsesetCode(DnsResponseCode code)Sets the response code for this message.DnsResponsesetId(int id)Sets theIDof this DNS message.DnsResponsesetOpCode(DnsOpCode opCode)Sets theopCodeof this DNS message.DnsResponsesetRecord(DnsSection section, DnsRecord record)Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section.DnsResponsesetRecursionAvailable(boolean recursionAvailable)Set totrueif DNS server can handle recursive queries.DnsResponsesetRecursionDesired(boolean recursionDesired)Sets theRD(recursion desired} field of this DNS message.DnsResponsesetTruncated(boolean truncated)Set totrueif response has been truncated (usually happens for responses over 512 bytes).DnsResponsesetZ(int z)Sets theZ(reserved for future use) field of this DNS message.java.lang.StringtoString()DnsResponsetouch()Records the current access location of this object for debugging purposes.DnsResponsetouch(java.lang.Object hint)Records the current access location of this object with an additional arbitrary information for debugging purposes.-
Methods inherited from class io.netty.handler.codec.dns.AbstractDnsMessage
count, count, deallocate, equals, hashCode, id, isRecursionDesired, opCode, recordAt, recordAt, removeRecord, setRecord, z
-
Methods inherited from class io.netty.util.AbstractReferenceCounted
refCnt, release, release, setRefCnt
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.handler.codec.dns.DnsMessage
count, count, id, isRecursionDesired, opCode, recordAt, recordAt, removeRecord, setRecord, z
-
Methods inherited from interface io.netty.util.ReferenceCounted
refCnt, release, release
-
-
-
-
Constructor Detail
-
DefaultDnsResponse
public DefaultDnsResponse(int id)
- Parameters:
id- theIDof the DNS response
-
DefaultDnsResponse
public DefaultDnsResponse(int id, DnsOpCode opCode)Creates a new instance with theDnsResponseCode.NOERRORRCODE.- Parameters:
id- theIDof the DNS responseopCode- theopCodeof the DNS response
-
DefaultDnsResponse
public DefaultDnsResponse(int id, DnsOpCode opCode, DnsResponseCode code)Creates a new instance.- Parameters:
id- theIDof the DNS responseopCode- theopCodeof the DNS responsecode- theRCODEof the DNS response
-
-
Method Detail
-
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
public DnsResponse setAuthoritativeAnswer(boolean authoritativeAnswer)
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
public DnsResponse setTruncated(boolean truncated)
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
public DnsResponse setRecursionAvailable(boolean recursionAvailable)
Description copied from interface:DnsResponseSet totrueif DNS server can handle recursive queries.- Specified by:
setRecursionAvailablein interfaceDnsResponse- Parameters:
recursionAvailable- flag for recursion availability
-
code
public DnsResponseCode code()
Description copied from interface:DnsResponseReturns the 4 bit return code.- Specified by:
codein interfaceDnsResponse
-
setCode
public DnsResponse setCode(DnsResponseCode code)
Description copied from interface:DnsResponseSets the response code for this message.- Specified by:
setCodein interfaceDnsResponse- Parameters:
code- the response code
-
setId
public DnsResponse setId(int id)
Description copied from interface:DnsMessageSets theIDof this DNS message.- Specified by:
setIdin interfaceDnsMessage- Specified by:
setIdin interfaceDnsResponse- Overrides:
setIdin classAbstractDnsMessage
-
setOpCode
public DnsResponse setOpCode(DnsOpCode opCode)
Description copied from interface:DnsMessageSets theopCodeof this DNS message.- Specified by:
setOpCodein interfaceDnsMessage- Specified by:
setOpCodein interfaceDnsResponse- Overrides:
setOpCodein classAbstractDnsMessage
-
setRecursionDesired
public DnsResponse setRecursionDesired(boolean recursionDesired)
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
public DnsResponse setZ(int z)
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
public DnsResponse setRecord(DnsSection section, DnsRecord record)
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
public DnsResponse addRecord(DnsSection section, DnsRecord record)
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
public DnsResponse addRecord(DnsSection section, int index, DnsRecord record)
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
public DnsResponse clear(DnsSection section)
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
public DnsResponse 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
public DnsResponse 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
public DnsResponse touch(java.lang.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 interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classAbstractDnsMessage
-
retain
public DnsResponse 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
public DnsResponse retain(int increment)
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-