\doxysection{include/osmocom/netif/osmux.h File Reference}
\label{osmux_8h}\index{include/osmocom/netif/osmux.h@{include/osmocom/netif/osmux.h}}


Osmocom multiplex protocol helpers.  


{\ttfamily \#include $<$osmocom/core/endian.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/timer.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmux\+\_\+hdr}
\begin{DoxyCompactList}\small\item\em Osmux protocol header. \end{DoxyCompactList}\item 
struct \textbf{ osmux\+\_\+in\+\_\+handle}
\begin{DoxyCompactList}\small\item\em one to handle all existing RTP flows \end{DoxyCompactList}\item 
struct \textbf{ osmux\+\_\+out\+\_\+handle}
\begin{DoxyCompactList}\small\item\em one per OSmux circuit\+\_\+id, ie. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define {\bfseries OSMUX\+\_\+\+DEFAULT\+\_\+\+PORT}~1984
\item 
\#define {\bfseries OSMUX\+\_\+\+FT\+\_\+\+SIGNAL}~0
\item 
\#define {\bfseries OSMUX\+\_\+\+FT\+\_\+\+VOICE\+\_\+\+AMR}~1
\item 
\#define {\bfseries OSMUX\+\_\+\+FT\+\_\+\+DUMMY}~2
\item 
\label{osmux_8h_aa2b0cfe6dad6635ea3313fd5009332cd} 
\#define {\bfseries OSMUX\+\_\+\+CID\+\_\+\+MAX}~255 /$\ast$ determined by circuit\+\_\+id $\ast$/
\item 
\#define {\bfseries OSMUX\+\_\+\+MAX\+\_\+\+CONCURRENT\+\_\+\+CALLS}~8
\item 
\#define {\bfseries OSMUX\+\_\+\+BATCH\+\_\+\+DEFAULT\+\_\+\+MAX}~1472
\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct msgb $\ast$($\ast$ {\bfseries rtp\+\_\+msgb\+\_\+alloc\+\_\+cb\+\_\+t}) (void $\ast$rtp\+\_\+msgb\+\_\+alloc\+\_\+priv\+\_\+data, unsigned int msg\+\_\+len)
\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmux\+\_\+hdr} {\bfseries \+\_\+\+\_\+attribute\+\_\+\+\_\+} ((packed))
\item 
int \textbf{ osmux\+\_\+snprintf} (char $\ast$buf, size\+\_\+t size, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Print osmux header fields and payload from msg into buffer buf. \end{DoxyCompactList}\item 
struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$ \textbf{ osmux\+\_\+xfrm\+\_\+input\+\_\+alloc} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Allocate a new osmux in handle (osmux source, tx side) \end{DoxyCompactList}\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+input\+\_\+init} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h) OSMO\+\_\+\+DEPRECATED("{}Use \textbf{ osmux\+\_\+xfrm\+\_\+input\+\_\+alloc}() instead"{})
\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+input\+\_\+fini} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h) OSMO\+\_\+\+DEPRECATED("{}Use talloc\+\_\+free() instead"{})
\item 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+name} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, const char $\ast$name)
\item 
int {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+batch\+\_\+factor} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, uint8\+\_\+t batch\+\_\+factor)
\item 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+batch\+\_\+size} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, uint16\+\_\+t batch\+\_\+size)
\item 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+initial\+\_\+seqnum} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, uint8\+\_\+t osmux\+\_\+seqnum)
\item 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+deliver\+\_\+cb} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, void($\ast$deliver\+\_\+cb)(struct msgb $\ast$msg, void $\ast$data), void $\ast$data)
\item 
void $\ast$ {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+get\+\_\+deliver\+\_\+cb\+\_\+data} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h)
\item 
int {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+open\+\_\+circuit} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, int ccid, int dummy)
\item 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+close\+\_\+circuit} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, int ccid)
\item 
int \textbf{ osmux\+\_\+xfrm\+\_\+input} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, struct msgb $\ast$msg, int ccid)
\begin{DoxyCompactList}\small\item\em osmux\+\_\+xfrm\+\_\+input -\/ add RTP message to OSmux batch \end{DoxyCompactList}\item 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+deliver} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h)
\item 
struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$ \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+alloc} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Allocate a new osmux out handle. \end{DoxyCompactList}\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+init} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, uint32\+\_\+t rtp\+\_\+ssrc) OSMO\+\_\+\+DEPRECATED("{}Use \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+alloc}() and osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+$\ast$() instead"{})
\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+init2} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, uint32\+\_\+t rtp\+\_\+ssrc, uint8\+\_\+t rtp\+\_\+payload\+\_\+type) OSMO\+\_\+\+DEPRECATED("{}Use \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+alloc}() and osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+$\ast$() instead"{})
\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+ssrc} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, uint32\+\_\+t rtp\+\_\+ssrc)
\begin{DoxyCompactList}\small\item\em Set SSRC of generated RTP packets from Osmux frames. \end{DoxyCompactList}\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+pl\+\_\+type} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, uint32\+\_\+t rtp\+\_\+payload\+\_\+type)
\begin{DoxyCompactList}\small\item\em Set Payload Type of generated RTP packets from Osmux frames. \end{DoxyCompactList}\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+tx\+\_\+cb} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, void($\ast$tx\+\_\+cb)(struct msgb $\ast$msg, void $\ast$data), void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set transmission callback to call when a generated RTP packet is to be transmitted. \end{DoxyCompactList}\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+msgb\+\_\+alloc\+\_\+cb} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, rtp\+\_\+msgb\+\_\+alloc\+\_\+cb\+\_\+t cb, void $\ast$cb\+\_\+data)
\begin{DoxyCompactList}\small\item\em Set callback to call when an RTP packet to be generated is to be allocated. \end{DoxyCompactList}\item 
int \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+sched} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h, struct \textbf{ osmux\+\_\+hdr} $\ast$osmuxh)
\begin{DoxyCompactList}\small\item\em Generate RTP packets from osmux frame AMR payload set and schedule them for transmission at appropriate time. \end{DoxyCompactList}\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+flush} (struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$h)
\begin{DoxyCompactList}\small\item\em Flush all scheduled RTP packets still pending to be transmitted. \end{DoxyCompactList}\item 
struct \textbf{ osmux\+\_\+hdr} $\ast$ {\bfseries osmux\+\_\+xfrm\+\_\+output\+\_\+pull} (struct msgb $\ast$msg)
\end{DoxyCompactItemize}
\doxysubsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\label{osmux_8h_a3f47451edd2274525a52e40f4e26c399} 
uint8\+\_\+t {\bfseries seq}
\item 
\label{osmux_8h_a1bb0153eecb7f155fd9a8052df877a60} 
uint8\+\_\+t {\bfseries circuit\+\_\+id}
\item 
\label{osmux_8h_ac3c027f9a365f5741871df5ace13943f} 
uint8\+\_\+t {\bfseries data} [0]
\item 
struct \textbf{ osmux\+\_\+in\+\_\+handle} {\bfseries \+\_\+\+\_\+attribute\+\_\+\+\_\+}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Osmocom multiplex protocol helpers. 

