\doxysection{Osmocom Multiplex Protocol}
\label{group__osmux}\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}


This code implements a variety of utility functions related to the OSMUX user-\/plane multiplexing protocol, an efficient alternative to plain UDP/\+RTP streams for voice transport in back-\/haul of cellular networks.  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ osmux.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom multiplex protocol helpers. \end{DoxyCompactList}\item 
file \textbf{ osmux.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom multiplex protocol helpers. \end{DoxyCompactList}\item 
file \textbf{ osmux\+\_\+input.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom multiplex protocol helpers (input) \end{DoxyCompactList}\item 
file \textbf{ osmux\+\_\+output.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom multiplex protocol helpers (output) \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{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}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__osmux_ga3bad2ffab901ca5152e03cf7fd21780f}} 
\#define {\bfseries OSMUX\+\_\+\+DEFAULT\+\_\+\+PORT}~1984
\item 
\mbox{\label{group__osmux_ga56541848fbbf5c529d7983685cbe1222}} 
\#define {\bfseries OSMUX\+\_\+\+FT\+\_\+\+SIGNAL}~0
\item 
\mbox{\label{group__osmux_gae48ff00bdb503143c58d74c08e3ea4c6}} 
\#define {\bfseries OSMUX\+\_\+\+FT\+\_\+\+VOICE\+\_\+\+AMR}~1
\item 
\mbox{\label{group__osmux_ga08d783f0644a0f44c9e39bb851a0d2a9}} 
\#define {\bfseries OSMUX\+\_\+\+FT\+\_\+\+DUMMY}~2
\item 
\mbox{\label{group__osmux_ga97865ddcdfb9cf8d39653cf704e154c4}} 
\#define {\bfseries OSMUX\+\_\+\+MAX\+\_\+\+CONCURRENT\+\_\+\+CALLS}~8
\item 
\mbox{\label{group__osmux_gafcc9ef25a29d641a31523dfeb627d20b}} 
\#define {\bfseries OSMUX\+\_\+\+BATCH\+\_\+\+DEFAULT\+\_\+\+MAX}~1472
\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__osmux_ga5470d7a4306e441a7f97ae12c1ad04a0}} 
typedef struct msgb $\ast$($\ast$ {\bfseries rtp\+\_\+msgb\+\_\+alloc\+\_\+cb\+\_\+t}) (void $\ast$rtp\+\_\+msgb\+\_\+alloc\+\_\+priv\+\_\+data, unsigned int msg\+\_\+len)
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__osmux_gab731e55b448e102a7f0937d575442929}} 
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(\char`\"{}Use \textbf{ osmux\+\_\+xfrm\+\_\+input\+\_\+alloc}() instead\char`\"{})
\item 
void \textbf{ osmux\+\_\+xfrm\+\_\+input\+\_\+fini} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h) OSMO\+\_\+\+DEPRECATED(\char`\"{}Use talloc\+\_\+free() instead\char`\"{})
\item 
\mbox{\label{group__osmux_ga7009914ae5d04f95461eb5ed00c48c5f}} 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+name} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, const char $\ast$name)
\item 
\mbox{\label{group__osmux_gaaa21b6e362e0355b9a307b61ad11041a}} 
int {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+batch\+\_\+factor} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, uint8\+\_\+t batch\+\_\+factor)
\item 
\mbox{\label{group__osmux_gaa3ffcf5b445c0c8671893d5b753d6ce1}} 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+batch\+\_\+size} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, uint16\+\_\+t batch\+\_\+size)
\item 
\mbox{\label{group__osmux_gaff9d6b79f4839694991dcfacb4dac346}} 
void {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+set\+\_\+initial\+\_\+seqnum} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, uint8\+\_\+t osmux\+\_\+seqnum)
\item 
\mbox{\label{group__osmux_gac51a84e71885e60a84f03b6e21a04492}} 
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 
\mbox{\label{group__osmux_gad93348881be4037fd67379f11d287f96}} 
void $\ast$ {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+get\+\_\+deliver\+\_\+cb\+\_\+data} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h)
\item 
\mbox{\label{group__osmux_ga8976891414ad18103efb8829b4b2844a}} 
int {\bfseries osmux\+\_\+xfrm\+\_\+input\+\_\+open\+\_\+circuit} (struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$h, int ccid, int dummy)
\item 
\mbox{\label{group__osmux_ga2c12c883c9dd7abd80b47802ef991b32}} 
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 
\mbox{\label{group__osmux_gafad3a85e58f396db7544ac0138df7974}} 
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(\char`\"{}Use \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+alloc}() and osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+$\ast$() instead\char`\"{})
\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(\char`\"{}Use \textbf{ osmux\+\_\+xfrm\+\_\+output\+\_\+alloc}() and osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+$\ast$() instead\char`\"{})
\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 
\mbox{\label{group__osmux_ga613c43d4166a4985718f8e4f7216efcc}} 
struct \textbf{ osmux\+\_\+hdr} $\ast$ {\bfseries osmux\+\_\+xfrm\+\_\+output\+\_\+pull} (struct msgb $\ast$msg)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__osmux_gaa558f46e9a75a7e08863bfb0093f2c33}} 
struct \textbf{ osmux\+\_\+in\+\_\+handle} {\bfseries \+\_\+\+\_\+attribute\+\_\+\+\_\+}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This code implements a variety of utility functions related to the OSMUX user-\/plane multiplexing protocol, an efficient alternative to plain UDP/\+RTP streams for voice transport in back-\/haul of cellular networks. 

