libosmogsm  1.10.1
Osmocom GSM library
rlp.h
Go to the documentation of this file.
1 /*
2  * GSM RLP (Radio Link Protocol) as used in CSD (3GPP TS 44.022)
3  *
4  * Copyright (C) 2022-2023 Harald Welte <laforge@osmocom.org>
5  *
6  * All Rights Reserved
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  */
18 
19 
20 
21 #pragma once
22 #include <stdint.h>
23 #include <stdbool.h>
24 #include <osmocom/core/utils.h>
25 
35 };
36 extern const struct value_string osmo_rlp_ftype_vals[];
37 
49 };
50 extern const struct value_string osmo_rlp_ftype_u_vals[];
51 
58 };
59 extern const struct value_string osmo_rlp_ftype_s_vals[];
60 
63  uint8_t version;
67  bool c_r;
68  bool p_f;
69  uint8_t s_bits;
70  uint16_t n_s;
71  uint16_t n_r;
72  uint32_t fcs;
73  uint8_t info[536/8];
74  uint16_t info_len;
75 };
76 
77 int osmo_rlp_decode(struct osmo_rlp_frame_decoded *out, uint8_t version, const uint8_t *data, size_t data_len);
78 int osmo_rlp_encode(uint8_t *out, size_t out_size, const struct osmo_rlp_frame_decoded *in);
79 uint32_t osmo_rlp_fcs_compute(const uint8_t *in, size_t in_len);
80 
Data structure representing one decoded RLP frame.
Definition: rlp.h:62
Definition: rlp.h:40
int osmo_rlp_decode(struct osmo_rlp_frame_decoded *out, uint8_t version, const uint8_t *data, size_t data_len)
decode a RLP frame into its abstract representation.
Definition: rlp.c:69
osmo_rlp_ftype
RLP frame type as per 3GPP TS 24.022 Section 5.2.1.
Definition: rlp.h:31
enum osmo_rlp_s_ftype s_ftype
Definition: rlp.h:66
bool p_f
Definition: rlp.h:68
uint32_t fcs
Definition: rlp.h:72
Definition: rlp.h:42
Definition: rlp.h:45
uint8_t info[536/8]
Definition: rlp.h:73
uint8_t s_bits
Definition: rlp.h:69
int osmo_rlp_encode(uint8_t *out, size_t out_size, const struct osmo_rlp_frame_decoded *in)
encode a RLP frame from its abstract representation.
Definition: rlp.c:122
osmo_rlp_u_ftype
RLP U-Frame Type as per 3GPP TS 24.022 Section 5.2.1.
Definition: rlp.h:39
Definition: rlp.h:56
uint16_t n_r
Definition: rlp.h:71
enum osmo_rlp_ftype ftype
Definition: rlp.h:64
uint16_t n_s
Definition: rlp.h:70
uint8_t data[0]
Definition: rlp.h:34
Definition: rlp.h:33
const struct value_string osmo_rlp_ftype_vals[]
Definition: rlp.c:32
Definition: rlp.h:43
enum osmo_rlp_u_ftype u_ftype
Definition: rlp.h:65
Definition: rlp.h:55
uint8_t version
Definition: rlp.h:63
Definition: rlp.h:41
Definition: rlp.h:46
Definition: rlp.h:44
const struct value_string osmo_rlp_ftype_s_vals[]
Definition: rlp.c:52
Definition: rlp.h:54
uint32_t osmo_rlp_fcs_compute(const uint8_t *in, size_t in_len)
compute RLP FCS according to 3GPP TS 24.022 Section 4.4.
Definition: rlp.c:230
Definition: rlp.h:57
const struct value_string osmo_rlp_ftype_u_vals[]
Definition: rlp.c:39
uint16_t info_len
Definition: rlp.h:74
Definition: rlp.h:32
bool c_r
Definition: rlp.h:67
Definition: rlp.h:48
Definition: rlp.h:47
osmo_rlp_s_ftype
RLP S-Frame type as per 3GPP TS 24.022 Section 5.2.1.
Definition: rlp.h:53