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.

Description

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

DNS TXT wire data consists of length-prefixed octet strings. Empty component strings are meaningful and need not terminate the record.

When to use this tool

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

  • Prepare the supplied bytes 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. 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.strings. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require a nonempty byte list. Read a one-byte length, consume exactly that many following bytes, append the component and repeat to the input end. Reject any truncated component.1

Input fieldMeaning and representationAccepted input
bytesbytes.List of integers from 0 to 255; at most 128 bytes
Output fieldInterpretation
resultObject containing the named outputs below.
result.stringsThe strings list in the ordering and representation described above.
json
{
  "input": {
    "bytes": [
      2,
      1,
      2,
      0,
      1,
      3
    ]
  },
  "output": {
    "result": {
      "strings": [
        [
          1,
          2
        ],
        [],
        [
          3
        ]
      ]
    }
  }
}

Limitations and assumptions

  • The tool returns raw octets rather than interpreting text encoding or TXT application syntax. The local input limit is 128 bytes, and at least one length byte is required.
  • 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 TXT String Wire Parser — tool.io

Similar or alternative tools

  • DNS TXT String Wire Formatter

    Format a nonempty DNS TXT character-string list as length-prefixed octets without a terminator; total output is bounded to 128 bytes and strings are not text-decoded.

  • 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.

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