laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/37815?usp=email )
Change subject: pySim.ts_102_221: Make sure FileDescriptor for BER-TLV contains file_type
......................................................................
pySim.ts_102_221: Make sure FileDescriptor for BER-TLV contains file_type
before this change, structure == 'ber_tlv' was missing the
file_type == working_ef attribute. So for linear_fixed, transparent
and cyclic, the file_type attribute was present, but for ber_tlv it was
missing. This is illogical from a user point of vie and makes downstream code
potentially more complex, as it cannot match on working_ef for all EF
types.
Change-Id: If0076cc6dd35a818c08309885f6ef1c1704052c6
---
M pySim/ts_102_221.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/15/37815/1
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index c326ad1..9e0db68 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -19,7 +19,7 @@
from bidict import bidict
from construct import Select, Const, Bit, Struct, Int16ub, FlagsEnum, GreedyString,
ValidationError
-from construct import Optional as COptional
+from construct import Optional as COptional, Computed
from pySim.construct import *
from pySim.utils import *
@@ -95,7 +95,7 @@
# ETSI TS 102 221 11.1.1.4.3
class FileDescriptor(BER_TLV_IE, tag=0x82):
_test_de_encode = [
- ( '82027921', { "file_descriptor_byte": {
"shareable": True, "structure": "ber_tlv" },
"record_len": None, "num_of_rec": None } ),
+ ( '82027921', { "file_descriptor_byte": {
"shareable": True, "file_type": "working_ef",
"structure": "ber_tlv" }, "record_len": None,
"num_of_rec": None } ),
( '82027821', { "file_descriptor_byte": {
"shareable": True, "file_type": "df", "structure":
"no_info_given" }, "record_len": None, "num_of_rec": None
}),
( '82024121', { "file_descriptor_byte": {
"shareable": True, "file_type": "working_ef",
"structure": "transparent" }, "record_len": None,
"num_of_rec": None } ),
( '82054221006e05', { "file_descriptor_byte": {
"shareable": True, "file_type": "working_ef",
"structure": "linear_fixed" }, "record_len": 110,
"num_of_rec": 5 } ),
@@ -110,7 +110,7 @@
return 0x39
raise ValidationError
- FDB = Select(BitStruct(Const(0, Bit), 'shareable'/Flag,
'structure'/BerTlvAdapter(Const(0x39, BitsInteger(6)))),
+ FDB = Select(BitStruct(Const(0, Bit), 'shareable'/Flag,
'structure'/BerTlvAdapter(Const(0x39, BitsInteger(6))),
'file_type'/Computed('working_ef')),
BitStruct(Const(0, Bit), 'shareable'/Flag,
'file_type'/Enum(BitsInteger(3), working_ef=0, internal_ef=1, df=7),
'structure'/Enum(BitsInteger(3), no_info_given=0,
transparent=1, linear_fixed=2, cyclic=6))
)
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/37815?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: If0076cc6dd35a818c08309885f6ef1c1704052c6
Gerrit-Change-Number: 37815
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>