Package io.netty.handler.codec.dns
Class DatagramDnsResponse
- java.lang.Object
-
- io.netty.util.AbstractReferenceCounted
-
- io.netty.handler.codec.dns.AbstractDnsMessage
-
- io.netty.handler.codec.dns.DefaultDnsResponse
-
- io.netty.handler.codec.dns.DatagramDnsResponse
-
- All Implemented Interfaces:
AddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>,DnsMessage,DnsResponse,ReferenceCounted
public class DatagramDnsResponse extends DefaultDnsResponse implements AddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>
ADnsResponseimplementation for UDP/IP.
-
-
Constructor Summary
Constructors Constructor Description DatagramDnsResponse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, int id)DatagramDnsResponse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, int id, DnsOpCode opCode)Creates a new instance with theDnsResponseCode.NOERRORresponseCode.DatagramDnsResponse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, int id, DnsOpCode opCode, DnsResponseCode responseCode)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DatagramDnsResponseaddRecord(DnsSection section, int index, DnsRecord record)Adds the specifiedrecordat the specifiedindexof the specifiedsectionof this DNS message.DatagramDnsResponseaddRecord(DnsSection section, DnsRecord record)Adds the specifiedrecordat the end of the specifiedsectionof this DNS message.DatagramDnsResponseclear()Removes all the records in this DNS message.DatagramDnsResponseclear(DnsSection section)Removes all the records in the specifiedsectionof this DNS message.DatagramDnsResponsecontent()Returns the message wrapped by this envelope message.booleanequals(java.lang.Object obj)inthashCode()java.net.InetSocketAddressrecipient()Returns the address of the recipient of this message.DatagramDnsResponseretain()Increases the reference count by1.DatagramDnsResponseretain(int increment)Increases the reference count by the specifiedincrement.java.net.InetSocketAddresssender()Returns the address of the sender of this message.DatagramDnsResponsesetAuthoritativeAnswer(boolean authoritativeAnswer)Set totrueif responding server is authoritative for the domain name in the query message.DatagramDnsResponsesetCode(DnsResponseCode code)Sets the response code for this message.DatagramDnsResponsesetId(int id)Sets theIDof this DNS message.DatagramDnsResponsesetOpCode(DnsOpCode opCode)Sets theopCodeof this DNS message.DatagramDnsResponsesetRecord(DnsSection section, DnsRecord record)Sets the specifiedsectionof this DNS message to the specifiedrecord, making it a single-record section.DatagramDnsResponsesetRecursionAvailable(boolean recursionAvailable)Set totrueif DNS server can handle recursive queries.DatagramDnsResponsesetRecursionDesired(boolean recursionDesired)Sets theRD(recursion desired} field of this DNS message.DatagramDnsResponsesetTruncated(boolean truncated)Set totrueif response has been truncated (usually happens for responses over 512 bytes).DatagramDnsResponsesetZ(int z)Sets theZ(reserved for future use) field of this DNS message.DatagramDnsResponsetouch()Records the current access location of this object for debugging purposes.DatagramDnsResponsetouch(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.DefaultDnsResponse
code, isAuthoritativeAnswer, isRecursionAvailable, isTruncated, toString
-
Methods inherited from class io.netty.handler.codec.dns.AbstractDnsMessage
count, count, deallocate, 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
-
DatagramDnsResponse
public DatagramDnsResponse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, int id)- Parameters:
sender- the address of the senderrecipient- the address of the recipientid- theIDof the DNS response
-
DatagramDnsResponse
public DatagramDnsResponse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, int id, DnsOpCode opCode)Creates a new instance with theDnsResponseCode.NOERRORresponseCode.- Parameters:
sender- the address of the senderrecipient- the address of the recipientid- theIDof the DNS responseopCode- theopCodeof the DNS response
-
DatagramDnsResponse
public DatagramDnsResponse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, int id, DnsOpCode opCode, DnsResponseCode responseCode)Creates a new instance.- Parameters:
sender- the address of the senderrecipient- the address of the recipientid- theIDof the DNS responseopCode- theopCodeof the DNS responseresponseCode- theRCODEof the DNS response
-
-
Method Detail
-
content
public DatagramDnsResponse content()
Description copied from interface:AddressedEnvelopeReturns the message wrapped by this envelope message.- Specified by:
contentin interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>
-
sender
public java.net.InetSocketAddress sender()
Description copied from interface:AddressedEnvelopeReturns the address of the sender of this message.- Specified by:
senderin interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>
-
recipient
public java.net.InetSocketAddress recipient()
Description copied from interface:AddressedEnvelopeReturns the address of the recipient of this message.- Specified by:
recipientin interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>
-
setAuthoritativeAnswer
public DatagramDnsResponse 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- Overrides:
setAuthoritativeAnswerin classDefaultDnsResponse- Parameters:
authoritativeAnswer- flag for authoritative answer
-
setTruncated
public DatagramDnsResponse setTruncated(boolean truncated)
Description copied from interface:DnsResponseSet totrueif response has been truncated (usually happens for responses over 512 bytes).- Specified by:
setTruncatedin interfaceDnsResponse- Overrides:
setTruncatedin classDefaultDnsResponse- Parameters:
truncated- flag for truncation
-
setRecursionAvailable
public DatagramDnsResponse setRecursionAvailable(boolean recursionAvailable)
Description copied from interface:DnsResponseSet totrueif DNS server can handle recursive queries.- Specified by:
setRecursionAvailablein interfaceDnsResponse- Overrides:
setRecursionAvailablein classDefaultDnsResponse- Parameters:
recursionAvailable- flag for recursion availability
-
setCode
public DatagramDnsResponse setCode(DnsResponseCode code)
Description copied from interface:DnsResponseSets the response code for this message.- Specified by:
setCodein interfaceDnsResponse- Overrides:
setCodein classDefaultDnsResponse- Parameters:
code- the response code
-
setId
public DatagramDnsResponse setId(int id)
Description copied from interface:DnsMessageSets theIDof this DNS message.- Specified by:
setIdin interfaceDnsMessage- Specified by:
setIdin interfaceDnsResponse- Overrides:
setIdin classDefaultDnsResponse
-
setOpCode
public DatagramDnsResponse setOpCode(DnsOpCode opCode)
Description copied from interface:DnsMessageSets theopCodeof this DNS message.- Specified by:
setOpCodein interfaceDnsMessage- Specified by:
setOpCodein interfaceDnsResponse- Overrides:
setOpCodein classDefaultDnsResponse
-
setRecursionDesired
public DatagramDnsResponse 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 classDefaultDnsResponse
-
setZ
public DatagramDnsResponse 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 classDefaultDnsResponse
-
setRecord
public DatagramDnsResponse 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 classDefaultDnsResponse
-
addRecord
public DatagramDnsResponse 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 classDefaultDnsResponse
-
addRecord
public DatagramDnsResponse 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 classDefaultDnsResponse
-
clear
public DatagramDnsResponse 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 classDefaultDnsResponse
-
clear
public DatagramDnsResponse clear()
Description copied from interface:DnsMessageRemoves all the records in this DNS message.- Specified by:
clearin interfaceDnsMessage- Specified by:
clearin interfaceDnsResponse- Overrides:
clearin classDefaultDnsResponse
-
touch
public DatagramDnsResponse 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 interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>- Specified by:
touchin interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classDefaultDnsResponse
-
touch
public DatagramDnsResponse 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 interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>- Specified by:
touchin interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceReferenceCounted- Overrides:
touchin classDefaultDnsResponse
-
retain
public DatagramDnsResponse retain()
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceDnsResponse- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classDefaultDnsResponse
-
retain
public DatagramDnsResponse retain(int increment)
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceAddressedEnvelope<DatagramDnsResponse,java.net.InetSocketAddress>- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceDnsResponse- Specified by:
retainin interfaceReferenceCounted- Overrides:
retainin classDefaultDnsResponse
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractDnsMessage
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDnsMessage
-
-