v1.8.0: PPS as standard request/response packets; fix res-byte flag docs

- Split the PPS exchange into the two standard GSMTAP-SIM subtypes:
  0x02 (PPS_REQ, raw request bytes, span ss..es_req) and 0x03 (PPS_RSP,
  raw response bytes, span es_req..end), replacing the single 0x02 packet
  with concatenated request+response that deviated from libosmocore's
  gsmtap.h.  Wireshark now dissects both halves; simtrace2-pysniff needs
  no change (its importer already maps 0x03 to 'pps' and _decode_pps()
  parses the 0xFF-leading response frame).  PPS annotation/log unchanged.
- gsmtap_stream.py: GSMTAP_SIM_PPS_REQ/RSP constants; header field labels
  aligned with libosmocore's struct (signal_dbm/snr_db).
- Docs: GSMTAP event tables (EN/RU) updated, PPS deviation note removed;
  corrected the res-byte flag attribution -- upstream simtrace2 never
  sets res, so the GSMTAP_FLAG_BAD_FCS carriage is this decoder's own
  extension (semantics mirror simtrace2's USB data flags).
- Tests: assert the PPS subtype values; baseline regenerated (only the
  version line and test listing differed -- no decode-metric changes).
  68/68 unit tests.
This commit is contained in:
catarrh committed 2026-09-17 23:01:40 +03:00
1 parent c222eecb3c
commit e5a2b7c83b
7 files changed
+103 -54

No files matched your search

+13 -12
View File
@@ -18,15 +18,14 @@ GSMTAP_VERSION = 0x02
GSMTAP_HDR_LEN = 4 # in 32-bit words (16 bytes)
GSMTAP_TYPE_SIM = 0x04
# sub_type values. 0x00/0x01 are standard GSMTAP-SIM types with standard
# payloads (libosmocore gsmtap.h). 0x02 uses the spec's GSMTAP_SIM_PPS_REQ
# value but carries request + response bytes concatenated in one packet;
# the spec splits PPS into PPS_REQ (0x02) / PPS_RSP (0x03), so Wireshark
# dissects 0x02 as "PPS request" and GSMTAP_SIM_PPS_RSP (0x03) is
# intentionally unused. 0x10/0x11 are custom extensions (not in the spec).
# sub_type values. 0x00-0x03 are standard GSMTAP-SIM types with standard
# payloads (libosmocore gsmtap.h): the PPS request and response are emitted
# as separate packets (PPS_REQ 0x02 / PPS_RSP 0x03). 0x10/0x11 are custom
# extensions (not in the spec) for RST/VCC line events.
GSMTAP_SIM_APDU = 0x00
GSMTAP_SIM_ATR = 0x01
GSMTAP_SIM_PPS = 0x02 # request + response combined (this decoder)
GSMTAP_SIM_PPS_REQ = 0x02 # raw PPS request bytes
GSMTAP_SIM_PPS_RSP = 0x03 # raw PPS response bytes
GSMTAP_SIM_RST_EVENT = 0x10 # payload: [direction, level, reserved]
GSMTAP_SIM_VCC_EVENT = 0x11 # payload: [direction, level, reserved]
@@ -39,9 +38,11 @@ GSMTAP_SIM_VCC_EVENT = 0x11 # payload: [direction, level, reserved]
GSMTAP_UDP_PORT = 4729
# libosmocore gsmtap.h: per-packet flags live in the header `res` byte,
# which the spec marks reserved (RFU). Flag usage here is a documented
# extension following the simtrace2-sniff convention, not part of gsmtap.h.
# Per-packet flags are carried in the header `res` byte, which libosmocore's
# gsmtap.h defines as reserved (RFU). This carriage is our own extension --
# upstream simtrace2-sniff/cardem never set `res` -- although the flag
# semantics mirror simtrace2's per-message USB data flags (the wire problem
# is reported out-of-band instead of being encoded in the APDU bytes).
GSMTAP_FLAG_BAD_FCS = 0x01 # "Any data checksum is wrong" -- reused here to
# mark decoder-desynced TPDUs (see README.md,
# "GSMTAP events").
@@ -60,8 +61,8 @@ def build_packet(sub_type, data, flags=0):
GSMTAP_TYPE_SIM, # type
0, # timeslot
0, # arfcn
0, # noise_db
0, # signal_db
0, # signal_dbm (libosmocore gsmtap.h field order)
0, # snr_db
0, # frame_number
sub_type, # sub_type
0, # antenna_nr