diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-01-18 16:51:59 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2016-02-02 17:06:35 +0100 |
commit | d960f87a4bc4b05c9cce2d9b95f7d2332fd529f6 (patch) | |
tree | c14ea4ac123986ea977e3397c54bce1c238ab5da /src/decoding.cpp | |
parent | c035235576fdd0e2175e597095f3f6bfa793609a (diff) |
edge: Add experimental support for uplink CRBB
Currently only uncompressed bitmaps (URBB) are supported in
PACKET UPLINK ACK/NACK messages.
Extend decode_egprs_acknack_bits to decode compressed bitmaps (CRBB),
too.
Note that this code is only active, if the macro WITH_CRBB_DECODING
is defined.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/decoding.cpp')
-rw-r--r-- | src/decoding.cpp | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/src/decoding.cpp b/src/decoding.cpp index 11c565ac..72293a21 100644 --- a/src/decoding.cpp +++ b/src/decoding.cpp @@ -23,6 +23,9 @@ extern "C" { #include <osmocom/core/utils.h> +#if WITH_CRBB_DECODING +#include <osmocom/core/bitcomp.h> +#endif } #include <arpa/inet.h> @@ -568,10 +571,45 @@ int Decoding::decode_egprs_acknack_bits(const EGPRS_AckNack_Desc_t *desc, if (crbb_len > 0) { int old_len = bits->cur_bit; - /* - decode_t4_rle(bits, desc->CRBB, desc->CRBB_LENGTH, - desc->CRBB_STARTING_COLOR_CODE); - */ +#if WITH_CRBB_DECODING +#warning "Experimental CRBB decoding enabled" + struct bitvec crbb; + int rc; + + crbb.data = (uint8_t *)desc->CRBB; + crbb.data_len = sizeof(desc->CRBB); + crbb.cur_bit = desc->CRBB_LENGTH; + + rc = osmo_t4_decode(&crbb, desc->CRBB_STARTING_COLOR_CODE, + bits); + + if (rc < 0) { + LOGP(DRLCMACUL, LOGL_NOTICE, + "Failed to decode CRBB: " + "length %d, data '%s'\n", + desc->CRBB_LENGTH, + osmo_hexdump(crbb.data, crbb.data_len)); + /* We don't know the SSN offset for the URBB, + * return what we have so far and assume the + * bitmap has stopped here */ + goto aborted; + } +#else + LOGP(DRLCMACUL, LOGL_ERROR, "ERROR: CRBB not supported, " + "please set window size to 64\n"); + + /* We don't know the SSN offset for the URBB, return + * what we have so far and assume the bitmap has + * stopped here */ + goto aborted; +#endif + LOGP(DRLCMACDL, LOGL_DEBUG, + "CRBB len: %d, decoded len: %d, cc: %d, crbb: '%s'\n", + desc->CRBB_LENGTH, bits->cur_bit - old_len, + desc->CRBB_STARTING_COLOR_CODE, + osmo_hexdump( + desc->CRBB, (desc->CRBB_LENGTH + 7)/8) + ); num_blocks += (bits->cur_bit - old_len); } @@ -591,6 +629,7 @@ int Decoding::decode_egprs_acknack_bits(const EGPRS_AckNack_Desc_t *desc, num_blocks += urbb_len; } +aborted: *bsn_begin = window->v_a(); *bsn_end = window->mod_sns(*bsn_begin + num_blocks); |