java.lang.Object
org.pcap4j.packet.DnsDomainName
- All Implemented Interfaces:
Serializable
DNS domain name
labels:
1 len 1 len
+-------+-------+-//-+-------+-------+-------+-//-+-------+--//--+-------+
| len | label | len | label | |len (0)|
+-------+-------+-//-+-------+-------+-------+-//-+-------+--//--+-------+
pointer:
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
| 1 1| OFFSET |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
- Since:
- pcap4j 1.7.1
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final Stringprivate final Shortstatic final DnsDomainNameThe root domain (zero)private static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDnsDomainName(byte[] rawData, int offset, int length) privateDnsDomainName(DnsDomainName.Builder builder) -
Method Summary
Modifier and TypeMethodDescriptiondecompress(byte[] headerRawData) private Stringdecompress(byte[] headerRawData, List<Short> pointers) booleangetName()byte[]inthashCode()private StringjoinLabels(List<String> lbls) intlength()static DnsDomainNamenewInstance(byte[] rawData, int offset, int length) A static factory method.toString()toString(byte[] headerRawData) Convert this object to string representation including all fields info and decompressed domain name.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
LOG
private static final org.slf4j.Logger LOG -
ROOT_DOMAIN
The root domain (zero) -
labels
-
name
-
pointer
-
-
Constructor Details
-
DnsDomainName
- Throws:
IllegalRawDataException
-
DnsDomainName
-
-
Method Details
-
newInstance
public static DnsDomainName 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 DnsDomainName object.
- Throws:
IllegalRawDataException- if parsing the raw data fails.
-
joinLabels
-
getLabels
- Returns:
- labels
-
getName
- Returns:
- name, which is made by joining labels with "."
-
getPointer
- Returns:
- pointer (0 - 16383 (inclusive)). May be null.
-
getPointerAsInt
- Returns:
- pointer (0 - 16383 (inclusive)). May be null.
-
decompress
- Parameters:
headerRawData- the raw data of the DNS header including this domain name.- Returns:
- decompressed name.
- Throws:
IllegalRawDataException- if an error occurred during decompression or circular reference is detected.
-
decompress
private String decompress(byte[] headerRawData, List<Short> pointers) throws IllegalRawDataException - Throws:
IllegalRawDataException
-
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
-
toString
Convert this object to string representation including all fields info and decompressed domain name.- Parameters:
headerRawData- the raw data of the DNS header including this domain name.- Returns:
- string representation of this object.
-
hashCode
public int hashCode() -
equals
-