For information about the OSMUX protocol design, please see the OSMUX reference manual at {\texttt{ http\+://ftp.\+osmocom.\+org/docs/latest/osmux-\/reference.\+pdf}} 

\doxysubsection{Function Documentation}
\mbox{\label{group__osmux_gaf654e092ca97dd764f59905a2ed21650}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_snprintf@{osmux\_snprintf}}
\index{osmux\_snprintf@{osmux\_snprintf}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_snprintf()}
{\footnotesize\ttfamily int osmux\+\_\+snprintf (\begin{DoxyParamCaption}\item[{char $\ast$}]{buf,  }\item[{size\+\_\+t}]{size,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Print osmux header fields and payload from msg into buffer buf. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em buf} & buffer to store the output into \\
\hline
\mbox{\texttt{ in}}  & {\em len} & length of buf in bytes \\
\hline
\mbox{\texttt{ in}}  & {\em msgb} & message buffer containing one or more osmux frames \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of characters printed (excluding the null byte used to end output to strings).
\end{DoxyReturn}
If the output was truncated due to this limit, then the return value is the number of characters (excluding the terminating null byte) which would have been written to the final string if enough space had been available. \mbox{\label{group__osmux_ga9c7d30c0d7d9bc0caf744799d629d4cc}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_input@{osmux\_xfrm\_input}}
\index{osmux\_xfrm\_input@{osmux\_xfrm\_input}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_input()}
{\footnotesize\ttfamily int osmux\+\_\+xfrm\+\_\+input (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$}]{h,  }\item[{struct msgb $\ast$}]{msg,  }\item[{int}]{ccid }\end{DoxyParamCaption})}



osmux\+\_\+xfrm\+\_\+input -\/ add RTP message to OSmux batch 


\begin{DoxyParams}{Parameters}
{\em msg} & RTP message that you want to batch into one OSmux message\\
\hline
\end{DoxyParams}
If 0 is returned, this indicates that the message has been batched and the msgb is now owned by the osmux layer. If negative value is returned, an error occurred and the message has been dropped (and freed). If 1 is returned, you have to invoke osmux\+\_\+xfrm\+\_\+input\+\_\+deliver and try again.

The function takes care of releasing the messages in case of error and when building the batch. \mbox{\label{group__osmux_gad61cdde332496df6d7350d147e50b8be}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_input\_alloc@{osmux\_xfrm\_input\_alloc}}
\index{osmux\_xfrm\_input\_alloc@{osmux\_xfrm\_input\_alloc}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_input\_alloc()}
{\footnotesize\ttfamily struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$ osmux\+\_\+xfrm\+\_\+input\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Allocate a new osmux in handle (osmux source, tx side) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context to use when allocating the returned struct \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Allocated osmux in handle
\end{DoxyReturn}
This object contains configuration and state to handle a group of circuits (trunk), receiving RTP packets from the upper layer (API user) and sending batched \& trunked Osmux messages containing all the data of those circuits down the stack outgoing network Osmux messages. Returned pointer can be freed with regular talloc\+\_\+free, all pending messages in queue and all internal data will be freed. \mbox{\label{group__osmux_ga13655a3bdc68f5e96ad1fe1c03dc235e}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_input\_fini@{osmux\_xfrm\_input\_fini}}
\index{osmux\_xfrm\_input\_fini@{osmux\_xfrm\_input\_fini}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_input\_fini()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+input\+\_\+fini (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$}]{h }\end{DoxyParamCaption})}

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]\+: Use talloc\+\_\+free() instead (will call osmux\+\_\+xfrm\+\_\+input\+\_\+talloc\+\_\+destructor()) \end{DoxyRefDesc}
\mbox{\label{group__osmux_ga96230b0431d5d4d91f2dd57a9c85c366}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_input\_init@{osmux\_xfrm\_input\_init}}
\index{osmux\_xfrm\_input\_init@{osmux\_xfrm\_input\_init}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_input\_init()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+input\+\_\+init (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+in\+\_\+handle} $\ast$}]{h }\end{DoxyParamCaption})}

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]\+: Use \doxyref{osmux\+\_\+xfrm\+\_\+input\+\_\+alloc()}{p.}{group__osmux_gad61cdde332496df6d7350d147e50b8be} instead \end{DoxyRefDesc}
\mbox{\label{group__osmux_ga41a217bffa1b0ac095c98ab0fab82c25}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_alloc@{osmux\_xfrm\_output\_alloc}}
\index{osmux\_xfrm\_output\_alloc@{osmux\_xfrm\_output\_alloc}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_alloc()}
{\footnotesize\ttfamily struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$ osmux\+\_\+xfrm\+\_\+output\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Allocate a new osmux out handle. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context to use when allocating the returned struct \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Allocated osmux out handle
\end{DoxyReturn}
This object contains configuration and state to handle a specific CID in incoming network Osmux messages, repackaging the frames for that CID as RTP packets and pushing them up the protocol stack. Returned pointer can be freed with regular talloc\+\_\+free, queue will be flushed and all internal data will be freed. \mbox{\label{group__osmux_gaaac410425f6470396ae9db53ebb8dc44}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_flush@{osmux\_xfrm\_output\_flush}}
\index{osmux\_xfrm\_output\_flush@{osmux\_xfrm\_output\_flush}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_flush()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+flush (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h }\end{DoxyParamCaption})}



