\doxysection{iuup.\+h}
\label{iuup_8h_source}\index{include/osmocom/gsm/iuup.h@{include/osmocom/gsm/iuup.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{2 }
\DoxyCodeLine{3 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{4 }
\DoxyCodeLine{5 \textcolor{preprocessor}{\#include <osmocom/core/prim.h>}}
\DoxyCodeLine{6 \textcolor{preprocessor}{\#include <osmocom/gsm/protocol/gsm\_25\_415.h>}}
\DoxyCodeLine{7 }
\DoxyCodeLine{8 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{9 \textcolor{comment}{ * Primitives towards the lower layers (typically RTP transport)}}
\DoxyCodeLine{10 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{11 \textcolor{keyword}{enum} osmo\_iuup\_tnl\_prim\_type \{}
\DoxyCodeLine{12         OSMO\_IUUP\_TNL\_UNITDATA,}
\DoxyCodeLine{13 \};}
\DoxyCodeLine{14 }
\DoxyCodeLine{15 \textcolor{keyword}{struct }osmo\_iuup\_tnl\_prim \{}
\DoxyCodeLine{16         \textcolor{keyword}{struct }osmo\_prim\_hdr oph;}
\DoxyCodeLine{17 \};}
\DoxyCodeLine{18 }
\DoxyCodeLine{19 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{20 \textcolor{comment}{ * Primitives towards the upper layers at the RNL SAP}}
\DoxyCodeLine{21 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{22 }
\DoxyCodeLine{23 \textcolor{comment}{/* 3GPP TS 25.415 Section 7.2.1 */}}
\DoxyCodeLine{24 \textcolor{keyword}{enum} osmo\_iuup\_rnl\_prim\_type \{}
\DoxyCodeLine{25         OSMO\_IUUP\_RNL\_CONFIG,}
\DoxyCodeLine{26         OSMO\_IUUP\_RNL\_DATA,}
\DoxyCodeLine{27         OSMO\_IUUP\_RNL\_STATUS,}
\DoxyCodeLine{28         OSMO\_IUUP\_RNL\_UNIT\_DATA,}
\DoxyCodeLine{29 \};}
\DoxyCodeLine{30 }
\DoxyCodeLine{31 \textcolor{comment}{/* TS 25.413 9.2.1.3*/}}
\DoxyCodeLine{32 \textcolor{preprocessor}{\#define IUUP\_MAX\_SUBFLOWS 7}}
\DoxyCodeLine{33 \textcolor{preprocessor}{\#define IUUP\_MAX\_RFCIS 64}}
\DoxyCodeLine{34 }
\DoxyCodeLine{35 \textcolor{preprocessor}{\#define IUUP\_TIMER\_INIT\_T\_DEFAULT 1000}}
\DoxyCodeLine{36 \textcolor{preprocessor}{\#define IUUP\_TIMER\_TA\_T\_DEFAULT 500}}
\DoxyCodeLine{37 \textcolor{preprocessor}{\#define IUUP\_TIMER\_RC\_T\_DEFAULT 500}}
\DoxyCodeLine{38 \textcolor{preprocessor}{\#define IUUP\_TIMER\_INIT\_N\_DEFAULT 3}}
\DoxyCodeLine{39 \textcolor{preprocessor}{\#define IUUP\_TIMER\_TA\_N\_DEFAULT 1}}
\DoxyCodeLine{40 \textcolor{preprocessor}{\#define IUUP\_TIMER\_RC\_N\_DEFAULT 1}}
\DoxyCodeLine{41 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_config\_timer \{}
\DoxyCodeLine{42         uint32\_t t\_ms;      \textcolor{comment}{/* time in ms */}}
\DoxyCodeLine{43         uint32\_t n\_max;    \textcolor{comment}{/* max number of repetitions */}}
\DoxyCodeLine{44 \};}
\DoxyCodeLine{45 \textcolor{keyword}{struct }osmo\_iuup\_rfci \{}
\DoxyCodeLine{46         uint8\_t used:1,}
\DoxyCodeLine{47                 spare1:1,}
\DoxyCodeLine{48                 id:6;}
\DoxyCodeLine{49         uint8\_t spare2:4,}
\DoxyCodeLine{50                 IPTI:4; \textcolor{comment}{/* values range 0-\/15, 4 bits */};}
\DoxyCodeLine{51         uint16\_t subflow\_sizes[IUUP\_MAX\_SUBFLOWS];}
\DoxyCodeLine{52 \};}
\DoxyCodeLine{53 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_config \{}
\DoxyCodeLine{54         \textcolor{comment}{/* transparent (true) or SMpSDU (false): */}}
\DoxyCodeLine{55         \textcolor{keywordtype}{bool} transparent;}
\DoxyCodeLine{56 }
\DoxyCodeLine{57         \textcolor{comment}{/* should we actively transmit INIT in SmpSDU mode? */}}
\DoxyCodeLine{58         \textcolor{keywordtype}{bool} active;}
\DoxyCodeLine{59 }
\DoxyCodeLine{60         \textcolor{comment}{/* Currently Version 0 or 1: */}}
\DoxyCodeLine{61         uint8\_t data\_pdu\_type;}
\DoxyCodeLine{62 }
\DoxyCodeLine{63         \textcolor{comment}{/* Supported mode versions */}}
\DoxyCodeLine{64         uint16\_t supported\_versions\_mask;}
\DoxyCodeLine{65         uint8\_t num\_rfci;}
\DoxyCodeLine{66         uint8\_t num\_subflows;}
\DoxyCodeLine{67         \textcolor{keywordtype}{bool} IPTIs\_present;}
\DoxyCodeLine{68         \textcolor{keyword}{struct }osmo\_iuup\_rfci rfci[IUUP\_MAX\_RFCIS];}
\DoxyCodeLine{69 }
\DoxyCodeLine{70         \textcolor{comment}{/* TODO: Indication of delivery of erroneous SDUs*/}}
\DoxyCodeLine{71         \textcolor{keyword}{struct }osmo\_iuup\_rnl\_config\_timer t\_init;}
\DoxyCodeLine{72         \textcolor{keyword}{struct }osmo\_iuup\_rnl\_config\_timer t\_ta;}
\DoxyCodeLine{73         \textcolor{keyword}{struct }osmo\_iuup\_rnl\_config\_timer t\_rc;}
\DoxyCodeLine{74 \};}
\DoxyCodeLine{75 }
\DoxyCodeLine{76 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_data \{}
\DoxyCodeLine{77         uint8\_t rfci;}
\DoxyCodeLine{78         uint8\_t frame\_nr;}
\DoxyCodeLine{79         uint8\_t fqc;}
\DoxyCodeLine{80 \};}
\DoxyCodeLine{81 }
\DoxyCodeLine{82 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_status \{}
\DoxyCodeLine{83         \textcolor{keyword}{enum} iuup\_procedure procedure;}
\DoxyCodeLine{84         \textcolor{keyword}{union }\{}
\DoxyCodeLine{85                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{86                         \textcolor{keyword}{enum} iuup\_error\_cause cause;}
\DoxyCodeLine{87                         \textcolor{keyword}{enum} iuup\_error\_distance distance;}
\DoxyCodeLine{88                 \} error\_event;}
\DoxyCodeLine{89                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{90                         uint16\_t mode\_version;}
\DoxyCodeLine{91                         uint8\_t data\_pdu\_type;}
\DoxyCodeLine{92                         uint8\_t num\_rfci;}
\DoxyCodeLine{93                         uint8\_t num\_subflows;}
\DoxyCodeLine{94                         \textcolor{keywordtype}{bool} IPTIs\_present;}
\DoxyCodeLine{95                         \textcolor{keyword}{struct }osmo\_iuup\_rfci rfci[IUUP\_MAX\_RFCIS];}
\DoxyCodeLine{96                 \} initialization;}
\DoxyCodeLine{97                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{98                 \} rate\_control;}
\DoxyCodeLine{99                 \textcolor{keyword}{struct }\{}
\DoxyCodeLine{100                 \} time\_alignment;}
\DoxyCodeLine{101         \} u;}
\DoxyCodeLine{102 \};}
\DoxyCodeLine{103 }
\DoxyCodeLine{104 \textcolor{comment}{/* SAP on the upper side of IuUP, towards the user */}}
\DoxyCodeLine{105 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_prim \{}
\DoxyCodeLine{106         \textcolor{keyword}{struct }osmo\_prim\_hdr oph;}
\DoxyCodeLine{107         \textcolor{keyword}{union }\{}
\DoxyCodeLine{108                 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_config config;}
\DoxyCodeLine{109                 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_data data;}
\DoxyCodeLine{110                 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_status status;}
\DoxyCodeLine{111                 \textcolor{comment}{//struct osmo\_iuup\_rnl\_unitdata unitdata;}}
\DoxyCodeLine{112         \} u;}
\DoxyCodeLine{113 \};}
\DoxyCodeLine{114 }
\DoxyCodeLine{115 \textcolor{keyword}{struct }osmo\_iuup\_instance;}
\DoxyCodeLine{116 \textcolor{keyword}{struct }osmo\_iuup\_instance *osmo\_iuup\_instance\_alloc(\textcolor{keywordtype}{void} *ctx, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\textcolor{keywordtype}{id});}
\DoxyCodeLine{117 \textcolor{keywordtype}{void} osmo\_iuup\_instance\_free(\textcolor{keyword}{struct} osmo\_iuup\_instance *iui);}
\DoxyCodeLine{118 }
\DoxyCodeLine{119 \textcolor{keywordtype}{void} osmo\_iuup\_instance\_set\_user\_prim\_cb(\textcolor{keyword}{struct} osmo\_iuup\_instance *iui, osmo\_prim\_cb func, \textcolor{keywordtype}{void} *priv);}
\DoxyCodeLine{120 \textcolor{keywordtype}{void} osmo\_iuup\_instance\_set\_transport\_prim\_cb(\textcolor{keyword}{struct} osmo\_iuup\_instance *iui, osmo\_prim\_cb func, \textcolor{keywordtype}{void} *priv);}
\DoxyCodeLine{121 \textcolor{keywordtype}{int} osmo\_iuup\_tnl\_prim\_up(\textcolor{keyword}{struct} osmo\_iuup\_instance *iui, \textcolor{keyword}{struct} osmo\_iuup\_tnl\_prim *itp);}
\DoxyCodeLine{122 \textcolor{keywordtype}{int} osmo\_iuup\_rnl\_prim\_down(\textcolor{keyword}{struct} osmo\_iuup\_instance *inst, \textcolor{keyword}{struct} osmo\_iuup\_rnl\_prim *irp);}
\DoxyCodeLine{123 }
\DoxyCodeLine{124 }
\DoxyCodeLine{125 \textcolor{keywordtype}{int} osmo\_iuup\_compute\_header\_crc(\textcolor{keyword}{const} uint8\_t *iuup\_pdu, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} pdu\_len);}
\DoxyCodeLine{126 \textcolor{keywordtype}{int} osmo\_iuup\_compute\_payload\_crc(\textcolor{keyword}{const} uint8\_t *iuup\_pdu, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} pdu\_len);}
\DoxyCodeLine{127 }
\DoxyCodeLine{128 \textcolor{keyword}{struct }osmo\_iuup\_rnl\_prim *osmo\_iuup\_rnl\_prim\_alloc(\textcolor{keywordtype}{void} *ctx, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} primitive, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} operation, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} size);}
\DoxyCodeLine{129 \textcolor{keyword}{struct }osmo\_iuup\_tnl\_prim *osmo\_iuup\_tnl\_prim\_alloc(\textcolor{keywordtype}{void} *ctx, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} primitive, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} operation, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} size);}

\end{DoxyCode}
