pysim[master]: ts_51_011: A file with MF/DF/EF constants from TS 51 011

2018-01-13 Thread Alexander Chemeris

Patch Set 1: Verified+1

-- 
To view, visit https://gerrit.osmocom.org/5714
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I38f5d36d16b41b5d516a6a3e2ec1d09637883932
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] pysim[master]: ts_51_011: A file with MF/DF/EF constants from TS 51 011

2018-01-13 Thread Alexander Chemeris
Alexander Chemeris has submitted this change and it was merged.

Change subject: ts_51_011: A file with MF/DF/EF constants from TS 51 011
..


ts_51_011: A file with MF/DF/EF constants from TS 51 011

pySim has been using magic numbers to access various files which makes it hard
to read, maintain and extend. With this file in place we can start replacing all
those magic numbers with human readable names lile EF['IMSI'] instead of
['3F00', '7F20', '6F07'].

Change-Id: I38f5d36d16b41b5d516a6a3e2ec1d09637883932
---
A pySim/ts_51_011.py
1 file changed, 251 insertions(+), 0 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Alexander Chemeris: Verified
  Harald Welte: Looks good to me, approved



diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
new file mode 100644
index 000..754d57f
--- /dev/null
+++ b/pySim/ts_51_011.py
@@ -0,0 +1,251 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+""" Various constants from ETSI TS 151.011
+"""
+
+#
+# Copyright (C) 2017 Alexander.Chemeris 
+#
+# 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 .
+#
+
+MF_num = '3F00'
+
+DF_num = {
+'TELECOM': '7F10',
+
+'GSM': '7F20',
+'IS-41': '7F22',
+'FP-CTS': '7F23',
+
+'GRAPHICS': '5F50',
+
+'IRIDIUM': '5F30',
+'GLOBST': '5F31',
+'ICO': '5F32',
+'ACeS': '5F33',
+
+'EIA/TIA-553': '5F40',
+'CTS': '5F60',
+'SOLSA': '5F70',
+
+'MExE': '5F3C',
+}
+
+EF_num = {
+# MF
+'ICCID': '2FE2',
+'ELP': '2F05',
+
+# DF_TELECOM
+'ADN': '6F3A',
+'FDN': '6F3B',
+'SMS': '6F3C',
+'CCP': '6F3D',
+'MSISDN': '6F40',
+'SMSP': '6F42',
+'SMSS': '6F43',
+'LND': '6F44',
+'SMSR': '6F47',
+'SDN': '6F49',
+'EXT1': '6F4A',
+'EXT2': '6F4B',
+'EXT3': '6F4C',
+'BDN': '6F4D',
+'EXT4': '6F4E',
+'CMI': '6F58',
+'ECCP': '6F4F',
+
+# DF_GRAPHICS
+'IMG': '4F20',
+
+# DF_SoLSA
+'SAI': '4F30',
+'SLL': '4F31',
+
+# DF_MExE
+'MExE-ST': '4F40',
+'ORPK': '4F41',
+'ARPK': '4F42',
+'TPRPK': '4F43',
+
+# DF_GSM
+'LP': '6F05',
+'IMSI': '6F07',
+'Kc': '6F20',
+'DCK': '6F2C',
+'PLMNsel': '6F30',
+'HPPLMN': '6F31',
+'CNL': '6F32',
+'ACMmax': '6F37',
+'SST': '6F38',
+'ACM': '6F39',
+'GID1': '6F3E',
+'GID2': '6F3F',
+'PUCT': '6F41',
+'CBMI': '6F45',
+'SPN': '6F46',
+'CBMID': '6F48',
+'BCCH': '6F74',
+'ACC': '6F78',
+'FPLMN': '6F7B',
+'LOCI': '6F7E',
+'AD': '6FAD',
+'PHASE': '6FAE',
+'VGCS': '6FB1',
+'VGCSS': '6FB2',
+'VBS': '6FB3',
+'VBSS': '6FB4',
+'eMLPP': '6FB5',
+'AAeM': '6FB6',
+'ECC': '6FB7',
+'CBMIR': '6F50',
+'NIA': '6F51',
+'KcGPRS': '6F52',
+'LOCIGPRS': '6F53',
+'SUME': '6F54',
+'PLMNwAcT': '6F60',
+'OPLMNwAcT': '6F61',
+# Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT
+'HPLMNAcT': '6F62',
+'HPLMNwAcT': '6F62',
+'CPBCCH': '6F63',
+'INVSCAN': '6F64',
+'PNN': '6FC5',
+'OPL': '6FC6',
+'MBDN': '6FC7',
+'EXT6': '6FC8',
+'MBI': '6FC9',
+'MWIS': '6FCA',
+'CFIS': '6FCB',
+'EXT7': '6FCC',
+'SPDI': '6FCD',
+'MMSN': '6FCE',
+'EXT8': '6FCF',
+'MMSICP': '6FD0',
+'MMSUP': '6FD1',
+'MMSUCP': '6FD2',
+}
+
+DF = {
+'TELECOM':  [MF_num, DF_num['TELECOM']],
+
+'GSM':  [MF_num, DF_num['GSM']],
+'IS-41':[MF_num, DF_num['IS-41']],
+'FP-CTS':   [MF_num, DF_num['FP-CTS']],
+
+'GRAPHICS': [MF_num, DF_num['GRAPHICS']],
+
+'IRIDIUM':  [MF_num, DF_num['IRIDIUM']],
+'GLOBST':   [MF_num, DF_num['GLOBST']],
+'ICO':  [MF_num, DF_num['ICO']],
+'ACeS': [MF_num, DF_num['ACeS']],
+
+'EIA/TIA-553': [MF_num, DF_num['EIA/TIA-553']],
+'CTS':  [MF_num, DF_num['CTS']],
+'SoLSA':[MF_num, DF_num['SOLSA']],
+
+'MExE': [MF_num, DF_num['MExE']],
+}
+
+
+EF = {
+'ICCID':  [MF_num, EF_num['ICCID']],
+'ELP':[MF_num, EF_num['ELP']],
+
+'ADN':DF['TELECOM']+[EF_num['ADN']],
+'FDN':DF['TELECOM']+[EF_num['FDN']],
+'SMS':DF['TELECOM']+[EF_num['SMS']],
+'CCP':DF['TELECOM']+[EF_num['CCP']],
+'MSISDN': DF['TELECOM']+[EF_num['MSISDN']],
+'SMSP':   DF['TELECOM']+[EF_num['SMSP']],
+'SMSS':   DF['TELECOM']+[EF_num['SMSS']],
+'LND':DF['TELECOM']+[EF_num['LND']],
+'SMSR':   DF['TELECOM']+[EF_num['SMSR']],
+'SDN':DF['TELECOM']+[EF_num['SDN']],
+'EXT1':   DF['TELECOM']+[EF_num['EXT1']],
+'EXT2':   DF['TELECOM']+[EF_num['EXT2']],
+'EXT3':   DF['TELECOM']+[EF_num['EXT3']],
+'BDN':DF['TELECOM']+[EF_num['BDN']],
+'EXT4':   DF['TELECOM']+[EF_num['EXT4']],
+'CMI':DF['TELECOM']+[EF_num['CMI']],
+'ECCP':   DF['TELECOM']+[EF_num['ECCP']],

pysim[master]: ts_51_011: A file with MF/DF/EF constants from TS 51 011

2018-01-12 Thread Harald Welte

Patch Set 1: Code-Review+2

-- 
To view, visit https://gerrit.osmocom.org/5714
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I38f5d36d16b41b5d516a6a3e2ec1d09637883932
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


pysim[master]: ts_51_011: A file with MF/DF/EF constants from TS 51 011

2018-01-10 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

-- 
To view, visit https://gerrit.osmocom.org/5714
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I38f5d36d16b41b5d516a6a3e2ec1d09637883932
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No