Flush all scheduled RTP packets still pending to be transmitted. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the osmux out handle to flush\\
\hline
\end{DoxyParams}
This function will immediately call the transmit callback for all queued RTP packets, making sure the list ends up empty. It will also stop all internal timers to make sure the \doxyref{osmux\+\_\+out\+\_\+handle}{p.}{structosmux__out__handle} can be dropped or re-\/used by calling osmux\+\_\+xfrm\+\_\+output on it. \mbox{\label{group__osmux_ga90d58246bcd24a6126898cd6c47dddf4}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_init@{osmux\_xfrm\_output\_init}}
\index{osmux\_xfrm\_output\_init@{osmux\_xfrm\_output\_init}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_init()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+init (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{uint32\+\_\+t}]{rtp\+\_\+ssrc }\end{DoxyParamCaption})}

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]\+: Use \doxyref{osmux\+\_\+xfrm\+\_\+output\+\_\+alloc()}{p.}{group__osmux_ga41a217bffa1b0ac095c98ab0fab82c25} and osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+$\ast$() instead \end{DoxyRefDesc}
\mbox{\label{group__osmux_gaa076e54fa0d249721a4c7b174a8ed2d1}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_init2@{osmux\_xfrm\_output\_init2}}
\index{osmux\_xfrm\_output\_init2@{osmux\_xfrm\_output\_init2}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_init2()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+init2 (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{uint32\+\_\+t}]{rtp\+\_\+ssrc,  }\item[{uint8\+\_\+t}]{rtp\+\_\+payload\+\_\+type }\end{DoxyParamCaption})}

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]\+: Use \doxyref{osmux\+\_\+xfrm\+\_\+output\+\_\+alloc()}{p.}{group__osmux_ga41a217bffa1b0ac095c98ab0fab82c25} and osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+$\ast$() instead \end{DoxyRefDesc}
\mbox{\label{group__osmux_gafee78ee4522a9caa238301d7b913dfd6}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_sched@{osmux\_xfrm\_output\_sched}}
\index{osmux\_xfrm\_output\_sched@{osmux\_xfrm\_output\_sched}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_sched()}
{\footnotesize\ttfamily int osmux\+\_\+xfrm\+\_\+output\+\_\+sched (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{struct \textbf{ osmux\+\_\+hdr} $\ast$}]{osmuxh }\end{DoxyParamCaption})}



