this patch refactors the MAC PDU class, the main changes are:
* add to_string() method to pretty print PDU and subheaders
This allows to have a single log entry per MAC PDU with all its
contents.
It removes the C-style fprint() method
* Simplity payload vs. w_payload_ce
Before we've used payload when reading the PDU and w_payload_ce
as a buffer when writing. In all getters we needed to differentiate
between both. Now payload points to w_payload_ce initially and is
only updated when parsing a new PDU.
* add various helpers, e.g. to get subheader index, update a BSR, ..
* fix PDU test to use new to_string() method
simplify logic to check whether a BSR fits and, if so, which type.
before the check has been done in two places.
we now also accomodate for the CE subheader size.
before the BSR was extracted but the actual index (between 0 and 63)
was not stored but directly converted into bytes.
for log parsing and debugging it is easier to follow the index
value. this patch therefore adds both values to the log message
and extends the API accordingly.
when adding a new subheader to a MAC PDU we should only add the subheader
if at least 2 bytes are left in the PDU. Even a 1 Byte MAC Control Element requires
another byte to pack the subheader.
This fixes#1424 in which a 3 B MAC opportunity is provided in the UL. After
adding the Short BSR, we tried to add another MAC subheader. Adding the subheader
succeeded even though no space is left to add a single byte. With this patch,
adding the subheader fails and the generates MAC PDU is correct.