From a630a3cd28f74bb995fadbb99aed6db393767265 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Feb 2022 10:41:00 +0100 Subject: [PATCH] cosmetic: Remove extraneous empty lines between spec-section-comment and class This is an artefact of the recent autopep8 re-formatting. Change-Id: I8b0e7781719d69e18856ada2f482de2c5396bcc3 --- pySim/cat.py | 34 ------------------- pySim/iso7816_4.py | 18 ----------- pySim/ts_102_221.py | 10 ------ pySim/ts_31_102.py | 73 ----------------------------------------- pySim/ts_31_103.py | 24 -------------- pySim/ts_51_011.py | 79 --------------------------------------------- 6 files changed, 238 deletions(-) diff --git a/pySim/cat.py b/pySim/cat.py index 332ad582..248be647 100644 --- a/pySim/cat.py +++ b/pySim/cat.py @@ -24,48 +24,34 @@ from construct import * # Tag values as per TS 101 220 Table 7.23 # TS 102 223 Section 8.1 - - class Address(COMPR_TLV_IE, tag=0x06): _construct = Struct('ton_npi'/Int8ub, 'call_number'/BcdAdapter(Bytes(this._.total_len-1))) # TS 102 223 Section 8.2 - - class AlphaIdentifier(COMPR_TLV_IE, tag=0x05): # FIXME: like EF.ADN pass # TS 102 223 Section 8.3 - - class Subaddress(COMPR_TLV_IE, tag=0x08): pass # TS 102 223 Section 8.4 - - class CapabilityConfigParams(COMPR_TLV_IE, tag=0x07): pass # TS 31.111 Section 8.5 - - class CBSPage(COMPR_TLV_IE, tag=0x0C): pass # TS 102 223 Section 8.6 - - class CommandDetails(COMPR_TLV_IE, tag=0x01): _construct = Struct('command_number'/Int8ub, 'type_of_command'/Int8ub, 'command_qualifier'/Int8ub) # TS 102 223 Section 8.7 - - class DeviceIdentities(COMPR_TLV_IE, tag=0x82): DEV_IDS = bidict({ 0x01: 'keypad', @@ -115,35 +101,25 @@ class DeviceIdentities(COMPR_TLV_IE, tag=0x82): return bytes([src, dst]) # TS 102 223 Section 8.8 - - class Duration(COMPR_TLV_IE, tag=0x04): _construct = Struct('time_unit'/Int8ub, 'time_interval'/Int8ub) # TS 102 223 Section 8.9 - - class Item(COMPR_TLV_IE, tag=0x0f): _construct = Struct('identifier'/Int8ub, 'text_string'/GsmStringAdapter(GreedyBytes)) # TS 102 223 Section 8.10 - - class ItemIdentifier(COMPR_TLV_IE, tag=0x10): _construct = Struct('identifier'/Int8ub) # TS 102 223 Section 8.11 - - class ResponseLength(COMPR_TLV_IE, tag=0x11): _construct = Struct('minimum_length'/Int8ub, 'maximum_length'/Int8ub) # TS 102 223 Section 8.12 - - class Result(COMPR_TLV_IE, tag=0x03): _construct = Struct('general_result'/Int8ub, 'additional_information'/HexAdapter(GreedyBytes)) @@ -154,21 +130,15 @@ class SMS_TPDU(COMPR_TLV_IE, tag=0x8B): _construct = Struct('tpdu'/HexAdapter(GreedyBytes)) # TS 102 223 Section 8.15 - - class TextString(COMPR_TLV_IE, tag=0x0d): _construct = Struct('dcs'/Int8ub, 'text_string'/HexAdapter(GreedyBytes)) # TS 102 223 Section 8.16 - - class Tone(COMPR_TLV_IE, tag=0x0e): _construct = Struct('tone'/Int8ub) # TS 31 111 Section 8.17 - - class USSDString(COMPR_TLV_IE, tag=0x0a): _construct = Struct('dcs'/Int8ub, 'ussd_string'/HexAdapter(GreedyBytes)) @@ -179,15 +149,11 @@ class ProactiveCommand(BER_TLV_IE, tag=0xD0): pass # TS 101 220 Table 7.17 + 31.111 7.1.1.2 - - class SMSPPDownload(BER_TLV_IE, tag=0xD1, nested=[DeviceIdentities, Address, SMS_TPDU]): pass # TS 101 220 Table 7.17 + 31.111 7.1.1.3 - - class SMSCBDownload(BER_TLV_IE, tag=0xD2, nested=[DeviceIdentities, CBSPage]): pass diff --git a/pySim/iso7816_4.py b/pySim/iso7816_4.py index c1df419b..1da58097 100644 --- a/pySim/iso7816_4.py +++ b/pySim/iso7816_4.py @@ -24,56 +24,38 @@ from pySim.filesystem import * from pySim.tlv import * # Table 91 + Section 8.2.1.2 - - class ApplicationId(BER_TLV_IE, tag=0x4f): _construct = GreedyBytes # Table 91 - - class ApplicationLabel(BER_TLV_IE, tag=0x50): _construct = GreedyBytes # Table 91 + Section 5.3.1.2 - - class FileReference(BER_TLV_IE, tag=0x51): _construct = GreedyBytes # Table 91 - - class CommandApdu(BER_TLV_IE, tag=0x52): _construct = GreedyBytes # Table 91 - - class DiscretionaryData(BER_TLV_IE, tag=0x53): _construct = GreedyBytes # Table 91 - - class DiscretionaryTemplate(BER_TLV_IE, tag=0x73): _construct = GreedyBytes # Table 91 + RFC1738 / RFC2396 - - class URL(BER_TLV_IE, tag=0x5f50): _construct = GreedyString('ascii') # Table 91 - - class ApplicationRelatedDOSet(BER_TLV_IE, tag=0x61): _construct = GreedyBytes # Section 8.2.1.3 Application Template - - class ApplicationTemplate(BER_TLV_IE, tag=0x61, nested=[ApplicationId, ApplicationLabel, FileReference, CommandApdu, DiscretionaryData, DiscretionaryTemplate, URL, ApplicationRelatedDOSet]): diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py index 24c95890..82776a03 100644 --- a/pySim/ts_102_221.py +++ b/pySim/ts_102_221.py @@ -250,8 +250,6 @@ def tlv_val_interpret(inmap, indata): return {d[0]: newval(inmap, d[0], d[1]) for d in indata.items()} # ETSI TS 102 221 Section 9.2.7 + ISO7816-4 9.3.3/9.3.4 - - class _AM_DO_DF(DataObject): def __init__(self): super().__init__('access_mode', 'Access Mode', tag=0x80) @@ -463,8 +461,6 @@ class CRT_DO(DataObject): return b'\x83\x01' + pin.to_bytes(1, 'big') + b'\x95\x01\x08' # ISO7816-4 9.3.3 Table 33 - - class SecCondByte_DO(DataObject): def __init__(self, tag=0x9d): super().__init__('security_condition_byte', tag=tag) @@ -557,8 +553,6 @@ SC_DO = DataObjectChoice('security_condition', 'Security Condition', OR_DO, AND_DO, NOT_DO]) # TS 102 221 Section 13.1 - - class EF_DIR(LinFixedEF): class ApplicationLabel(BER_TLV_IE, tag=0x50): # TODO: UCS-2 coding option as per Annex A of TS 102 221 @@ -578,8 +572,6 @@ class EF_DIR(LinFixedEF): self._tlv = EF_DIR.ApplicationTemplate # TS 102 221 Section 13.2 - - class EF_ICCID(TransparentEF): def __init__(self, fid='2fe2', sfid=0x02, name='EF.ICCID', desc='ICC Identification'): super().__init__(fid, sfid=sfid, name=name, desc=desc, size={10, 10}) @@ -591,8 +583,6 @@ class EF_ICCID(TransparentEF): return enc_iccid(abstract['iccid']) # TS 102 221 Section 13.3 - - class EF_PL(TransRecEF): def __init__(self, fid='2f05', sfid=0x05, name='EF.PL', desc='Preferred Languages'): super().__init__(fid, sfid=sfid, name=name, diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py index 30b65dab..17d865d3 100644 --- a/pySim/ts_31_102.py +++ b/pySim/ts_31_102.py @@ -304,7 +304,6 @@ EF_USIM_ADF_map = { # 3GPP TS 31.102 Section 4.4.11.4 (EF_5GS3GPPNSC) - class EF_5GS3GPPNSC(LinFixedEF): class NgKSI(BER_TLV_IE, tag=0x80): _construct = Int8ub @@ -338,8 +337,6 @@ class EF_5GS3GPPNSC(LinFixedEF): self._tlv = EF_5GS3GPPNSC.FiveGSNasSecurityContext # 3GPP TS 31.102 Section 4.4.11.6 - - class EF_5GAUTHKEYS(TransparentEF): class K_AUSF(BER_TLV_IE, tag=0x80): _construct = HexAdapter(GreedyBytes) @@ -356,8 +353,6 @@ class EF_5GAUTHKEYS(TransparentEF): self._tlv = EF_5GAUTHKEYS.FiveGAuthKeys # 3GPP TS 31.102 Section 4.4.11.8 - - class ProtSchemeIdList(BER_TLV_IE, tag=0xa0): # FIXME: 3GPP TS 24.501 Protection Scheme Identifier # repeated sequence of (id, index) tuples @@ -380,8 +375,6 @@ class HomeNetPubKeyList(BER_TLV_IE, tag=0xa1, pass # 3GPP TS 31.102 Section 4.4.11.6 - - class SUCI_CalcInfo(TLV_IE_Collection, nested=[ProtSchemeIdList, HomeNetPubKeyList]): pass @@ -538,8 +531,6 @@ class EF_Keys(TransparentEF): 'ksi'/Int8ub, 'ck'/HexAdapter(Bytes(16)), 'ik'/HexAdapter(Bytes(16))) # TS 31.102 Section 4.2.6 - - class EF_HPPLMN(TransparentEF): def __init__(self, fid='6f31', sfid=0x12, name='EF.HPPLMN', size={1, 1}, desc='Higher Priority PLMN search period'): @@ -547,8 +538,6 @@ class EF_HPPLMN(TransparentEF): self._construct = Int8ub # TS 31.102 Section 4.2.8 - - class EF_UServiceTable(TransparentEF): def __init__(self, fid, sfid, name, desc, size, table, **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) @@ -612,8 +601,6 @@ class EF_UServiceTable(TransparentEF): self._cmd.card.update_ust(int(arg), 0) # TS 31.103 Section 4.2.7 - *not* the same as DF.GSM/EF.ECC! - - class EF_ECC(LinFixedEF): cc_construct = Rpad(BcdAdapter(Rpad(Bytes(3))), pattern='f') category_construct = FlagsEnum(Byte, police=1, ambulance=2, fire_brigade=3, marine_guard=4, @@ -655,8 +642,6 @@ class EF_LOCI(TransparentEF): self._construct = Struct('tmsi'/HexAdapter(Bytes(4)), 'lai'/HexAdapter(Bytes(5)), 'rfu'/Int8ub, 'lu_status'/Int8ub) # TS 31.102 Section 4.2.18 - - class EF_AD(TransparentEF): class OP_MODE(enum.IntEnum): normal = 0x00 @@ -680,8 +665,6 @@ class EF_AD(TransparentEF): ) # TS 31.102 Section 4.2.23 - - class EF_PSLOCI(TransparentEF): def __init__(self, fid='6f73', sfid=0x0c, name='EF.PSLOCI', desc='PS Location information', size={14, 14}): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) @@ -689,8 +672,6 @@ class EF_PSLOCI(TransparentEF): 'rai'/HexAdapter(Bytes(6)), 'rau_status'/Int8ub) # TS 31.102 Section 4.2.33 - - class EF_ICI(CyclicEF): def __init__(self, fid='6f80', sfid=0x14, name='EF.ICI', rec_len={28, 48}, desc='Incoming Call Information', **kwargs): @@ -707,8 +688,6 @@ class EF_ICI(CyclicEF): 'link_to_phonebook'/Bytes(3)) # TS 31.102 Section 4.2.34 - - class EF_OCI(CyclicEF): def __init__(self, fid='6f81', sfid=0x15, name='EF.OCI', rec_len={27, 47}, desc='Outgoing Call Information', **kwargs): @@ -724,8 +703,6 @@ class EF_OCI(CyclicEF): 'link_to_phonebook'/Bytes(3)) # TS 31.102 Section 4.2.35 - - class EF_ICT(CyclicEF): def __init__(self, fid='6f82', sfid=None, name='EF.ICT', rec_len={3, 3}, desc='Incoming Call Timer', **kwargs): @@ -733,15 +710,11 @@ class EF_ICT(CyclicEF): self._construct = Struct('accumulated_call_timer'/Int24ub) # TS 31.102 Section 4.2.38 - - class EF_CCP2(LinFixedEF): 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) # TS 31.102 Section 4.2.48 - - class EF_ACL(TransparentEF): def __init__(self, fid='6f57', sfid=None, name='EF.ACL', size={32, None}, desc='Access Point Name Control List', **kwargs): @@ -749,8 +722,6 @@ class EF_ACL(TransparentEF): self._construct = Struct('num_of_apns'/Int8ub, 'tlvs'/GreedyBytes) # TS 31.102 Section 4.2.51 - - class EF_START_HFN(TransparentEF): def __init__(self, fid='6f5b', sfid=0x0f, name='EF.START-HFN', size={6, 6}, desc='Initialisation values for Hyperframe number', **kwargs): @@ -758,8 +729,6 @@ class EF_START_HFN(TransparentEF): self._construct = Struct('start_cs'/Int24ub, 'start_ps'/Int24ub) # TS 31.102 Section 4.2.52 - - class EF_THRESHOLD(TransparentEF): def __init__(self, fid='6f5c', sfid=0x10, name='EF.THRESHOLD', size={3, 3}, desc='Maximum value of START', **kwargs): @@ -767,8 +736,6 @@ class EF_THRESHOLD(TransparentEF): self._construct = Struct('max_start'/Int24ub) # TS 31.102 Section 4.2.77 - - class EF_VGCSCA(TransRecEF): def __init__(self, fid='6fd4', sfid=None, name='EF.VGCSCA', size={2, 100}, rec_len=2, desc='Voice Group Call Service Ciphering Algorithm', **kwargs): @@ -776,8 +743,6 @@ class EF_VGCSCA(TransRecEF): self._construct = Struct('alg_v_ki_1'/Int8ub, 'alg_v_ki_2'/Int8ub) # TS 31.102 Section 4.2.79 - - class EF_GBABP(TransparentEF): def __init__(self, fid='6fd6', sfid=None, name='EF.GBABP', size={3, 50}, desc='GBA Bootstrapping parameters', **kwargs): @@ -785,8 +750,6 @@ class EF_GBABP(TransparentEF): self._construct = Struct('rand'/LV, 'b_tid'/LV, 'key_lifetime'/LV) # TS 31.102 Section 4.2.80 - - class EF_MSK(LinFixedEF): 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) @@ -795,8 +758,6 @@ class EF_MSK(LinFixedEF): 'num_msk_id'/Int8ub, 'msk_ids'/msk_ts_constr[this.num_msk_id]) # TS 31.102 Section 4.2.81 - - class EF_MUK(LinFixedEF): class MUK_Idr(BER_TLV_IE, tag=0x80): _construct = HexAdapter(GreedyBytes) @@ -818,8 +779,6 @@ class EF_MUK(LinFixedEF): self._tlv = EF_MUK.EF_MUK_Collection # TS 31.102 Section 4.2.83 - - class EF_GBANL(LinFixedEF): class NAF_ID(BER_TLV_IE, tag=0x80): _construct = HexAdapter(GreedyBytes) @@ -835,8 +794,6 @@ class EF_GBANL(LinFixedEF): self._tlv = EF_GBANL.EF_GBANL_Collection # TS 31.102 Section 4.2.85 - - class EF_EHPLMNPI(TransparentEF): def __init__(self, fid='6fdb', sfid=None, name='EF.EHPLMNPI', size={1, 1}, desc='Equivalent HPLMN Presentation Indication', **kwargs): @@ -845,8 +802,6 @@ class EF_EHPLMNPI(TransparentEF): Enum(Byte, no_preference=0, display_highest_prio_only=1, display_all=2)) # TS 31.102 Section 4.2.87 - - class EF_NAFKCA(LinFixedEF): class NAF_KeyCentreAddress(BER_TLV_IE, tag=0x80): _construct = HexAdapter(GreedyBytes) @@ -856,8 +811,6 @@ class EF_NAFKCA(LinFixedEF): self._tlv = EF_NAFKCA.NAF_KeyCentreAddress # TS 31.102 Section 4.2.90 - - class EF_NCP_IP(LinFixedEF): class DataDestAddrRange(TLV_IE, tag=0x83): _construct = Struct('type_of_address'/Enum(Byte, IPv4=0x21, IPv6=0x56), @@ -889,8 +842,6 @@ class EF_NCP_IP(LinFixedEF): self._tlv = EF_NCP_IP.EF_NCP_IP_Collection # TS 31.102 Section 4.2.91 - - class EF_EPSLOCI(TransparentEF): def __init__(self, fid='6fe3', sfid=0x1e, name='EF.EPSLOCI', size={18, 18}, desc='EPS Location Information', **kwargs): @@ -901,8 +852,6 @@ class EF_EPSLOCI(TransparentEF): 'eps_update_status'/upd_status_constr) # TS 31.102 Section 4.2.92 - - class EF_EPSNSC(LinFixedEF): class KSI_ASME(BER_TLV_IE, tag=0x80): _construct = Int8ub @@ -929,8 +878,6 @@ class EF_EPSNSC(LinFixedEF): self._tlv = EF_EPSNSC.EPS_NAS_Security_Context # TS 31.102 Section 4.2.96 - - class EF_PWS(TransparentEF): def __init__(self, fid='6fec', sfid=None, name='EF.PWS', desc='Public Warning System', size={1, 1}, **kwargs): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) @@ -939,8 +886,6 @@ class EF_PWS(TransparentEF): self._construct = Struct('pws_configuration'/pws_config) # TS 31.102 Section 4.2.101 - - class EF_IPS(CyclicEF): def __init__(self, fid='6ff1', sfid=None, name='EF.IPS', rec_len={4, 4}, desc='IMEI(SV) Pairing Status', **kwargs): @@ -949,8 +894,6 @@ class EF_IPS(CyclicEF): 'link_to_ef_ipd'/Int8ub, 'rfu'/Byte) # TS 31.102 Section 4.2.103 - - class EF_ePDGId(TransparentEF): class ePDGId(BER_TLV_IE, tag=0x80, nested=[]): _construct = Struct('type_of_ePDG_address'/Enum(Byte, FQDN=0, IPv4=1, IPv6=2), @@ -964,8 +907,6 @@ class EF_ePDGId(TransparentEF): self._tlv = EF_ePDGId.ePDGId # TS 31.102 Section 4.2.106 - - class EF_FromPreferred(TransparentEF): def __init__(self, fid='6ff7', sfid=None, name='EF.FromPreferred', size={1, 1}, desc='From Preferred', **kwargs): @@ -977,8 +918,6 @@ class EF_FromPreferred(TransparentEF): ###################################################################### # TS 31.102 Section 4.4.11.2 - - class EF_5GS3GPPLOCI(TransparentEF): def __init__(self, fid='4f01', sfid=0x01, name='EF.5GS3GPPLOCI', size={20, 20}, desc='5S 3GP location information'): @@ -989,8 +928,6 @@ class EF_5GS3GPPLOCI(TransparentEF): '5gs_update_status'/upd_status_constr) # TS 31.102 Section 4.4.11.7 - - class EF_UAC_AIC(TransparentEF): def __init__(self, fid='4f06', sfid=0x06, name='EF.UAC_AIC', size={4, 4}, desc='UAC Access Identities Configuration'): @@ -1000,8 +937,6 @@ class EF_UAC_AIC(TransparentEF): self._construct = Struct('uac_access_id_config'/cfg_constr) # TS 31.102 Section 4.4.11.9 - - class EF_OPL5G(LinFixedEF): def __init__(self, fid='6f08', sfid=0x08, name='EF.OPL5G', desc='5GS Operator PLMN List'): super().__init__(fid=fid, sfid=sfid, @@ -1009,8 +944,6 @@ class EF_OPL5G(LinFixedEF): self._construct = Struct('tai'/Bytes(9), 'pnn_record_id'/Int8ub) # TS 31.102 Section 4.4.11.10 - - class EF_SUPI_NAI(TransparentEF): class NetworkSpecificIdentifier(TLV_IE, tag=0x80): # RFC 7542 encoded as UTF-8 string @@ -1042,8 +975,6 @@ class EF_TN3GPPSNN(TransparentEF): self._tlv = EF_TN3GPPSNN.ServingNetworkName # TS 31.102 Section 4.4.5 - - class DF_WLAN(CardDF): def __init__(self, fid='5f40', name='DF.WLAN', desc='Files for WLAN purpose', **kwargs): super().__init__(fid=fid, name=name, desc=desc, **kwargs) @@ -1073,8 +1004,6 @@ class DF_WLAN(CardDF): self.add_files(files) # TS 31.102 Section 4.4.6 - - class DF_HNB(CardDF): def __init__(self, fid='5f50', name='DF.HNB', desc='Files for HomeNodeB purpose', **kwargs): super().__init__(fid=fid, name=name, desc=desc, **kwargs) @@ -1089,8 +1018,6 @@ class DF_HNB(CardDF): self.add_files(files) # TS 31.102 Section 4.4.8 - - class DF_ProSe(CardDF): def __init__(self, fid='5f90', name='DF.ProSe', desc='Files for ProSe purpose', **kwargs): super().__init__(fid=fid, name=name, desc=desc, **kwargs) diff --git a/pySim/ts_31_103.py b/pySim/ts_31_103.py index 9fcdd930..7d324091 100644 --- a/pySim/ts_31_103.py +++ b/pySim/ts_31_103.py @@ -78,8 +78,6 @@ EF_ISIM_ADF_map = { } # TS 31.103 Section 4.2.2 - - class EF_IMPI(TransparentEF): class nai(BER_TLV_IE, tag=0x80): _construct = GreedyString("utf8") @@ -89,8 +87,6 @@ class EF_IMPI(TransparentEF): self._tlv = EF_IMPI.nai # TS 31.103 Section 4.2.3 - - class EF_DOMAIN(TransparentEF): class domain(BER_TLV_IE, tag=0x80): _construct = GreedyString("utf8") @@ -100,8 +96,6 @@ class EF_DOMAIN(TransparentEF): self._tlv = EF_DOMAIN.domain # TS 31.103 Section 4.2.4 - - class EF_IMPU(LinFixedEF): class impu(BER_TLV_IE, tag=0x80): _construct = GreedyString("utf8") @@ -111,8 +105,6 @@ class EF_IMPU(LinFixedEF): self._tlv = EF_IMPU.impu # TS 31.103 Section 4.2.8 - - class EF_PCSCF(LinFixedEF): def __init__(self, fid='6f09', sfid=None, name='EF.P-CSCF', desc='P-CSCF Address', **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, **kwargs) @@ -127,29 +119,21 @@ class EF_PCSCF(LinFixedEF): return enc_addr_tlv(addr, addr_type) # TS 31.103 Section 4.2.9 - - class EF_GBABP(TransparentEF): def __init__(self, fid='6fd5', sfid=None, name='EF.GBABP', desc='GBA Bootstrapping', **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, **kwargs) # TS 31.103 Section 4.2.10 - - class EF_GBANL(LinFixedEF): def __init__(self, fid='6fd7', sfid=None, name='EF.GBANL', desc='GBA NAF List', **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, **kwargs) # TS 31.103 Section 4.2.11 - - class EF_NAFKCA(LinFixedEF): def __init__(self, fid='6fdd', sfid=None, name='EF.NAFKCA', desc='NAF Key Centre Address', **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, **kwargs) # TS 31.103 Section 4.2.16 - - class EF_UICCIARI(LinFixedEF): class iari(BER_TLV_IE, tag=0x80): _construct = GreedyString("utf8") @@ -159,22 +143,16 @@ class EF_UICCIARI(LinFixedEF): self._tlv = EF_UICCIARI.iari # TS 31.103 Section 4.2.18 - - class EF_IMSConfigData(BerTlvEF): def __init__(self, fid='6ff8', sfid=None, name='EF.IMSConfigData', desc='IMS Configuration Data', **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, **kwargs) # TS 31.103 Section 4.2.19 - - class EF_XCAPConfigData(BerTlvEF): def __init__(self, fid='6ffc', sfid=None, name='EF.XCAPConfigData', desc='XCAP Configuration Data', **kwargs): super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, **kwargs) # TS 31.103 Section 4.2.20 - - class EF_WebRTCURI(TransparentEF): class uri(BER_TLV_IE, tag=0x80): _construct = GreedyString("utf8") @@ -184,8 +162,6 @@ class EF_WebRTCURI(TransparentEF): self._tlv = EF_WebRTCURI.uri # TS 31.103 Section 4.2.21 - - class EF_MuDMiDConfigData(BerTlvEF): def __init__(self, fid='6ffe', sfid=None, name='EF.MuDMiDConfigData', desc='MuD and MiD Configuration Data', **kwargs): diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py index d13e4b79..f9f1e2a7 100644 --- a/pySim/ts_51_011.py +++ b/pySim/ts_51_011.py @@ -340,7 +340,6 @@ EF_SST_map = { ###################################################################### # TS 51.011 Section 10.5.1 - class EF_ADN(LinFixedEF): 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) @@ -353,8 +352,6 @@ class EF_ADN(LinFixedEF): 'dialing_nr': u[2], 'cap_conf_id': u[3], 'ext1_record_id': u[4]} # TS 51.011 Section 10.5.5 - - class EF_SMS(LinFixedEF): 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) @@ -404,15 +401,11 @@ class EF_MSISDN(LinFixedEF): return alpha_identifier + encoded_msisdn # TS 51.011 Section 10.5.6 - - class EF_SMSP(LinFixedEF): 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) # TS 51.011 Section 10.5.7 - - class EF_SMSS(TransparentEF): class MemCapAdapter(Adapter): def _decode(self, obj, context, path): @@ -427,8 +420,6 @@ class EF_SMSS(TransparentEF): 'last_used_tpmr'/Int8ub, 'memory_capacity_exceeded'/self.MemCapAdapter(Int8ub)) # TS 51.011 Section 10.5.8 - - class EF_SMSR(LinFixedEF): 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) @@ -443,8 +434,6 @@ class EF_EXT(LinFixedEF): 'record_type'/Int8ub, 'extension_data'/HexAdapter(Bytes(11)), 'identifier'/Int8ub) # TS 51.011 Section 10.5.16 - - class EF_CMI(LinFixedEF): def __init__(self, fid='6f58', sfid=None, name='EF.CMI', rec_len={2, 21}, desc='Comparison Method Information', **kwargs): @@ -483,8 +472,6 @@ class DF_TELECOM(CardDF): ###################################################################### # TS 51.011 Section 10.3.1 - - class EF_LP(TransRecEF): def __init__(self, fid='6f05', sfid=None, name='EF.LP', size={1, None}, rec_len=1, desc='Language Preference'): @@ -497,8 +484,6 @@ class EF_LP(TransRecEF): return h2b(in_json) # TS 51.011 Section 10.3.2 - - class EF_IMSI(TransparentEF): def __init__(self, fid='6f07', sfid=None, name='EF.IMSI', desc='IMSI', size={9, 9}): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) @@ -555,8 +540,6 @@ class EF_PLMNsel(TransRecEF): return enc_plmn(in_json['mcc'], in_json['mnc']) # TS 51.011 Section 10.3.6 - - class EF_ACMmax(TransparentEF): def __init__(self, fid='6f37', sfid=None, name='EF.ACMmax', size={3, 3}, desc='ACM maximum value', **kwargs): @@ -564,8 +547,6 @@ class EF_ACMmax(TransparentEF): self._construct = Struct('acm_max'/Int24ub) # TS 51.011 Section 10.3.7 - - class EF_ServiceTable(TransparentEF): def __init__(self, fid, sfid, name, desc, size, table): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) @@ -616,8 +597,6 @@ class EF_ServiceTable(TransparentEF): return out # TS 51.011 Section 10.3.11 - - class EF_SPN(TransparentEF): def __init__(self, fid='6f46', sfid=None, name='EF.SPN', desc='Service Provider Name', size={17, 17}, **kwargs): @@ -632,8 +611,6 @@ class EF_SPN(TransparentEF): ) # TS 51.011 Section 10.3.13 - - class EF_CBMI(TransRecEF): def __init__(self, fid='6f45', sfid=None, name='EF.CBMI', size={2, None}, rec_len=2, desc='Cell Broadcast message identifier selection', **kwargs): @@ -641,8 +618,6 @@ class EF_CBMI(TransRecEF): self._construct = GreedyRange(Int16ub) # TS 51.011 Section 10.3.15 - - class EF_ACC(TransparentEF): def __init__(self, fid='6f78', sfid=None, name='EF.ACC', desc='Access Control Class', size={2, 2}, **kwargs): @@ -655,8 +630,6 @@ class EF_ACC(TransparentEF): return pack('!H', abstract['acc']) # TS 51.011 Section 10.3.16 - - class EF_LOCI(TransparentEF): def __init__(self, fid='6f7e', sfid=None, name='EF.LOCI', desc='Location Information', size={11, 11}): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) @@ -665,8 +638,6 @@ class EF_LOCI(TransparentEF): location_area_not_allowed=3)) # TS 51.011 Section 10.3.18 - - class EF_AD(TransparentEF): class OP_MODE(enum.IntEnum): normal = 0x00 @@ -698,8 +669,6 @@ class EF_AD(TransparentEF): ) # TS 51.011 Section 10.3.20 / 10.3.22 - - class EF_VGCS(TransRecEF): def __init__(self, fid='6fb1', sfid=None, name='EF.VGCS', size={4, 200}, rec_len=4, desc='Voice Group Call Service', **kwargs): @@ -707,8 +676,6 @@ class EF_VGCS(TransRecEF): self._construct = BcdAdapter(Bytes(4)) # TS 51.011 Section 10.3.21 / 10.3.23 - - class EF_VGCSS(TransparentEF): def __init__(self, fid='6fb2', sfid=None, name='EF.VGCSS', size={7, 7}, desc='Voice Group Call Service Status', **kwargs): @@ -717,8 +684,6 @@ class EF_VGCSS(TransparentEF): 'flags'/Bit[50], Padding(6, pattern=b'\xff')) # TS 51.011 Section 10.3.24 - - class EF_eMLPP(TransparentEF): def __init__(self, fid='6fb5', sfid=None, name='EF.eMLPP', size={2, 2}, desc='enhanced Multi Level Pre-emption and Priority', **kwargs): @@ -729,8 +694,6 @@ class EF_eMLPP(TransparentEF): 'levels'/FlagsConstruct, 'fast_call_setup_cond'/FlagsConstruct) # TS 51.011 Section 10.3.25 - - class EF_AAeM(TransparentEF): def __init__(self, fid='6fb6', sfid=None, name='EF.AAeM', size={1, 1}, desc='Automatic Answer for eMLPP Service', **kwargs): @@ -740,8 +703,6 @@ class EF_AAeM(TransparentEF): self._construct = Struct('auto_answer_prio_levels'/FlagsConstruct) # TS 51.011 Section 10.3.26 - - class EF_CBMID(EF_CBMI): def __init__(self, fid='6f48', sfid=None, name='EF.CBMID', size={2, None}, rec_len=2, desc='Cell Broadcast Message Identifier for Data Download', **kwargs): @@ -749,8 +710,6 @@ class EF_CBMID(EF_CBMI): self._construct = GreedyRange(Int16ub) # TS 51.011 Section 10.3.27 - - class EF_ECC(TransRecEF): def __init__(self, fid='6fb7', sfid=None, name='EF.ECC', size={3, 15}, rec_len=3, desc='Emergency Call Codes', **kwargs): @@ -758,8 +717,6 @@ class EF_ECC(TransRecEF): self._construct = GreedyRange(BcdAdapter(Bytes(3))) # TS 51.011 Section 10.3.28 - - class EF_CBMIR(TransRecEF): def __init__(self, fid='6f50', sfid=None, name='EF.CBMIR', size={4, None}, rec_len=4, desc='Cell Broadcast message identifier range selection', **kwargs): @@ -767,8 +724,6 @@ class EF_CBMIR(TransRecEF): self._construct = GreedyRange(Struct('lower'/Int16ub, 'upper'/Int16ub)) # TS 51.011 Section 10.3.29 - - class EF_DCK(TransparentEF): def __init__(self, fid='6f2c', sfid=None, name='EF.DCK', size={16, 16}, desc='Depersonalisation Control Keys', **kwargs): @@ -778,8 +733,6 @@ class EF_DCK(TransparentEF): 'service_provider'/BcdAdapter(Bytes(4)), 'corporate'/BcdAdapter(Bytes(4))) # TS 51.011 Section 10.3.30 - - class EF_CNL(TransRecEF): def __init__(self, fid='6f32', sfid=None, name='EF.CNL', size={6, None}, rec_len=6, desc='Co-operative Network List', **kwargs): @@ -802,8 +755,6 @@ class EF_CNL(TransRecEF): in_json['corporate_id'])) # TS 51.011 Section 10.3.31 - - class EF_NIA(LinFixedEF): def __init__(self, fid='6f51', sfid=None, name='EF.NIA', rec_len={1, 32}, desc='Network\'s Indication of Alerting', **kwargs): @@ -812,16 +763,12 @@ class EF_NIA(LinFixedEF): 'alerting_category'/Int8ub, 'category'/GreedyBytes) # TS 51.011 Section 10.3.32 - - class EF_Kc(TransparentEF): def __init__(self, fid='6f20', sfid=None, name='EF.Kc', desc='Ciphering key Kc', size={9, 9}): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) self._construct = Struct('kc'/HexAdapter(Bytes(8)), 'cksn'/Int8ub) # TS 51.011 Section 10.3.33 - - class EF_LOCIGPRS(TransparentEF): def __init__(self, fid='6f53', sfid=None, name='EF.LOCIGPRS', desc='GPRS Location Information', size={14, 14}): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) @@ -830,8 +777,6 @@ class EF_LOCIGPRS(TransparentEF): routing_area_not_allowed=3)) # TS 51.011 Section 10.3.35..37 - - class EF_xPLMNwAcT(TransRecEF): def __init__(self, fid, sfid=None, name=None, desc=None, size={40, None}, rec_len=5, **kwargs): super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) @@ -881,8 +826,6 @@ class EF_xPLMNwAcT(TransRecEF): return '%04X' % (u16) # TS 51.011 Section 10.3.38 - - class EF_CPBCCH(TransRecEF): def __init__(self, fid='6f63', sfid=None, name='EF.CPBCCH', size={2, 14}, rec_len=2, desc='CPBCCH Information'): @@ -890,8 +833,6 @@ class EF_CPBCCH(TransRecEF): self._construct = Struct('cpbcch'/Int16ub) # TS 51.011 Section 10.3.39 - - class EF_InvScan(TransparentEF): def __init__(self, fid='6f64', sfid=None, name='EF.InvScan', size={1, 1}, desc='IOnvestigation Scan'): @@ -900,8 +841,6 @@ class EF_InvScan(TransparentEF): Byte, in_limited_service_mode=1, after_successful_plmn_selection=2) # TS 51.011 Section 4.2.58 - - class EF_PNN(LinFixedEF): class FullNameForNetwork(BER_TLV_IE, tag=0x43): # TS 24.008 10.5.3.5a @@ -919,16 +858,12 @@ class EF_PNN(LinFixedEF): self._tlv = EF_PNN.NetworkNameCollection # TS 51.011 Section 10.3.42 - - class EF_OPL(LinFixedEF): 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) self._construct = Struct('lai'/Bytes(5), 'pnn_record_id'/Int8ub) # TS 51.011 Section 10.3.44 + TS 31.102 4.2.62 - - class EF_MBI(LinFixedEF): 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) @@ -936,8 +871,6 @@ class EF_MBI(LinFixedEF): 'mbi_other'/Int8ub, 'mbi_videocall'/COptional(Int8ub)) # TS 51.011 Section 10.3.45 + TS 31.102 4.2.63 - - class EF_MWIS(LinFixedEF): def __init__(self, fid='6fca', sfid=None, name='EF.MWIS', rec_len={5, 6}, desc='Message Waiting Indication Status', **kwargs): @@ -948,8 +881,6 @@ class EF_MWIS(LinFixedEF): 'num_waiting_other'/Int8ub, 'num_waiting_videomail'/COptional(Int8ub)) # TS 51.011 Section 10.3.66 - - class EF_SPDI(TransparentEF): class ServiceProviderPLMN(BER_TLV_IE, tag=0x80): # flexible numbers of 3-byte PLMN records @@ -963,8 +894,6 @@ class EF_SPDI(TransparentEF): self._tlv = EF_SPDI.SPDI # TS 51.011 Section 10.3.51 - - class EF_MMSN(LinFixedEF): 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) @@ -972,14 +901,10 @@ class EF_MMSN(LinFixedEF): 'mms_notification'/Bytes(this._.total_len-4), 'ext_record_nr'/Byte) # TS 51.011 Annex K.1 - - class MMS_Implementation(BER_TLV_IE, tag=0x80): _construct = FlagsEnum(Byte, WAP=1) # TS 51.011 Section 10.3.53 - - class EF_MMSICP(TransparentEF): class MMS_Relay_Server(BER_TLV_IE, tag=0x81): # 3GPP TS 23.140 @@ -1002,8 +927,6 @@ class EF_MMSICP(TransparentEF): self._tlv = EF_MMSICP.MMS_ConnectivityParamters # TS 51.011 Section 10.3.54 - - class EF_MMSUP(LinFixedEF): class MMS_UserPref_ProfileName(BER_TLV_IE, tag=0x81): pass @@ -1020,8 +943,6 @@ class EF_MMSUP(LinFixedEF): self._tlv = EF_MMSUP.MMS_User_Preferences # TS 51.011 Section 10.3.55 - - class EF_MMSUCP(TransparentEF): def __init__(self, fid='6fd2', sfid=None, name='EF.MMSUCP', size={1, None}, desc='MMS User Connectivity Parameters', **kwargs):