2013-10-26 15:32:04 +00:00
|
|
|
/* decoding
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Ivan Klyuchnikov
|
|
|
|
* Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-01-18 16:14:14 +00:00
|
|
|
#ifdef __cplusplus
|
2020-03-26 14:14:01 +00:00
|
|
|
extern "C" {
|
2021-01-18 16:14:14 +00:00
|
|
|
#endif
|
|
|
|
|
2020-03-26 14:14:01 +00:00
|
|
|
#include "gsm_rlcmac.h"
|
2021-01-18 16:14:14 +00:00
|
|
|
#include "coding_scheme.h"
|
2020-03-26 14:14:01 +00:00
|
|
|
|
2021-01-18 16:14:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2013-10-26 15:38:37 +00:00
|
|
|
|
2013-10-26 15:32:04 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-01-13 12:55:44 +00:00
|
|
|
struct bitvec;
|
|
|
|
|
2021-01-18 16:14:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2013-10-26 15:32:04 +00:00
|
|
|
class Decoding {
|
|
|
|
public:
|
2016-05-30 15:30:10 +00:00
|
|
|
/* represents (parts) LLC PDUs within one RLC Data block */
|
2015-12-08 14:14:05 +00:00
|
|
|
struct RlcData {
|
|
|
|
uint8_t offset;
|
|
|
|
uint8_t length;
|
2016-05-30 15:30:10 +00:00
|
|
|
bool is_complete; /* if this PDU ends in this block */
|
2015-12-08 14:14:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int rlc_data_from_ul_data(
|
2016-01-07 17:59:28 +00:00
|
|
|
const struct gprs_rlc_data_block_info *rdbi,
|
2020-05-18 09:35:35 +00:00
|
|
|
enum CodingScheme cs, const uint8_t *data, RlcData *chunks,
|
2015-12-08 14:14:05 +00:00
|
|
|
unsigned int chunks_size, uint32_t *tlli);
|
2013-11-24 16:05:48 +00:00
|
|
|
|
2016-02-05 12:16:24 +00:00
|
|
|
static void extract_rbb(const struct bitvec *rbb, char *show_rbb);
|
2016-03-22 13:12:30 +00:00
|
|
|
static int rlc_parse_ul_data_header_egprs_type_3(
|
|
|
|
struct gprs_rlc_data_info *rlc,
|
|
|
|
const uint8_t *data,
|
2020-05-18 09:35:35 +00:00
|
|
|
const enum CodingScheme &cs);
|
2016-06-14 13:29:18 +00:00
|
|
|
static int rlc_parse_ul_data_header_egprs_type_2(
|
|
|
|
struct gprs_rlc_data_info *rlc,
|
|
|
|
const uint8_t *data,
|
2020-05-18 09:35:35 +00:00
|
|
|
const enum CodingScheme &cs);
|
2016-06-15 12:16:41 +00:00
|
|
|
static int rlc_parse_ul_data_header_egprs_type_1(
|
|
|
|
struct gprs_rlc_data_info *rlc,
|
|
|
|
const uint8_t *data,
|
2020-05-18 09:35:35 +00:00
|
|
|
const enum CodingScheme &cs);
|
2016-03-22 13:12:30 +00:00
|
|
|
static int rlc_parse_ul_data_header_gprs(
|
|
|
|
struct gprs_rlc_data_info *rlc,
|
|
|
|
const uint8_t *data,
|
2020-05-18 09:35:35 +00:00
|
|
|
const enum CodingScheme &cs);
|
2016-01-07 17:59:28 +00:00
|
|
|
static int rlc_parse_ul_data_header(struct gprs_rlc_data_info *rlc,
|
2020-05-18 09:35:35 +00:00
|
|
|
const uint8_t *data, enum CodingScheme cs);
|
2015-12-08 14:14:05 +00:00
|
|
|
static unsigned int rlc_copy_to_aligned_buffer(
|
2016-01-07 17:59:28 +00:00
|
|
|
const struct gprs_rlc_data_info *rlc,
|
2015-12-08 14:14:05 +00:00
|
|
|
unsigned int data_block_idx,
|
|
|
|
const uint8_t *src, uint8_t *buffer);
|
|
|
|
static const uint8_t *rlc_get_data_aligned(
|
2016-01-07 17:59:28 +00:00
|
|
|
const struct gprs_rlc_data_info *rlc,
|
2015-12-08 14:14:05 +00:00
|
|
|
unsigned int data_block_idx,
|
|
|
|
const uint8_t *src, uint8_t *buffer);
|
2016-01-13 12:55:44 +00:00
|
|
|
static int decode_egprs_acknack_bits(
|
|
|
|
const EGPRS_AckNack_Desc_t *desc,
|
|
|
|
struct bitvec *bits, int *bsn_begin, int *bsn_end,
|
|
|
|
struct gprs_rlc_dl_window *window);
|
2016-02-05 12:10:29 +00:00
|
|
|
static int decode_gprs_acknack_bits(
|
|
|
|
const Ack_Nack_Description_t *desc,
|
|
|
|
bitvec *bits, int *bsn_begin, int *bsn_end,
|
|
|
|
gprs_rlc_dl_window *window);
|
2013-10-26 15:32:04 +00:00
|
|
|
};
|
2021-01-18 16:14:14 +00:00
|
|
|
|
|
|
|
#endif /* #ifdef __cplusplus */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
uint8_t get_ms_class_by_capability(MS_Radio_Access_capability_t *cap);
|
|
|
|
uint8_t get_egprs_ms_class_by_capability(MS_Radio_Access_capability_t *cap);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|