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
diff --git a/src/decoding.h b/src/decoding.h
index 03dad47..1cda7b4 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);
};