diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-08 15:14:05 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-16 19:36:09 +0100 |
commit | 4abc686d76b1d74ba07939f5e586842c68c37e25 (patch) | |
tree | a73951c8ca663a7878d24f0369faae7ff9953553 /src/decoding.h | |
parent | 392a5453361d639abe3eb50ec5ea7ace1595af04 (diff) |
edge: Add unified decoder methods for GPRS/EGPRS
This commit adds new RLC block decoder functions that support both
GPRS and EGPRS. The code path is selected based on the value of the
GprsCodingScheme cs object.
- rlc_parse_ul_data_header
parses the header of an RLC data block including the E and FBI/TI
flags (currently supported CS-1 - CS-4, MCS-1 - MCS-4).
- rlc_copy_to_aligned_buffer
copies an RLC data unit to a byte aligned buffer and returns
the unit's length.
- rlc_get_data_aligned
is a convenience wrapper around rlc_copy_to_aligned_buffer
that avoids copying if the data unit is already byte aligned.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/decoding.h')
-rw-r--r-- | src/decoding.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/decoding.h b/src/decoding.h index 03dad47e..1cda7b42 100644 --- a/src/decoding.h +++ b/src/decoding.h @@ -20,15 +20,37 @@ #pragma once #include <gsm_rlcmac.h> +#include "rlc.h" #include <stdint.h> class Decoding { public: + struct RlcData { + uint8_t offset; + uint8_t length; + bool is_complete; + }; + static int tlli_from_ul_data(const uint8_t *data, uint8_t len, uint32_t *tlli); + static int rlc_data_from_ul_data( + const struct gprs_rlc_ul_data_block_info *rdbi, + GprsCodingScheme cs, const uint8_t *data, RlcData *chunks, + unsigned int chunks_size, uint32_t *tlli); static uint8_t get_ms_class_by_capability(MS_Radio_Access_capability_t *cap); static uint8_t get_egprs_ms_class_by_capability(MS_Radio_Access_capability_t *cap); static void extract_rbb(const uint8_t *rbb, char *extracted_rbb); + + static int rlc_parse_ul_data_header(struct gprs_rlc_ul_header_egprs *rlc, + const uint8_t *data, GprsCodingScheme cs); + static unsigned int rlc_copy_to_aligned_buffer( + const struct gprs_rlc_ul_header_egprs *rlc, + unsigned int data_block_idx, + const uint8_t *src, uint8_t *buffer); + static const uint8_t *rlc_get_data_aligned( + const struct gprs_rlc_ul_header_egprs *rlc, + unsigned int data_block_idx, + const uint8_t *src, uint8_t *buffer); }; |