Attention is currently required from: laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/27141
to look at the new patch set (#3).
Change subject: cosmetic: Switch to consistent four-spaces indent; run autopep8
......................................................................
cosmetic: Switch to consistent four-spaces indent; run autopep8
We had a mixture of tab and 4space based indenting, which is a bad
idea. 4space is the standard in python, so convert all our code to
that. The result unfortuantely still shoed even more inconsistencies,
so I've decided to run autopep8 on the entire code base.
Change-Id: I4a4b1b444a2f43fab05fc5d2c8a7dd6ddecb5f07
---
M pySim-prog.py
M pySim-read.py
M pySim-shell.py
M pySim/__init__.py
M pySim/ara_m.py
M pySim/card_handler.py
M pySim/card_key_provider.py
M pySim/cards.py
M pySim/cat.py
M pySim/commands.py
M pySim/construct.py
M pySim/exceptions.py
M pySim/filesystem.py
M pySim/gsm_r.py
M pySim/iso7816_4.py
M pySim/jsonpath.py
M pySim/profile.py
M pySim/sysmocom_sja2.py
M pySim/tlv.py
M pySim/transport/__init__.py
M pySim/transport/calypso.py
M pySim/transport/modem_atcmd.py
M pySim/transport/pcsc.py
M pySim/transport/serial.py
M pySim/ts_102_221.py
M pySim/ts_31_102.py
M pySim/ts_31_103.py
M pySim/ts_51_011.py
M pySim/utils.py
29 files changed, 7,420 insertions(+), 6,468 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/27141/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27141
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4a4b1b444a2f43fab05fc5d2c8a7dd6ddecb5f07
Gerrit-Change-Number: 27141
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/27130 )
Change subject: ts_102_221: Implement proper parsing of EF.DIR
......................................................................
ts_102_221: Implement proper parsing of EF.DIR
EF.DIR can not only contain the AID + Label of TS 102 221, but can
also contain any of the DOs specified in ISO7816-4. Let's imoplement
this based on the modern pySim.tlv parser
Change-Id: I875eb49e1f0370428c2eae69af84f5483bd5b1fc
Closes: OS#5410
---
A pySim/iso7816_4.py
M pySim/ts_102_221.py
2 files changed, 78 insertions(+), 10 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/pySim/iso7816_4.py b/pySim/iso7816_4.py
new file mode 100644
index 0000000..ea838cf
--- /dev/null
+++ b/pySim/iso7816_4.py
@@ -0,0 +1,62 @@
+# coding=utf-8
+"""Utilities / Functions related to ISO 7816-4
+
+(C) 2022 by Harald Welte <laforge(a)osmocom.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from construct import *
+from pySim.construct import *
+from pySim.utils import *
+from pySim.filesystem import *
+from pySim.tlv import *
+
+# Table 91 + Section 8.2.1.2
+class ApplicationId(BER_TLV_IE, tag=0x4f):
+ _construct = GreedyBytes
+
+# Table 91
+class ApplicationLabel(BER_TLV_IE, tag=0x50):
+ _construct = GreedyBytes
+
+# Table 91 + Section 5.3.1.2
+class FileReference(BER_TLV_IE, tag=0x51):
+ _construct = GreedyBytes
+
+# Table 91
+class CommandApdu(BER_TLV_IE, tag=0x52):
+ _construct = GreedyBytes
+
+# Table 91
+class DiscretionaryData(BER_TLV_IE, tag=0x53):
+ _construct = GreedyBytes
+
+# Table 91
+class DiscretionaryTemplate(BER_TLV_IE, tag=0x73):
+ _construct = GreedyBytes
+
+# Table 91 + RFC1738 / RFC2396
+class URL(BER_TLV_IE, tag=0x5f50):
+ _construct = GreedyString('ascii')
+
+# Table 91
+class ApplicationRelatedDOSet(BER_TLV_IE, tag=0x61):
+ _construct = GreedyBytes
+
+# Section 8.2.1.3 Application Template
+class ApplicationTemplate(BER_TLV_IE, tag=0x61, nested=[ApplicationId, ApplicationLabel, FileReference,
+ CommandApdu, DiscretionaryData, DiscretionaryTemplate,URL,
+ ApplicationRelatedDOSet]):
+ pass
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index 71d5b82..1955484 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -22,10 +22,12 @@
from pySim.construct import *
from pySim.utils import *
from pySim.filesystem import *
+from pySim.tlv import *
from bidict import bidict
from pySim.profile import CardProfile
from pySim.profile import match_uicc
from pySim.profile import match_sim
+import pySim.iso7816_4 as iso7816_4
# A UICC will usually also support 2G functionality. If this is the case, we
# need to add DF_GSM and DF_TELECOM along with the UICC related files
@@ -502,18 +504,22 @@
# TS 102 221 Section 13.1
class EF_DIR(LinFixedEF):
+ class ApplicationLabel(BER_TLV_IE, tag=0x50):
+ # TODO: UCS-2 coding option as per Annex A of TS 102 221
+ _construct = GreedyString('ascii')
+
+ # see https://github.com/PyCQA/pylint/issues/5794
+ #pylint: disable=undefined-variable
+ class ApplicationTemplate(BER_TLV_IE, tag=0x61,
+ nested=[iso7816_4.ApplicationId, ApplicationLabel, iso7816_4.FileReference,
+ iso7816_4.CommandApdu, iso7816_4.DiscretionaryData,
+ iso7816_4.DiscretionaryTemplate, iso7816_4.URL,
+ iso7816_4.ApplicationRelatedDOSet]):
+ pass
+
def __init__(self, fid='2f00', sfid=0x1e, name='EF.DIR', desc='Application Directory'):
super().__init__(fid, sfid=sfid, name=name, desc=desc, rec_len={5,54})
-
- def _decode_record_hex(self, raw_hex_data):
- raw_hex_data = raw_hex_data.upper()
- atempl_base_tlv = TLV(['61'])
- atempl_base = atempl_base_tlv.parse(raw_hex_data)
- atempl_TLV_MAP = {'4F': 'aid_value', 50:'label'}
- atempl_tlv = TLV(atempl_TLV_MAP)
- atempl = atempl_tlv.parse(atempl_base['61'])
- # FIXME: "All other Dos are according to ISO/IEC 7816-4"
- return tlv_key_replace(atempl_TLV_MAP, atempl)
+ self._tlv = EF_DIR.ApplicationTemplate
# TS 102 221 Section 13.2
class EF_ICCID(TransparentEF):
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27130
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I875eb49e1f0370428c2eae69af84f5483bd5b1fc
Gerrit-Change-Number: 27130
Gerrit-PatchSet: 7
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
Attention is currently required from: iedemam, daniel.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/27137 )
Change subject: stats: sanitize tcp stat name identifiers
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> There is no sanitation in osmo_stat_item_group_set_name(). […]
What's strange to me then is why don't we have already some sort of API to sanitize string so that the resulting string is a valid statsd string. That would be helpful, because there can be lots of chars which are not accepted.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/27137
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib04c2f5bfcbd6c19dd87debf1fc053abf0b9bef2
Gerrit-Change-Number: 27137
Gerrit-PatchSet: 1
Gerrit-Owner: iedemam <michael(a)kapsulate.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: iedemam <michael(a)kapsulate.com>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 11 Feb 2022 12:04:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: iedemam <michael(a)kapsulate.com>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: laforge.
Hello Jenkins Builder, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/27130
to look at the new patch set (#7).
Change subject: ts_102_221: Implement proper parsing of EF.DIR
......................................................................
ts_102_221: Implement proper parsing of EF.DIR
EF.DIR can not only contain the AID + Label of TS 102 221, but can
also contain any of the DOs specified in ISO7816-4. Let's imoplement
this based on the modern pySim.tlv parser
Change-Id: I875eb49e1f0370428c2eae69af84f5483bd5b1fc
Closes: OS#5410
---
A pySim/iso7816_4.py
M pySim/ts_102_221.py
2 files changed, 78 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/30/27130/7
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27130
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I875eb49e1f0370428c2eae69af84f5483bd5b1fc
Gerrit-Change-Number: 27130
Gerrit-PatchSet: 7
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: iedemam, fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/27134 )
Change subject: stats: add RSL line number to TCP stats name
......................................................................
Patch Set 3:
(1 comment)
File src/input/ipaccess.c:
https://gerrit.osmocom.org/c/libosmo-abis/+/27134/comment/660ce509_0c823ec8
PS3, Line 346: snprintf(stat_name, sizeof(stat_name), "ipa-rsl-%u", unit_data.trx_id);
> Done
Hmm that's probably because there's only one line per link in ip.access Abis, because each TRX has its own RSL ipa connection, so each line is line 0 of its own link.
I'd like to hear Harald's opinion regarding this topic.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/27134
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ie42d8a0cb3757f2d01a4b6d69ea2bcce400b7538
Gerrit-Change-Number: 27134
Gerrit-PatchSet: 3
Gerrit-Owner: iedemam <michael(a)kapsulate.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: iedemam <michael(a)kapsulate.com>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 11 Feb 2022 12:02:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: iedemam <michael(a)kapsulate.com>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment