Skip to content
Success

Changes

Summary

  1. construct: add length steps to StripTrailerAdapter (details)
  2. construct: allow stripping of leading zeros with StripHeaderAdapter (details)
Commit d1ccc9c7aa0ba88a80caed42630b7f826a0ab4e4 by pmaier@sysmocom.de
construct: add length steps to StripTrailerAdapter

The class StripTrailerAdapter allows to remove trailing bytes that
match a specified value from the encoding result of a sub-construct.
The result is always the shortest possible remainder of bytes that
do not match the secified value.

Unfortunately there are specifications that explicitly require the
length of the result to fit into a limited set of possible length
values. For example: A result may be either one byte or three byte
long. To cover those cases as well, let's add an array parameter
where we can configure the allowed length values of the encoding
result.

Related: OS#6679
Change-Id: I86df064fa41db85923eeb0d83cc399504fdd4488
The file was modifiedtests/test_construct.py
The file was modifiedsrc/osmocom/construct.py
Commit 3ee202bdfb6a627cf101752cbdc472390568d515 by pmaier@sysmocom.de
construct: allow stripping of leading zeros with StripHeaderAdapter

This patch adds a new class StripHeaderAdapter. This adapter class can
be used to strip leading zeros in the same way that StripTrailerAdapter
strips trailing zeros.

Related: OS#6679
Change-Id: I1a9fff17abbbef0c5f6d45f58198debfa12e78b6
The file was modifiedtests/test_construct.py
The file was modifiedsrc/osmocom/construct.py