Class DnsQuestion

java.lang.Object
org.pcap4j.packet.DnsQuestion
All Implemented Interfaces:
Serializable

public final class DnsQuestion extends Object implements Serializable
DNS Question
                                 1  1  1  1  1  1
   0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                                               |
 /                     QNAME                     /
 /                                               /
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                     QTYPE                     |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                     QCLASS                    |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 
Since:
pcap4j 1.7.1
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • newInstance

      public static DnsQuestion newInstance(byte[] rawData, int offset, int length) throws IllegalRawDataException
      A static factory method. This method validates the arguments by ByteArrays.validateBounds(byte[], int, int), which may throw exceptions undocumented here.
      Parameters:
      rawData - rawData
      offset - offset
      length - length
      Returns:
      a new DnsQuestion object.
      Throws:
      IllegalRawDataException - if parsing the raw data fails.
    • getQName

      public DnsDomainName getQName()
      Returns:
      qName
    • getQType

      public DnsResourceRecordType getQType()
      Returns:
      qType
    • getQClass

      public DnsClass getQClass()
      Returns:
      qClass
    • getBuilder

      public DnsQuestion.Builder getBuilder()
      Returns:
      a new Builder object populated with this object's fields.
    • getRawData

      public byte[] getRawData()
      Returns:
      the raw data.
    • length

      public int length()
      Returns:
      length
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(String indent)
      Parameters:
      indent - indent
      Returns:
      String representation of this object.
    • toString

      public String toString(String indent, byte[] headerRawData)
      Parameters:
      indent - indent
      headerRawData - the raw data of the DNS header including this question.
      Returns:
      String representation of this object.
    • convertToString

      private String convertToString(String indent, byte[] headerRawData)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object