This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
guilly@gmail.com gerrit-no-reply at lists.osmocom.orgguilly at gmail.com has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/18737 )
Change subject: utils.py add LOCI EFs decode functions
......................................................................
utils.py add LOCI EFs decode functions
The LOCI, PSLOCI and EPSLOCI contain some info,
including the PLMN, added helper functions to
decode it
Change-Id: Ibb513ff7d1dc6d33b354ae26cbd9c390ea3c8efc
---
M pySim/ts_31_102.py
M pySim/utils.py
2 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/37/18737/1
diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index 473e595..215ed4c 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -137,6 +137,12 @@
111: 'ePDG configuration Information for Emergency Service configured',
}
+LOCI_STATUS_map = {
+ 0: 'updated',
+ 1: 'not updated',
+ 2: 'plmn not allowed',
+ 3: 'locatation area not allowed'
+}
EF_USIM_ADF_map = {
'LI': '6F05',
'ARR': '6F06',
diff --git a/pySim/utils.py b/pySim/utils.py
index 496b918..2ca6165 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -183,6 +183,36 @@
s += "\t%s # %s\n" % (rec_data, rec_str)
return s
+def dec_loci(hexstr):
+ res = {'tmsi': '', 'mcc': 0, 'mnc': 0, 'lac': '', 'status': 0}
+ res['tmsi'] = hexstr[:8]
+ res['mcc'] = dec_mcc_from_plmn(hexstr[8:14])
+ res['mnc'] = dec_mnc_from_plmn(hexstr[8:14])
+ res['lac'] = hexstr[14:18]
+ res['status'] = h2i(hexstr[20:22])
+ return res
+
+def dec_psloci(hexstr):
+ res = {'p-tmsi': '', 'p-tmsi-sig': '', 'mcc': 0, 'mnc': 0, 'lac': '', 'rac': '', 'status': 0}
+ res['p-tmsi'] = hexstr[:8]
+ res['p-tmsi-sig'] = hexstr[8:14]
+ res['mcc'] = dec_mcc_from_plmn(hexstr[14:20])
+ res['mnc'] = dec_mnc_from_plmn(hexstr[14:20])
+ res['lac'] = hexstr[20:24]
+ res['rac'] = hexstr[24:26]
+ res['status'] = h2i(hexstr[26:28])
+ return res
+
+def dec_epsloci(hexstr):
+ res = {'guti': '', 'mcc': 0, 'mnc': 0, 'tac': '', 'status': 0}
+ res['guti'] = hexstr[:24]
+ res['tai'] = hexstr[24:34]
+ res['mcc'] = dec_mcc_from_plmn(hexstr[24:30])
+ res['mnc'] = dec_mnc_from_plmn(hexstr[24:30])
+ res['tac'] = hexstr[30:34]
+ res['status'] = h2i(hexstr[34:36])
+ return res
+
def derive_milenage_opc(ki_hex, op_hex):
"""
Run the milenage algorithm to calculate OPC from Ki and OP
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/18737
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ibb513ff7d1dc6d33b354ae26cbd9c390ea3c8efc
Gerrit-Change-Number: 18737
Gerrit-PatchSet: 1
Gerrit-Owner: guilly at gmail.com <guilly at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200609/de345f58/attachment.htm>