aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-03-24 13:09:03 +0100
committerherlesupreeth <herlesupreeth@gmail.com>2020-10-21 08:32:57 +0200
commit95ec772b61c9f8c7514d92a8f434706759bfb787 (patch)
tree754b39b847287f80efb95d816d6fee454e572546
parent99d55552d5b37905e2a551c18024fca869f3c321 (diff)
utils.py: Add helper method to encode ePDGSelection info TLV
Encodes ePDGSelection info TLV so it can be stored at EF.ePDGSelection or EF.ePDGSelectionEm. See 3GPP TS 31.102 version 15.2.0 Release 15, section 4.2.104 and 4.2.106. Take original hex string of EF.ePDGSelection or EF.ePDGSelectionEm, MCC, MNC, ePDG priority for PLMN and ePDG FQDN Format to use for PLMNas input and outputs the encoded hex string. Change-Id: Ia7292d33783c770a3bb91b081c671af36bbb907f
-rw-r--r--pySim/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pySim/utils.py b/pySim/utils.py
index a3e4cb1..ebc2a95 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -610,6 +610,22 @@ def init_reader(opts):
return sl
+def enc_ePDGSelection(hexstr, mcc, mnc, epdg_priority='0001', epdg_fqdn_format='00'):
+ """
+ Encode ePDGSelection so it can be stored at EF.ePDGSelection or EF.ePDGSelectionEm.
+ See 3GPP TS 31.102 version 15.2.0 Release 15, section 4.2.104 and 4.2.106.
+
+ Default values:
+ - epdg_priority: '0001' - 1st Priority
+ - epdg_fqdn_format: '00' - Operator Identifier FQDN
+ """
+
+ plmn1 = enc_plmn(mcc, mnc) + epdg_priority + epdg_fqdn_format
+ # TODO: Handle encoding of Length field for length more than 127 Bytes
+ content = '80' + ('%02x' % (len(plmn1)//2)) + plmn1
+ content = rpad(content, len(hexstr))
+ return content
+
def dec_ePDGSelection(sixhexbytes):
"""
Decode ePDGSelection to get EF.ePDGSelection or EF.ePDGSelectionEm.