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.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/17883 ) Change subject: utils.py: Add helper method to parse ePDG Identifier from hex string ...................................................................... utils.py: Add helper method to parse ePDG Identifier from hex string The hex string consists of contains zero or more ePDG identifier data objects. Each ePDG Identifier TLV data object consists of tag value of '80', length, address type, identifier. TS 31.102 version 13.4.0 Release 13. The same parsing method applies for both EF.ePDGId and EF.ePDGIdEm Change-Id: I96fb129d178cfd7ec037989526da77899ae8d344 --- M pySim/utils.py 1 file changed, 34 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/pySim/utils.py b/pySim/utils.py index ee4d2f3..dbc7337 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -402,3 +402,37 @@ else: bytelist = bytelist[ L+2 : ] return ret + +def dec_epdgid(hexstr): + """ + Decode ePDG Id to get EF.ePDGId or EF.ePDGIdEm. + See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.102 and 4.2.104. + """ + + # Convert from hex str to int bytes list + epdgid_bytes = h2i(hexstr) + + s = "" + + # Get list of tuples containing parsed TLVs + tlvs = TLV_parser(epdgid_bytes) + + for tlv in tlvs: + # tlv = (T, L, [V]) + # T = Tag + # L = Length + # [V] = List of value + + # Invalid Tag value scenario + if tlv[0] != 0x80: + continue + + # First byte in the value has the address type + addr_type = tlv[2][0] + # TODO: Support parsing of IPv4 and IPv6 + if addr_type == 0x00: #FQDN + # Skip address tye byte i.e. first byte in value list + content = tlv[2][1:] + s += "\t%s # %s\n" % (i2h(content), i2s(content)) + + return s -- To view, visit https://gerrit.osmocom.org/c/pysim/+/17883 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I96fb129d178cfd7ec037989526da77899ae8d344 Gerrit-Change-Number: 17883 Gerrit-PatchSet: 4 Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: herlesupreeth <herlesupreeth at gmail.com> 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/20200511/97f803d0/attachment.htm>