Class DnsResourceRecord

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

public final class DnsResourceRecord extends Object implements Serializable
DNS Resource record
                                 1  1  1  1  1  1
   0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                                               |
 /                                               /
 /                      NAME                     /
 |                                               |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                      TYPE                     |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                     CLASS                     |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                      TTL                      |
 |                                               |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                   RDLENGTH                    |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
 /                     RDATA                     /
 /                                               /
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 
Since:
pcap4j 1.7.1
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • newInstance

      public static DnsResourceRecord 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 DnsResourceRecord object.
      Throws:
      IllegalRawDataException - if parsing the raw data fails.
    • getName

      public DnsDomainName getName()
      Returns:
      name
    • getDataType

      public DnsResourceRecordType getDataType()
      Returns:
      dataType
    • getDataClass

      public DnsClass getDataClass()
      Returns:
      dataClass
    • getTtl

      public int getTtl()
      Returns:
      ttl
    • getTtlAsLong

      public long getTtlAsLong()
      Returns:
      ttl
    • getRdLength

      public short getRdLength()
      Returns:
      rdLength
    • getRdLengthAsInt

      public int getRdLengthAsInt()
      Returns:
      rdLength
    • getRData

      public DnsResourceRecord.DnsRData getRData()
      Returns:
      rData. May be null.
    • getBuilder

      public DnsResourceRecord.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 resource record.
      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 o)
      Overrides:
      equals in class Object