*gdZddlZddlmZmZmZmZmZddlTddl Tddl Tddl m Z m Z ddlmZddlmZmZddlmZid d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*id+d,d-d.d/d0d1d2d3d4d5d6d7d6d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdGdIdGdGdGdGdJdKdLdMdNdOdPdQdRdSdT ZGdUdVeZGdWdXeZGdYdZeZGd[d\eZGd]d^e ZGd_d`e ZdS)aaR-UIM (Removable User Identity Module) card profile (see 3GPP2 C.S0023-D) (C) 2023 by Vadim Yanitskiy This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . N)Bytewise BitStruct BitsIntegerStruct FlagsEnum)*) CardProfileCardProfileAddon)CardProfileSIM) DF_TELECOMDF_GSM)EF_ServiceTablezCHV disable functionz!Abbreviated Dialing Numbers (ADN)zFixed Dialing Numbers (FDN)zShort Message Storage (SMS)HRPDzEnhanced Phone BookzMulti Media Domain (MMD)zSF_EUIMID-based EUIMID z MEID Support Extension1 Extension2 zSMS Parameters zLast Number Dialled (LND)z#Service Category Program for BC-SMSzMessaging and 3GPD ExtensionszRoot CertificateszCDMA Home Service Provider NamezService Dialing Numbers (SDN) Extension3z3GPD-SIPz WAP BrowserJavazReserved for CDGzData Download via SMS BroadcastzData Download via SMS-PPzMenu Selectionz Call ControlzProactive R-UIMAKAIPv6 RFU!"z3GPD-MIPBCMCSz"Multimedia Messaging Service (MMS)z Extension 8z MMS User Connectivity ParameterszApplication AuthenticationzGroup Identifier Level 1zGroup Identifier Level 2zDe-Personalization Control KeyszCooperative Network List) #$%&'()*+,-./c@eZdZdZddddddddfgZ dfd ZxZS)EF_SPNz&3.4.31 CDMA Home Service Provider NameF010801536b796c696e6b204e57ffffffffffffffffffffffffffffffffffffffffffffrTrrz Skylink NW)rfu1 show_in_hsarfu2 char_encodinglang_indspn6f41NEF.SPNService Provider Namer:r:c Btj|f||||d|tdtdz dtz dtdz dt dz d t d z d t td z |_dS) NsfidnamedescsizerJrrKrLrrMrrNrrOr5) super__init__rBitsRFUFlagrr GsmString _constructselffidrVrWrXrYkwargs __class__s =/home/jenkins/workspace/simtester-sanitize/pySim/cdma_ruim.pyr[zEF_SPN.__init__bsS4dDSSFSSS# 71::  $  71::  KNN * {1~~ % (9R==)) )   )rPNrQrRrS)__name__ __module__ __qualname____doc___test_de_encoder[ __classcell__rds@rerHrHYsx00 Sqa H H JO 4<4<          rfrHcdeZdZdZdddddfgZdZGdd ejZ dfd Z xZ S)EF_ADz3.4.33 Administrative Data000000normal0000)ms_operation_modeadditional_inforfuTc&eZdZdZdZdZdZdZdZdS) EF_AD.OP_MODErrrrN) rgrhrirq type_approvalnormal_and_specific_facilities%type_approval_and_specific_facilitiesmaintenance_off_line cell_testrfreOP_MODErxzs/ )-&04-# rfr6f43NEF.ADrRrNc tj|f||||d|tdtt|jz dt tdz dt tz |_ dS)NrUrtrurrv) rZr[rEnumByter HexAdapterBytesGreedyBytesRFUr_r`s rer[zEF_AD.__init__s|S4dDSSFSSS T4< 8 8 8 jq22 2 *^,, ,   rf)rNrrRr) rgrhrirjrk _test_no_padenumIntEnumrr[rlrms@rerorors$$ H&Z\^^`OL$,4;4=           rfroc$eZdZdZdfd ZxZS)EF_SMSz3.4.27 Short Messages6f3cNEF.SMSShort messagesc ptj|f|||dd|tdtdt dz dt z dt dz dt tddd dd z d t z z d tz dtdz |_ dS)N)r)rVrWrXrec_lenstatusrfu87r protectionrfu54rrr)read to_be_readsent to_be_sentusedlengthtpduc,|jjr|jndSNr)rrr)ctxs rez!EF_SMS.__init__..s3:?%ISZZrf) rZr[rrr\r]rrInt8ubrr_)rarbrVrWrXrcrds rer[zEF_SMS.__init__sZ4dxZZSYZZZ Y "T! ";q>>aa\]^^^^t   VO 5IIJJ J   rf)rNrr)rgrhrirjr[rlrms@rerrsC          rfrceZdZfdZxZS)DF_CDMActdddtddddtd t t t g}||dS) N7f25zDF.CDMAz$CDMA related files (3GPP2 C.S0023-D))rbrWrX6f32zEF.CSTzCDMA Service Table)rr!)tablerY)rZr[r EF_CST_maprHror add_filesrafilesrds rer[zDF_CDMA.__init__s V)D  F F F FD(0  R R R HH GG HH   urf)rgrhrir[rlrms@rerrs8         rfrcfeZdZdZdZfdZededefdZ e de ddfd Z xZ S) CardProfileRUIMz)R-UIM card profile as per 3GPP2 C.S0023-Dr&c tddddttt gdS)NzR-UIMzCDMA R-UIM Carda0rr)rXclasel_ctrl files_in_mf)rZr[r r r)rards rer[zCardProfileRUIM.__init__sR '8d"(z||VXXwyy6Y  [ [ [ [ [rfdata_hexreturnc*tj|S)N)r decode_select_response)rs rerz&CardProfileRUIM.decode_select_responses4X>>>rfsccNc:||ddddgdS)z} Try to access MF/DF.CDMA via 2G APDUs (3GPP TS 11.11), if this works, the card is considered an R-UIM card for CDMA.rrr3f00rN)_mf_select_test)clsrs re_try_match_cardzCardProfileRUIM._try_match_cards) Cv/?@@@@@rf)rgrhrirjORDERr[ staticmethodstrobjectr classmethodSimCardCommandsrrlrms@rerrs33 E[[[[[?????\?A/AdAAA[AAAAArfrc2eZdZdZfdZdddefdZxZS) AddonRUIMzVAn Addon that can be found on on a combined SIM + RUIM or UICC + RUIM to support CDMA.cntg}tdd|dS)NRUIMz CDMA RUIM)rXr)rrZr[rs rer[zAddonRUIM.__init__s8 II  kuEEEEErfcardCardBasercL||jdjSr) file_existsrrb)rars reprobezAddonRUIM.probes! 0 3 7888rf)rgrhrirjr[boolrrlrms@rerrse``FFFFF 9*999999999rfr)rjr constructrrrrr osmocom.utilsosmocom.constructpySim.filesystem pySim.profiler r pySim.ts_51_011r r r rr TransparentEFrHro LinFixedEFrCardDFrrrrrfrers$ IIIIIIIIIIIIII77777777******........++++++00+0%0% 0  0  0"0 0000 0 $0 .0 (0  !0" *#00$ (%0&'0()0*+0,-0. /00 102 *304 #506 70890: ;0<=0>?0@A0BC0DE00F      -  + % # # * #_000 n     ]   2     M   :     Z   (     f   AAAAAkAAA* 9 9 9 9 9 9 9 9 9 9rf