mirror of https://gerrit.osmocom.org/pysim
filesystem: Use Tuple for record length
The size should be a *tuple*. In reality we so far passed a set. The problem with the set is that ordering is not guaranteed, and hence we cannot assume the first and second item have meaning (minimum vs. default record length). Change-Id: I470f4e69c83cb2761861b3350bf8d49e31f4d957
This commit is contained in:
parent
13edf30d6c
commit
99e4cc02e5
|
@ -913,7 +913,7 @@ class LinFixedEF(CardEF):
|
||||||
self._cmd.poutput_json(data)
|
self._cmd.poutput_json(data)
|
||||||
|
|
||||||
def __init__(self, fid: str, sfid: str = None, name: str = None, desc: str = None,
|
def __init__(self, fid: str, sfid: str = None, name: str = None, desc: str = None,
|
||||||
parent: Optional[CardDF] = None, rec_len={1, None}, **kwargs):
|
parent: Optional[CardDF] = None, rec_len: Size = (1, None), **kwargs):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
fid : File Identifier (4 hex digits)
|
fid : File Identifier (4 hex digits)
|
||||||
|
@ -921,7 +921,7 @@ class LinFixedEF(CardEF):
|
||||||
name : Brief name of the file, lik EF_ICCID
|
name : Brief name of the file, lik EF_ICCID
|
||||||
desc : Description of the file
|
desc : Description of the file
|
||||||
parent : Parent CardFile object within filesystem hierarchy
|
parent : Parent CardFile object within filesystem hierarchy
|
||||||
rec_len : set of {minimum_length, recommended_length}
|
rec_len : Tuple of (minimum_length, recommended_length)
|
||||||
"""
|
"""
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, parent=parent, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, parent=parent, **kwargs)
|
||||||
self.rec_len = rec_len
|
self.rec_len = rec_len
|
||||||
|
@ -1044,7 +1044,7 @@ class CyclicEF(LinFixedEF):
|
||||||
# we don't really have any special support for those; just recycling LinFixedEF here
|
# we don't really have any special support for those; just recycling LinFixedEF here
|
||||||
|
|
||||||
def __init__(self, fid: str, sfid: str = None, name: str = None, desc: str = None, parent: CardDF = None,
|
def __init__(self, fid: str, sfid: str = None, name: str = None, desc: str = None, parent: CardDF = None,
|
||||||
rec_len={1, None}, **kwargs):
|
rec_len: Size = (1, None), **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, parent=parent, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, parent=parent, rec_len=rec_len, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class EF_FN(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(fid='6ff1', sfid=None, name='EF.EN',
|
super().__init__(fid='6ff1', sfid=None, name='EF.EN',
|
||||||
desc='Functional numbers', rec_len={9, 9})
|
desc='Functional numbers', rec_len=(9, 9))
|
||||||
self._construct = Struct('functional_number_and_type'/FuncNTypeAdapter(Bytes(8)),
|
self._construct = Struct('functional_number_and_type'/FuncNTypeAdapter(Bytes(8)),
|
||||||
'list_number'/Int8ub)
|
'list_number'/Int8ub)
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class EF_CallconfI(LinFixedEF):
|
||||||
"""Section 7.5"""
|
"""Section 7.5"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(fid='6ff3', sfid=None, name='EF.CallconfI', rec_len={21, 21},
|
super().__init__(fid='6ff3', sfid=None, name='EF.CallconfI', rec_len=(21, 21),
|
||||||
desc='Call Configuration of emergency calls Information')
|
desc='Call Configuration of emergency calls Information')
|
||||||
self._construct = Struct('t_dur'/Int24ub,
|
self._construct = Struct('t_dur'/Int24ub,
|
||||||
't_relcalc'/Int32ub,
|
't_relcalc'/Int32ub,
|
||||||
|
@ -193,7 +193,7 @@ class EF_GsmrPLMN(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(fid='6ff5', sfid=None, name='EF.GsmrPLMN',
|
super().__init__(fid='6ff5', sfid=None, name='EF.GsmrPLMN',
|
||||||
desc='GSM-R network selection', rec_len={9, 9})
|
desc='GSM-R network selection', rec_len=(9, 9))
|
||||||
self._construct = Struct('plmn'/BcdAdapter(Bytes(3)),
|
self._construct = Struct('plmn'/BcdAdapter(Bytes(3)),
|
||||||
'class_of_network'/BitStruct('supported'/FlagsEnum(BitsInteger(5), vbs=1, vgcs=2, emlpp=4, fn=8, eirene=16),
|
'class_of_network'/BitStruct('supported'/FlagsEnum(BitsInteger(5), vbs=1, vgcs=2, emlpp=4, fn=8, eirene=16),
|
||||||
'preference'/BitsInteger(3)),
|
'preference'/BitsInteger(3)),
|
||||||
|
@ -207,7 +207,7 @@ class EF_IC(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(fid='6f8d', sfid=None, name='EF.IC',
|
super().__init__(fid='6f8d', sfid=None, name='EF.IC',
|
||||||
desc='International Code', rec_len={7, 7})
|
desc='International Code', rec_len=(7, 7))
|
||||||
self._construct = Struct('next_table_type'/NextTableType,
|
self._construct = Struct('next_table_type'/NextTableType,
|
||||||
'id_of_next_table'/HexAdapter(Bytes(2)),
|
'id_of_next_table'/HexAdapter(Bytes(2)),
|
||||||
'ic_decision_value'/BcdAdapter(Bytes(2)),
|
'ic_decision_value'/BcdAdapter(Bytes(2)),
|
||||||
|
@ -219,7 +219,7 @@ class EF_NW(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(fid='6f80', sfid=None, name='EF.NW',
|
super().__init__(fid='6f80', sfid=None, name='EF.NW',
|
||||||
desc='Network Name', rec_len={8, 8})
|
desc='Network Name', rec_len=(8, 8))
|
||||||
self._construct = GsmString(8)
|
self._construct = GsmString(8)
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ class EF_Switching(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self, fid, name, desc):
|
def __init__(self, fid, name, desc):
|
||||||
super().__init__(fid=fid, sfid=None,
|
super().__init__(fid=fid, sfid=None,
|
||||||
name=name, desc=desc, rec_len={6, 6})
|
name=name, desc=desc, rec_len=(6, 6))
|
||||||
self._construct = Struct('next_table_type'/NextTableType,
|
self._construct = Struct('next_table_type'/NextTableType,
|
||||||
'id_of_next_table'/HexAdapter(Bytes(2)),
|
'id_of_next_table'/HexAdapter(Bytes(2)),
|
||||||
'decision_value'/BcdAdapter(Bytes(2)),
|
'decision_value'/BcdAdapter(Bytes(2)),
|
||||||
|
@ -240,7 +240,7 @@ class EF_Predefined(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self, fid, name, desc):
|
def __init__(self, fid, name, desc):
|
||||||
super().__init__(fid=fid, sfid=None,
|
super().__init__(fid=fid, sfid=None,
|
||||||
name=name, desc=desc, rec_len={3, 3})
|
name=name, desc=desc, rec_len=(3, 3))
|
||||||
# header and other records have different structure. WTF !?!
|
# header and other records have different structure. WTF !?!
|
||||||
self._construct = Struct('next_table_type'/NextTableType,
|
self._construct = Struct('next_table_type'/NextTableType,
|
||||||
'id_of_next_table'/HexAdapter(Bytes(2)),
|
'id_of_next_table'/HexAdapter(Bytes(2)),
|
||||||
|
|
|
@ -85,7 +85,7 @@ class EF_MILENAGE_CFG(TransparentEF):
|
||||||
|
|
||||||
class EF_0348_KEY(LinFixedEF):
|
class EF_0348_KEY(LinFixedEF):
|
||||||
def __init__(self, fid='6f22', name='EF.0348_KEY', desc='TS 03.48 OTA Keys'):
|
def __init__(self, fid='6f22', name='EF.0348_KEY', desc='TS 03.48 OTA Keys'):
|
||||||
super().__init__(fid, name=name, desc=desc, rec_len={27, 35})
|
super().__init__(fid, name=name, desc=desc, rec_len=(27, 35))
|
||||||
|
|
||||||
def _decode_record_bin(self, raw_bin_data):
|
def _decode_record_bin(self, raw_bin_data):
|
||||||
u = unpack('!BBB', raw_bin_data[0:3])
|
u = unpack('!BBB', raw_bin_data[0:3])
|
||||||
|
@ -103,7 +103,7 @@ class EF_0348_KEY(LinFixedEF):
|
||||||
|
|
||||||
class EF_0348_COUNT(LinFixedEF):
|
class EF_0348_COUNT(LinFixedEF):
|
||||||
def __init__(self, fid='6f23', name='EF.0348_COUNT', desc='TS 03.48 OTA Counters'):
|
def __init__(self, fid='6f23', name='EF.0348_COUNT', desc='TS 03.48 OTA Counters'):
|
||||||
super().__init__(fid, name=name, desc=desc, rec_len={7, 7})
|
super().__init__(fid, name=name, desc=desc, rec_len=(7, 7))
|
||||||
|
|
||||||
def _decode_record_bin(self, raw_bin_data):
|
def _decode_record_bin(self, raw_bin_data):
|
||||||
u = unpack('!BB5s', raw_bin_data)
|
u = unpack('!BB5s', raw_bin_data)
|
||||||
|
@ -118,7 +118,7 @@ class EF_SIM_AUTH_COUNTER(TransparentEF):
|
||||||
|
|
||||||
class EF_GP_COUNT(LinFixedEF):
|
class EF_GP_COUNT(LinFixedEF):
|
||||||
def __init__(self, fid='6f26', name='EF.GP_COUNT', desc='GP SCP02 Counters'):
|
def __init__(self, fid='6f26', name='EF.GP_COUNT', desc='GP SCP02 Counters'):
|
||||||
super().__init__(fid, name=name, desc=desc, rec_len={5, 5})
|
super().__init__(fid, name=name, desc=desc, rec_len=(5, 5))
|
||||||
|
|
||||||
def _decode_record_bin(self, raw_bin_data):
|
def _decode_record_bin(self, raw_bin_data):
|
||||||
u = unpack('!BBHB', raw_bin_data)
|
u = unpack('!BBHB', raw_bin_data)
|
||||||
|
@ -127,7 +127,7 @@ class EF_GP_COUNT(LinFixedEF):
|
||||||
|
|
||||||
class EF_GP_DIV_DATA(LinFixedEF):
|
class EF_GP_DIV_DATA(LinFixedEF):
|
||||||
def __init__(self, fid='6f27', name='EF.GP_DIV_DATA', desc='GP SCP02 key diversification data'):
|
def __init__(self, fid='6f27', name='EF.GP_DIV_DATA', desc='GP SCP02 key diversification data'):
|
||||||
super().__init__(fid, name=name, desc=desc, rec_len={12, 12})
|
super().__init__(fid, name=name, desc=desc, rec_len=(12, 12))
|
||||||
|
|
||||||
def _decode_record_bin(self, raw_bin_data):
|
def _decode_record_bin(self, raw_bin_data):
|
||||||
u = unpack('!BB8s', raw_bin_data)
|
u = unpack('!BB8s', raw_bin_data)
|
||||||
|
@ -241,7 +241,7 @@ class EF_GBA_REC_LIST(TransparentEF):
|
||||||
class EF_GBA_INT_KEY(LinFixedEF):
|
class EF_GBA_INT_KEY(LinFixedEF):
|
||||||
def __init__(self, fid='af33', name='EF.GBA_INT_KEY'):
|
def __init__(self, fid='af33', name='EF.GBA_INT_KEY'):
|
||||||
super().__init__(fid, name=name,
|
super().__init__(fid, name=name,
|
||||||
desc='Secret key for GBA key derivation', rec_len={32, 32})
|
desc='Secret key for GBA key derivation', rec_len=(32, 32))
|
||||||
self._construct = GreedyBytes
|
self._construct = GreedyBytes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -588,7 +588,7 @@ class EF_DIR(LinFixedEF):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, fid='2f00', sfid=0x1e, name='EF.DIR', desc='Application Directory'):
|
def __init__(self, fid='2f00', sfid=0x1e, name='EF.DIR', desc='Application Directory'):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={5, 54})
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(5, 54))
|
||||||
self._tlv = EF_DIR.ApplicationTemplate
|
self._tlv = EF_DIR.ApplicationTemplate
|
||||||
|
|
||||||
# TS 102 221 Section 13.2
|
# TS 102 221 Section 13.2
|
||||||
|
|
|
@ -333,7 +333,7 @@ class EF_5GS3GPPNSC(LinFixedEF):
|
||||||
IdsOfSelectedEpsAlgos]):
|
IdsOfSelectedEpsAlgos]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, fid="4f03", sfid=0x03, name='EF.5GS3GPPNSC', rec_len={57, None},
|
def __init__(self, fid="4f03", sfid=0x03, name='EF.5GS3GPPNSC', rec_len=(57, None),
|
||||||
desc='5GS 3GPP Access NAS Security Context', **kwargs):
|
desc='5GS 3GPP Access NAS Security Context', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._tlv = EF_5GS3GPPNSC.FiveGSNasSecurityContext
|
self._tlv = EF_5GS3GPPNSC.FiveGSNasSecurityContext
|
||||||
|
@ -597,7 +597,7 @@ class EF_ECC(LinFixedEF):
|
||||||
|
|
||||||
def __init__(self, fid='6fb7', sfid=0x01, name='EF.ECC',
|
def __init__(self, fid='6fb7', sfid=0x01, name='EF.ECC',
|
||||||
desc='Emergency Call Codes'):
|
desc='Emergency Call Codes'):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={4, 20})
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(4, 20))
|
||||||
|
|
||||||
def _decode_record_bin(self, in_bin):
|
def _decode_record_bin(self, in_bin):
|
||||||
# mandatory parts
|
# mandatory parts
|
||||||
|
@ -661,7 +661,7 @@ class EF_PSLOCI(TransparentEF):
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.33
|
# TS 31.102 Section 4.2.33
|
||||||
class EF_ICI(CyclicEF):
|
class EF_ICI(CyclicEF):
|
||||||
def __init__(self, fid='6f80', sfid=0x14, name='EF.ICI', rec_len={28, 48},
|
def __init__(self, fid='6f80', sfid=0x14, name='EF.ICI', rec_len=(28, 48),
|
||||||
desc='Incoming Call Information', **kwargs):
|
desc='Incoming Call Information', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('alpha_id'/HexAdapter(Bytes(this._.total_len-28)),
|
self._construct = Struct('alpha_id'/HexAdapter(Bytes(this._.total_len-28)),
|
||||||
|
@ -677,7 +677,7 @@ class EF_ICI(CyclicEF):
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.34
|
# TS 31.102 Section 4.2.34
|
||||||
class EF_OCI(CyclicEF):
|
class EF_OCI(CyclicEF):
|
||||||
def __init__(self, fid='6f81', sfid=0x15, name='EF.OCI', rec_len={27, 47},
|
def __init__(self, fid='6f81', sfid=0x15, name='EF.OCI', rec_len=(27, 47),
|
||||||
desc='Outgoing Call Information', **kwargs):
|
desc='Outgoing Call Information', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('alpha_id'/HexAdapter(Bytes(this._.total_len-27)),
|
self._construct = Struct('alpha_id'/HexAdapter(Bytes(this._.total_len-27)),
|
||||||
|
@ -692,7 +692,7 @@ class EF_OCI(CyclicEF):
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.35
|
# TS 31.102 Section 4.2.35
|
||||||
class EF_ICT(CyclicEF):
|
class EF_ICT(CyclicEF):
|
||||||
def __init__(self, fid='6f82', sfid=None, name='EF.ICT', rec_len={3, 3},
|
def __init__(self, fid='6f82', sfid=None, name='EF.ICT', rec_len=(3, 3),
|
||||||
desc='Incoming Call Timer', **kwargs):
|
desc='Incoming Call Timer', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('accumulated_call_timer'/Int24ub)
|
self._construct = Struct('accumulated_call_timer'/Int24ub)
|
||||||
|
@ -700,7 +700,7 @@ class EF_ICT(CyclicEF):
|
||||||
# TS 31.102 Section 4.2.38
|
# TS 31.102 Section 4.2.38
|
||||||
class EF_CCP2(LinFixedEF):
|
class EF_CCP2(LinFixedEF):
|
||||||
def __init__(self, fid='6f4f', sfid=0x16, name='EF.CCP2', desc='Capability Configuration Parameters 2', **kwargs):
|
def __init__(self, fid='6f4f', sfid=0x16, name='EF.CCP2', desc='Capability Configuration Parameters 2', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={15, None}, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=(15, None), **kwargs)
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.47
|
# TS 31.102 Section 4.2.47
|
||||||
class EF_EST(EF_UServiceTable):
|
class EF_EST(EF_UServiceTable):
|
||||||
|
@ -769,7 +769,7 @@ class EF_GBABP(TransparentEF):
|
||||||
# TS 31.102 Section 4.2.80
|
# TS 31.102 Section 4.2.80
|
||||||
class EF_MSK(LinFixedEF):
|
class EF_MSK(LinFixedEF):
|
||||||
def __init__(self, fid='6fd7', sfid=None, name='EF.MSK', desc='MBMS Service Key List', **kwargs):
|
def __init__(self, fid='6fd7', sfid=None, name='EF.MSK', desc='MBMS Service Key List', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={20, None}, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=(20, None), **kwargs)
|
||||||
msk_ts_constr = Struct('msk_id'/Int32ub, 'timestamp_counter'/Int32ub)
|
msk_ts_constr = Struct('msk_id'/Int32ub, 'timestamp_counter'/Int32ub)
|
||||||
self._construct = Struct('key_domain_id'/HexAdapter(Bytes(3)),
|
self._construct = Struct('key_domain_id'/HexAdapter(Bytes(3)),
|
||||||
'num_msk_id'/Int8ub,
|
'num_msk_id'/Int8ub,
|
||||||
|
@ -792,7 +792,7 @@ class EF_MUK(LinFixedEF):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, fid='6fd8', sfid=None, name='EF.MUK', desc='MBMS User Key', **kwargs):
|
def __init__(self, fid='6fd8', sfid=None, name='EF.MUK', desc='MBMS User Key', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={None, None}, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=(None, None), **kwargs)
|
||||||
self._tlv = EF_MUK.EF_MUK_Collection
|
self._tlv = EF_MUK.EF_MUK_Collection
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.83
|
# TS 31.102 Section 4.2.83
|
||||||
|
@ -807,7 +807,7 @@ class EF_GBANL(LinFixedEF):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, fid='6fda', sfid=None, name='EF.GBANL', desc='GBA NAF List', **kwargs):
|
def __init__(self, fid='6fda', sfid=None, name='EF.GBANL', desc='GBA NAF List', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={None, None}, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=(None, None), **kwargs)
|
||||||
self._tlv = EF_GBANL.EF_GBANL_Collection
|
self._tlv = EF_GBANL.EF_GBANL_Collection
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.85
|
# TS 31.102 Section 4.2.85
|
||||||
|
@ -822,7 +822,7 @@ class EF_EHPLMNPI(TransparentEF):
|
||||||
class EF_NAFKCA(LinFixedEF):
|
class EF_NAFKCA(LinFixedEF):
|
||||||
class NAF_KeyCentreAddress(BER_TLV_IE, tag=0x80):
|
class NAF_KeyCentreAddress(BER_TLV_IE, tag=0x80):
|
||||||
_construct = HexAdapter(GreedyBytes)
|
_construct = HexAdapter(GreedyBytes)
|
||||||
def __init__(self, fid='6fdd', sfid=None, name='EF.NAFKCA', rec_len={None, None},
|
def __init__(self, fid='6fdd', sfid=None, name='EF.NAFKCA', rec_len=(None, None),
|
||||||
desc='NAF Key Centre Address', **kwargs):
|
desc='NAF Key Centre Address', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._tlv = EF_NAFKCA.NAF_KeyCentreAddress
|
self._tlv = EF_NAFKCA.NAF_KeyCentreAddress
|
||||||
|
@ -853,7 +853,7 @@ class EF_NCP_IP(LinFixedEF):
|
||||||
class EF_NCP_IP_Collection(TLV_IE_Collection,
|
class EF_NCP_IP_Collection(TLV_IE_Collection,
|
||||||
nested=[AccessPointName, Login, Password, BearerDescription]):
|
nested=[AccessPointName, Login, Password, BearerDescription]):
|
||||||
pass
|
pass
|
||||||
def __init__(self, fid='6fe2', sfid=None, name='EF.NCP-IP', rec_len={None, None},
|
def __init__(self, fid='6fe2', sfid=None, name='EF.NCP-IP', rec_len=(None, None),
|
||||||
desc='Network Connectivity Parameters for USIM IP connections', **kwargs):
|
desc='Network Connectivity Parameters for USIM IP connections', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._tlv = EF_NCP_IP.EF_NCP_IP_Collection
|
self._tlv = EF_NCP_IP.EF_NCP_IP_Collection
|
||||||
|
@ -890,7 +890,7 @@ class EF_EPSNSC(LinFixedEF):
|
||||||
nested=[KSI_ASME, K_ASME, UplinkNASCount, DownlinkNASCount,
|
nested=[KSI_ASME, K_ASME, UplinkNASCount, DownlinkNASCount,
|
||||||
IDofNASAlgorithms]):
|
IDofNASAlgorithms]):
|
||||||
pass
|
pass
|
||||||
def __init__(self, fid='6fe4', sfid=0x18, name='EF.EPSNSC', rec_len={54, 128},
|
def __init__(self, fid='6fe4', sfid=0x18, name='EF.EPSNSC', rec_len=(54, 128),
|
||||||
desc='EPS NAS Security Context', **kwargs):
|
desc='EPS NAS Security Context', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._tlv = EF_EPSNSC.EPS_NAS_Security_Context
|
self._tlv = EF_EPSNSC.EPS_NAS_Security_Context
|
||||||
|
@ -905,7 +905,7 @@ class EF_PWS(TransparentEF):
|
||||||
|
|
||||||
# TS 31.102 Section 4.2.101
|
# TS 31.102 Section 4.2.101
|
||||||
class EF_IPS(CyclicEF):
|
class EF_IPS(CyclicEF):
|
||||||
def __init__(self, fid='6ff1', sfid=None, name='EF.IPS', rec_len={4, 4},
|
def __init__(self, fid='6ff1', sfid=None, name='EF.IPS', rec_len=(4, 4),
|
||||||
desc='IMEI(SV) Pairing Status', **kwargs):
|
desc='IMEI(SV) Pairing Status', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('status'/PaddedString(2, 'ascii'),
|
self._construct = Struct('status'/PaddedString(2, 'ascii'),
|
||||||
|
@ -975,7 +975,7 @@ class EF_UAC_AIC(TransparentEF):
|
||||||
# TS 31.102 Section 4.4.11.9
|
# TS 31.102 Section 4.4.11.9
|
||||||
class EF_OPL5G(LinFixedEF):
|
class EF_OPL5G(LinFixedEF):
|
||||||
def __init__(self, fid='6f08', sfid=0x08, name='EF.OPL5G', desc='5GS Operator PLMN List', **kwargs):
|
def __init__(self, fid='6f08', sfid=0x08, name='EF.OPL5G', desc='5GS Operator PLMN List', **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len={10, None}, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=(10, None), **kwargs)
|
||||||
Tai = Struct('mcc_mnc'/BcdAdapter(Bytes(3)), 'tac_min'/HexAdapter(Bytes(3)),
|
Tai = Struct('mcc_mnc'/BcdAdapter(Bytes(3)), 'tac_min'/HexAdapter(Bytes(3)),
|
||||||
'tac_max'/HexAdapter(Bytes(3)))
|
'tac_max'/HexAdapter(Bytes(3)))
|
||||||
self._construct = Struct('tai'/Tai, 'pnn_record_id'/Int8ub)
|
self._construct = Struct('tai'/Tai, 'pnn_record_id'/Int8ub)
|
||||||
|
@ -1131,7 +1131,7 @@ class ADF_USIM(CardADF):
|
||||||
EF_ACMmax(service=13),
|
EF_ACMmax(service=13),
|
||||||
EF_UST(),
|
EF_UST(),
|
||||||
CyclicEF('6f39', None, 'EF.ACM',
|
CyclicEF('6f39', None, 'EF.ACM',
|
||||||
'Accumulated call meter', rec_len={3, 3}, service=13),
|
'Accumulated call meter', rec_len=(3, 3), service=13),
|
||||||
TransparentEF('6f3e', None, 'EF.GID1', 'Group Identifier Level 1', service=17),
|
TransparentEF('6f3e', None, 'EF.GID1', 'Group Identifier Level 1', service=17),
|
||||||
TransparentEF('6f3f', None, 'EF.GID2', 'Group Identifier Level 2', service=18),
|
TransparentEF('6f3f', None, 'EF.GID2', 'Group Identifier Level 2', service=18),
|
||||||
EF_SPN(service=19),
|
EF_SPN(service=19),
|
||||||
|
|
|
@ -343,7 +343,7 @@ EF_SST_map = {
|
||||||
# TS 51.011 Section 10.5.1
|
# TS 51.011 Section 10.5.1
|
||||||
class EF_ADN(LinFixedEF):
|
class EF_ADN(LinFixedEF):
|
||||||
def __init__(self, fid='6f3a', sfid=None, name='EF.ADN', desc='Abbreviated Dialing Numbers', **kwargs):
|
def __init__(self, fid='6f3a', sfid=None, name='EF.ADN', desc='Abbreviated Dialing Numbers', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={14, 30}, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(14, 30), **kwargs)
|
||||||
self._construct = Struct('alpha_id'/COptional(GsmStringAdapter(Rpad(Bytes(this._.total_len-14)), codec='ascii')),
|
self._construct = Struct('alpha_id'/COptional(GsmStringAdapter(Rpad(Bytes(this._.total_len-14)), codec='ascii')),
|
||||||
'len_of_bcd'/Int8ub,
|
'len_of_bcd'/Int8ub,
|
||||||
'ton_npi'/TonNpi,
|
'ton_npi'/TonNpi,
|
||||||
|
@ -354,7 +354,7 @@ class EF_ADN(LinFixedEF):
|
||||||
# TS 51.011 Section 10.5.5
|
# TS 51.011 Section 10.5.5
|
||||||
class EF_SMS(LinFixedEF):
|
class EF_SMS(LinFixedEF):
|
||||||
def __init__(self, fid='6f3c', sfid=None, name='EF.SMS', desc='Short messages', **kwargs):
|
def __init__(self, fid='6f3c', sfid=None, name='EF.SMS', desc='Short messages', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={176, 176}, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(176, 176), **kwargs)
|
||||||
|
|
||||||
def _decode_record_bin(self, raw_bin_data):
|
def _decode_record_bin(self, raw_bin_data):
|
||||||
def decode_status(status):
|
def decode_status(status):
|
||||||
|
@ -385,7 +385,7 @@ class EF_SMS(LinFixedEF):
|
||||||
# TS 51.011 Section 10.5.5
|
# TS 51.011 Section 10.5.5
|
||||||
class EF_MSISDN(LinFixedEF):
|
class EF_MSISDN(LinFixedEF):
|
||||||
def __init__(self, fid='6f40', sfid=None, name='EF.MSISDN', desc='MSISDN', **kwargs):
|
def __init__(self, fid='6f40', sfid=None, name='EF.MSISDN', desc='MSISDN', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={15, 34}, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=(15, 34), **kwargs)
|
||||||
|
|
||||||
def _decode_record_hex(self, raw_hex_data):
|
def _decode_record_hex(self, raw_hex_data):
|
||||||
return {'msisdn': dec_msisdn(raw_hex_data)}
|
return {'msisdn': dec_msisdn(raw_hex_data)}
|
||||||
|
@ -427,7 +427,7 @@ class EF_SMSP(LinFixedEF):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
def __init__(self, fid='6f42', sfid=None, name='EF.SMSP', desc='Short message service parameters', **kwargs):
|
def __init__(self, fid='6f42', sfid=None, name='EF.SMSP', desc='Short message service parameters', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={28, None}, **kwargs)
|
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))))
|
ScAddr = Struct('length'/Int8ub, 'ton_npi'/TonNpi, 'call_number'/BcdAdapter(Rpad(Bytes(10))))
|
||||||
self._construct = Struct('alpha_id'/COptional(GsmStringAdapter(Rpad(Bytes(this._.total_len-28)))),
|
self._construct = Struct('alpha_id'/COptional(GsmStringAdapter(Rpad(Bytes(this._.total_len-28)))),
|
||||||
'parameter_indicators'/InvertAdapter(FlagsEnum(Byte, tp_dest_addr=1, tp_sc_addr=2,
|
'parameter_indicators'/InvertAdapter(FlagsEnum(Byte, tp_dest_addr=1, tp_sc_addr=2,
|
||||||
|
@ -455,21 +455,21 @@ class EF_SMSS(TransparentEF):
|
||||||
|
|
||||||
# TS 51.011 Section 10.5.8
|
# TS 51.011 Section 10.5.8
|
||||||
class EF_SMSR(LinFixedEF):
|
class EF_SMSR(LinFixedEF):
|
||||||
def __init__(self, fid='6f47', sfid=None, name='EF.SMSR', desc='SMS status reports', rec_len={30, 30}, **kwargs):
|
def __init__(self, fid='6f47', sfid=None, name='EF.SMSR', desc='SMS status reports', rec_len=(30, 30), **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct(
|
self._construct = Struct(
|
||||||
'sms_record_id'/Int8ub, 'sms_status_report'/HexAdapter(Bytes(29)))
|
'sms_record_id'/Int8ub, 'sms_status_report'/HexAdapter(Bytes(29)))
|
||||||
|
|
||||||
|
|
||||||
class EF_EXT(LinFixedEF):
|
class EF_EXT(LinFixedEF):
|
||||||
def __init__(self, fid, sfid=None, name='EF.EXT', desc='Extension', rec_len={13, 13}, **kwargs):
|
def __init__(self, fid, sfid=None, name='EF.EXT', desc='Extension', rec_len=(13, 13), **kwargs):
|
||||||
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct(
|
self._construct = Struct(
|
||||||
'record_type'/Int8ub, 'extension_data'/HexAdapter(Bytes(11)), 'identifier'/Int8ub)
|
'record_type'/Int8ub, 'extension_data'/HexAdapter(Bytes(11)), 'identifier'/Int8ub)
|
||||||
|
|
||||||
# TS 51.011 Section 10.5.16
|
# TS 51.011 Section 10.5.16
|
||||||
class EF_CMI(LinFixedEF):
|
class EF_CMI(LinFixedEF):
|
||||||
def __init__(self, fid='6f58', sfid=None, name='EF.CMI', rec_len={2, 21},
|
def __init__(self, fid='6f58', sfid=None, name='EF.CMI', rec_len=(2, 21),
|
||||||
desc='Comparison Method Information', **kwargs):
|
desc='Comparison Method Information', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct(
|
self._construct = Struct(
|
||||||
|
@ -484,9 +484,9 @@ class DF_TELECOM(CardDF):
|
||||||
EF_ADN(fid='6f3b', name='EF.FDN', desc='Fixed dialling numbers'),
|
EF_ADN(fid='6f3b', name='EF.FDN', desc='Fixed dialling numbers'),
|
||||||
EF_SMS(),
|
EF_SMS(),
|
||||||
LinFixedEF(fid='6f3d', name='EF.CCP',
|
LinFixedEF(fid='6f3d', name='EF.CCP',
|
||||||
desc='Capability Configuration Parameters', rec_len={14, 14}),
|
desc='Capability Configuration Parameters', rec_len=(14, 14)),
|
||||||
LinFixedEF(fid='6f4f', name='EF.ECCP',
|
LinFixedEF(fid='6f4f', name='EF.ECCP',
|
||||||
desc='Extended Capability Configuration Parameters', rec_len={15, 32}),
|
desc='Extended Capability Configuration Parameters', rec_len=(15, 32)),
|
||||||
EF_MSISDN(),
|
EF_MSISDN(),
|
||||||
EF_SMSP(),
|
EF_SMSP(),
|
||||||
EF_SMSS(),
|
EF_SMSS(),
|
||||||
|
@ -790,7 +790,7 @@ class EF_CNL(TransRecEF):
|
||||||
|
|
||||||
# TS 51.011 Section 10.3.31
|
# TS 51.011 Section 10.3.31
|
||||||
class EF_NIA(LinFixedEF):
|
class EF_NIA(LinFixedEF):
|
||||||
def __init__(self, fid='6f51', sfid=None, name='EF.NIA', rec_len={1, 32},
|
def __init__(self, fid='6f51', sfid=None, name='EF.NIA', rec_len=(1, 32),
|
||||||
desc='Network\'s Indication of Alerting', **kwargs):
|
desc='Network\'s Indication of Alerting', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct(
|
self._construct = Struct(
|
||||||
|
@ -895,21 +895,21 @@ class EF_PNN(LinFixedEF):
|
||||||
|
|
||||||
# TS 51.011 Section 10.3.42
|
# TS 51.011 Section 10.3.42
|
||||||
class EF_OPL(LinFixedEF):
|
class EF_OPL(LinFixedEF):
|
||||||
def __init__(self, fid='6fc6', sfid=None, name='EF.OPL', rec_len={8, 8}, desc='Operator PLMN List', **kwargs):
|
def __init__(self, fid='6fc6', sfid=None, name='EF.OPL', rec_len=(8, 8), desc='Operator PLMN List', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('lai'/Struct('mcc_mnc'/BcdAdapter(Bytes(3)),
|
self._construct = Struct('lai'/Struct('mcc_mnc'/BcdAdapter(Bytes(3)),
|
||||||
'lac_min'/HexAdapter(Bytes(2)), 'lac_max'/HexAdapter(Bytes(2))), 'pnn_record_id'/Int8ub)
|
'lac_min'/HexAdapter(Bytes(2)), 'lac_max'/HexAdapter(Bytes(2))), 'pnn_record_id'/Int8ub)
|
||||||
|
|
||||||
# TS 51.011 Section 10.3.44 + TS 31.102 4.2.62
|
# TS 51.011 Section 10.3.44 + TS 31.102 4.2.62
|
||||||
class EF_MBI(LinFixedEF):
|
class EF_MBI(LinFixedEF):
|
||||||
def __init__(self, fid='6fc9', sfid=None, name='EF.MBI', rec_len={4, 5}, desc='Mailbox Identifier', **kwargs):
|
def __init__(self, fid='6fc9', sfid=None, name='EF.MBI', rec_len=(4, 5), desc='Mailbox Identifier', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('mbi_voicemail'/Int8ub, 'mbi_fax'/Int8ub, 'mbi_email'/Int8ub,
|
self._construct = Struct('mbi_voicemail'/Int8ub, 'mbi_fax'/Int8ub, 'mbi_email'/Int8ub,
|
||||||
'mbi_other'/Int8ub, 'mbi_videocall'/COptional(Int8ub))
|
'mbi_other'/Int8ub, 'mbi_videocall'/COptional(Int8ub))
|
||||||
|
|
||||||
# TS 51.011 Section 10.3.45 + TS 31.102 4.2.63
|
# TS 51.011 Section 10.3.45 + TS 31.102 4.2.63
|
||||||
class EF_MWIS(LinFixedEF):
|
class EF_MWIS(LinFixedEF):
|
||||||
def __init__(self, fid='6fca', sfid=None, name='EF.MWIS', rec_len={5, 6},
|
def __init__(self, fid='6fca', sfid=None, name='EF.MWIS', rec_len=(5, 6),
|
||||||
desc='Message Waiting Indication Status', **kwargs):
|
desc='Message Waiting Indication Status', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('mwi_status'/FlagsEnum(Byte, voicemail=1, fax=2, email=4, other=8, videomail=16),
|
self._construct = Struct('mwi_status'/FlagsEnum(Byte, voicemail=1, fax=2, email=4, other=8, videomail=16),
|
||||||
|
@ -932,7 +932,7 @@ class EF_SPDI(TransparentEF):
|
||||||
|
|
||||||
# TS 51.011 Section 10.3.51
|
# TS 51.011 Section 10.3.51
|
||||||
class EF_MMSN(LinFixedEF):
|
class EF_MMSN(LinFixedEF):
|
||||||
def __init__(self, fid='6fce', sfid=None, name='EF.MMSN', rec_len={4, 20}, desc='MMS Notification', **kwargs):
|
def __init__(self, fid='6fce', sfid=None, name='EF.MMSN', rec_len=(4, 20), desc='MMS Notification', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._construct = Struct('mms_status'/HexAdapter(Bytes(2)), 'mms_implementation'/HexAdapter(Bytes(1)),
|
self._construct = Struct('mms_status'/HexAdapter(Bytes(2)), 'mms_implementation'/HexAdapter(Bytes(1)),
|
||||||
'mms_notification'/HexAdapter(Bytes(this._.total_len-4)), 'ext_record_nr'/Byte)
|
'mms_notification'/HexAdapter(Bytes(this._.total_len-4)), 'ext_record_nr'/Byte)
|
||||||
|
@ -974,7 +974,7 @@ class EF_MMSUP(LinFixedEF):
|
||||||
class MMS_User_Preferences(TLV_IE_Collection,
|
class MMS_User_Preferences(TLV_IE_Collection,
|
||||||
nested=[MMS_Implementation, MMS_UserPref_ProfileName, MMS_UserPref_Info]):
|
nested=[MMS_Implementation, MMS_UserPref_ProfileName, MMS_UserPref_Info]):
|
||||||
pass
|
pass
|
||||||
def __init__(self, fid='6fd1', sfid=None, name='EF.MMSUP', rec_len={1, None},
|
def __init__(self, fid='6fd1', sfid=None, name='EF.MMSUP', rec_len=(1, None),
|
||||||
desc='MMS User Preferences', **kwargs):
|
desc='MMS User Preferences', **kwargs):
|
||||||
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs)
|
||||||
self._tlv = EF_MMSUP.MMS_User_Preferences
|
self._tlv = EF_MMSUP.MMS_User_Preferences
|
||||||
|
@ -1000,7 +1000,7 @@ class DF_GSM(CardDF):
|
||||||
EF_ServiceTable('6f38', None, 'EF.SST',
|
EF_ServiceTable('6f38', None, 'EF.SST',
|
||||||
'SIM service table', table=EF_SST_map, size=(2, 16)),
|
'SIM service table', table=EF_SST_map, size=(2, 16)),
|
||||||
CyclicEF('6f39', None, 'EF.ACM',
|
CyclicEF('6f39', None, 'EF.ACM',
|
||||||
'Accumulated call meter', rec_len={3, 3}),
|
'Accumulated call meter', rec_len=(3, 3)),
|
||||||
TransparentEF('6f3e', None, 'EF.GID1', 'Group Identifier Level 1'),
|
TransparentEF('6f3e', None, 'EF.GID1', 'Group Identifier Level 1'),
|
||||||
TransparentEF('6f3f', None, 'EF.GID2', 'Group Identifier Level 2'),
|
TransparentEF('6f3f', None, 'EF.GID2', 'Group Identifier Level 2'),
|
||||||
EF_SPN(),
|
EF_SPN(),
|
||||||
|
|
Loading…
Reference in New Issue