diff options
author | Harald Welte <laforge@osmocom.org> | 2023-05-27 12:48:54 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2023-06-03 12:45:35 +0000 |
commit | 455611c9a33099673b1807d74769597d8c1805d1 (patch) | |
tree | 0bf70f5e5d3d8329def387081b5fd4e55568634e | |
parent | d70ac226186de5503b2adc9de117d2818d307867 (diff) |
ts_31_102: Add decoder/encoder for DF.5GS/EF.Routing_Indicator
This file is rather important for 5G SA operation, so we should have
a proper encoder/decoder in place.
Change-Id: I1b37fdfc2807976880b2cafb61951f08eebeb344
-rw-r--r-- | docs/suci-tutorial.rst | 4 | ||||
-rw-r--r-- | pySim/ts_31_102.py | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/docs/suci-tutorial.rst b/docs/suci-tutorial.rst index 00c060f..fc6e911 100644 --- a/docs/suci-tutorial.rst +++ b/docs/suci-tutorial.rst @@ -132,10 +132,8 @@ the Routing Indicator to 0x71: :: - pySIM-shell (MF/ADF.USIM/DF.5GS/EF.Routing_Indicator)> update_binary 0071ffff + pySIM-shell (MF/ADF.USIM/DF.5GS/EF.Routing_Indicator)> update_binary 17ffffff -(the encoding might be different, see `this -comment <https://gist.github.com/mrlnc/01d6300f1904f154d969ff205136b753?permalink_comment_id=4050795#gistcomment-4050795>`__) You can also set the routing indicator to **0x0**, which is *valid* and means “routing indicator not specified”, leaving it to the modem. diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py index 76f1358..73c5fd5 100644 --- a/pySim/ts_31_102.py +++ b/pySim/ts_31_102.py @@ -1080,6 +1080,16 @@ class EF_SUPI_NAI(TransparentEF): super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) self._tlv = EF_SUPI_NAI.NAI_TLV_Collection +# TS 31.102 Section 4.4.11.11 +class EF_Routing_Indicator(TransparentEF): + def __init__(self, fid='4f0a', sfid=0x0a, name='EF.Routing_Indicator', desc='Routing Indicator', **kwargs): + super().__init__(fid, sfid=sfid, name=name, desc=desc, **kwargs) + # 3GPP TS 24.501 Table 9.11.3.4.1: + # Routing Indicator shall consist of 1 to 4 digits. The coding of this field is the + # responsibility of home network operator but BCD coding shall be used. If a network + # operator decides to assign less than 4 digits to Routing Indicator, the remaining digits + # shall be coded as "1111" to fill the 4 digits coding of Routing Indicator + self._construct = Struct('routing_indicator'/BcdAdapter(Rpad(Bytes(2))), 'rfu'/HexAdapter(Bytes(2))) # TS 31.102 Section 4.4.11.13 class EF_TN3GPPSNN(TransparentEF): @@ -1434,8 +1444,7 @@ class DF_USIM_5GS(CardDF): EF_SUCI_Calc_Info(service=124), EF_OPL5G(service=129), EF_SUPI_NAI(service=130), - TransparentEF('4F0A', 0x0a, 'EF.Routing_Indicator', - 'Routing Indicator', size=(4, 4), service=124), + EF_Routing_Indicator(service=124), TransparentEF('4F0B', 0x0b, 'EF.URSP', 'UE Route Selector Policies per PLMN', service=132), EF_TN3GPPSNN(service=133), |