libosmogsm 1.9.0.196-9975
Osmocom GSM library
GSM RLP (Radio Link Protocol) as used in CSD (3GPP TS 24.022)

RLP (Radio Link Protocol) as per 3GPP TS 24.022. More...

Files

file  rlp.h
 

Data Structures

struct  osmo_rlp_frame_decoded
 Data structure representing one decoded RLP frame. More...
 

Macros

#define FCS_SIZE_BYTES   3
 

Enumerations

enum  osmo_rlp_ftype {
  OSMO_RLP_FT_U ,
  OSMO_RLP_FT_S ,
  OSMO_RLP_FT_IS
}
 RLP frame type as per 3GPP TS 24.022 Section 5.2.1. More...
 
enum  osmo_rlp_u_ftype {
  OSMO_RLP_U_FT_SABM = 0x07 ,
  OSMO_RLP_U_FT_UA = 0x0c ,
  OSMO_RLP_U_FT_DISC = 0x08 ,
  OSMO_RLP_U_FT_DM = 0x03 ,
  OSMO_RLP_U_FT_NULL = 0x0f ,
  OSMO_RLP_U_FT_UI = 0x00 ,
  OSMO_RLP_U_FT_XID = 0x17 ,
  OSMO_RLP_U_FT_TEST = 0x1c ,
  OSMO_RLP_U_FT_REMAP = 0x11
}
 RLP U-Frame Type as per 3GPP TS 24.022 Section 5.2.1. More...
 
enum  osmo_rlp_s_ftype {
  OSMO_RLP_S_FT_RR = 0 ,
  OSMO_RLP_S_FT_REJ = 2 ,
  OSMO_RLP_S_FT_RNR = 1 ,
  OSMO_RLP_S_FT_SREJ = 3
}
 RLP S-Frame type as per 3GPP TS 24.022 Section 5.2.1. More...
 

Functions

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. More...
 
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. More...
 
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. More...
 

Variables

const struct value_string osmo_rlp_ftype_vals []
 
const struct value_string osmo_rlp_ftype_u_vals []
 
const struct value_string osmo_rlp_ftype_s_vals []
 
const struct value_string osmo_rlp_ftype_vals []
 
const struct value_string osmo_rlp_ftype_u_vals []
 
const struct value_string osmo_rlp_ftype_s_vals []
 
static const uint32_t rlp_fcs_table [256]
 

Detailed Description

RLP (Radio Link Protocol) as per 3GPP TS 24.022.

Macro Definition Documentation

◆ FCS_SIZE_BYTES

#define FCS_SIZE_BYTES   3

Enumeration Type Documentation

◆ osmo_rlp_ftype

RLP frame type as per 3GPP TS 24.022 Section 5.2.1.

Enumerator
OSMO_RLP_FT_U 
OSMO_RLP_FT_S 
OSMO_RLP_FT_IS 

◆ osmo_rlp_s_ftype

RLP S-Frame type as per 3GPP TS 24.022 Section 5.2.1.

Enumerator
OSMO_RLP_S_FT_RR 
OSMO_RLP_S_FT_REJ 
OSMO_RLP_S_FT_RNR 
OSMO_RLP_S_FT_SREJ 

◆ osmo_rlp_u_ftype

RLP U-Frame Type as per 3GPP TS 24.022 Section 5.2.1.

Enumerator
OSMO_RLP_U_FT_SABM 
OSMO_RLP_U_FT_UA 
OSMO_RLP_U_FT_DISC 
OSMO_RLP_U_FT_DM 
OSMO_RLP_U_FT_NULL 
OSMO_RLP_U_FT_UI 
OSMO_RLP_U_FT_XID 
OSMO_RLP_U_FT_TEST 
OSMO_RLP_U_FT_REMAP 

Function Documentation

◆ osmo_rlp_decode()

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.

Doesn't check FCS correctness.

Parameters
[out]outcaller-allocated memory for output of decoded frame
[in]versionRLP version number to use when decoding
[in]dataraw RLP frame input data
[in]data_lenlength of data (in octets); must be 30 (240bit) or 72 (576bit)
Returns
0 in case of success; negative on error

References osmo_rlp_frame_decoded::c_r, data, ENOTSUP, osmo_rlp_frame_decoded::fcs, FCS_SIZE_BYTES, osmo_rlp_frame_decoded::ftype, hdr_len, osmo_rlp_frame_decoded::info, osmo_rlp_frame_decoded::info_len, osmo_rlp_frame_decoded::n_r, osmo_rlp_frame_decoded::n_s, OSMO_RLP_FT_IS, OSMO_RLP_FT_S, OSMO_RLP_FT_U, OSMO_RLP_U_FT_XID, osmo_rlp_frame_decoded::p_f, osmo_rlp_frame_decoded::s_ftype, osmo_rlp_frame_decoded::u_ftype, version, and osmo_rlp_frame_decoded::version.

◆ osmo_rlp_encode()

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.

Generates FCS.

Parameters
[out]outcaller-allocated output buffer
[in]out_sizesize of output buffer (in octets); must be 30 (240bit) or 72 (576bit)
[in]indecoded RLP frame which is to be encoded
Returns
number of output bytes used; negative on error

References osmo_rlp_frame_decoded::c_r, ENOTSUP, FCS_SIZE_BYTES, osmo_rlp_frame_decoded::ftype, hdr_len, osmo_rlp_frame_decoded::info, osmo_rlp_frame_decoded::info_len, osmo_rlp_frame_decoded::n_r, osmo_rlp_frame_decoded::n_s, osmo_rlp_fcs_compute(), OSMO_RLP_FT_IS, OSMO_RLP_FT_S, OSMO_RLP_FT_U, OSMO_RLP_U_FT_XID, osmo_rlp_frame_decoded::p_f, osmo_rlp_frame_decoded::s_ftype, osmo_rlp_frame_decoded::u_ftype, and osmo_rlp_frame_decoded::version.

◆ osmo_rlp_fcs_compute()

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.

Parameters
[in]ininput data over which to compute FCS
[in]in_lenlength of input data (in octets)
Returns
computed frame check sequence (FCS).

References rlp_fcs_table.

Referenced by osmo_rlp_encode().

Variable Documentation

◆ osmo_rlp_ftype_s_vals [1/2]

const struct value_string osmo_rlp_ftype_s_vals[]
extern

◆ osmo_rlp_ftype_s_vals [2/2]

const struct value_string osmo_rlp_ftype_s_vals[]
Initial value:
= {
{ OSMO_RLP_S_FT_RR, "RR" },
{ OSMO_RLP_S_FT_REJ, "REJ" },
{ OSMO_RLP_S_FT_RNR, "RNR" },
{ OSMO_RLP_S_FT_SREJ, "SREJ" },
{ 0, NULL }
}
@ OSMO_RLP_S_FT_SREJ
Definition: rlp.h:57
@ OSMO_RLP_S_FT_RR
Definition: rlp.h:54
@ OSMO_RLP_S_FT_RNR
Definition: rlp.h:56
@ OSMO_RLP_S_FT_REJ
Definition: rlp.h:55

◆ osmo_rlp_ftype_u_vals [1/2]

const struct value_string osmo_rlp_ftype_u_vals[]
extern

◆ osmo_rlp_ftype_u_vals [2/2]

const struct value_string osmo_rlp_ftype_u_vals[]
Initial value:
= {
{ OSMO_RLP_U_FT_SABM, "SABM" },
{ OSMO_RLP_U_FT_UA, "UA" },
{ OSMO_RLP_U_FT_DISC, "DISC" },
{ OSMO_RLP_U_FT_DM, "DM" },
{ OSMO_RLP_U_FT_NULL, "NULL" },
{ OSMO_RLP_U_FT_UI, "UI" },
{ OSMO_RLP_U_FT_XID, "XID" },
{ OSMO_RLP_U_FT_TEST, "TEST" },
{ OSMO_RLP_U_FT_REMAP, "REMAP" },
{ 0, NULL }
}
@ OSMO_RLP_U_FT_REMAP
Definition: rlp.h:48
@ OSMO_RLP_U_FT_TEST
Definition: rlp.h:47
@ OSMO_RLP_U_FT_XID
Definition: rlp.h:46
@ OSMO_RLP_U_FT_UI
Definition: rlp.h:45
@ OSMO_RLP_U_FT_DISC
Definition: rlp.h:42
@ OSMO_RLP_U_FT_DM
Definition: rlp.h:43
@ OSMO_RLP_U_FT_SABM
Definition: rlp.h:40
@ OSMO_RLP_U_FT_NULL
Definition: rlp.h:44
@ OSMO_RLP_U_FT_UA
Definition: rlp.h:41

◆ osmo_rlp_ftype_vals [1/2]

const struct value_string osmo_rlp_ftype_vals[]
extern

◆ osmo_rlp_ftype_vals [2/2]

const struct value_string osmo_rlp_ftype_vals[]
Initial value:
= {
{ OSMO_RLP_FT_U, "U" },
{ OSMO_RLP_FT_S, "S" },
{ OSMO_RLP_FT_IS, "IS" },
{ 0, NULL }
}
@ OSMO_RLP_FT_S
Definition: rlp.h:33
@ OSMO_RLP_FT_IS
Definition: rlp.h:34
@ OSMO_RLP_FT_U
Definition: rlp.h:32

◆ rlp_fcs_table

const uint32_t rlp_fcs_table[256]
static

Referenced by osmo_rlp_fcs_compute().