Change in pysim[master]: ts_31_102: Fully support USIM EF.AD

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
Sat Jun 5 12:27:16 UTC 2021


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


Change subject: ts_31_102: Fully support USIM EF.AD
......................................................................

ts_31_102: Fully support USIM EF.AD

The USIM EF.AD has quite some more bits, it should have a separate
implementation and not reuse te DF.GSM/EF.AD implementation.

Change-Id: Iaf195cb63d5d12fc906a7e7cd85e3fd44589a41e
---
M pySim/ts_31_102.py
1 file changed, 26 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/70/24570/1

diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py
index d6f5dc0..075d6bf 100644
--- a/pySim/ts_31_102.py
+++ b/pySim/ts_31_102.py
@@ -276,13 +276,15 @@
 # ADF.USIM
 ######################################################################
 
+import enum
 from struct import unpack, pack
 from construct import *
+from construct import Optional as COptional
 from pySim.construct import *
 from pySim.filesystem import *
 from pySim.tlv import *
 from pySim.ts_102_221 import EF_ARR
-from pySim.ts_51_011 import EF_IMSI, EF_xPLMNwAcT, EF_SPN, EF_CBMI, EF_ACC, EF_PLMNsel, EF_AD
+from pySim.ts_51_011 import EF_IMSI, EF_xPLMNwAcT, EF_SPN, EF_CBMI, EF_ACC, EF_PLMNsel
 from pySim.ts_51_011 import EF_CBMID, EF_CBMIR, EF_ADN, EF_SMS, EF_MSISDN, EF_SMSP, EF_SMSS
 from pySim.ts_51_011 import EF_SMSR, EF_DCK, EF_EXT, EF_CNL, EF_OPL, EF_MBI, EF_MWIS
 from pySim.ts_51_011 import EF_MMSN, EF_MMSICP, EF_MMSUP, EF_MMSUCP, EF_VGCS, EF_VGCSS, EF_NIA
@@ -555,6 +557,28 @@
         super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size)
         self._construct = Struct('tmsi'/HexAdapter(Bytes(4)), 'lai'/HexAdapter(Bytes(5)), 'rfu'/Int8ub,
                                  'lu_status'/Int8ub)
+# TS 31.102 Section 4.2.18
+class EF_AD(TransparentEF):
+    class OP_MODE(enum.IntEnum):
+        normal                                  = 0x00
+        type_approval                           = 0x80
+        normal_and_specific_facilities          = 0x01
+        type_approval_and_specific_facilities   = 0x81
+        maintenance_off_line                    = 0x02
+        cell_test                               = 0x04
+
+    def __init__(self, fid='6fad', sfid=0x03, name='EF.AD', desc='Administrative Data', size={4,6}):
+        super().__init__(fid, sfid=sfid, name=name, desc=desc, size=size)
+        self._construct = BitStruct(
+            # Byte 1
+            'ms_operation_mode'/Bytewise(Enum(Byte, EF_AD.OP_MODE)),
+            # Byte 2 + 3
+            'additional_info'/Bytewise(FlagsEnum(Int16ub, ciphering_indicator=1, csg_display_control=2,
+                                                 prose_services=4, extended_drx=8)),
+            'rfu'/BitsRFU(4),
+            'mnc_len'/BitsInteger(4),
+            'extensions'/COptional(Bytewise(GreedyBytesRFU))
+        )
 
 # TS 31.102 Section 4.2.23
 class EF_PSLOCI(TransparentEF):
@@ -817,7 +841,7 @@
           EF_ACC(sfid=0x06),
           EF_PLMNsel('6f7b', 0x0d, 'EF.FPLMN', 'Forbidden PLMNs', size={12,None}),
           EF_LOCI(),
-          EF_AD(sfid=0x03),
+          EF_AD(),
           EF_CBMID(sfid=0x0e),
           EF_ECC(),
           EF_CBMIR(),

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iaf195cb63d5d12fc906a7e7cd85e3fd44589a41e
Gerrit-Change-Number: 24570
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210605/5ec01f0d/attachment.htm>


More information about the gerrit-log mailing list