TCP segment: format specification

KS implementation details

License: CC0-1.0

This page hosts a formal specification of TCP segment 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

  id: tcp_segment
  title: TCP segment
  license: CC0-1.0
  endian: be
  - id: src_port
    type: u2
  - id: dst_port
    type: u2
  - id: seq_num
    type: u4
  - id: ack_num
    type: u4
  - id: b12
    type: u1
  - id: b13
    type: u1
  - id: window_size
    type: u2
  - id: checksum
    type: u2
  - id: urgent_pointer
    type: u2
  - id: body
    size-eos: true