Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 3 | # without this, pylint will fail when inner classes are used |
| 4 | # within the 'nested' kwarg of our TlvMeta metaclass on python 3.7 :( |
| 5 | # pylint: disable=undefined-variable |
| 6 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 7 | """ Various constants from ETSI TS 151.011 + |
| 8 | Representation of the GSM SIM/USIM/ISIM filesystem hierarchy. |
| 9 | |
| 10 | The File (and its derived classes) uses the classes of pySim.filesystem in |
| 11 | order to describe the files specified in the relevant ETSI + 3GPP specifications. |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 12 | """ |
| 13 | |
| 14 | # |
| 15 | # Copyright (C) 2017 Alexander.Chemeris <Alexander.Chemeris@gmail.com> |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 16 | # Copyright (C) 2021 Harald Welte <laforge@osmocom.org> |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 17 | # |
| 18 | # This program is free software: you can redistribute it and/or modify |
| 19 | # it under the terms of the GNU General Public License as published by |
| 20 | # the Free Software Foundation, either version 2 of the License, or |
| 21 | # (at your option) any later version. |
| 22 | # |
| 23 | # This program is distributed in the hope that it will be useful, |
| 24 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | # GNU General Public License for more details. |
| 27 | # |
| 28 | # You should have received a copy of the GNU General Public License |
| 29 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 30 | # |
| 31 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 32 | from pySim.profile import match_sim |
| 33 | from pySim.profile import CardProfile |
| 34 | from pySim.filesystem import * |
| 35 | import enum |
| 36 | from pySim.construct import * |
| 37 | from construct import Optional as COptional |
| 38 | from construct import * |
| 39 | from struct import pack, unpack |
| 40 | from typing import Tuple |
| 41 | from pySim.tlv import * |
| 42 | from pySim.utils import * |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 43 | MF_num = '3F00' |
| 44 | |
| 45 | DF_num = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 46 | 'TELECOM': '7F10', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 47 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 48 | 'GSM': '7F20', |
| 49 | 'IS-41': '7F22', |
| 50 | 'FP-CTS': '7F23', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 51 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 52 | 'GRAPHICS': '5F50', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 53 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 54 | 'IRIDIUM': '5F30', |
| 55 | 'GLOBST': '5F31', |
| 56 | 'ICO': '5F32', |
| 57 | 'ACeS': '5F33', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 58 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 59 | 'EIA/TIA-553': '5F40', |
| 60 | 'CTS': '5F60', |
| 61 | 'SOLSA': '5F70', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 62 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 63 | 'MExE': '5F3C', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | EF_num = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 67 | # MF |
| 68 | 'ICCID': '2FE2', |
| 69 | 'ELP': '2F05', |
| 70 | 'DIR': '2F00', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 71 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 72 | # DF_TELECOM |
| 73 | 'ADN': '6F3A', |
| 74 | 'FDN': '6F3B', |
| 75 | 'SMS': '6F3C', |
| 76 | 'CCP': '6F3D', |
| 77 | 'MSISDN': '6F40', |
| 78 | 'SMSP': '6F42', |
| 79 | 'SMSS': '6F43', |
| 80 | 'LND': '6F44', |
| 81 | 'SMSR': '6F47', |
| 82 | 'SDN': '6F49', |
| 83 | 'EXT1': '6F4A', |
| 84 | 'EXT2': '6F4B', |
| 85 | 'EXT3': '6F4C', |
| 86 | 'BDN': '6F4D', |
| 87 | 'EXT4': '6F4E', |
| 88 | 'CMI': '6F58', |
| 89 | 'ECCP': '6F4F', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 90 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 91 | # DF_GRAPHICS |
| 92 | 'IMG': '4F20', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 93 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 94 | # DF_SoLSA |
| 95 | 'SAI': '4F30', |
| 96 | 'SLL': '4F31', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 97 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 98 | # DF_MExE |
| 99 | 'MExE-ST': '4F40', |
| 100 | 'ORPK': '4F41', |
| 101 | 'ARPK': '4F42', |
| 102 | 'TPRPK': '4F43', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 103 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 104 | # DF_GSM |
| 105 | 'LP': '6F05', |
| 106 | 'IMSI': '6F07', |
| 107 | 'Kc': '6F20', |
| 108 | 'DCK': '6F2C', |
| 109 | 'PLMNsel': '6F30', |
| 110 | 'HPPLMN': '6F31', |
| 111 | 'CNL': '6F32', |
| 112 | 'ACMmax': '6F37', |
| 113 | 'SST': '6F38', |
| 114 | 'ACM': '6F39', |
| 115 | 'GID1': '6F3E', |
| 116 | 'GID2': '6F3F', |
| 117 | 'PUCT': '6F41', |
| 118 | 'CBMI': '6F45', |
| 119 | 'SPN': '6F46', |
| 120 | 'CBMID': '6F48', |
| 121 | 'BCCH': '6F74', |
| 122 | 'ACC': '6F78', |
| 123 | 'FPLMN': '6F7B', |
| 124 | 'LOCI': '6F7E', |
| 125 | 'AD': '6FAD', |
| 126 | 'PHASE': '6FAE', |
| 127 | 'VGCS': '6FB1', |
| 128 | 'VGCSS': '6FB2', |
| 129 | 'VBS': '6FB3', |
| 130 | 'VBSS': '6FB4', |
| 131 | 'eMLPP': '6FB5', |
| 132 | 'AAeM': '6FB6', |
| 133 | 'ECC': '6FB7', |
| 134 | 'CBMIR': '6F50', |
| 135 | 'NIA': '6F51', |
| 136 | 'KcGPRS': '6F52', |
| 137 | 'LOCIGPRS': '6F53', |
| 138 | 'SUME': '6F54', |
| 139 | 'PLMNwAcT': '6F60', |
| 140 | 'OPLMNwAcT': '6F61', |
| 141 | # Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT |
| 142 | 'HPLMNAcT': '6F62', |
| 143 | 'HPLMNwAcT': '6F62', |
| 144 | 'CPBCCH': '6F63', |
| 145 | 'INVSCAN': '6F64', |
| 146 | 'PNN': '6FC5', |
| 147 | 'OPL': '6FC6', |
| 148 | 'MBDN': '6FC7', |
| 149 | 'EXT6': '6FC8', |
| 150 | 'MBI': '6FC9', |
| 151 | 'MWIS': '6FCA', |
| 152 | 'CFIS': '6FCB', |
| 153 | 'EXT7': '6FCC', |
| 154 | 'SPDI': '6FCD', |
| 155 | 'MMSN': '6FCE', |
| 156 | 'EXT8': '6FCF', |
| 157 | 'MMSICP': '6FD0', |
| 158 | 'MMSUP': '6FD1', |
| 159 | 'MMSUCP': '6FD2', |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | DF = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 163 | 'TELECOM': [MF_num, DF_num['TELECOM']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 164 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 165 | 'GSM': [MF_num, DF_num['GSM']], |
| 166 | 'IS-41': [MF_num, DF_num['IS-41']], |
| 167 | 'FP-CTS': [MF_num, DF_num['FP-CTS']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 168 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 169 | 'GRAPHICS': [MF_num, DF_num['GRAPHICS']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 170 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 171 | 'IRIDIUM': [MF_num, DF_num['IRIDIUM']], |
| 172 | 'GLOBST': [MF_num, DF_num['GLOBST']], |
| 173 | 'ICO': [MF_num, DF_num['ICO']], |
| 174 | 'ACeS': [MF_num, DF_num['ACeS']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 175 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 176 | 'EIA/TIA-553': [MF_num, DF_num['EIA/TIA-553']], |
| 177 | 'CTS': [MF_num, DF_num['CTS']], |
| 178 | 'SoLSA': [MF_num, DF_num['SOLSA']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 179 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 180 | 'MExE': [MF_num, DF_num['MExE']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | |
| 184 | EF = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 185 | 'ICCID': [MF_num, EF_num['ICCID']], |
| 186 | 'ELP': [MF_num, EF_num['ELP']], |
| 187 | 'DIR': [MF_num, EF_num['DIR']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 188 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 189 | 'ADN': DF['TELECOM']+[EF_num['ADN']], |
| 190 | 'FDN': DF['TELECOM']+[EF_num['FDN']], |
| 191 | 'SMS': DF['TELECOM']+[EF_num['SMS']], |
| 192 | 'CCP': DF['TELECOM']+[EF_num['CCP']], |
| 193 | 'MSISDN': DF['TELECOM']+[EF_num['MSISDN']], |
| 194 | 'SMSP': DF['TELECOM']+[EF_num['SMSP']], |
| 195 | 'SMSS': DF['TELECOM']+[EF_num['SMSS']], |
| 196 | 'LND': DF['TELECOM']+[EF_num['LND']], |
| 197 | 'SMSR': DF['TELECOM']+[EF_num['SMSR']], |
| 198 | 'SDN': DF['TELECOM']+[EF_num['SDN']], |
| 199 | 'EXT1': DF['TELECOM']+[EF_num['EXT1']], |
| 200 | 'EXT2': DF['TELECOM']+[EF_num['EXT2']], |
| 201 | 'EXT3': DF['TELECOM']+[EF_num['EXT3']], |
| 202 | 'BDN': DF['TELECOM']+[EF_num['BDN']], |
| 203 | 'EXT4': DF['TELECOM']+[EF_num['EXT4']], |
| 204 | 'CMI': DF['TELECOM']+[EF_num['CMI']], |
| 205 | 'ECCP': DF['TELECOM']+[EF_num['ECCP']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 206 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 207 | 'IMG': DF['GRAPHICS']+[EF_num['IMG']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 208 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 209 | 'SAI': DF['SoLSA']+[EF_num['SAI']], |
| 210 | 'SLL': DF['SoLSA']+[EF_num['SLL']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 211 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 212 | 'MExE-ST': DF['MExE']+[EF_num['MExE-ST']], |
| 213 | 'ORPK': DF['MExE']+[EF_num['ORPK']], |
| 214 | 'ARPK': DF['MExE']+[EF_num['ARPK']], |
| 215 | 'TPRPK': DF['MExE']+[EF_num['TPRPK']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 216 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 217 | 'LP': DF['GSM']+[EF_num['LP']], |
| 218 | 'IMSI': DF['GSM']+[EF_num['IMSI']], |
| 219 | 'Kc': DF['GSM']+[EF_num['Kc']], |
| 220 | 'DCK': DF['GSM']+[EF_num['DCK']], |
| 221 | 'PLMNsel': DF['GSM']+[EF_num['PLMNsel']], |
| 222 | 'HPPLMN': DF['GSM']+[EF_num['HPPLMN']], |
| 223 | 'CNL': DF['GSM']+[EF_num['CNL']], |
| 224 | 'ACMmax': DF['GSM']+[EF_num['ACMmax']], |
| 225 | 'SST': DF['GSM']+[EF_num['SST']], |
| 226 | 'ACM': DF['GSM']+[EF_num['ACM']], |
| 227 | 'GID1': DF['GSM']+[EF_num['GID1']], |
| 228 | 'GID2': DF['GSM']+[EF_num['GID2']], |
| 229 | 'PUCT': DF['GSM']+[EF_num['PUCT']], |
| 230 | 'CBMI': DF['GSM']+[EF_num['CBMI']], |
| 231 | 'SPN': DF['GSM']+[EF_num['SPN']], |
| 232 | 'CBMID': DF['GSM']+[EF_num['CBMID']], |
| 233 | 'BCCH': DF['GSM']+[EF_num['BCCH']], |
| 234 | 'ACC': DF['GSM']+[EF_num['ACC']], |
| 235 | 'FPLMN': DF['GSM']+[EF_num['FPLMN']], |
| 236 | 'LOCI': DF['GSM']+[EF_num['LOCI']], |
| 237 | 'AD': DF['GSM']+[EF_num['AD']], |
| 238 | 'PHASE': DF['GSM']+[EF_num['PHASE']], |
| 239 | 'VGCS': DF['GSM']+[EF_num['VGCS']], |
| 240 | 'VGCSS': DF['GSM']+[EF_num['VGCSS']], |
| 241 | 'VBS': DF['GSM']+[EF_num['VBS']], |
| 242 | 'VBSS': DF['GSM']+[EF_num['VBSS']], |
| 243 | 'eMLPP': DF['GSM']+[EF_num['eMLPP']], |
| 244 | 'AAeM': DF['GSM']+[EF_num['AAeM']], |
| 245 | 'ECC': DF['GSM']+[EF_num['ECC']], |
| 246 | 'CBMIR': DF['GSM']+[EF_num['CBMIR']], |
| 247 | 'NIA': DF['GSM']+[EF_num['NIA']], |
| 248 | 'KcGPRS': DF['GSM']+[EF_num['KcGPRS']], |
| 249 | 'LOCIGPRS': DF['GSM']+[EF_num['LOCIGPRS']], |
| 250 | 'SUME': DF['GSM']+[EF_num['SUME']], |
| 251 | 'PLMNwAcT': DF['GSM']+[EF_num['PLMNwAcT']], |
| 252 | 'OPLMNwAcT': DF['GSM']+[EF_num['OPLMNwAcT']], |
| 253 | # Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT |
| 254 | 'HPLMNAcT': DF['GSM']+[EF_num['HPLMNAcT']], |
| 255 | 'HPLMNwAcT': DF['GSM']+[EF_num['HPLMNAcT']], |
| 256 | 'CPBCCH': DF['GSM']+[EF_num['CPBCCH']], |
| 257 | 'INVSCAN': DF['GSM']+[EF_num['INVSCAN']], |
| 258 | 'PNN': DF['GSM']+[EF_num['PNN']], |
| 259 | 'OPL': DF['GSM']+[EF_num['OPL']], |
| 260 | 'MBDN': DF['GSM']+[EF_num['MBDN']], |
| 261 | 'EXT6': DF['GSM']+[EF_num['EXT6']], |
| 262 | 'MBI': DF['GSM']+[EF_num['MBI']], |
| 263 | 'MWIS': DF['GSM']+[EF_num['MWIS']], |
| 264 | 'CFIS': DF['GSM']+[EF_num['CFIS']], |
| 265 | 'EXT7': DF['GSM']+[EF_num['EXT7']], |
| 266 | 'SPDI': DF['GSM']+[EF_num['SPDI']], |
| 267 | 'MMSN': DF['GSM']+[EF_num['MMSN']], |
| 268 | 'EXT8': DF['GSM']+[EF_num['EXT8']], |
| 269 | 'MMSICP': DF['GSM']+[EF_num['MMSICP']], |
| 270 | 'MMSUP': DF['GSM']+[EF_num['MMSUP']], |
| 271 | 'MMSUCP': DF['GSM']+[EF_num['MMSUCP']], |
Alexander Chemeris | 067f69c | 2017-07-18 16:44:26 +0300 | [diff] [blame] | 272 | } |
Supreeth Herle | bf5d602 | 2020-03-20 15:18:27 +0100 | [diff] [blame] | 273 | |
| 274 | # Mapping between SIM Service Number and its description |
| 275 | EF_SST_map = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 276 | 1: 'CHV1 disable function', |
| 277 | 2: 'Abbreviated Dialling Numbers (ADN)', |
| 278 | 3: 'Fixed Dialling Numbers (FDN)', |
| 279 | 4: 'Short Message Storage (SMS)', |
| 280 | 5: 'Advice of Charge (AoC)', |
| 281 | 6: 'Capability Configuration Parameters (CCP)', |
| 282 | 7: 'PLMN selector', |
| 283 | 8: 'RFU', |
| 284 | 9: 'MSISDN', |
| 285 | 10: 'Extension1', |
| 286 | 11: 'Extension2', |
| 287 | 12: 'SMS Parameters', |
| 288 | 13: 'Last Number Dialled (LND)', |
| 289 | 14: 'Cell Broadcast Message Identifier', |
| 290 | 15: 'Group Identifier Level 1', |
| 291 | 16: 'Group Identifier Level 2', |
| 292 | 17: 'Service Provider Name', |
| 293 | 18: 'Service Dialling Numbers (SDN)', |
| 294 | 19: 'Extension3', |
| 295 | 20: 'RFU', |
| 296 | 21: 'VGCS Group Identifier List (EFVGCS and EFVGCSS)', |
| 297 | 22: 'VBS Group Identifier List (EFVBS and EFVBSS)', |
| 298 | 23: 'enhanced Multi-Level Precedence and Pre-emption Service', |
| 299 | 24: 'Automatic Answer for eMLPP', |
| 300 | 25: 'Data download via SMS-CB', |
| 301 | 26: 'Data download via SMS-PP', |
| 302 | 27: 'Menu selection', |
| 303 | 28: 'Call control', |
| 304 | 29: 'Proactive SIM', |
| 305 | 30: 'Cell Broadcast Message Identifier Ranges', |
| 306 | 31: 'Barred Dialling Numbers (BDN)', |
| 307 | 32: 'Extension4', |
| 308 | 33: 'De-personalization Control Keys', |
| 309 | 34: 'Co-operative Network List', |
| 310 | 35: 'Short Message Status Reports', |
| 311 | 36: 'Network\'s indication of alerting in the MS', |
| 312 | 37: 'Mobile Originated Short Message control by SIM', |
| 313 | 38: 'GPRS', |
| 314 | 39: 'Image (IMG)', |
| 315 | 40: 'SoLSA (Support of Local Service Area)', |
| 316 | 41: 'USSD string data object supported in Call Control', |
| 317 | 42: 'RUN AT COMMAND command', |
| 318 | 43: 'User controlled PLMN Selector with Access Technology', |
| 319 | 44: 'Operator controlled PLMN Selector with Access Technology', |
| 320 | 45: 'HPLMN Selector with Access Technology', |
| 321 | 46: 'CPBCCH Information', |
| 322 | 47: 'Investigation Scan', |
| 323 | 48: 'Extended Capability Configuration Parameters', |
| 324 | 49: 'MExE', |
| 325 | 50: 'Reserved and shall be ignored', |
| 326 | 51: 'PLMN Network Name', |
| 327 | 52: 'Operator PLMN List', |
| 328 | 53: 'Mailbox Dialling Numbers', |
| 329 | 54: 'Message Waiting Indication Status', |
| 330 | 55: 'Call Forwarding Indication Status', |
| 331 | 56: 'Service Provider Display Information', |
| 332 | 57: 'Multimedia Messaging Service (MMS)', |
| 333 | 58: 'Extension 8', |
| 334 | 59: 'MMS User Connectivity Parameters', |
Vadim Yanitskiy | dfe3dbb | 2020-07-28 05:26:02 +0700 | [diff] [blame] | 335 | } |
| 336 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 337 | |
| 338 | ###################################################################### |
| 339 | # DF.TELECOM |
| 340 | ###################################################################### |
| 341 | |
| 342 | # TS 51.011 Section 10.5.1 |
| 343 | class EF_ADN(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 344 | def __init__(self, fid='6f3a', sfid=None, name='EF.ADN', desc='Abbreviated Dialing Numbers', **kwargs): |
| 345 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={14, 30}, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 346 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 347 | def _decode_record_bin(self, raw_bin_data): |
| 348 | alpha_id_len = len(raw_bin_data) - 14 |
| 349 | alpha_id = raw_bin_data[:alpha_id_len] |
| 350 | u = unpack('!BB10sBB', raw_bin_data[-14:]) |
| 351 | return {'alpha_id': alpha_id, 'len_of_bcd': u[0], 'ton_npi': u[1], |
| 352 | 'dialing_nr': u[2], 'cap_conf_id': u[3], 'ext1_record_id': u[4]} |
| 353 | |
| 354 | # TS 51.011 Section 10.5.5 |
Harald Welte | ec7d0da | 2021-04-02 22:01:19 +0200 | [diff] [blame] | 355 | class EF_SMS(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 356 | def __init__(self, fid='6f3c', sfid=None, name='EF.SMS', desc='Short messages', **kwargs): |
| 357 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={176, 176}, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 358 | |
Harald Welte | ec7d0da | 2021-04-02 22:01:19 +0200 | [diff] [blame] | 359 | def _decode_record_bin(self, raw_bin_data): |
| 360 | def decode_status(status): |
| 361 | if status & 0x01 == 0x00: |
| 362 | return (None, 'free_space') |
| 363 | elif status & 0x07 == 0x01: |
| 364 | return ('mt', 'message_read') |
| 365 | elif status & 0x07 == 0x03: |
| 366 | return ('mt', 'message_to_be_read') |
| 367 | elif status & 0x07 == 0x07: |
| 368 | return ('mo', 'message_to_be_sent') |
| 369 | elif status & 0x1f == 0x05: |
| 370 | return ('mo', 'sent_status_not_requested') |
| 371 | elif status & 0x1f == 0x0d: |
| 372 | return ('mo', 'sent_status_req_but_not_received') |
| 373 | elif status & 0x1f == 0x15: |
| 374 | return ('mo', 'sent_status_req_rx_not_stored_smsr') |
| 375 | elif status & 0x1f == 0x1d: |
| 376 | return ('mo', 'sent_status_req_rx_stored_smsr') |
| 377 | else: |
| 378 | return (None, 'rfu') |
| 379 | |
| 380 | status = decode_status(raw_bin_data[0]) |
| 381 | remainder = raw_bin_data[1:] |
| 382 | return {'direction': status[0], 'status': status[1], 'remainder': b2h(remainder)} |
| 383 | |
| 384 | |
| 385 | # TS 51.011 Section 10.5.5 |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 386 | class EF_MSISDN(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 387 | def __init__(self, fid='6f40', sfid=None, name='EF.MSISDN', desc='MSISDN', **kwargs): |
| 388 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={15, 34}, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 389 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 390 | def _decode_record_hex(self, raw_hex_data): |
| 391 | return {'msisdn': dec_msisdn(raw_hex_data)} |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 392 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 393 | def _encode_record_hex(self, abstract): |
Philipp Maier | f9cbe09 | 2021-04-23 19:37:36 +0200 | [diff] [blame] | 394 | msisdn = abstract['msisdn'] |
| 395 | if type(msisdn) == str: |
| 396 | encoded_msisdn = enc_msisdn(msisdn) |
| 397 | else: |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 398 | encoded_msisdn = enc_msisdn(msisdn[2], msisdn[0], msisdn[1]) |
| 399 | alpha_identifier = (list(self.rec_len)[ |
| 400 | 0] - len(encoded_msisdn) // 2) * "ff" |
Philipp Maier | b46cb3f | 2021-04-20 22:38:21 +0200 | [diff] [blame] | 401 | return alpha_identifier + encoded_msisdn |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 402 | |
| 403 | # TS 51.011 Section 10.5.6 |
| 404 | class EF_SMSP(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 405 | def __init__(self, fid='6f42', sfid=None, name='EF.SMSP', desc='Short message service parameters', **kwargs): |
| 406 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={28, None}, **kwargs) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 407 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 408 | # TS 51.011 Section 10.5.7 |
| 409 | class EF_SMSS(TransparentEF): |
| 410 | class MemCapAdapter(Adapter): |
| 411 | def _decode(self, obj, context, path): |
| 412 | return False if obj & 1 else True |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 413 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 414 | def _encode(self, obj, context, path): |
| 415 | return 0 if obj else 1 |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 416 | |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 417 | def __init__(self, fid='6f43', sfid=None, name='EF.SMSS', desc='SMS status', size={2, 8}, **kwargs): |
| 418 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 419 | self._construct = Struct( |
| 420 | 'last_used_tpmr'/Int8ub, 'memory_capacity_exceeded'/self.MemCapAdapter(Int8ub)) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 421 | |
| 422 | # TS 51.011 Section 10.5.8 |
| 423 | class EF_SMSR(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 424 | def __init__(self, fid='6f47', sfid=None, name='EF.SMSR', desc='SMS status reports', rec_len={30, 30}, **kwargs): |
| 425 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 426 | self._construct = Struct( |
| 427 | 'sms_record_id'/Int8ub, 'sms_status_report'/HexAdapter(Bytes(29))) |
| 428 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 429 | |
| 430 | class EF_EXT(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 431 | def __init__(self, fid, sfid=None, name='EF.EXT', desc='Extension', rec_len={13, 13}, **kwargs): |
| 432 | super().__init__(fid=fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 433 | self._construct = Struct( |
| 434 | 'record_type'/Int8ub, 'extension_data'/HexAdapter(Bytes(11)), 'identifier'/Int8ub) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 435 | |
| 436 | # TS 51.011 Section 10.5.16 |
| 437 | class EF_CMI(LinFixedEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 438 | def __init__(self, fid='6f58', sfid=None, name='EF.CMI', rec_len={2, 21}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 439 | desc='Comparison Method Information', **kwargs): |
| 440 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 441 | self._construct = Struct( |
| 442 | 'alpha_id'/Bytes(this._.total_len-1), 'comparison_method_id'/Int8ub) |
| 443 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 444 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 445 | class DF_TELECOM(CardDF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 446 | def __init__(self, fid='7f10', name='DF.TELECOM', desc=None, **kwargs): |
| 447 | super().__init__(fid=fid, name=name, desc=desc, **kwargs) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 448 | files = [ |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 449 | EF_ADN(), |
| 450 | EF_ADN(fid='6f3b', name='EF.FDN', desc='Fixed dialling numbers'), |
| 451 | EF_SMS(), |
| 452 | LinFixedEF(fid='6f3d', name='EF.CCP', |
| 453 | desc='Capability Configuration Parameters', rec_len={14, 14}), |
| 454 | LinFixedEF(fid='6f4f', name='EF.ECCP', |
| 455 | desc='Extended Capability Configuration Parameters', rec_len={15, 32}), |
| 456 | EF_MSISDN(), |
| 457 | EF_SMSP(), |
| 458 | EF_SMSS(), |
| 459 | # LND, SDN |
| 460 | EF_EXT('6f4a', None, 'EF.EXT1', 'Extension1 (ADN/SSC)'), |
| 461 | EF_EXT('6f4b', None, 'EF.EXT2', 'Extension2 (FDN/SSC)'), |
| 462 | EF_EXT('6f4c', None, 'EF.EXT3', 'Extension3 (SDN)'), |
| 463 | EF_ADN(fid='6f4d', name='EF.BDN', desc='Barred Dialling Numbers'), |
| 464 | EF_EXT('6f4e', None, 'EF.EXT4', 'Extension4 (BDN/SSC)'), |
| 465 | EF_SMSR(), |
| 466 | EF_CMI(), |
| 467 | ] |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 468 | self.add_files(files) |
| 469 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 470 | ###################################################################### |
| 471 | # DF.GSM |
| 472 | ###################################################################### |
| 473 | |
| 474 | # TS 51.011 Section 10.3.1 |
| 475 | class EF_LP(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 476 | def __init__(self, fid='6f05', sfid=None, name='EF.LP', size={1, None}, rec_len=1, |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 477 | desc='Language Preference'): |
| 478 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 479 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 480 | def _decode_record_bin(self, in_bin): |
| 481 | return b2h(in_bin) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 482 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 483 | def _encode_record_bin(self, in_json): |
| 484 | return h2b(in_json) |
| 485 | |
| 486 | # TS 51.011 Section 10.3.2 |
| 487 | class EF_IMSI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 488 | def __init__(self, fid='6f07', sfid=None, name='EF.IMSI', desc='IMSI', size={9, 9}): |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 489 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
Bjoern Riemer | e91405e | 2021-12-17 15:16:35 +0100 | [diff] [blame] | 490 | # add those commands to the general commands of a TransparentEF |
| 491 | self.shell_commands += [self.AddlShellCommands(self)] |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 492 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 493 | def _decode_hex(self, raw_hex): |
| 494 | return {'imsi': dec_imsi(raw_hex)} |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 495 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 496 | def _encode_hex(self, abstract): |
| 497 | return enc_imsi(abstract['imsi']) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 498 | |
Bjoern Riemer | e91405e | 2021-12-17 15:16:35 +0100 | [diff] [blame] | 499 | @with_default_category('File-Specific Commands') |
| 500 | class AddlShellCommands(CommandSet): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 501 | def __init__(self, ef: TransparentEF): |
Bjoern Riemer | e91405e | 2021-12-17 15:16:35 +0100 | [diff] [blame] | 502 | super().__init__() |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 503 | self._ef = ef |
Bjoern Riemer | e91405e | 2021-12-17 15:16:35 +0100 | [diff] [blame] | 504 | |
| 505 | def do_update_imsi_plmn(self, arg: str): |
| 506 | """Change the plmn part of the IMSI""" |
| 507 | plmn = arg.strip() |
| 508 | if len(plmn) == 5 or len(plmn) == 6: |
| 509 | (data, sw) = self._cmd.rs.read_binary_dec() |
| 510 | if sw == '9000' and len(data['imsi'])-len(plmn) == 10: |
| 511 | imsi = data['imsi'] |
| 512 | msin = imsi[len(plmn):] |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 513 | (data, sw) = self._cmd.rs.update_binary_dec( |
| 514 | {'imsi': plmn+msin}) |
Bjoern Riemer | e91405e | 2021-12-17 15:16:35 +0100 | [diff] [blame] | 515 | if sw == '9000' and data: |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 516 | self._cmd.poutput_json( |
| 517 | self._cmd.rs.selected_file.decode_hex(data)) |
Bjoern Riemer | e91405e | 2021-12-17 15:16:35 +0100 | [diff] [blame] | 518 | else: |
| 519 | raise ValueError("PLMN length does not match IMSI length") |
| 520 | else: |
| 521 | raise ValueError("PLMN has wrong length!") |
| 522 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 523 | |
| 524 | # TS 51.011 Section 10.3.4 |
| 525 | class EF_PLMNsel(TransRecEF): |
| 526 | def __init__(self, fid='6f30', sfid=None, name='EF.PLMNsel', desc='PLMN selector', |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 527 | size={24, None}, rec_len=3, **kwargs): |
| 528 | super().__init__(fid, name=name, sfid=sfid, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 529 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 530 | def _decode_record_hex(self, in_hex): |
| 531 | if in_hex[:6] == "ffffff": |
| 532 | return None |
| 533 | else: |
| 534 | return dec_plmn(in_hex) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 535 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 536 | def _encode_record_hex(self, in_json): |
| 537 | if in_json == None: |
| 538 | return "ffffff" |
| 539 | else: |
| 540 | return enc_plmn(in_json['mcc'], in_json['mnc']) |
| 541 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 542 | # TS 51.011 Section 10.3.6 |
| 543 | class EF_ACMmax(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 544 | def __init__(self, fid='6f37', sfid=None, name='EF.ACMmax', size={3, 3}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 545 | desc='ACM maximum value', **kwargs): |
| 546 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 547 | self._construct = Struct('acm_max'/Int24ub) |
| 548 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 549 | # TS 51.011 Section 10.3.7 |
| 550 | class EF_ServiceTable(TransparentEF): |
| 551 | def __init__(self, fid, sfid, name, desc, size, table): |
| 552 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 553 | self.table = table |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 554 | |
Harald Welte | 7a8aa86 | 2021-10-14 20:46:19 +0200 | [diff] [blame] | 555 | @staticmethod |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 556 | def _bit_byte_offset_for_service(service: int) -> Tuple[int, int]: |
Harald Welte | 7a8aa86 | 2021-10-14 20:46:19 +0200 | [diff] [blame] | 557 | i = service - 1 |
| 558 | byte_offset = i//4 |
| 559 | bit_offset = (i % 4) * 2 |
| 560 | return (byte_offset, bit_offset) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 561 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 562 | def _decode_bin(self, raw_bin): |
| 563 | ret = {} |
| 564 | for i in range(0, len(raw_bin)*4): |
| 565 | service_nr = i+1 |
| 566 | byte = int(raw_bin[i//4]) |
| 567 | bit_offset = (i % 4) * 2 |
| 568 | bits = (byte >> bit_offset) & 3 |
| 569 | ret[service_nr] = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 570 | 'description': self.table[service_nr] if service_nr in self.table else None, |
| 571 | 'allocated': True if bits & 1 else False, |
| 572 | 'activated': True if bits & 2 else False, |
| 573 | } |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 574 | return ret |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 575 | |
Harald Welte | 7a8aa86 | 2021-10-14 20:46:19 +0200 | [diff] [blame] | 576 | def _encode_bin(self, in_json): |
| 577 | # compute the required binary size |
| 578 | bin_len = 0 |
| 579 | for srv in in_json.keys(): |
| 580 | service_nr = int(srv) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 581 | (byte_offset, bit_offset) = EF_ServiceTable._bit_byte_offset_for_service( |
| 582 | service_nr) |
Harald Welte | 7a8aa86 | 2021-10-14 20:46:19 +0200 | [diff] [blame] | 583 | if byte_offset >= bin_len: |
| 584 | bin_len = byte_offset+1 |
| 585 | # encode the actual data |
| 586 | out = bytearray(b'\x00' * bin_len) |
| 587 | for srv in in_json.keys(): |
| 588 | service_nr = int(srv) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 589 | (byte_offset, bit_offset) = EF_ServiceTable._bit_byte_offset_for_service( |
| 590 | service_nr) |
Harald Welte | 7a8aa86 | 2021-10-14 20:46:19 +0200 | [diff] [blame] | 591 | bits = 0 |
| 592 | if in_json[srv]['allocated'] == True: |
| 593 | bits |= 1 |
| 594 | if in_json[srv]['activated'] == True: |
| 595 | bits |= 2 |
| 596 | out[byte_offset] |= ((bits & 3) << bit_offset) |
| 597 | return out |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 598 | |
| 599 | # TS 51.011 Section 10.3.11 |
| 600 | class EF_SPN(TransparentEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 601 | def __init__(self, fid='6f46', sfid=None, name='EF.SPN', |
| 602 | desc='Service Provider Name', size={17, 17}, **kwargs): |
| 603 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Robert Falkenberg | b07a3e9 | 2021-05-07 15:23:20 +0200 | [diff] [blame] | 604 | self._construct = BitStruct( |
| 605 | # Byte 1 |
| 606 | 'rfu'/BitsRFU(6), |
| 607 | 'hide_in_oplmn'/Flag, |
| 608 | 'show_in_hplmn'/Flag, |
| 609 | # Bytes 2..17 |
| 610 | 'spn'/Bytewise(GsmString(16)) |
| 611 | ) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 612 | |
| 613 | # TS 51.011 Section 10.3.13 |
| 614 | class EF_CBMI(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 615 | def __init__(self, fid='6f45', sfid=None, name='EF.CBMI', size={2, None}, rec_len=2, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 616 | desc='Cell Broadcast message identifier selection', **kwargs): |
| 617 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 618 | self._construct = GreedyRange(Int16ub) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 619 | |
| 620 | # TS 51.011 Section 10.3.15 |
| 621 | class EF_ACC(TransparentEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 622 | def __init__(self, fid='6f78', sfid=None, name='EF.ACC', |
| 623 | desc='Access Control Class', size={2, 2}, **kwargs): |
| 624 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 625 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 626 | def _decode_bin(self, raw_bin): |
| 627 | return {'acc': unpack('!H', raw_bin)[0]} |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 628 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 629 | def _encode_bin(self, abstract): |
| 630 | return pack('!H', abstract['acc']) |
| 631 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 632 | # TS 51.011 Section 10.3.16 |
| 633 | class EF_LOCI(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 634 | def __init__(self, fid='6f7e', sfid=None, name='EF.LOCI', desc='Location Information', size={11, 11}): |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 635 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 636 | self._construct = Struct('tmsi'/Bytes(4), 'lai'/Bytes(5), 'tmsi_time'/Int8ub, |
| 637 | 'lu_status'/Enum(Byte, updated=0, not_updated=1, plmn_not_allowed=2, |
| 638 | location_area_not_allowed=3)) |
| 639 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 640 | # TS 51.011 Section 10.3.18 |
| 641 | class EF_AD(TransparentEF): |
Robert Falkenberg | 9d16fbc | 2021-04-12 11:43:22 +0200 | [diff] [blame] | 642 | class OP_MODE(enum.IntEnum): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 643 | normal = 0x00 |
| 644 | type_approval = 0x80 |
| 645 | normal_and_specific_facilities = 0x01 |
| 646 | type_approval_and_specific_facilities = 0x81 |
| 647 | maintenance_off_line = 0x02 |
| 648 | cell_test = 0x04 |
Robert Falkenberg | 9d16fbc | 2021-04-12 11:43:22 +0200 | [diff] [blame] | 649 | #OP_MODE_DICT = {int(v) : str(v) for v in EF_AD.OP_MODE} |
| 650 | #OP_MODE_DICT_REVERSED = {str(v) : int(v) for v in EF_AD.OP_MODE} |
| 651 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 652 | def __init__(self, fid='6fad', sfid=None, name='EF.AD', desc='Administrative Data', size={3, 4}): |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 653 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
Robert Falkenberg | 9d16fbc | 2021-04-12 11:43:22 +0200 | [diff] [blame] | 654 | self._construct = BitStruct( |
| 655 | # Byte 1 |
| 656 | 'ms_operation_mode'/Bytewise(Enum(Byte, EF_AD.OP_MODE)), |
| 657 | # Byte 2 |
| 658 | 'rfu1'/Bytewise(ByteRFU), |
| 659 | # Byte 3 |
| 660 | 'rfu2'/BitsRFU(7), |
| 661 | 'ofm'/Flag, |
| 662 | # Byte 4 (optional), |
| 663 | 'extensions'/COptional(Struct( |
| 664 | 'rfu3'/BitsRFU(4), |
| 665 | 'mnc_len'/BitsInteger(4), |
| 666 | # Byte 5..N-4 (optional, RFU) |
| 667 | 'extensions'/Bytewise(GreedyBytesRFU) |
| 668 | )) |
| 669 | ) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 670 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 671 | # TS 51.011 Section 10.3.20 / 10.3.22 |
| 672 | class EF_VGCS(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 673 | def __init__(self, fid='6fb1', sfid=None, name='EF.VGCS', size={4, 200}, rec_len=4, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 674 | desc='Voice Group Call Service', **kwargs): |
| 675 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 676 | self._construct = BcdAdapter(Bytes(4)) |
| 677 | |
| 678 | # TS 51.011 Section 10.3.21 / 10.3.23 |
| 679 | class EF_VGCSS(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 680 | def __init__(self, fid='6fb2', sfid=None, name='EF.VGCSS', size={7, 7}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 681 | desc='Voice Group Call Service Status', **kwargs): |
| 682 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 683 | self._construct = BitStruct( |
| 684 | 'flags'/Bit[50], Padding(6, pattern=b'\xff')) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 685 | |
| 686 | # TS 51.011 Section 10.3.24 |
| 687 | class EF_eMLPP(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 688 | def __init__(self, fid='6fb5', sfid=None, name='EF.eMLPP', size={2, 2}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 689 | desc='enhanced Multi Level Pre-emption and Priority', **kwargs): |
| 690 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 691 | FlagsConstruct = FlagsEnum( |
| 692 | Byte, A=1, B=2, zero=4, one=8, two=16, three=32, four=64) |
| 693 | self._construct = Struct( |
| 694 | 'levels'/FlagsConstruct, 'fast_call_setup_cond'/FlagsConstruct) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 695 | |
| 696 | # TS 51.011 Section 10.3.25 |
| 697 | class EF_AAeM(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 698 | def __init__(self, fid='6fb6', sfid=None, name='EF.AAeM', size={1, 1}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 699 | desc='Automatic Answer for eMLPP Service', **kwargs): |
| 700 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 701 | FlagsConstruct = FlagsEnum( |
| 702 | Byte, A=1, B=2, zero=4, one=8, two=16, three=32, four=64) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 703 | self._construct = Struct('auto_answer_prio_levels'/FlagsConstruct) |
| 704 | |
| 705 | # TS 51.011 Section 10.3.26 |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 706 | class EF_CBMID(EF_CBMI): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 707 | def __init__(self, fid='6f48', sfid=None, name='EF.CBMID', size={2, None}, rec_len=2, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 708 | desc='Cell Broadcast Message Identifier for Data Download', **kwargs): |
| 709 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 710 | self._construct = GreedyRange(Int16ub) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 711 | |
Harald Welte | 89e5954 | 2021-04-02 21:33:13 +0200 | [diff] [blame] | 712 | # TS 51.011 Section 10.3.27 |
| 713 | class EF_ECC(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 714 | def __init__(self, fid='6fb7', sfid=None, name='EF.ECC', size={3, 15}, rec_len=3, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 715 | desc='Emergency Call Codes', **kwargs): |
| 716 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 717 | self._construct = GreedyRange(BcdAdapter(Bytes(3))) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 718 | |
| 719 | # TS 51.011 Section 10.3.28 |
| 720 | class EF_CBMIR(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 721 | def __init__(self, fid='6f50', sfid=None, name='EF.CBMIR', size={4, None}, rec_len=4, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 722 | desc='Cell Broadcast message identifier range selection', **kwargs): |
| 723 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 724 | self._construct = GreedyRange(Struct('lower'/Int16ub, 'upper'/Int16ub)) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 725 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 726 | # TS 51.011 Section 10.3.29 |
| 727 | class EF_DCK(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 728 | def __init__(self, fid='6f2c', sfid=None, name='EF.DCK', size={16, 16}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 729 | desc='Depersonalisation Control Keys', **kwargs): |
| 730 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 731 | self._construct = Struct('network'/BcdAdapter(Bytes(4)), |
| 732 | 'network_subset'/BcdAdapter(Bytes(4)), |
| 733 | 'service_provider'/BcdAdapter(Bytes(4)), |
| 734 | 'corporate'/BcdAdapter(Bytes(4))) |
| 735 | # TS 51.011 Section 10.3.30 |
| 736 | class EF_CNL(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 737 | def __init__(self, fid='6f32', sfid=None, name='EF.CNL', size={6, None}, rec_len=6, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 738 | desc='Co-operative Network List', **kwargs): |
| 739 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 740 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 741 | def _decode_record_hex(self, in_hex): |
| 742 | (in_plmn, sub, svp, corp) = unpack('!3sBBB', h2b(in_hex)) |
| 743 | res = dec_plmn(b2h(in_plmn)) |
| 744 | res['network_subset'] = sub |
| 745 | res['service_provider_id'] = svp |
| 746 | res['corporate_id'] = corp |
| 747 | return res |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 748 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 749 | def _encode_record_hex(self, in_json): |
| 750 | plmn = enc_plmn(in_json['mcc'], in_json['mnc']) |
Vadim Yanitskiy | 1a95d2b | 2021-05-02 01:42:09 +0200 | [diff] [blame] | 751 | return b2h(pack('!3sBBB', |
| 752 | h2b(plmn), |
| 753 | in_json['network_subset'], |
| 754 | in_json['service_provider_id'], |
| 755 | in_json['corporate_id'])) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 756 | |
| 757 | # TS 51.011 Section 10.3.31 |
| 758 | class EF_NIA(LinFixedEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 759 | def __init__(self, fid='6f51', sfid=None, name='EF.NIA', rec_len={1, 32}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 760 | desc='Network\'s Indication of Alerting', **kwargs): |
| 761 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 762 | self._construct = Struct( |
| 763 | 'alerting_category'/Int8ub, 'category'/GreedyBytes) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 764 | |
| 765 | # TS 51.011 Section 10.3.32 |
| 766 | class EF_Kc(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 767 | def __init__(self, fid='6f20', sfid=None, name='EF.Kc', desc='Ciphering key Kc', size={9, 9}): |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 768 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 769 | self._construct = Struct('kc'/HexAdapter(Bytes(8)), 'cksn'/Int8ub) |
| 770 | |
| 771 | # TS 51.011 Section 10.3.33 |
| 772 | class EF_LOCIGPRS(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 773 | def __init__(self, fid='6f53', sfid=None, name='EF.LOCIGPRS', desc='GPRS Location Information', size={14, 14}): |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 774 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
| 775 | self._construct = Struct('ptmsi'/Bytes(4), 'ptmsi_sig'/Int8ub, 'rai'/Bytes(6), |
| 776 | 'rau_status'/Enum(Byte, updated=0, not_updated=1, plmn_not_allowed=2, |
| 777 | routing_area_not_allowed=3)) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 778 | |
| 779 | # TS 51.011 Section 10.3.35..37 |
| 780 | class EF_xPLMNwAcT(TransRecEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 781 | def __init__(self, fid, sfid=None, name=None, desc=None, size={40, None}, rec_len=5, **kwargs): |
| 782 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len, **kwargs) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 783 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 784 | def _decode_record_hex(self, in_hex): |
| 785 | if in_hex[:6] == "ffffff": |
| 786 | return None |
| 787 | else: |
| 788 | return dec_xplmn_w_act(in_hex) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 789 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 790 | def _encode_record_hex(self, in_json): |
| 791 | if in_json == None: |
| 792 | return "ffffff0000" |
| 793 | else: |
| 794 | hplmn = enc_plmn(in_json['mcc'], in_json['mnc']) |
| 795 | act = self.enc_act(in_json['act']) |
| 796 | return hplmn + act |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 797 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 798 | @staticmethod |
| 799 | def enc_act(in_list): |
| 800 | u16 = 0 |
| 801 | # first the simple ones |
| 802 | if 'UTRAN' in in_list: |
| 803 | u16 |= 0x8000 |
| 804 | if 'NG-RAN' in in_list: |
| 805 | u16 |= 0x0800 |
| 806 | if 'GSM COMPACT' in in_list: |
| 807 | u16 |= 0x0040 |
| 808 | if 'cdma2000 HRPD' in in_list: |
| 809 | u16 |= 0x0020 |
| 810 | if 'cdma2000 1xRTT' in in_list: |
| 811 | u16 |= 0x0010 |
| 812 | # E-UTRAN |
Philipp Maier | e7d4179 | 2021-04-29 16:20:07 +0200 | [diff] [blame] | 813 | if 'E-UTRAN' in in_list: |
| 814 | u16 |= 0x4000 |
Vadim Yanitskiy | 5452d64 | 2021-03-07 21:45:34 +0100 | [diff] [blame] | 815 | if 'E-UTRAN WB-S1' in in_list: |
| 816 | u16 |= 0x6000 |
| 817 | if 'E-UTRAN NB-S1' in in_list: |
| 818 | u16 |= 0x5000 |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 819 | # GSM mess |
| 820 | if 'GSM' in in_list and 'EC-GSM-IoT' in in_list: |
| 821 | u16 |= 0x008C |
| 822 | elif 'GSM' in in_list: |
| 823 | u16 |= 0x0084 |
| 824 | elif 'EC-GSM-IuT' in in_list: |
| 825 | u16 |= 0x0088 |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 826 | return '%04X' % (u16) |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 827 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 828 | # TS 51.011 Section 10.3.38 |
| 829 | class EF_CPBCCH(TransRecEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 830 | def __init__(self, fid='6f63', sfid=None, name='EF.CPBCCH', size={2, 14}, rec_len=2, |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 831 | desc='CPBCCH Information'): |
| 832 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, rec_len=rec_len) |
| 833 | self._construct = Struct('cpbcch'/Int16ub) |
| 834 | |
| 835 | # TS 51.011 Section 10.3.39 |
| 836 | class EF_InvScan(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 837 | def __init__(self, fid='6f64', sfid=None, name='EF.InvScan', size={1, 1}, |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 838 | desc='IOnvestigation Scan'): |
| 839 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 840 | self._construct = FlagsEnum( |
| 841 | Byte, in_limited_service_mode=1, after_successful_plmn_selection=2) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 842 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 843 | # TS 51.011 Section 4.2.58 |
| 844 | class EF_PNN(LinFixedEF): |
| 845 | class FullNameForNetwork(BER_TLV_IE, tag=0x43): |
| 846 | # TS 24.008 10.5.3.5a |
| 847 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 848 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 849 | class ShortNameForNetwork(BER_TLV_IE, tag=0x45): |
| 850 | # TS 24.008 10.5.3.5a |
| 851 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 852 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 853 | class NetworkNameCollection(TLV_IE_Collection, nested=[FullNameForNetwork, ShortNameForNetwork]): |
| 854 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 855 | |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 856 | def __init__(self, fid='6fc5', sfid=None, name='EF.PNN', desc='PLMN Network Name', **kwargs): |
| 857 | super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 858 | self._tlv = EF_PNN.NetworkNameCollection |
| 859 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 860 | # TS 51.011 Section 10.3.42 |
| 861 | class EF_OPL(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 862 | def __init__(self, fid='6fc6', sfid=None, name='EF.OPL', rec_len={8, 8}, desc='Operator PLMN List', **kwargs): |
| 863 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 864 | self._construct = Struct('lai'/Bytes(5), 'pnn_record_id'/Int8ub) |
| 865 | |
| 866 | # TS 51.011 Section 10.3.44 + TS 31.102 4.2.62 |
| 867 | class EF_MBI(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 868 | def __init__(self, fid='6fc9', sfid=None, name='EF.MBI', rec_len={4, 5}, desc='Mailbox Identifier', **kwargs): |
| 869 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 870 | self._construct = Struct('mbi_voicemail'/Int8ub, 'mbi_fax'/Int8ub, 'mbi_email'/Int8ub, |
| 871 | 'mbi_other'/Int8ub, 'mbi_videocall'/COptional(Int8ub)) |
| 872 | |
| 873 | # TS 51.011 Section 10.3.45 + TS 31.102 4.2.63 |
| 874 | class EF_MWIS(LinFixedEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 875 | def __init__(self, fid='6fca', sfid=None, name='EF.MWIS', rec_len={5, 6}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 876 | desc='Message Waiting Indication Status', **kwargs): |
| 877 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 878 | self._construct = Struct('mwi_status'/FlagsEnum(Byte, voicemail=1, fax=2, email=4, other=8, videomail=16), |
| 879 | 'num_waiting_voicemail'/Int8ub, |
| 880 | 'num_waiting_fax'/Int8ub, 'num_waiting_email'/Int8ub, |
| 881 | 'num_waiting_other'/Int8ub, 'num_waiting_videomail'/COptional(Int8ub)) |
| 882 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 883 | # TS 51.011 Section 10.3.66 |
| 884 | class EF_SPDI(TransparentEF): |
| 885 | class ServiceProviderPLMN(BER_TLV_IE, tag=0x80): |
| 886 | # flexible numbers of 3-byte PLMN records |
| 887 | _construct = GreedyRange(BcdAdapter(Bytes(3))) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 888 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 889 | class SPDI(BER_TLV_IE, tag=0xA3, nested=[ServiceProviderPLMN]): |
| 890 | pass |
| 891 | def __init__(self, fid='6fcd', sfid=None, name='EF.SPDI', |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 892 | desc='Service Provider Display Information', **kwargs): |
| 893 | super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 894 | self._tlv = EF_SPDI.SPDI |
| 895 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 896 | # TS 51.011 Section 10.3.51 |
| 897 | class EF_MMSN(LinFixedEF): |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 898 | def __init__(self, fid='6fce', sfid=None, name='EF.MMSN', rec_len={4, 20}, desc='MMS Notification', **kwargs): |
| 899 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 900 | self._construct = Struct('mms_status'/Bytes(2), 'mms_implementation'/Bytes(1), |
| 901 | 'mms_notification'/Bytes(this._.total_len-4), 'ext_record_nr'/Byte) |
| 902 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 903 | # TS 51.011 Annex K.1 |
| 904 | class MMS_Implementation(BER_TLV_IE, tag=0x80): |
| 905 | _construct = FlagsEnum(Byte, WAP=1) |
| 906 | |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 907 | # TS 51.011 Section 10.3.53 |
| 908 | class EF_MMSICP(TransparentEF): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 909 | class MMS_Relay_Server(BER_TLV_IE, tag=0x81): |
| 910 | # 3GPP TS 23.140 |
| 911 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 912 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 913 | class Interface_to_CN(BER_TLV_IE, tag=0x82): |
| 914 | # 3GPP TS 23.140 |
| 915 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 916 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 917 | class Gateway(BER_TLV_IE, tag=0x83): |
| 918 | # Address, Type of address, Port, Service, AuthType, AuthId, AuthPass / 3GPP TS 23.140 |
| 919 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 920 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 921 | class MMS_ConnectivityParamters(TLV_IE_Collection, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 922 | nested=[MMS_Implementation, MMS_Relay_Server, Interface_to_CN, Gateway]): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 923 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 924 | def __init__(self, fid='6fd0', sfid=None, name='EF.MMSICP', size={1, None}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 925 | desc='MMS Issuer Connectivity Parameters', **kwargs): |
| 926 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 927 | self._tlv = EF_MMSICP.MMS_ConnectivityParamters |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 928 | |
| 929 | # TS 51.011 Section 10.3.54 |
| 930 | class EF_MMSUP(LinFixedEF): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 931 | class MMS_UserPref_ProfileName(BER_TLV_IE, tag=0x81): |
| 932 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 933 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 934 | class MMS_UserPref_Info(BER_TLV_IE, tag=0x82): |
| 935 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 936 | |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 937 | class MMS_User_Preferences(TLV_IE_Collection, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 938 | nested=[MMS_Implementation, MMS_UserPref_ProfileName, MMS_UserPref_Info]): |
Harald Welte | 14105dc | 2021-05-31 08:48:51 +0200 | [diff] [blame] | 939 | pass |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 940 | def __init__(self, fid='6fd1', sfid=None, name='EF.MMSUP', rec_len={1, None}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 941 | desc='MMS User Preferences', **kwargs): |
| 942 | super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len=rec_len, **kwargs) |
Harald Welte | 6113fe9 | 2022-01-21 15:51:35 +0100 | [diff] [blame] | 943 | self._tlv = EF_MMSUP.MMS_User_Preferences |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 944 | |
| 945 | # TS 51.011 Section 10.3.55 |
| 946 | class EF_MMSUCP(TransparentEF): |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 947 | def __init__(self, fid='6fd2', sfid=None, name='EF.MMSUCP', size={1, None}, |
Harald Welte | 6169c72 | 2022-02-12 09:05:15 +0100 | [diff] [blame] | 948 | desc='MMS User Connectivity Parameters', **kwargs): |
| 949 | super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size, **kwargs) |
Harald Welte | 790b270 | 2021-04-11 00:01:35 +0200 | [diff] [blame] | 950 | |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 951 | |
| 952 | class DF_GSM(CardDF): |
| 953 | def __init__(self, fid='7f20', name='DF.GSM', desc='GSM Network related files'): |
| 954 | super().__init__(fid=fid, name=name, desc=desc) |
| 955 | files = [ |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 956 | EF_LP(), |
| 957 | EF_IMSI(), |
| 958 | EF_Kc(), |
| 959 | EF_PLMNsel(), |
| 960 | TransparentEF('6f31', None, 'EF.HPPLMN', |
| 961 | 'Higher Priority PLMN search period'), |
| 962 | EF_ACMmax(), |
| 963 | EF_ServiceTable('6f38', None, 'EF.SST', |
| 964 | 'SIM service table', table=EF_SST_map, size={2, 16}), |
| 965 | CyclicEF('6f39', None, 'EF.ACM', |
| 966 | 'Accumulated call meter', rec_len={3, 3}), |
| 967 | TransparentEF('6f3e', None, 'EF.GID1', 'Group Identifier Level 1'), |
| 968 | TransparentEF('6f3f', None, 'EF.GID2', 'Group Identifier Level 2'), |
| 969 | EF_SPN(), |
| 970 | TransparentEF('6f41', None, 'EF.PUCT', |
| 971 | 'Price per unit and currency table', size={5, 5}), |
| 972 | EF_CBMI(), |
| 973 | TransparentEF('6f7f', None, 'EF.BCCH', |
| 974 | 'Broadcast control channels', size={16, 16}), |
| 975 | EF_ACC(), |
| 976 | EF_PLMNsel('6f7b', None, 'EF.FPLMN', |
| 977 | 'Forbidden PLMNs', size={12, 12}), |
| 978 | EF_LOCI(), |
| 979 | EF_AD(), |
| 980 | TransparentEF('6fa3', None, 'EF.Phase', |
| 981 | 'Phase identification', size={1, 1}), |
| 982 | EF_VGCS(), |
| 983 | EF_VGCSS(), |
| 984 | EF_VGCS('6fb3', None, 'EF.VBS', 'Voice Broadcast Service'), |
| 985 | EF_VGCSS('6fb4', None, 'EF.VBSS', |
| 986 | 'Voice Broadcast Service Status'), |
| 987 | EF_eMLPP(), |
| 988 | EF_AAeM(), |
| 989 | EF_CBMID(), |
| 990 | EF_ECC(), |
| 991 | EF_CBMIR(), |
| 992 | EF_DCK(), |
| 993 | EF_CNL(), |
| 994 | EF_NIA(), |
| 995 | EF_Kc('6f52', None, 'EF.KcGPRS', 'GPRS Ciphering key KcGPRS'), |
| 996 | EF_LOCIGPRS(), |
| 997 | TransparentEF('6f54', None, 'EF.SUME', 'SetUpMenu Elements'), |
| 998 | EF_xPLMNwAcT('6f60', None, 'EF.PLMNwAcT', |
| 999 | 'User controlled PLMN Selector with Access Technology'), |
| 1000 | EF_xPLMNwAcT('6f61', None, 'EF.OPLMNwAcT', |
| 1001 | 'Operator controlled PLMN Selector with Access Technology'), |
| 1002 | EF_xPLMNwAcT('6f62', None, 'EF.HPLMNwAcT', |
| 1003 | 'HPLMN Selector with Access Technology'), |
| 1004 | EF_CPBCCH(), |
| 1005 | EF_InvScan(), |
| 1006 | EF_PNN(), |
| 1007 | EF_OPL(), |
| 1008 | EF_ADN('6fc7', None, 'EF.MBDN', 'Mailbox Dialling Numbers'), |
| 1009 | EF_MBI(), |
| 1010 | EF_MWIS(), |
| 1011 | EF_ADN('6fcb', None, 'EF.CFIS', |
| 1012 | 'Call Forwarding Indication Status'), |
| 1013 | EF_EXT('6fc8', None, 'EF.EXT6', 'Externsion6 (MBDN)'), |
| 1014 | EF_EXT('6fcc', None, 'EF.EXT7', 'Externsion7 (CFIS)'), |
| 1015 | EF_SPDI(), |
| 1016 | EF_MMSN(), |
| 1017 | EF_EXT('6fcf', None, 'EF.EXT8', 'Extension8 (MMSN)'), |
| 1018 | EF_MMSICP(), |
| 1019 | EF_MMSUP(), |
| 1020 | EF_MMSUCP(), |
| 1021 | ] |
Harald Welte | b2edd14 | 2021-01-08 23:29:35 +0100 | [diff] [blame] | 1022 | self.add_files(files) |
| 1023 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1024 | |
Philipp Maier | c8387dc | 2021-10-29 17:59:50 +0200 | [diff] [blame] | 1025 | class CardProfileSIM(CardProfile): |
Philipp Maier | a028c7d | 2021-11-08 16:12:03 +0100 | [diff] [blame] | 1026 | |
| 1027 | ORDER = 2 |
| 1028 | |
Philipp Maier | c8387dc | 2021-10-29 17:59:50 +0200 | [diff] [blame] | 1029 | def __init__(self): |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1030 | sw = { |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1031 | 'Normal': { |
| 1032 | '9000': 'Normal ending of the command', |
| 1033 | '91xx': 'normal ending of the command, with extra information from the proactive SIM containing a command for the ME', |
| 1034 | '9exx': 'length XX of the response data given in case of a SIM data download error', |
| 1035 | '9fxx': 'length XX of the response data', |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1036 | }, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1037 | 'Postponed processing': { |
| 1038 | '9300': 'SIM Application Toolkit is busy. Command cannot be executed at present, further normal commands are allowed', |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1039 | }, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1040 | 'Memory management': { |
| 1041 | '920x': 'command successful but after using an internal update retry routine X times', |
| 1042 | '9240': 'memory problem', |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1043 | }, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1044 | 'Referencing management': { |
| 1045 | '9400': 'no EF selected', |
| 1046 | '9402': 'out of range (invalid address)', |
| 1047 | '9404': 'file ID not found or pattern not found', |
| 1048 | '9408': 'file is inconsistent with the command', |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1049 | }, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1050 | 'Security management': { |
| 1051 | '9802': 'no CHV initialized', |
| 1052 | '9804': 'access condition not fulfilled, unsuccessful CHV verification or authentication failed', |
| 1053 | '9808': 'in contradiction with CHV status', |
| 1054 | '9810': 'in contradiction with invalidation status', |
| 1055 | '9840': 'unsuccessful verification, CHV blocked, UNBLOCK CHV blocked', |
| 1056 | '9850': 'increase cannot be performed, Max value reached', |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1057 | }, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1058 | 'Application independent errors': { |
| 1059 | '67xx': 'incorrect parameter P3', |
| 1060 | '6bxx': 'incorrect parameter P1 or P2', |
| 1061 | '6dxx': 'unknown instruction code given in the command', |
| 1062 | '6exx': 'wrong instruction class given in the command', |
| 1063 | '6fxx': 'technical problem with no diagnostic given', |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1064 | }, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1065 | } |
Philipp Maier | a4df942 | 2021-11-10 17:13:40 +0100 | [diff] [blame] | 1066 | |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1067 | super().__init__('SIM', desc='GSM SIM Card', cla="a0", |
| 1068 | sel_ctrl="0000", files_in_mf=[DF_TELECOM(), DF_GSM()], sw=sw) |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1069 | |
Philipp Maier | 5998a3a | 2021-11-16 15:16:39 +0100 | [diff] [blame] | 1070 | @staticmethod |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1071 | def decode_select_response(resp_hex: str) -> object: |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1072 | resp_bin = h2b(resp_hex) |
| 1073 | struct_of_file_map = { |
| 1074 | 0: 'transparent', |
| 1075 | 1: 'linear_fixed', |
| 1076 | 3: 'cyclic' |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1077 | } |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1078 | type_of_file_map = { |
| 1079 | 1: 'mf', |
| 1080 | 2: 'df', |
| 1081 | 4: 'working_ef' |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1082 | } |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1083 | ret = { |
| 1084 | 'file_descriptor': {}, |
| 1085 | 'proprietary_info': {}, |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1086 | } |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1087 | ret['file_id'] = b2h(resp_bin[4:6]) |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1088 | ret['proprietary_info']['available_memory'] = int.from_bytes( |
| 1089 | resp_bin[2:4], 'big') |
| 1090 | file_type = type_of_file_map[resp_bin[6] |
| 1091 | ] if resp_bin[6] in type_of_file_map else resp_bin[6] |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1092 | ret['file_descriptor']['file_type'] = file_type |
| 1093 | if file_type in ['mf', 'df']: |
| 1094 | ret['file_characteristics'] = b2h(resp_bin[13:14]) |
| 1095 | ret['num_direct_child_df'] = resp_bin[14] |
| 1096 | ret['num_direct_child_ef'] = resp_bin[15] |
| 1097 | ret['num_chv_unblock_adm_codes'] = int(resp_bin[16]) |
| 1098 | # CHV / UNBLOCK CHV stats |
| 1099 | elif file_type in ['working_ef']: |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1100 | file_struct = struct_of_file_map[resp_bin[13] |
| 1101 | ] if resp_bin[13] in struct_of_file_map else resp_bin[13] |
Philipp Maier | 4ab971c | 2021-11-11 11:53:49 +0100 | [diff] [blame] | 1102 | ret['file_descriptor']['structure'] = file_struct |
| 1103 | ret['access_conditions'] = b2h(resp_bin[8:10]) |
| 1104 | if resp_bin[11] & 0x01 == 0: |
| 1105 | ret['life_cycle_status_int'] = 'operational_activated' |
| 1106 | elif resp_bin[11] & 0x04: |
| 1107 | ret['life_cycle_status_int'] = 'operational_deactivated' |
| 1108 | else: |
| 1109 | ret['life_cycle_status_int'] = 'terminated' |
| 1110 | return ret |
Philipp Maier | a028c7d | 2021-11-08 16:12:03 +0100 | [diff] [blame] | 1111 | |
| 1112 | @staticmethod |
Harald Welte | c91085e | 2022-02-10 18:05:45 +0100 | [diff] [blame] | 1113 | def match_with_card(scc: SimCardCommands) -> bool: |
Philipp Maier | a028c7d | 2021-11-08 16:12:03 +0100 | [diff] [blame] | 1114 | return match_sim(scc) |