- java.lang.Object
-
- io.netty5.util.AbstractReferenceCounted
-
- io.netty5.handler.codec.dns.AbstractDnsMessage
-
- io.netty5.handler.codec.dns.DefaultDnsResponse
-
- io.netty5.handler.codec.dns.DatagramDnsResponse
-
- All Implemented Interfaces:
AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
,DnsMessage
,DnsResponse
,ReferenceCounted
@UnstableApi public class DatagramDnsResponse extends DefaultDnsResponse implements AddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
ADnsResponse
implementation 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.NOERROR
responseCode.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 DatagramDnsResponse
addRecord(DnsSection section, int index, DnsRecord record)
Adds the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message.DatagramDnsResponse
addRecord(DnsSection section, DnsRecord record)
Adds the specifiedrecord
at the end of the specifiedsection
of this DNS message.DatagramDnsResponse
clear()
Removes all the records in this DNS message.DatagramDnsResponse
clear(DnsSection section)
Removes all the records in the specifiedsection
of this DNS message.DatagramDnsResponse
content()
Returns the message wrapped by this envelope message.boolean
equals(Object obj)
int
hashCode()
InetSocketAddress
recipient()
Returns the address of the recipient of this message.DatagramDnsResponse
retain()
Increases the reference count by1
.DatagramDnsResponse
retain(int increment)
Increases the reference count by the specifiedincrement
.InetSocketAddress
sender()
Returns the address of the sender of this message.DatagramDnsResponse
setAuthoritativeAnswer(boolean authoritativeAnswer)
Set totrue
if responding server is authoritative for the domain name in the query message.DatagramDnsResponse
setCode(DnsResponseCode code)
Sets the response code for this message.DatagramDnsResponse
setId(int id)
Sets theID
of this DNS message.DatagramDnsResponse
setOpCode(DnsOpCode opCode)
Sets theopCode
of this DNS message.DatagramDnsResponse
setRecord(DnsSection section, DnsRecord record)
Sets the specifiedsection
of this DNS message to the specifiedrecord
, making it a single-record section.DatagramDnsResponse
setRecursionAvailable(boolean recursionAvailable)
Set totrue
if DNS server can handle recursive queries.DatagramDnsResponse
setRecursionDesired(boolean recursionDesired)
Sets theRD
(recursion desired} field of this DNS message.DatagramDnsResponse
setTruncated(boolean truncated)
Set totrue
if response has been truncated (usually happens for responses over 512 bytes).DatagramDnsResponse
setZ(int z)
Sets theZ
(reserved for future use) field of this DNS message.DatagramDnsResponse
touch()
Records the current access location of this object for debugging purposes.DatagramDnsResponse
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.-
Methods inherited from class io.netty5.handler.codec.dns.DefaultDnsResponse
code, isAuthoritativeAnswer, isRecursionAvailable, isTruncated, toString
-
Methods inherited from class io.netty5.handler.codec.dns.AbstractDnsMessage
count, count, deallocate, id, isRecursionDesired, opCode, recordAt, recordAt, removeRecord, setRecord, z
-
Methods inherited from class io.netty5.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.netty5.handler.codec.dns.DnsMessage
count, count, id, isRecursionDesired, opCode, recordAt, recordAt, removeRecord, setRecord, z
-
Methods inherited from interface io.netty5.util.ReferenceCounted
refCnt, release, release
-
-
-
-
Constructor Detail
-
DatagramDnsResponse
public DatagramDnsResponse(InetSocketAddress sender, InetSocketAddress recipient, int id)
- Parameters:
sender
- the address of the senderrecipient
- the address of the recipientid
- theID
of the DNS response
-
DatagramDnsResponse
public DatagramDnsResponse(InetSocketAddress sender, InetSocketAddress recipient, int id, DnsOpCode opCode)
Creates a new instance with theDnsResponseCode.NOERROR
responseCode.- Parameters:
sender
- the address of the senderrecipient
- the address of the recipientid
- theID
of the DNS responseopCode
- theopCode
of 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
- theID
of the DNS responseopCode
- theopCode
of the DNS responseresponseCode
- theRCODE
of the DNS response
-
-
Method Detail
-
content
public DatagramDnsResponse content()
Description copied from interface:AddressedEnvelope
Returns the message wrapped by this envelope message.- Specified by:
content
in interfaceAddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
-
sender
public InetSocketAddress sender()
Description copied from interface:AddressedEnvelope
Returns the address of the sender of this message.- Specified by:
sender
in interfaceAddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
-
recipient
public InetSocketAddress recipient()
Description copied from interface:AddressedEnvelope
Returns the address of the recipient of this message.- Specified by:
recipient
in interfaceAddressedEnvelope<DatagramDnsResponse,InetSocketAddress>
-
setAuthoritativeAnswer
public DatagramDnsResponse setAuthoritativeAnswer(boolean authoritativeAnswer)
Description copied from interface:DnsResponse
Set totrue
if responding server is authoritative for the domain name in the query message.- Specified by:
setAuthoritativeAnswer
in interfaceDnsResponse
- Overrides:
setAuthoritativeAnswer
in classDefaultDnsResponse
- Parameters:
authoritativeAnswer
- flag for authoritative answer
-
setTruncated
public DatagramDnsResponse setTruncated(boolean truncated)
Description copied from interface:DnsResponse
Set totrue
if response has been truncated (usually happens for responses over 512 bytes).- Specified by:
setTruncated
in interfaceDnsResponse
- Overrides:
setTruncated
in classDefaultDnsResponse
- Parameters:
truncated
- flag for truncation
-
setRecursionAvailable
public DatagramDnsResponse setRecursionAvailable(boolean recursionAvailable)
Description copied from interface:DnsResponse
Set totrue
if DNS server can handle recursive queries.- Specified by:
setRecursionAvailable
in interfaceDnsResponse
- Overrides:
setRecursionAvailable
in classDefaultDnsResponse
- Parameters:
recursionAvailable
- flag for recursion availability
-
setCode
public DatagramDnsResponse setCode(DnsResponseCode code)
Description copied from interface:DnsResponse
Sets the response code for this message.- Specified by:
setCode
in interfaceDnsResponse
- Overrides:
setCode
in classDefaultDnsResponse
- Parameters:
code
- the response code
-
setId
public DatagramDnsResponse setId(int id)
Description copied from interface:DnsMessage
Sets theID
of this DNS message.- Specified by:
setId
in interfaceDnsMessage
- Specified by:
setId
in interfaceDnsResponse
- Overrides:
setId
in classDefaultDnsResponse
-
setOpCode
public DatagramDnsResponse setOpCode(DnsOpCode opCode)
Description copied from interface:DnsMessage
Sets theopCode
of this DNS message.- Specified by:
setOpCode
in interfaceDnsMessage
- Specified by:
setOpCode
in interfaceDnsResponse
- Overrides:
setOpCode
in classDefaultDnsResponse
-
setRecursionDesired
public DatagramDnsResponse setRecursionDesired(boolean recursionDesired)
Description copied from interface:DnsMessage
Sets theRD
(recursion desired} field of this DNS message.- Specified by:
setRecursionDesired
in interfaceDnsMessage
- Specified by:
setRecursionDesired
in interfaceDnsResponse
- Overrides:
setRecursionDesired
in classDefaultDnsResponse
-
setZ
public DatagramDnsResponse setZ(int z)
Description copied from interface:DnsMessage
Sets theZ
(reserved for future use) field of this DNS message.- Specified by:
setZ
in interfaceDnsMessage
- Specified by:
setZ
in interfaceDnsResponse
- Overrides:
setZ
in classDefaultDnsResponse
-
setRecord
public DatagramDnsResponse setRecord(DnsSection section, DnsRecord record)
Description copied from interface:DnsMessage
Sets the specifiedsection
of this DNS message to the specifiedrecord
, making it a single-record section. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
.- Specified by:
setRecord
in interfaceDnsMessage
- Specified by:
setRecord
in interfaceDnsResponse
- Overrides:
setRecord
in classDefaultDnsResponse
-
addRecord
public DatagramDnsResponse addRecord(DnsSection section, DnsRecord record)
Description copied from interface:DnsMessage
Adds the specifiedrecord
at the end of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
.- Specified by:
addRecord
in interfaceDnsMessage
- Specified by:
addRecord
in interfaceDnsResponse
- Overrides:
addRecord
in classDefaultDnsResponse
-
addRecord
public DatagramDnsResponse addRecord(DnsSection section, int index, DnsRecord record)
Description copied from interface:DnsMessage
Adds the specifiedrecord
at the specifiedindex
of the specifiedsection
of this DNS message. When the specifiedsection
isDnsSection.QUESTION
, the specifiedrecord
must be aDnsQuestion
.- Specified by:
addRecord
in interfaceDnsMessage
- Specified by:
addRecord
in interfaceDnsResponse
- Overrides:
addRecord
in classDefaultDnsResponse
-
clear
public DatagramDnsResponse clear(DnsSection section)
Description copied from interface:DnsMessage
Removes all the records in the specifiedsection
of this DNS message.- Specified by:
clear
in interfaceDnsMessage
- Specified by:
clear
in interfaceDnsResponse
- Overrides:
clear
in classDefaultDnsResponse
-
clear
public DatagramDnsResponse clear()
Description copied from interface:DnsMessage
Removes all the records in this DNS message.- Specified by:
clear
in interfaceDnsMessage
- Specified by:
clear
in interfaceDnsResponse
- Overrides:
clear
in classDefaultDnsResponse
-
touch
public DatagramDnsResponse touch()
Description copied from interface:ReferenceCounted
Records 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:
touch
in interfaceDnsMessage
- Specified by:
touch
in interfaceDnsResponse
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classDefaultDnsResponse
-
touch
public DatagramDnsResponse touch(Object hint)
Description copied from interface:ReferenceCounted
Records 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:
touch
in interfaceDnsMessage
- Specified by:
touch
in interfaceDnsResponse
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classDefaultDnsResponse
-
retain
public DatagramDnsResponse retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceDnsMessage
- Specified by:
retain
in interfaceDnsResponse
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classDefaultDnsResponse
-
retain
public DatagramDnsResponse retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceDnsMessage
- Specified by:
retain
in interfaceDnsResponse
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classDefaultDnsResponse
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractDnsMessage
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractDnsMessage
-
-