Package nl.sidnlabs.dnslib.message.util
Class DNSStringUtil
java.lang.Object
nl.sidnlabs.dnslib.message.util.DNSStringUtil
DNS Label Types
Registration Procedures IESG Approval Reference [RFC-ietf-dnsext-rfc2671bis-edns0-10] Note IETF
standards action required to allocate new types The top 2 bits of the first byte of an DNS label
indicates the type of label. Registration of further Extended Label Types is closed per
[RFC-ietf-dnsext-rfc2671bis-edns0-10].
Value Type Status Reference 0 0 Normal label lower 6 bits is the length of the label Standard
[RFC1035] 1 1 Compressed label the lower 6 bits and the 8 bits from next octet form a pointer to
the compression target. Standard [RFC1035] 0 1 Extended label type the lower 6 bits of this type
(section 3) indicate the type of label in use Proposed [RFC-ietf-dnsext-rfc2671bis-edns0-10] 0 1
0 0 0 0 0 1 Binary Label Experimental not recommended [RFC3364][RFC3363][RFC2673] 0 1 1 1 1 1 1 1
Reserved for future expansion. Proposed [RFC-ietf-dnsext-rfc2671bis-edns0-10] 1 0 Unallocated
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisCompressedName(byte namePrefix) static booleanisUncompressedName(byte namePrefix) static StringreadLabelData(NetworkData buffer) static StringreadName(NetworkData buffer) static StringreadNameUsingBuffer(NetworkData buffer) Optimized version of the readName method, this version uses a shared buffer to prevent having to keep allocating memory for new strings. the buffers is used to store all bytes for the string and when all bytes have been found the bytes are converted into a String.static StringreadNameUsingBuffer(NetworkData buffer, byte[] stringBuffer) static voidwriteLabelData(String value, NetworkData buffer) static byte[]static voidwriteName(String name, NetworkData buffer)
-
Method Details
-
isUncompressedName
public static boolean isUncompressedName(byte namePrefix) -
isCompressedName
public static boolean isCompressedName(byte namePrefix) -
readName
-
readNameUsingBuffer
Optimized version of the readName method, this version uses a shared buffer to prevent having to keep allocating memory for new strings. the buffers is used to store all bytes for the string and when all bytes have been found the bytes are converted into a String. NOTE: This method is not thread safe, due to the shared buffer- Parameters:
buffer-- Returns:
-
readNameUsingBuffer
-
writeName
-
writeName
-
readLabelData
-
writeLabelData
-