Change in pysim[master]: utils.py: Add helper method to encode ePDGSelection info TLV

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/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Wed Oct 21 06:36:51 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/20818 )


Change subject: utils.py: Add helper method to encode ePDGSelection info TLV
......................................................................

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
---
M pySim/utils.py
1 file changed, 16 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/18/20818/1

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 @@
 
 	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.

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/20818
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ia7292d33783c770a3bb91b081c671af36bbb907f
Gerrit-Change-Number: 20818
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201021/26189d88/attachment.htm>


More information about the gerrit-log mailing list