Change in pysim[master]: utils.py: Add helper method to encode ePDG Identifier

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Jul 14 10:33:14 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/18977 )

Change subject: utils.py: Add helper method to encode ePDG Identifier
......................................................................

utils.py: Add helper method to encode ePDG Identifier

This method encodes ePDG Id so it can be stored to EF.ePDGId or EF.ePDGIdEm.
See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.102 and 4.2.104.

Resulting hex string is made of tag value + length + address type + address.
tag value for home ePDG identifier is 80
address type: 0x00 (FQDN), 0x01 (IPv4), 0x02 (IPv6), other (Reserved)

ePDG FQDN example: epdg.mnc001.mcc001.3gppnetwork.org

Note: Only FQDN format is supported for now

Change-Id: I864bda5505e9061391a727add294a6e90c50f9ef
---
M pySim/utils.py
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pySim/utils.py b/pySim/utils.py
index 79a1c1b..ac82774 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -476,6 +476,24 @@
 
 	return s
 
+def enc_epdgid(epdg_addr, addr_type='00'):
+	"""
+	Encode ePDG Id so it can be stored to EF.ePDGId or EF.ePDGIdEm.
+	See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.102 and 4.2.104.
+
+	Default values:
+	  - addr_type: 00 - FQDN format of ePDG Address
+	"""
+
+	s = ""
+
+	# TODO: Encoding of IPv4 and IPv6 address
+	if addr_type == '00':
+		hex_str = s2h(epdg_addr)
+		s += '80' + ('%02x' % ((len(hex_str)//2)+1)) + '00' + hex_str
+
+	return s
+
 def sanitize_pin_adm(opts):
 	"""
 	The ADM pin can be supplied either in its hexadecimal form or as

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I864bda5505e9061391a727add294a6e90c50f9ef
Gerrit-Change-Number: 18977
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200714/b275031e/attachment.htm>


More information about the gerrit-log mailing list