aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoding.h
blob: 1043d6730913aff6ab56adec14f29c55417181ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* 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

#include <gsm_rlcmac.h>
#include "rlc.h"

#include <stdint.h>

struct bitvec;

class Decoding {
public:
	struct RlcData {
		uint8_t	offset;
		uint8_t	length;
		bool	is_complete;
	};

	static int rlc_data_from_ul_data(
		const struct gprs_rlc_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 void extract_rbb(const struct bitvec *rbb, char *show_rbb);
	static int rlc_parse_ul_data_header_egprs_type_3(
		struct gprs_rlc_data_info *rlc,
		const uint8_t *data,
		const GprsCodingScheme &cs);
	static int rlc_parse_ul_data_header_gprs(
		struct gprs_rlc_data_info *rlc,
		const uint8_t *data,
		const GprsCodingScheme &cs);
	static int rlc_parse_ul_data_header(struct gprs_rlc_data_info *rlc,
		const uint8_t *data, GprsCodingScheme cs);
	static unsigned int rlc_copy_to_aligned_buffer(
		const struct gprs_rlc_data_info *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_data_info *rlc,
		unsigned int data_block_idx,
		const uint8_t *src, uint8_t *buffer);
	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);
	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);
};