laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38906?usp=email )
Change subject: esim.saip.File: Re-compute file_size when changing body
......................................................................
esim.saip.File: Re-compute file_size when changing body
If the API user modifies the size of the body, we need to check if we
need to re-compute the file_size attribute which is later encoded into
the fileDescriptor. The size obviously must be large enough to fit the
body. Let's do this implicitly by introducing a setter for File.body
Change-Id: I1a908504b845b7c90f31294faf2a6e988bdd8049
---
M pySim/esim/saip/__init__.py
1 file changed, 20 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/06/38906/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index b83367e..163c91b 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -106,7 +106,7 @@
self.pe_name = pename
self._name = name
self.template = template
- self.body: Optional[bytes] = None
+ self._body: Optional[bytes] = None
self.node: Optional['FsNode'] = None
self.file_type = None
self.fid: Optional[int] = None
@@ -191,6 +191,24 @@
# All the files defined in the templates shall have, by default, shareable/not-shareable bit in the file descriptor set to "shareable".
self.shareable = True
self._template_derived = True
+ if hasattr(template, 'file_size'):
+ self._file_size = template.file_size
+
+ def _recompute_size(self):
+ """recompute the file size, if needed (body larger than current size)"""
+ body_size = len(self.body)
+ if self.file_size == None or self.file_size < body_size:
+ self._file_size = body_size
+
+ @property
+ def body(self):
+ return self._body
+
+ @body.setter
+ def body(self, value: bytes):
+ self._body = value
+ # we need to potentially update the file size after changing the body [size]
+ self._recompute_size()
def to_fileDescriptor(self) -> dict:
"""Convert from internal representation to 'fileDescriptor' as used by asn1tools for SAIP"""
@@ -332,7 +350,7 @@
if fd:
self.from_fileDescriptor(dict(fd))
# BODY
- self.body = self.file_content_from_tuples(l)
+ self._body = self.file_content_from_tuples(l)
@staticmethod
def path_from_gfm(bin_path: bytes):
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38906?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1a908504b845b7c90f31294faf2a6e988bdd8049
Gerrit-Change-Number: 38906
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38907?usp=email )
Change subject: esim.saip.File: Proper ARR conversion of template (into) to file (bytes)
......................................................................
esim.saip.File: Proper ARR conversion of template (into) to file (bytes)
The encoding of the access rule reference is different in FileTemplate
vs File, let's make sure we properly convert it when instantiating a
File from a FileTemplate.
Change-Id: Ibb8afb85cc0006bc5c59230ebf28b2c0c1a8a8ed
---
M pySim/esim/saip/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/07/38907/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 163c91b..40ef4ce 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -178,7 +178,7 @@
self.file_type = template.file_type
self.fid = template.fid
self.sfi = template.sfi
- self.arr = template.arr
+ self.arr = template.arr.to_bytes(1)
if hasattr(template, 'rec_len'):
self.rec_len = template.rec_len
else:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38907?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ibb8afb85cc0006bc5c59230ebf28b2c0c1a8a8ed
Gerrit-Change-Number: 38907
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38908?usp=email )
Change subject: esim.saip.File: Suppress encoding attributes that are like template
......................................................................
esim.saip.File: Suppress encoding attributes that are like template
The point of the SAIP template mechanism is to reduce the size of the
encoded profile. Therefore, our encoder in the to_fileDescriptor()
method should suppress generating attributes if their value is identical
to that of the template (if any).
Change-Id: I337ee6c7e882ec711bece17b7a0def9da36b0ad7
---
M pySim/esim/saip/__init__.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/08/38908/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 40ef4ce..94df453 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -216,13 +216,13 @@
fdb_dec = {}
pefi = {}
spfi = 0
- if self.fid:
+ if self.fid and self.fid != self.template.fid:
fileDescriptor['fileID'] = self.fid.to_bytes(2, 'big')
- if self.sfi:
+ if self.sfi and self.sfi != self.template.sfi:
fileDescriptor['shortEFID'] = bytes([self.sfi])
if self.df_name:
fileDescriptor['dfName'] = self.df_name
- if self.arr:
+ if self.arr and self.arr != self.template.arr.to_bytes(1):
fileDescriptor['securityAttributesReferenced'] = self.arr
if self.file_type in ['LF', 'CY']:
fdb_dec['file_type'] = 'working_ef'
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38908?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I337ee6c7e882ec711bece17b7a0def9da36b0ad7
Gerrit-Change-Number: 38908
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38909?usp=email )
Change subject: esim.saip.FsProfileElement: Add create_file() method
......................................................................
esim.saip.FsProfileElement: Add create_file() method
So far we mainly created File() instances when parsing existing
profiles. However, sometimes we want to programmatically create Files
and we should offer a convenience helper to do so, rather than asking
API users to worry about low-level details.
Change-Id: I0817819af40f3d0dc0c3d2b91039c5748dd31ee2
---
M pySim/esim/saip/__init__.py
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/09/38909/1
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 94df453..2552c8e 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -643,6 +643,14 @@
file = File(k, v, template.files_by_pename.get(k, None))
self.add_file(file)
+ def create_file(self, pename: str) -> File:
+ """Programatically create a file by its PE-Name."""
+ template = templates.ProfileTemplateRegistry.get_by_oid(self.templateID)
+ file = File(pename, None, template.files_by_pename.get(pename, None))
+ self.add_file(file)
+ self.decoded[pename] = []
+ return file
+
def _post_decode(self):
# not entirely sure about doing this this automatism
self.pe2files()
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38909?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0817819af40f3d0dc0c3d2b91039c5748dd31ee2
Gerrit-Change-Number: 38909
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/38904?usp=email )
Change subject: e1_input: Store new msg in llist before calling driver->want_write()
......................................................................
e1_input: Store new msg in llist before calling driver->want_write()
This is needed for drivers handling the message synchronously during
want_write() op.
Until now this was not needed because probably all drivers are relying
on poll based write to tx the message, which meant using the msg
happened in a delayed form, asynchronously.
Once we move the ipaccess driver to use libosmo-netif's stream, we'll
need the msg to be available in the upper layer llist when want_write()
is called, because at that time it will pop it from that llist and
submit it to the lower layer stream tx_queue.
Change-Id: I2b4e7bed502964fe03e3dabaeed668713b4baa7a
---
M src/e1_input.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/04/38904/1
diff --git a/src/e1_input.c b/src/e1_input.c
index d4e9e88..145fccf 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -307,12 +307,12 @@
return -EINVAL;
}
e1i_ts = sign_link->ts;
+ msgb_enqueue(&sign_link->tx_list, msg);
if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
/* notify the driver we have something to write */
e1inp_driver = sign_link->ts->line->driver;
e1inp_driver->want_write(e1i_ts);
}
- msgb_enqueue(&sign_link->tx_list, msg);
/* we only need to write a 'Fake LAPD' packet here, if the
* underlying driver hides LAPD from us. If we use the
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/38904?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I2b4e7bed502964fe03e3dabaeed668713b4baa7a
Gerrit-Change-Number: 38904
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: pespin.
fixeria has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-bts/+/38901?usp=email )
Change subject: Fix missing quote char in log line
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/38901?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie272a268be8986210f7f6de0d28626789f28f4bb
Gerrit-Change-Number: 38901
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 22 Nov 2024 18:03:29 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes