\doxysection{twrtp.\+h}
\label{twrtp_8h_source}\index{include/osmocom/netif/twrtp.h@{include/osmocom/netif/twrtp.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{00002\ \textcolor{comment}{\ *\ Themyscira\ Wireless\ RTP\ endpoint\ implementation:}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ public\ API\ definition\ for\ Osmocom-\/integrated\ version.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ This\ code\ was\ contributed\ to\ Osmocom\ Cellular\ Network\ Infrastructure}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ project\ by\ Mother\ Mychaela\ N.\ Falconia\ of\ Themyscira\ Wireless.}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ Mother\ Mychaela's\ contributions\ are\ NOT\ subject\ to\ copyright:}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ no\ rights\ reserved,\ all\ rights\ relinquished.}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <stdint.h>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <stdbool.h>}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <osmocom/core/msgb.h>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ <osmocom/core/socket.h>}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00121\ \textcolor{keyword}{struct\ }osmo\_twrtp;}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00132\ \textcolor{keyword}{struct\ }osmo\_twrtp\_stats\ \{}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ For\ ABI\ reasons,\ none\ of\ the\ following\ fields\ may\ be\ deleted}}
\DoxyCodeLine{00134\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ or\ reordered!\ */}}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ uint32\_t\ rx\_rtp\_pkt;}
\DoxyCodeLine{00136\ \ \ \ \ \ \ \ \ uint32\_t\ rx\_rtp\_badsrc;}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ uint32\_t\ rx\_rtcp\_pkt;}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ uint32\_t\ rx\_rtcp\_badsrc;}
\DoxyCodeLine{00139\ \ \ \ \ \ \ \ \ uint32\_t\ rx\_rtcp\_invalid;}
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ uint32\_t\ rx\_rtcp\_wrong\_ssrc;}
\DoxyCodeLine{00141\ \ \ \ \ \ \ \ \ uint32\_t\ tx\_rtp\_pkt;}
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ uint32\_t\ tx\_rtp\_bytes;}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ uint32\_t\ tx\_rtcp\_pkt;}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ New\ fields\ may\ be\ added\ here\ at\ the\ end;\ once\ added,\ they\ become}}
\DoxyCodeLine{00145\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ permanent\ like\ the\ initially\ defined\ ones.\ */}}
\DoxyCodeLine{00146\ \};}
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ \textcolor{comment}{/*\ declare\ structs\ that\ are\ used\ in\ our\ API\ */}}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ \textcolor{keyword}{struct\ }osmo\_twjit;}
\DoxyCodeLine{00151\ \textcolor{keyword}{struct\ }osmo\_twjit\_config;}
\DoxyCodeLine{00152\ \textcolor{keyword}{struct\ }osmo\_twjit\_stats;}
\DoxyCodeLine{00153\ \textcolor{keyword}{struct\ }osmo\_twjit\_rr\_info;}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ \textcolor{comment}{/*\ public\ API\ functions:\ create\ \&\ destroy,\ local\ and\ remote\ addresses\ */}}
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ \textcolor{keyword}{struct\ }osmo\_twrtp\ *}
\DoxyCodeLine{00158\ osmo\_twrtp\_create(\textcolor{keywordtype}{void}\ *ctx,\ uint16\_t\ clock\_khz,\ uint16\_t\ quantum\_ms,}
\DoxyCodeLine{00159\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ random\_ts\_seq,}
\DoxyCodeLine{00160\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_twjit\_config\ *twjit\_config);}
\DoxyCodeLine{00161\ \textcolor{keywordtype}{void}\ osmo\_twrtp\_destroy(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00162\ }
\DoxyCodeLine{00163\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_supply\_fds(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ \textcolor{keywordtype}{int}\ rtp\_fd,\ \textcolor{keywordtype}{int}\ rtcp\_fd);}
\DoxyCodeLine{00164\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_bind\_local(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,}
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_sockaddr\ *rtp\_addr,\ \textcolor{keywordtype}{bool}\ bind\_rtcp);}
\DoxyCodeLine{00166\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_set\_remote(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_sockaddr\ *rtp\_addr);}
\DoxyCodeLine{00168\ }
\DoxyCodeLine{00169\ \textcolor{comment}{/*\ receiving\ incoming\ RTP\ via\ twjit\ */}}
\DoxyCodeLine{00170\ }
\DoxyCodeLine{00171\ \textcolor{keywordtype}{void}\ osmo\_twrtp\_twjit\_rx\_ctrl(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ \textcolor{keywordtype}{bool}\ rx\_enable);}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00173\ \textcolor{comment}{/*\ output\ function,\ to\ be\ called\ by\ TDM/GSM/etc\ fixed-\/timing\ side\ */}}
\DoxyCodeLine{00174\ \textcolor{keyword}{struct\ }msgb\ *osmo\_twrtp\_twjit\_rx\_poll(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00175\ }
\DoxyCodeLine{00176\ \textcolor{comment}{/*\ receiving\ incoming\ RTP\ without\ twjit\ */}}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00178\ \textcolor{comment}{/*\ callback\ function\ takes\ ownership\ of\ msgb\ *if*\ it\ returns\ true\ */}}
\DoxyCodeLine{00179\ \textcolor{keyword}{typedef}\ bool\ (*osmo\_twrtp\_raw\_rx\_cb)(\textcolor{keyword}{struct\ }osmo\_twrtp\ *endp,\ \textcolor{keywordtype}{void}\ *user\_data,}
\DoxyCodeLine{00180\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }msgb\ *msg);}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ \textcolor{keywordtype}{void}\ osmo\_twrtp\_set\_raw\_rx\_cb(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ osmo\_twrtp\_raw\_rx\_cb\ cb,}
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ *user\_data);}
\DoxyCodeLine{00184\ }
\DoxyCodeLine{00185\ \textcolor{comment}{/*\ RTP\ Tx\ direction\ */}}
\DoxyCodeLine{00186\ }
\DoxyCodeLine{00187\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_tx\_quantum(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ \textcolor{keyword}{const}\ uint8\_t\ *payload,}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ payload\_len,\ uint8\_t\ payload\_type,}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ marker,\ \textcolor{keywordtype}{bool}\ auto\_marker,\ \textcolor{keywordtype}{bool}\ send\_rtcp);}
\DoxyCodeLine{00190\ \textcolor{keywordtype}{void}\ osmo\_twrtp\_tx\_skip(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00191\ \textcolor{keywordtype}{void}\ osmo\_twrtp\_tx\_restart(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00193\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_tx\_forward(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ \textcolor{keyword}{struct}\ msgb\ *msg);}
\DoxyCodeLine{00194\ }
\DoxyCodeLine{00195\ \textcolor{comment}{/*\ support\ for\ emitting\ RTCP\ SR\ \&\ RR\ */}}
\DoxyCodeLine{00196\ }
\DoxyCodeLine{00197\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_set\_sdes(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *cname,}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *name,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *email,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *phone,}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *loc,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *tool,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *note);}
\DoxyCodeLine{00200\ \textcolor{keywordtype}{void}\ osmo\_twrtp\_set\_auto\_rtcp\_interval(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint16\_t\ interval);}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00203\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_send\_rtcp\_rr(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00204\ }
\DoxyCodeLine{00205\ \textcolor{comment}{/*\ information\ retrieval\ functions\ */}}
\DoxyCodeLine{00206\ }
\DoxyCodeLine{00207\ \textcolor{keyword}{struct\ }osmo\_twjit\ *osmo\_twrtp\_get\_twjit(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00208\ }
\DoxyCodeLine{00209\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }osmo\_twrtp\_stats\ *osmo\_twrtp\_get\_stats(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00210\ }
\DoxyCodeLine{00211\ \textcolor{comment}{/*\ have\ we\ received\ at\ least\ one\ RTCP\ RR\ matching\ our\ RTP\ Tx\ output?\ */}}
\DoxyCodeLine{00212\ \textcolor{keywordtype}{bool}\ osmo\_twrtp\_got\_rtcp\_rr(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00213\ }
\DoxyCodeLine{00214\ \textcolor{comment}{/*\ retrieving\ RTCP\ RR\ info:\ valid\ only\ if\ above\ function\ returned\ true\ */}}
\DoxyCodeLine{00215\ uint32\_t\ osmo\_twrtp\_rr\_lost\_word(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00216\ int32\_t\ osmo\_twrtp\_rr\_lost\_cumulative(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00217\ uint32\_t\ osmo\_twrtp\_rr\_jitter\_last(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00218\ uint32\_t\ osmo\_twrtp\_rr\_jitter\_max(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00219\ }
\DoxyCodeLine{00220\ \textcolor{comment}{/*\ socket-\/related\ miscellany\ */}}
\DoxyCodeLine{00221\ }
\DoxyCodeLine{00222\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_get\_rtp\_fd(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00223\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_get\_rtcp\_fd(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp);}
\DoxyCodeLine{00224\ }
\DoxyCodeLine{00225\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_set\_dscp(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ uint8\_t\ dscp);}
\DoxyCodeLine{00226\ \textcolor{keywordtype}{int}\ osmo\_twrtp\_set\_socket\_prio(\textcolor{keyword}{struct}\ osmo\_twrtp\ *endp,\ \textcolor{keywordtype}{int}\ prio);}
\DoxyCodeLine{00227\ }

\end{DoxyCode}
