Class DnsCodecUtil
java.lang.Object
io.netty.handler.codec.dns.DnsCodecUtil
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int(package private) static final int(package private) static final int(package private) static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intcalculateMaxNameLength(int readable) Returns the initial capacity to use for theStringBuilderthat accumulates a decoded domain name.(package private) static intcheckRecordCount(DnsSection section, int count) Ensures the record count of a section, as announced in the header of a DNS message, does not exceedMAX_RECORDS_PER_SECTION.(package private) static String(package private) static ByteBufdecompressDomainName(ByteBuf compression) Decompress pointer data.(package private) static voidencodeDomainName(String name, ByteBuf buf) (package private) static void
-
Field Details
-
MAX_DOMAIN_NAME_LENGTH
static final int MAX_DOMAIN_NAME_LENGTH- See Also:
-
MAX_TCP_MESSAGE_LENGTH
static final int MAX_TCP_MESSAGE_LENGTH- See Also:
-
MAX_COMPRESSION_POINTERS
static final int MAX_COMPRESSION_POINTERS- See Also:
-
MAX_RECORDS_PER_SECTION
static final int MAX_RECORDS_PER_SECTION- See Also:
-
-
Constructor Details
-
DnsCodecUtil
private DnsCodecUtil()
-
-
Method Details
-
setTcpMessageLength
Writes the length of the message into the first two bytes of the givenByteBufwhich were reserved for it, as defined by RFC 7766.- Throws:
IllegalArgumentException- if the message is too large for the length to fit into two bytes.
-
encodeDomainName
-
calculateMaxNameLength
static int calculateMaxNameLength(int readable) Returns the initial capacity to use for theStringBuilderthat accumulates a decoded domain name. A decoded name can never exceedMAX_DOMAIN_NAME_LENGTHcharacters (see the check indecodeDomainName(ByteBuf)), so the capacity must not scale withreadable, the number of bytes left in the whole message: doing so would let a message with a huge amount of trailing data (e.g. many more records after this name) force an oversized allocation for every single name decoded from it. -
checkRecordCount
Ensures the record count of a section, as announced in the header of a DNS message, does not exceedMAX_RECORDS_PER_SECTION.- Throws:
TooLongFrameException- if the count is too large.
-
decodeDomainName
-
decompressDomainName
-