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:
io.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>,DnsMessage,DnsResponse,io.netty.util.ReferenceCounted
public class DatagramDnsResponse extends DefaultDnsResponse implements io.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
ADnsResponseimplementation for UDP/IP.
-
-
Constructor Summary
Constructors Constructor Description DatagramDnsResponse(InetSocketAddress sender, InetSocketAddress recipient, int id)DatagramDnsResponse(InetSocketAddress sender, InetSocketAddress recipient, int id, DnsOpCode opCode)Creates a new instance with theDnsResponseCode.NOERRORresponseCode.DatagramDnsResponse(InetSocketAddress sender, 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()booleanequals(Object obj)inthashCode()InetSocketAddressrecipient()DatagramDnsResponseretain()DatagramDnsResponseretain(int increment)InetSocketAddresssender()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()DatagramDnsResponsetouch(Object hint)-
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
-
-
-
-
Constructor Detail
-
DatagramDnsResponse
public DatagramDnsResponse(InetSocketAddress sender, InetSocketAddress recipient, int id)
- Parameters:
sender- the address of the senderrecipient- the address of the recipientid- theIDof the DNS response
-
DatagramDnsResponse
public DatagramDnsResponse(InetSocketAddress sender, 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(InetSocketAddress sender, 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()
- Specified by:
contentin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
-
sender
public InetSocketAddress sender()
- Specified by:
senderin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
-
recipient
public InetSocketAddress recipient()
- Specified by:
recipientin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,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()
- Specified by:
touchin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>- Specified by:
touchin interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceio.netty.util.ReferenceCounted- Overrides:
touchin classDefaultDnsResponse
-
touch
public DatagramDnsResponse touch(Object hint)
- Specified by:
touchin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>- Specified by:
touchin interfaceDnsMessage- Specified by:
touchin interfaceDnsResponse- Specified by:
touchin interfaceio.netty.util.ReferenceCounted- Overrides:
touchin classDefaultDnsResponse
-
retain
public DatagramDnsResponse retain()
- Specified by:
retainin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceDnsResponse- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Overrides:
retainin classDefaultDnsResponse
-
retain
public DatagramDnsResponse retain(int increment)
- Specified by:
retainin interfaceio.netty.channel.AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>- Specified by:
retainin interfaceDnsMessage- Specified by:
retainin interfaceDnsResponse- Specified by:
retainin interfaceio.netty.util.ReferenceCounted- Overrides:
retainin classDefaultDnsResponse
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractDnsMessage
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDnsMessage
-
-