Attention is currently required from: fixeria.
laforge has removed a vote from this change. ( https://gerrit.osmocom.org/c/pysim/+/27171 )
Change subject: filesystem: Maintain a 'service' attribute for all files on a card
......................................................................
Removed Code-Review+2 by laforge <laforge(a)osmocom.org>
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27171
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3b3f74b691368fa09967ecb377a9f7a6d8af7869
Gerrit-Change-Number: 27171
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: deleteVote
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/27164
to look at the new patch set (#3).
Change subject: pySim-shell: export: allow export as JSON instead of hex
......................................................................
pySim-shell: export: allow export as JSON instead of hex
The primary use case of the --json option is to systematically execute
all of our decoder classes in order to find bugs. As we don't have
encoders for all files yet, the output generated by 'export --json'
will in many cases not be executable as script again, unlike the normal
'export' output.
Change-Id: Idd820f8e3af70ebcbf82037b56fd2ae9655afbc5
---
M pySim-shell.py
1 file changed, 27 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/64/27164/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27164
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idd820f8e3af70ebcbf82037b56fd2ae9655afbc5
Gerrit-Change-Number: 27164
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/27169 )
Change subject: construct: Add Construct for variable-length int 'GreedyInteger'
......................................................................
construct: Add Construct for variable-length int 'GreedyInteger'
We have a number of integers with variable-length encoding, so
add a Construct for this. Naming inspired by GreedyBytes.
Related to https://github.com/construct/construct/issues/962
Change-Id: Ic6049b74ea3705fda24855f34b4a1d5f2c9327f7
---
M pySim/construct.py
1 file changed, 54 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/27169/1
diff --git a/pySim/construct.py b/pySim/construct.py
index e3f6a88..1783753 100644
--- a/pySim/construct.py
+++ b/pySim/construct.py
@@ -2,12 +2,14 @@
from construct.core import EnumIntegerString
import typing
from construct import *
+from construct.core import evaluate, bytes2integer, integer2bytes
+from construct.lib import integertypes
from pySim.utils import b2h, h2b, swap_nibbles
import gsm0338
"""Utility code related to the integration of the 'construct' declarative parser."""
-# (C) 2021 by Harald Welte <laforge(a)osmocom.org>
+# (C) 2021-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
@@ -184,3 +186,54 @@
n (Integer): Fixed length of the encoded byte string
'''
return GsmStringAdapter(Rpad(Bytes(n), pattern=b'\xff'), codec='gsm03.38')
+
+class GreedyInteger(Construct):
+ """A variable-length integer implementation, think of combining GrredyBytes with BytesInteger."""
+ def __init__(self, signed=False, swapped=False):
+ super().__init__()
+ self.signed = signed
+ self.swapped = swapped
+
+ def _parse(self, stream, context, path):
+ data = stream_read_entire(stream, path)
+ if evaluate(self.swapped, context):
+ data = swapbytes(data)
+ try:
+ return bytes2integer(data, self.signed)
+ except ValueError as e:
+ raise IntegerError(str(e), path=path)
+
+ def __bytes_rqd(self, i):
+ if self.signed:
+ raise IntegerError("FIXME: Implement support for encoding signed integer")
+ if i <= 0xff:
+ return 1
+ elif i <= 0xffff:
+ return 2
+ elif i <= 0xffffff:
+ return 3
+ elif i <= 0xffffffff:
+ return 4
+ elif i <= 0xffffffffff:
+ return 5
+ elif i <= 0xffffffffffff:
+ return 6
+ elif i <= 0xffffffffffffff:
+ return 7
+ elif i <= 0xffffffffffffffff:
+ return 8
+ else:
+ raise IntegerError(f"value {i} is out of range")
+
+ def _build(self, obj, stream, context, path):
+ if not isinstance(obj, integertypes):
+ raise IntegerError(f"value {obj} is not an integer", path=path)
+ length = self.__bytes_rqd(obj)
+ try:
+ data = integer2bytes(obj, length, self.signed)
+ except ValueError as e:
+ raise IntegerError(str(e), path=path)
+ if evaluate(self.swapped, context):
+ data = swapbytes(data)
+ stream_write(stream, data, length, path)
+ return obj
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27169
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ic6049b74ea3705fda24855f34b4a1d5f2c9327f7
Gerrit-Change-Number: 27169
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/27168 )
Change subject: tlv: Convert CamleCase class name to snake_case in json
......................................................................
tlv: Convert CamleCase class name to snake_case in json
Our hand-written JSON so far is using snake_case identifiers,
while the JSON generated by the pySim.tlv classes use the class
names as keys, which LooksQuiteDifferent.
So let's auto-convert the CamelCase into something that reflects
our existing notion.
Change-Id: Id55929ef03dc48cb668e6ba7e99b6b291680a42f
---
M pySim/tlv.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/68/27168/1
diff --git a/pySim/tlv.py b/pySim/tlv.py
index 71338ab..dc8cc4f 100644
--- a/pySim/tlv.py
+++ b/pySim/tlv.py
@@ -31,7 +31,11 @@
import inspect
import abc
+import re
+def camel_to_snake(name):
+ name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
+ return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
class TlvMeta(abc.ABCMeta):
"""Metaclass which we use to set some class variables at the time of defining a subclass.
@@ -148,7 +152,7 @@
v = [x.to_dict() for x in self.children]
else:
v = self.decoded
- return {type(self).__name__: v}
+ return {camel_to_snake(type(self).__name__): v}
def from_dict(self, decoded: dict):
"""Set the IE internal decoded representation to data from the argument.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27168
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Id55929ef03dc48cb668e6ba7e99b6b291680a42f
Gerrit-Change-Number: 27168
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/27162
to look at the new patch set (#2).
Change subject: ts_102_221: Proper parsing of FCP using pySim.tlv instead of pytlv
......................................................................
ts_102_221: Proper parsing of FCP using pySim.tlv instead of pytlv
pytlv is a nightmare of shortcomings, let's abandon it in favor of
our own meanwhile-created pySim.tlv. This has the added benefit
that unknown tags finally no longer raise exceptions.
Change-Id: Ic8e0e0ddf915949670d620630d4ceb02a9116471
Closes: OS#5414
---
M pySim/ts_102_221.py
1 file changed, 179 insertions(+), 164 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/62/27162/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27162
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ic8e0e0ddf915949670d620630d4ceb02a9116471
Gerrit-Change-Number: 27162
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset
Attention is currently required from: osmith, pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/27094 )
Change subject: ttcn3-ggsn-tests-ogs: Set correct DNS address to get ping working
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/27094
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I2a452ad871612d1c88b94579dadbe62b718b1475
Gerrit-Change-Number: 27094
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 11 Feb 2022 15:43:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: laforge.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/27165 )
Change subject: pySim-shell: introduce 'apdu' command for sending raw APDU to card
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27165
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ib504431d26ed2b6f71f77a143ff0a7fb4f5ea02e
Gerrit-Change-Number: 27165
Gerrit-PatchSet: 1
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-Comment-Date: Fri, 11 Feb 2022 15:40:49 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment