Interface DnsMessage

All Superinterfaces:
ReferenceCounted
All Known Subinterfaces:
DnsQuery, DnsResponse
All Known Implementing Classes:
AbstractDnsMessage, DatagramDnsQuery, DatagramDnsResponse, DefaultDnsQuery, DefaultDnsResponse

@UnstableApi public interface DnsMessage extends ReferenceCounted
The superclass which contains core information concerning a DnsQuery and a DnsResponse.
  • Method Summary

    Modifier and Type
    Method
    Description
    addRecord(DnsSection section, int index, DnsRecord record)
    Adds the specified record at the specified index of the specified section of this DNS message.
    addRecord(DnsSection section, DnsRecord record)
    Adds the specified record at the end of the specified section of this DNS message.
    Removes all the records in this DNS message.
    clear(DnsSection section)
    Removes all the records in the specified section of this DNS message.
    int
    Returns the number of records in this DNS message.
    int
    count(DnsSection section)
    Returns the number of records in the specified section of this DNS message.
    int
    id()
    Returns the ID of this DNS message.
    boolean
    Returns the RD (recursion desired} field of this DNS message.
    Returns the opCode of this DNS message.
    <T extends DnsRecord>
    T
    Returns the first record in the specified section of this DNS message.
    <T extends DnsRecord>
    T
    recordAt(DnsSection section, int index)
    Returns the record at the specified index of the specified section of this DNS message.
    <T extends DnsRecord>
    T
    removeRecord(DnsSection section, int index)
    Removes the record at the specified index of the specified section from this DNS message.
    Increases the reference count by 1.
    retain(int increment)
    Increases the reference count by the specified increment.
    setId(int id)
    Sets the ID of this DNS message.
    Sets the opCode of this DNS message.
    <T extends DnsRecord>
    T
    setRecord(DnsSection section, int index, DnsRecord record)
    Sets the specified record at the specified index of the specified section of this DNS message.
    setRecord(DnsSection section, DnsRecord record)
    Sets the specified section of this DNS message to the specified record, making it a single-record section.
    setRecursionDesired(boolean recursionDesired)
    Sets the RD (recursion desired} field of this DNS message.
    setZ(int z)
    Sets the Z (reserved for future use) field of this DNS message.
    Records the current access location of this object for debugging purposes.
    touch(Object hint)
    Records the current access location of this object with an additional arbitrary information for debugging purposes.
    int
    z()
    Returns the Z (reserved for future use) field of this DNS message.

    Methods inherited from interface io.netty.util.ReferenceCounted

    refCnt, release, release
  • Method Details

    • id

      int id()
      Returns the ID of this DNS message.
    • setId

      DnsMessage setId(int id)
      Sets the ID of this DNS message.
    • opCode

      DnsOpCode opCode()
      Returns the opCode of this DNS message.
    • setOpCode

      DnsMessage setOpCode(DnsOpCode opCode)
      Sets the opCode of this DNS message.
    • isRecursionDesired

      boolean isRecursionDesired()
      Returns the RD (recursion desired} field of this DNS message.
    • setRecursionDesired

      DnsMessage setRecursionDesired(boolean recursionDesired)
      Sets the RD (recursion desired} field of this DNS message.
    • z

      int z()
      Returns the Z (reserved for future use) field of this DNS message.
    • setZ

      DnsMessage setZ(int z)
      Sets the Z (reserved for future use) field of this DNS message.
    • count

      int count(DnsSection section)
      Returns the number of records in the specified section of this DNS message.
    • count

      int count()
      Returns the number of records in this DNS message.
    • recordAt

      <T extends DnsRecord> T recordAt(DnsSection section)
      Returns the first record in the specified section of this DNS message. When the specified section is DnsSection.QUESTION, the type of the returned record is always DnsQuestion.
      Returns:
      null if this message doesn't have any records in the specified section
    • recordAt

      <T extends DnsRecord> T recordAt(DnsSection section, int index)
      Returns the record at the specified index of the specified section of this DNS message. When the specified section is DnsSection.QUESTION, the type of the returned record is always DnsQuestion.
      Throws:
      IndexOutOfBoundsException - if the specified index is out of bounds
    • setRecord

      DnsMessage setRecord(DnsSection section, DnsRecord record)
      Sets the specified section of this DNS message to the specified record, making it a single-record section. When the specified section is DnsSection.QUESTION, the specified record must be a DnsQuestion.
    • setRecord

      <T extends DnsRecord> T setRecord(DnsSection section, int index, DnsRecord record)
      Sets the specified record at the specified index of the specified section of this DNS message. When the specified section is DnsSection.QUESTION, the specified record must be a DnsQuestion.
      Returns:
      the old record
      Throws:
      IndexOutOfBoundsException - if the specified index is out of bounds
    • addRecord

      DnsMessage addRecord(DnsSection section, DnsRecord record)
      Adds the specified record at the end of the specified section of this DNS message. When the specified section is DnsSection.QUESTION, the specified record must be a DnsQuestion.
    • addRecord

      DnsMessage addRecord(DnsSection section, int index, DnsRecord record)
      Adds the specified record at the specified index of the specified section of this DNS message. When the specified section is DnsSection.QUESTION, the specified record must be a DnsQuestion.
      Throws:
      IndexOutOfBoundsException - if the specified index is out of bounds
    • removeRecord

      <T extends DnsRecord> T removeRecord(DnsSection section, int index)
      Removes the record at the specified index of the specified section from this DNS message. When the specified section is DnsSection.QUESTION, the type of the returned record is always DnsQuestion.
      Returns:
      the removed record
    • clear

      DnsMessage clear(DnsSection section)
      Removes all the records in the specified section of this DNS message.
    • clear

      DnsMessage clear()
      Removes all the records in this DNS message.
    • touch

      DnsMessage 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 via ResourceLeakDetector. This method is a shortcut to touch(null).
      Specified by:
      touch in interface ReferenceCounted
    • touch

      DnsMessage 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 via ResourceLeakDetector.
      Specified by:
      touch in interface ReferenceCounted
    • retain

      DnsMessage retain()
      Description copied from interface: ReferenceCounted
      Increases the reference count by 1.
      Specified by:
      retain in interface ReferenceCounted
    • retain

      DnsMessage retain(int increment)
      Description copied from interface: ReferenceCounted
      Increases the reference count by the specified increment.
      Specified by:
      retain in interface ReferenceCounted