Generate RTP packets from osmux frame AMR payload set and schedule them for transmission at appropriate time. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the osmux out handle handling a specific CID \\
\hline
\mbox{\texttt{ in}}  & {\em osmuxh} & Buffer pointing to osmux frame header structure and AMR payload \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Number of generated RTP packets
\end{DoxyReturn}
The osmux frame passed to this function must be of the type OSMUX\+\_\+\+FT\+\_\+\+VOICE\+\_\+\+AMR. The generated RTP packets are kept into h\textquotesingle{}s internal list and sent to the callback configured through osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+tx\+\_\+cb when are ready to be transmitted according to schedule. \mbox{\label{group__osmux_ga97187827e1f793f2392e54585343db32}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_set\_rtp\_msgb\_alloc\_cb@{osmux\_xfrm\_output\_set\_rtp\_msgb\_alloc\_cb}}
\index{osmux\_xfrm\_output\_set\_rtp\_msgb\_alloc\_cb@{osmux\_xfrm\_output\_set\_rtp\_msgb\_alloc\_cb}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_set\_rtp\_msgb\_alloc\_cb()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+msgb\+\_\+alloc\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{rtp\+\_\+msgb\+\_\+alloc\+\_\+cb\+\_\+t}]{cb,  }\item[{void $\ast$}]{cb\+\_\+data }\end{DoxyParamCaption})}



Set callback to call when an RTP packet to be generated is to be allocated. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the osmux out handle handling a specific CID \\
\hline
\mbox{\texttt{ in}}  & {\em cb} & User defined msgb alloc function for generated RTP pkts \\
\hline
\mbox{\texttt{ in}}  & {\em cb\+\_\+data} & Opaque data pointer set by user and passed in cb \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
msgb structure to be used to fill in generated RTP pkt content 
\end{DoxyReturn}
\mbox{\label{group__osmux_ga0d96c8a544e0ff56576615e0b2ac7774}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_set\_rtp\_pl\_type@{osmux\_xfrm\_output\_set\_rtp\_pl\_type}}
\index{osmux\_xfrm\_output\_set\_rtp\_pl\_type@{osmux\_xfrm\_output\_set\_rtp\_pl\_type}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_set\_rtp\_pl\_type()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+pl\+\_\+type (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{uint32\+\_\+t}]{rtp\+\_\+payload\+\_\+type }\end{DoxyParamCaption})}



Set Payload Type of generated RTP packets from Osmux frames. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the osmux out handle handling a specific CID \\
\hline
\mbox{\texttt{ in}}  & {\em rtp\+\_\+payload\+\_\+type} & the RTP Payload Type to set \\
\hline
\end{DoxyParams}
\mbox{\label{group__osmux_ga08151bad3c12df245d4c0e4f9c4ca966}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_set\_rtp\_ssrc@{osmux\_xfrm\_output\_set\_rtp\_ssrc}}
\index{osmux\_xfrm\_output\_set\_rtp\_ssrc@{osmux\_xfrm\_output\_set\_rtp\_ssrc}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_set\_rtp\_ssrc()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+rtp\+\_\+ssrc (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{uint32\+\_\+t}]{rtp\+\_\+ssrc }\end{DoxyParamCaption})}



Set SSRC of generated RTP packets from Osmux frames. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the osmux out handle handling a specific CID \\
\hline
\mbox{\texttt{ in}}  & {\em rtp\+\_\+ssrc} & the RTP SSRC to set \\
\hline
\end{DoxyParams}
\mbox{\label{group__osmux_ga3936e43e881d0992648937417969ead1}} 
\index{Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}!osmux\_xfrm\_output\_set\_tx\_cb@{osmux\_xfrm\_output\_set\_tx\_cb}}
\index{osmux\_xfrm\_output\_set\_tx\_cb@{osmux\_xfrm\_output\_set\_tx\_cb}!Osmocom Multiplex Protocol@{Osmocom Multiplex Protocol}}
\doxysubsubsection{osmux\_xfrm\_output\_set\_tx\_cb()}
{\footnotesize\ttfamily void osmux\+\_\+xfrm\+\_\+output\+\_\+set\+\_\+tx\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmux\+\_\+out\+\_\+handle} $\ast$}]{h,  }\item[{void($\ast$)(struct msgb $\ast$msg, void $\ast$data)}]{tx\+\_\+cb,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set transmission callback to call when a generated RTP packet is to be transmitted. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the osmux out handle handling a specific CID \\
\hline
\mbox{\texttt{ in}}  & {\em osmuxh} & Buffer pointing to osmux frame header structure and AMR payload \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Number of generated RTP packets
\end{DoxyReturn}
This Function sets the callback called by the interal timer set by osmux\+\_\+xfrm\+\_\+out\+\_\+sched function. 