DNS Uncompressed Wire Name Parser

Parse one uncompressed DNS wire name at an explicit byte offset, returning the next offset; pointers and extended labels are rejected, trailing packet bytes remain unread.

Description

Parse one uncompressed DNS wire name at an explicit byte offset, returning the next offset; pointers and extended labels are rejected, trailing packet bytes remain unread.

An uncompressed DNS name is a sequence of length-prefixed labels ending in root zero. A packet can contain unrelated bytes before and after it.

When to use this tool

Parse one uncompressed DNS wire name at an explicit byte offset, returning the next offset; pointers and extended labels are rejected, trailing packet bytes remain unread.

  • Prepare the supplied bytes, offset fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter bytes, offset. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.labels, result.endOffset. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Begin at the explicit offset, read lengths at most 63, consume each full label and stop at zero. Return labels and endOffset immediately after the root marker. Reject truncated labels, missing termination and compression or extended-label markers.1

Input fieldMeaning and representationAccepted input
bytesbytes.List of integers from 0 to 255; at most 128 bytes
offsetoffset.Integer from 0 to bytes.length - 1 inclusive
Output fieldInterpretation
resultObject containing the named outputs below.
result.labelsThe labels list in the ordering and representation described above.
result.endOffsetThe end offset value under the stated formula or text convention.
json
{
  "input": {
    "bytes": [
      9,
      1,
      97,
      2,
      98,
      99,
      0,
      8
    ],
    "offset": 1
  },
  "output": {
    "result": {
      "labels": [
        [
          97
        ],
        [
          98,
          99
        ]
      ],
      "endOffset": 7
    }
  }
}

Limitations and assumptions

  • The entire supplied byte array is limited to 128 bytes. Trailing packet bytes are left unread and no compression pointers or other packet fields are parsed.
  • All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
  • JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.

Alternative or Complementary methods

Use a packet-aware DNS parser or resolver when the task requires compression-chain validation, live records or complete resource-record semantics. Keep byte labels, presentation text and network packets distinct.

References

  1. Tool behavior and example: DNS Uncompressed Wire Name Parser — tool.io

Similar or alternative tools

  • DNS TXT String Wire Parser

    Parse a complete nonempty DNS TXT wire character-string list, retaining empty strings and rejecting incomplete trailing payload; no text encoding assumptions.

  • DNS Compression Pointer Offset Parser

    Parse exactly one two-byte DNS compression pointer into its 14-bit packet offset; does not dereference the pointer.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies