libosmogsm 1.13.1.1-afb4 Osmocom GSM library

iuup.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4
5#include <osmocom/core/prim.h>
6#include <osmocom/gsm/protocol/gsm_25_415.h>
7
8/***********************************************************************
9 * Primitives towards the lower layers (typically RTP transport)
10 ***********************************************************************/
11 enum osmo_iuup_tnl_prim_type {
12 OSMO_IUUP_TNL_UNITDATA,
13};
14
15 struct osmo_iuup_tnl_prim {
16 struct osmo_prim_hdr oph;
17};
18
19/***********************************************************************
20 * Primitives towards the upper layers at the RNL SAP
21 ***********************************************************************/
22
23/* 3GPP TS 25.415 Section 7.2.1 */
24 enum osmo_iuup_rnl_prim_type {
25 OSMO_IUUP_RNL_CONFIG,
26 OSMO_IUUP_RNL_DATA,
27 OSMO_IUUP_RNL_STATUS,
28 OSMO_IUUP_RNL_UNIT_DATA,
29};
30
31/* TS 25.413 9.2.1.3*/
32#define IUUP_MAX_SUBFLOWS 7
33#define IUUP_MAX_RFCIS 64
34
35#define IUUP_TIMER_INIT_T_DEFAULT 1000
36#define IUUP_TIMER_TA_T_DEFAULT 500
37#define IUUP_TIMER_RC_T_DEFAULT 500
38#define IUUP_TIMER_INIT_N_DEFAULT 3
39#define IUUP_TIMER_TA_N_DEFAULT 1
40#define IUUP_TIMER_RC_N_DEFAULT 1
41 struct osmo_iuup_rnl_config_timer {
42 uint32_t t_ms; /* time in ms */
43 uint32_t n_max; /* max number of repetitions */
44};
45 struct osmo_iuup_rfci {
46 uint8_t used:1,
47 spare1:1,
48 id:6;
49 uint8_t spare2:4,
50 IPTI:4; /* values range 0-15, 4 bits */;
51 uint16_t subflow_sizes[IUUP_MAX_SUBFLOWS];
52};
53 struct osmo_iuup_rnl_config {
54 /* transparent (true) or SMpSDU (false): */
55 bool transparent;
56
57 /* should we actively transmit INIT in SmpSDU mode? */
58 bool active;
59
60 /* Currently Version 0 or 1: */
61 uint8_t data_pdu_type;
62
63 /* Supported mode versions */
64 uint16_t supported_versions_mask;
65 uint8_t num_rfci;
66 uint8_t num_subflows;
67 bool IPTIs_present;
68 struct osmo_iuup_rfci rfci[IUUP_MAX_RFCIS];
69
70 /* TODO: Indication of delivery of erroneous SDUs*/
71 struct osmo_iuup_rnl_config_timer t_init;
72 struct osmo_iuup_rnl_config_timer t_ta;
73 struct osmo_iuup_rnl_config_timer t_rc;
74};
75
76 struct osmo_iuup_rnl_data {
77 uint8_t rfci;
78 uint8_t frame_nr;
79 uint8_t fqc;
80};
81
82 struct osmo_iuup_rnl_status {
83 enum iuup_procedure procedure;
84 union {
85 struct {
86 enum iuup_error_cause cause;
87 enum iuup_error_distance distance;
88 } error_event;
89 struct {
90 uint16_t mode_version;
91 uint8_t data_pdu_type;
92 uint8_t num_rfci;
93 uint8_t num_subflows;
94 bool IPTIs_present;
95 struct osmo_iuup_rfci rfci[IUUP_MAX_RFCIS];
96 } initialization;
97 struct {
98 } rate_control;
99 struct {
100 } time_alignment;
101 } u;
102};
103
104/* SAP on the upper side of IuUP, towards the user */
105 struct osmo_iuup_rnl_prim {
106 struct osmo_prim_hdr oph;
107 union {
108 struct osmo_iuup_rnl_config config;
109 struct osmo_iuup_rnl_data data;
110 struct osmo_iuup_rnl_status status;
111 //struct osmo_iuup_rnl_unitdata unitdata;
112 } u;
113};
114
115 struct osmo_iuup_instance;
116 struct osmo_iuup_instance *osmo_iuup_instance_alloc(void *ctx, const char *id);
117 void osmo_iuup_instance_free(struct osmo_iuup_instance *iui);
118
119 void osmo_iuup_instance_set_user_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv);
120 void osmo_iuup_instance_set_transport_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv);
121 int osmo_iuup_tnl_prim_up(struct osmo_iuup_instance *iui, struct osmo_iuup_tnl_prim *itp);
122 int osmo_iuup_rnl_prim_down(struct osmo_iuup_instance *inst, struct osmo_iuup_rnl_prim *irp);
123
124
125 int osmo_iuup_compute_header_crc(const uint8_t *iuup_pdu, unsigned int pdu_len);
126 int osmo_iuup_compute_payload_crc(const uint8_t *iuup_pdu, unsigned int pdu_len);
127
128 struct osmo_iuup_rnl_prim *osmo_iuup_rnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size);
129 struct osmo_iuup_tnl_prim *osmo_iuup_tnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size);
osmo_prim_cb
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
gsm_25_415.h
iuup_error_distance
iuup_error_distance
Definition: gsm_25_415.h:190
iuup_error_cause
iuup_error_cause
Definition: gsm_25_415.h:199
iuup_procedure
iuup_procedure
Definition: gsm_25_415.h:181
IUUP_MAX_SUBFLOWS
#define IUUP_MAX_SUBFLOWS
Definition: iuup.h:32
osmo_iuup_rnl_prim_alloc
struct osmo_iuup_rnl_prim * osmo_iuup_rnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size)
Definition: iuup.c:212
osmo_iuup_instance_set_transport_prim_cb
void osmo_iuup_instance_set_transport_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv)
Definition: iuup.c:1067
osmo_iuup_compute_payload_crc
int osmo_iuup_compute_payload_crc(const uint8_t *iuup_pdu, unsigned int pdu_len)
Definition: iuup.c:71
osmo_iuup_instance_alloc
struct osmo_iuup_instance * osmo_iuup_instance_alloc(void *ctx, const char *id)
Definition: iuup.c:1034
osmo_iuup_compute_header_crc
int osmo_iuup_compute_header_crc(const uint8_t *iuup_pdu, unsigned int pdu_len)
Definition: iuup.c:98
osmo_iuup_tnl_prim_type
osmo_iuup_tnl_prim_type
Definition: iuup.h:11
OSMO_IUUP_TNL_UNITDATA
@ OSMO_IUUP_TNL_UNITDATA
Definition: iuup.h:12
osmo_iuup_tnl_prim_up
int osmo_iuup_tnl_prim_up(struct osmo_iuup_instance *iui, struct osmo_iuup_tnl_prim *itp)
Definition: iuup.c:916
osmo_iuup_instance_set_user_prim_cb
void osmo_iuup_instance_set_user_prim_cb(struct osmo_iuup_instance *iui, osmo_prim_cb func, void *priv)
Definition: iuup.c:1062
osmo_iuup_rnl_prim_type
osmo_iuup_rnl_prim_type
Definition: iuup.h:24
OSMO_IUUP_RNL_CONFIG
@ OSMO_IUUP_RNL_CONFIG
Definition: iuup.h:25
OSMO_IUUP_RNL_STATUS
@ OSMO_IUUP_RNL_STATUS
Definition: iuup.h:27
OSMO_IUUP_RNL_DATA
@ OSMO_IUUP_RNL_DATA
Definition: iuup.h:26
OSMO_IUUP_RNL_UNIT_DATA
@ OSMO_IUUP_RNL_UNIT_DATA
Definition: iuup.h:28
osmo_iuup_instance_free
void osmo_iuup_instance_free(struct osmo_iuup_instance *iui)
Definition: iuup.c:1051
osmo_iuup_tnl_prim_alloc
struct osmo_iuup_tnl_prim * osmo_iuup_tnl_prim_alloc(void *ctx, unsigned int primitive, unsigned int operation, unsigned int size)
Definition: iuup.c:223
osmo_iuup_rnl_prim_down
int osmo_iuup_rnl_prim_down(struct osmo_iuup_instance *inst, struct osmo_iuup_rnl_prim *irp)
Definition: iuup.c:1006
IUUP_MAX_RFCIS
#define IUUP_MAX_RFCIS
Definition: iuup.h:33
prim.h
osmo_iuup_instance
Definition: iuup.c:125
osmo_iuup_rfci
Definition: iuup.h:45
osmo_iuup_rfci::IPTI
uint8_t IPTI
Definition: iuup.h:50
osmo_iuup_rfci::subflow_sizes
uint16_t subflow_sizes[IUUP_MAX_SUBFLOWS]
Definition: iuup.h:51
osmo_iuup_rfci::spare2
uint8_t spare2
Definition: iuup.h:49
osmo_iuup_rfci::used
uint8_t used
Definition: iuup.h:46
osmo_iuup_rfci::spare1
uint8_t spare1
Definition: iuup.h:47
osmo_iuup_rfci::id
uint8_t id
Definition: iuup.h:48
osmo_iuup_rnl_config_timer
Definition: iuup.h:41
osmo_iuup_rnl_config_timer::n_max
uint32_t n_max
Definition: iuup.h:43
osmo_iuup_rnl_config_timer::t_ms
uint32_t t_ms
Definition: iuup.h:42
osmo_iuup_rnl_config
Definition: iuup.h:53
osmo_iuup_rnl_config::supported_versions_mask
uint16_t supported_versions_mask
Definition: iuup.h:64
osmo_iuup_rnl_config::t_ta
struct osmo_iuup_rnl_config_timer t_ta
Definition: iuup.h:72
osmo_iuup_rnl_config::data_pdu_type
uint8_t data_pdu_type
Definition: iuup.h:61
osmo_iuup_rnl_config::t_init
struct osmo_iuup_rnl_config_timer t_init
Definition: iuup.h:71
osmo_iuup_rnl_config::active
bool active
Definition: iuup.h:58
osmo_iuup_rnl_config::num_rfci
uint8_t num_rfci
Definition: iuup.h:65
osmo_iuup_rnl_config::t_rc
struct osmo_iuup_rnl_config_timer t_rc
Definition: iuup.h:73
osmo_iuup_rnl_config::IPTIs_present
bool IPTIs_present
Definition: iuup.h:67
osmo_iuup_rnl_config::num_subflows
uint8_t num_subflows
Definition: iuup.h:66
osmo_iuup_rnl_config::rfci
struct osmo_iuup_rfci rfci[IUUP_MAX_RFCIS]
Definition: iuup.h:68
osmo_iuup_rnl_config::transparent
bool transparent
Definition: iuup.h:55
osmo_iuup_rnl_data
Definition: iuup.h:76
osmo_iuup_rnl_data::fqc
uint8_t fqc
Definition: iuup.h:79
osmo_iuup_rnl_data::rfci
uint8_t rfci
Definition: iuup.h:77
osmo_iuup_rnl_data::frame_nr
uint8_t frame_nr
Definition: iuup.h:78
osmo_iuup_rnl_prim
Definition: iuup.h:105
osmo_iuup_rnl_prim::data
struct osmo_iuup_rnl_data data
Definition: iuup.h:109
osmo_iuup_rnl_prim::status
struct osmo_iuup_rnl_status status
Definition: iuup.h:110
osmo_iuup_rnl_prim::oph
struct osmo_prim_hdr oph
Definition: iuup.h:106
osmo_iuup_rnl_prim::config
struct osmo_iuup_rnl_config config
Definition: iuup.h:108
osmo_iuup_rnl_prim::u
union osmo_iuup_rnl_prim::@18 u
osmo_iuup_rnl_status
Definition: iuup.h:82
osmo_iuup_rnl_status::time_alignment
struct osmo_iuup_rnl_status::@13::@17 time_alignment
osmo_iuup_rnl_status::distance
enum iuup_error_distance distance
Definition: iuup.h:87
osmo_iuup_rnl_status::mode_version
uint16_t mode_version
Definition: iuup.h:90
osmo_iuup_rnl_status::initialization
struct osmo_iuup_rnl_status::@13::@15 initialization
osmo_iuup_rnl_status::u
union osmo_iuup_rnl_status::@13 u
osmo_iuup_rnl_status::rate_control
struct osmo_iuup_rnl_status::@13::@16 rate_control
osmo_iuup_rnl_status::num_subflows
uint8_t num_subflows
Definition: iuup.h:93
osmo_iuup_rnl_status::num_rfci
uint8_t num_rfci
Definition: iuup.h:92
osmo_iuup_rnl_status::cause
enum iuup_error_cause cause
Definition: iuup.h:86
osmo_iuup_rnl_status::rfci
struct osmo_iuup_rfci rfci[IUUP_MAX_RFCIS]
Definition: iuup.h:95
osmo_iuup_rnl_status::data_pdu_type
uint8_t data_pdu_type
Definition: iuup.h:91
osmo_iuup_rnl_status::procedure
enum iuup_procedure procedure
Definition: iuup.h:83
osmo_iuup_rnl_status::IPTIs_present
bool IPTIs_present
Definition: iuup.h:94
osmo_iuup_rnl_status::error_event
struct osmo_iuup_rnl_status::@13::@14 error_event
osmo_iuup_tnl_prim
Definition: iuup.h:15
osmo_iuup_tnl_prim::oph
struct osmo_prim_hdr oph
Definition: iuup.h:16
osmo_prim_hdr