summaryrefslogtreecommitdiffstats
path: root/src/host/gprsdecode/rlcmac.h
blob: 2381d77194039c606c42f70069ebc312b5e6a4c5 (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
#pragma once

#include <stdint.h>
#include <stdbool.h>

#define OLD_TIME 2000

struct gprs_message {
	uint16_t arfcn;
	uint32_t fn;
	uint8_t tn;
	uint8_t rxl;
	uint8_t snr;
	uint8_t len;
	uint8_t msg[0];
};

struct gprs_lime {
	uint8_t li:6,
		m:1,
		e:1;
	uint8_t used;
} __attribute__ ((packed));

struct gprs_frag {
	uint32_t fn;
	uint8_t last;
	uint8_t len;
	uint8_t data[53];
	uint8_t n_blocks;
	struct gprs_lime blocks[20];
} __attribute__ ((packed));

struct gprs_tbf {
	uint8_t last_bsn;
	uint8_t start_bsn;
	struct gprs_frag frags[128];
} __attribute__ ((packed));

void print_pkt(uint8_t *msg, size_t len);
void process_blocks(struct gprs_tbf *t, bool ul);
void rlc_data_handler(struct gprs_message *gm);
int rlc_type_handler(struct gprs_message *gm);