UDP (User Datagram Protocol) datagram: format specification

UDP is a simple stateless transport layer (AKA OSI layer 4) protocol, one of the core Internet protocols. It provides source and destination ports, basic checksumming, but provides not guarantees of delivery, order of packets, or duplicate delivery.

KS implementation details

License: CC0-1.0

References

This page hosts a formal specification of UDP (User Datagram Protocol) datagram using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.

Block diagram

Format specification in Kaitai Struct YAML

meta:
  id: udp_datagram
  title: UDP (User Datagram Protocol) datagram
  xref:
    rfc: 768
    wikidata: Q11163
  license: CC0-1.0
  endian: be
doc: |
  UDP is a simple stateless transport layer (AKA OSI layer 4)
  protocol, one of the core Internet protocols. It provides source and
  destination ports, basic checksumming, but provides not guarantees
  of delivery, order of packets, or duplicate delivery.
seq:
  - id: src_port
    type: u2
  - id: dst_port
    type: u2
  - id: length
    type: u2
  - id: checksum
    type: u2
  - id: body
    size: length - 8