- java.lang.Object
-
- org.pcap4j.packet.DnsResourceRecord
-
- All Implemented Interfaces:
java.io.Serializable
public final class DnsResourceRecord extends java.lang.Object implements java.io.SerializableDNS Resource record1 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:
- RFC 1035, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDnsResourceRecord.Builderstatic interfaceDnsResourceRecord.DnsRDataThe interface representing an RDATA.
-
Field Summary
Fields Modifier and Type Field Description private DnsClassdataClassprivate DnsResourceRecordTypedataTypeprivate DnsDomainNamenameprivate DnsResourceRecord.DnsRDatarDataprivate shortrdLengthprivate static longserialVersionUIDprivate intttl
-
Constructor Summary
Constructors Modifier Constructor Description privateDnsResourceRecord(byte[] rawData, int offset, int length)privateDnsResourceRecord(DnsResourceRecord.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringconvertToString(java.lang.String indent, byte[] headerRawData)booleanequals(java.lang.Object o)DnsResourceRecord.BuildergetBuilder()DnsClassgetDataClass()DnsResourceRecordTypegetDataType()DnsDomainNamegetName()byte[]getRawData()DnsResourceRecord.DnsRDatagetRData()shortgetRdLength()intgetRdLengthAsInt()intgetTtl()longgetTtlAsLong()inthashCode()intlength()static DnsResourceRecordnewInstance(byte[] rawData, int offset, int length)A static factory method.java.lang.StringtoString()java.lang.StringtoString(java.lang.String indent)java.lang.StringtoString(java.lang.String indent, byte[] headerRawData)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
name
private final DnsDomainName name
-
dataType
private final DnsResourceRecordType dataType
-
dataClass
private final DnsClass dataClass
-
ttl
private final int ttl
-
rdLength
private final short rdLength
-
rData
private final DnsResourceRecord.DnsRData rData
-
-
Constructor Detail
-
DnsResourceRecord
private DnsResourceRecord(byte[] rawData, int offset, int length) throws IllegalRawDataException- Throws:
IllegalRawDataException
-
DnsResourceRecord
private DnsResourceRecord(DnsResourceRecord.Builder builder)
-
-
Method Detail
-
newInstance
public static DnsResourceRecord newInstance(byte[] rawData, int offset, int length) throws IllegalRawDataException
A static factory method. This method validates the arguments byByteArrays.validateBounds(byte[], int, int), which may throw exceptions undocumented here.- Parameters:
rawData- rawDataoffset- offsetlength- 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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String indent)
- Parameters:
indent- indent- Returns:
- String representation of this object.
-
toString
public java.lang.String toString(java.lang.String indent, byte[] headerRawData)- Parameters:
indent- indentheaderRawData- the raw data of the DNS header including this resource record.- Returns:
- String representation of this object.
-
convertToString
private java.lang.String convertToString(java.lang.String indent, byte[] headerRawData)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-