laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/41674?usp=email )

Change subject: ts_51_011/EF.SMSP: Fix parsing of parameter_indicators
......................................................................

ts_51_011/EF.SMSP: Fix parsing of parameter_indicators

There's a 3-bit RFU field that (unlike everything else in USIM/UICC)
considers '1' to be the default.  Let's make sure we get that right
during encode.

Change-Id: Ibe24a07f5f73d875d2077fa55471dbfc4e90da23
---
M pySim/ts_51_011.py
M tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
2 files changed, 9 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  dexter: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved




diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 7532ba4..6e3f5e9 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -243,7 +243,7 @@
     _test_decode = [
         ( 
'454e6574776f726b73fffffffffffffff1ffffffffffffffffffffffffffffffffffffffffffffffff0000a7',
           { "alpha_id": "ENetworks", "parameter_indicators": { "tp_dest_addr": 
False, "tp_sc_addr": True,
-                                                               "tp_pid": True, 
"tp_dcs": True, "tp_vp": True },
+                                                               "tp_pid": True, 
"tp_dcs": True, "tp_vp": False },
             "tp_dest_addr": { "length": 255, "ton_npi": { "ext": True, 
"type_of_number": "reserved_for_extension",
                                                           "numbering_plan_id": 
"reserved_for_extension" },
                               "call_number": "" },
@@ -281,8 +281,13 @@
         super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(28, 
None), **kwargs)
         ScAddr = Struct('length'/Int8ub, 'ton_npi'/TonNpi, 
'call_number'/BcdAdapter(Rpad(Bytes(10))))
         self._construct = 
Struct('alpha_id'/COptional(GsmOrUcs2Adapter(Rpad(Bytes(this._.total_len-28)))),
-                                 
'parameter_indicators'/InvertAdapter(FlagsEnum(Byte, tp_dest_addr=1, 
tp_sc_addr=2,
-                                                                               
 tp_pid=3, tp_dcs=4, tp_vp=5)),
+                                 
'parameter_indicators'/InvertAdapter(BitStruct(
+                                                                        
Const(7, BitsInteger(3)),
+                                                                        
'tp_vp'/Flag,
+                                                                        
'tp_dcs'/Flag,
+                                                                        
'tp_pid'/Flag,
+                                                                        
'tp_sc_addr'/Flag,
+                                                                        
'tp_dest_addr'/Flag)),
                                  'tp_dest_addr'/ScAddr,
                                  'tp_sc_addr'/ScAddr,

diff --git a/tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok 
b/tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
index 423f25e..49b28bd 100644
--- a/tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
+++ b/tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
@@ -143,7 +143,7 @@
 ===============================
 00 SEARCH RECORD    MF/ADF.USIM/EF.SMSP                 01       9000 {"cmd": 
{"file": "currently_selected_ef", "mode": "forward_search", "record_number": 1, 
"search_string": 
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"},
 "rsp": {"body": [2], "sw": "9000"}}
 ===============================
-00 READ RECORD      MF/ADF.USIM/EF.SMSP                 01       9000 
{"alpha_id": "", "parameter_indicators": {"tp_dest_addr": false, "tp_sc_addr": 
true, "tp_pid": true, "tp_dcs": true, "tp_vp": true}, "tp_dest_addr": 
{"length": 255, "ton_npi": {"ext": true, "type_of_number": 
"reserved_for_extension", "numbering_plan_id": "reserved_for_extension"}, 
"call_number": ""}, "tp_sc_addr": {"length": 5, "ton_npi": {"ext": true, 
"type_of_number": "unknown", "numbering_plan_id": "isdn_e164"}, "call_number": 
"0015555f"}, "tp_pid": "00", "tp_dcs": "00", "tp_vp_minutes": 5}
+00 READ RECORD      MF/ADF.USIM/EF.SMSP                 01       9000 
{"alpha_id": "", "parameter_indicators": {"tp_vp": true, "tp_dcs": true, 
"tp_pid": true, "tp_sc_addr": true, "tp_dest_addr": false}, "tp_dest_addr": 
{"length": 255, "ton_npi": {"ext": true, "type_of_number": 
"reserved_for_extension", "numbering_plan_id": "reserved_for_extension"}, 
"call_number": ""}, "tp_sc_addr": {"length": 5, "ton_npi": {"ext": true, 
"type_of_number": "unknown", "numbering_plan_id": "isdn_e164"}, "call_number": 
"0015555f"}, "tp_pid": "00", "tp_dcs": "00", "tp_vp_minutes": 5}
 ===============================
 00 SEARCH RECORD    MF/ADF.USIM/EF.SMS                  01       9000 {"cmd": 
{"file": "currently_selected_ef", "mode": "forward_search", "record_number": 1, 
"search_string": 
"00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"},
 "rsp": {"body": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "sw": "9000"}}
 ===============================

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41674?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ibe24a07f5f73d875d2077fa55471dbfc4e90da23
Gerrit-Change-Number: 41674
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>

Reply via email to