Sequence Number Arithmetic

pcapkit.utilities.seqnum places a 32-bit sequence number on one unbounded line, as RFC 9293 Section 3.4 compares TCP sequence numbers. TCP and TLS reassembly share it, so it lives beside neither.

Added in version 1.9.0.

pcapkit.utilities.seqnum.unwrap(seq, ref)[source]

Place a 32-bit sequence number on the unwrapped line near ref.

Parameters:
  • seq (int) – sequence number as carried on the wire, i.e. modulo 2 ** 32

  • ref (int) – unwrapped sequence number seq is expected to be near

Return type:

int

Returns:

The integer congruent to seq modulo 2 ** 32 that lies within 2 ** 31 of ref, which is how RFC 9293 Section 3.4 compares sequence numbers.