Fix dropped change flags + FIDI parsing
- capture.py: DirectSniffer/GsmtapListener yield (type, data, flags), CaptureManager passes flags to insert_message (change flags were previously dropped, leaving every change row with flags=0) - protocol.py: add _parse_fidi (1-byte value) — FIDI was mis-mapped to _parse_change (4-byte flags), so FIDI messages were silently dropped - database.py: pass flags into decode_sniff_msg - decode.py: decode_change(flags) reads flags directly; decode_sniff_msg gains flags parameter; change messages no longer require non-empty data - tests: fix FIDI test, add change/fidi decode tests (43 total)
This commit is contained in:
1 parent
4097bb864e
commit
2a58fec0a3
7 files changed
+52
-20
No files matched your search
@@ -590,12 +590,8 @@ CHANGE_FLAGS = {
|
||||
}
|
||||
|
||||
|
||||
def decode_change(raw_data):
|
||||
"""Decode a SIMtrace2 sniff_change payload (4-byte flags)."""
|
||||
if len(raw_data) < 4:
|
||||
return None
|
||||
import struct
|
||||
flags = struct.unpack('<I', raw_data[:4])[0]
|
||||
def decode_change(flags):
|
||||
"""Decode SIMtrace2 sniff_change flags into a list of human-readable names."""
|
||||
bits = []
|
||||
for mask, name in sorted(CHANGE_FLAGS.items()):
|
||||
if flags & mask:
|
||||
@@ -628,7 +624,7 @@ def decode_fidi(raw_data):
|
||||
}
|
||||
|
||||
|
||||
def decode_sniff_msg(raw_data, msg_type):
|
||||
def decode_sniff_msg(raw_data, msg_type, flags=0):
|
||||
"""Decode a raw sniff message of the given type.
|
||||
|
||||
Returns a structured dict with at least a 'type' key, or None if
|
||||
@@ -636,8 +632,8 @@ def decode_sniff_msg(raw_data, msg_type):
|
||||
"""
|
||||
if msg_type == 'tpdu' and raw_data:
|
||||
return decode_message(raw_data)
|
||||
if msg_type == 'change' and raw_data:
|
||||
return decode_change(raw_data)
|
||||
if msg_type == 'change':
|
||||
return decode_change(flags)
|
||||
if msg_type == 'fidi' and raw_data:
|
||||
return decode_fidi(raw_data)
|
||||
if msg_type == 'atr':
|
||||
|
||||
Reference in new issue
Block a user