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

\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{comment}{/*}}
\DoxyCodeLine{2 \textcolor{comment}{ * Themyscira Wireless RTP endpoint implementation:}}
\DoxyCodeLine{3 \textcolor{comment}{ * public API definition for Osmocom-\/integrated version.}}
\DoxyCodeLine{4 \textcolor{comment}{ *}}
\DoxyCodeLine{5 \textcolor{comment}{ * This code was contributed to Osmocom Cellular Network Infrastructure}}
\DoxyCodeLine{6 \textcolor{comment}{ * project by Mother Mychaela N. Falconia of Themyscira Wireless.}}
\DoxyCodeLine{7 \textcolor{comment}{ * Mother Mychaela's contributions are NOT subject to copyright:}}
\DoxyCodeLine{8 \textcolor{comment}{ * no rights reserved, all rights relinquished.}}
\DoxyCodeLine{9 \textcolor{comment}{ */}}
\DoxyCodeLine{10 }
\DoxyCodeLine{11 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{12 }
\DoxyCodeLine{13 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{14 \textcolor{preprocessor}{\#include <stdbool.h>}}
\DoxyCodeLine{15 }
\DoxyCodeLine{16 \textcolor{preprocessor}{\#include <osmocom/core/msgb.h>}}
\DoxyCodeLine{17 \textcolor{preprocessor}{\#include <osmocom/core/socket.h>}}
\DoxyCodeLine{18 }
\DoxyCodeLine{121 \textcolor{keyword}{struct }osmo\_twrtp;}
\DoxyCodeLine{122 }
\DoxyCodeLine{132 \textcolor{keyword}{struct }osmo\_twrtp\_stats \{}
\DoxyCodeLine{133         \textcolor{comment}{/* For ABI reasons, none of the following fields may be deleted}}
\DoxyCodeLine{134 \textcolor{comment}{         * or reordered! */}}
\DoxyCodeLine{135         uint32\_t rx\_rtp\_pkt;}
\DoxyCodeLine{136         uint32\_t rx\_rtp\_badsrc;}
\DoxyCodeLine{137         uint32\_t rx\_rtcp\_pkt;}
\DoxyCodeLine{138         uint32\_t rx\_rtcp\_badsrc;}
\DoxyCodeLine{139         uint32\_t rx\_rtcp\_invalid;}
\DoxyCodeLine{140         uint32\_t rx\_rtcp\_wrong\_ssrc;}
\DoxyCodeLine{141         uint32\_t tx\_rtp\_pkt;}
\DoxyCodeLine{142         uint32\_t tx\_rtp\_bytes;}
\DoxyCodeLine{143         uint32\_t tx\_rtcp\_pkt;}
\DoxyCodeLine{144         \textcolor{comment}{/* New fields may be added here at the end; once added, they become}}
\DoxyCodeLine{145 \textcolor{comment}{         * permanent like the initially defined ones. */}}
\DoxyCodeLine{146 \};}
\DoxyCodeLine{147 }
\DoxyCodeLine{148 \textcolor{comment}{/* declare structs that are used in our API */}}
\DoxyCodeLine{149 }
\DoxyCodeLine{150 \textcolor{keyword}{struct }osmo\_twjit;}
\DoxyCodeLine{151 \textcolor{keyword}{struct }osmo\_twjit\_config;}
\DoxyCodeLine{152 \textcolor{keyword}{struct }osmo\_twjit\_stats;}
\DoxyCodeLine{153 \textcolor{keyword}{struct }osmo\_twjit\_rr\_info;}
\DoxyCodeLine{154 }
\DoxyCodeLine{155 \textcolor{comment}{/* public API functions: create \& destroy, local and remote addresses */}}
\DoxyCodeLine{156 }
\DoxyCodeLine{157 \textcolor{keyword}{struct }osmo\_twrtp *}
\DoxyCodeLine{158 osmo\_twrtp\_create(\textcolor{keywordtype}{void} *ctx, uint16\_t clock\_khz, uint16\_t quantum\_ms,}
\DoxyCodeLine{159                   \textcolor{keywordtype}{bool} random\_ts\_seq,}
\DoxyCodeLine{160                   \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_twjit\_config *twjit\_config);}
\DoxyCodeLine{161 \textcolor{keywordtype}{void} osmo\_twrtp\_destroy(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{162 }
\DoxyCodeLine{163 \textcolor{keywordtype}{int} osmo\_twrtp\_supply\_fds(\textcolor{keyword}{struct} osmo\_twrtp *endp, \textcolor{keywordtype}{int} rtp\_fd, \textcolor{keywordtype}{int} rtcp\_fd);}
\DoxyCodeLine{164 \textcolor{keywordtype}{int} osmo\_twrtp\_bind\_local(\textcolor{keyword}{struct} osmo\_twrtp *endp,}
\DoxyCodeLine{165                           \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_sockaddr *rtp\_addr, \textcolor{keywordtype}{bool} bind\_rtcp);}
\DoxyCodeLine{166 \textcolor{keywordtype}{int} osmo\_twrtp\_set\_remote(\textcolor{keyword}{struct} osmo\_twrtp *endp,}
\DoxyCodeLine{167                           \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_sockaddr *rtp\_addr);}
\DoxyCodeLine{168 }
\DoxyCodeLine{169 \textcolor{comment}{/* receiving incoming RTP via twjit */}}
\DoxyCodeLine{170 }
\DoxyCodeLine{171 \textcolor{keywordtype}{void} osmo\_twrtp\_twjit\_rx\_ctrl(\textcolor{keyword}{struct} osmo\_twrtp *endp, \textcolor{keywordtype}{bool} rx\_enable);}
\DoxyCodeLine{172 }
\DoxyCodeLine{173 \textcolor{comment}{/* output function, to be called by TDM/GSM/etc fixed-\/timing side */}}
\DoxyCodeLine{174 \textcolor{keyword}{struct }msgb *osmo\_twrtp\_twjit\_rx\_poll(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{175 }
\DoxyCodeLine{176 \textcolor{comment}{/* receiving incoming RTP without twjit */}}
\DoxyCodeLine{177 }
\DoxyCodeLine{178 \textcolor{comment}{/* callback function takes ownership of msgb *if* it returns true */}}
\DoxyCodeLine{179 \textcolor{keyword}{typedef} bool (*osmo\_twrtp\_raw\_rx\_cb)(\textcolor{keyword}{struct }osmo\_twrtp *endp, \textcolor{keywordtype}{void} *user\_data,}
\DoxyCodeLine{180                                      \textcolor{keyword}{struct }msgb *msg);}
\DoxyCodeLine{181 }
\DoxyCodeLine{182 \textcolor{keywordtype}{void} osmo\_twrtp\_set\_raw\_rx\_cb(\textcolor{keyword}{struct} osmo\_twrtp *endp, osmo\_twrtp\_raw\_rx\_cb cb,}
\DoxyCodeLine{183                               \textcolor{keywordtype}{void} *user\_data);}
\DoxyCodeLine{184 }
\DoxyCodeLine{185 \textcolor{comment}{/* RTP Tx direction */}}
\DoxyCodeLine{186 }
\DoxyCodeLine{187 \textcolor{keywordtype}{int} osmo\_twrtp\_tx\_quantum(\textcolor{keyword}{struct} osmo\_twrtp *endp, \textcolor{keyword}{const} uint8\_t *payload,}
\DoxyCodeLine{188                           \textcolor{keywordtype}{unsigned} payload\_len, uint8\_t payload\_type,}
\DoxyCodeLine{189                           \textcolor{keywordtype}{bool} marker, \textcolor{keywordtype}{bool} auto\_marker, \textcolor{keywordtype}{bool} send\_rtcp);}
\DoxyCodeLine{190 \textcolor{keywordtype}{void} osmo\_twrtp\_tx\_skip(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{191 \textcolor{keywordtype}{void} osmo\_twrtp\_tx\_restart(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{192 }
\DoxyCodeLine{193 \textcolor{keywordtype}{int} osmo\_twrtp\_tx\_forward(\textcolor{keyword}{struct} osmo\_twrtp *endp, \textcolor{keyword}{struct} msgb *msg);}
\DoxyCodeLine{194 }
\DoxyCodeLine{195 \textcolor{comment}{/* support for emitting RTCP SR \& RR */}}
\DoxyCodeLine{196 }
\DoxyCodeLine{197 \textcolor{keywordtype}{int} osmo\_twrtp\_set\_sdes(\textcolor{keyword}{struct} osmo\_twrtp *endp, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *cname,}
\DoxyCodeLine{198                         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *email, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *phone,}
\DoxyCodeLine{199                         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *loc, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *tool, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *note);}
\DoxyCodeLine{200 \textcolor{keywordtype}{void} osmo\_twrtp\_set\_auto\_rtcp\_interval(\textcolor{keyword}{struct} osmo\_twrtp *endp,}
\DoxyCodeLine{201                                         uint16\_t interval);}
\DoxyCodeLine{202 }
\DoxyCodeLine{203 \textcolor{keywordtype}{int} osmo\_twrtp\_send\_rtcp\_rr(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{204 }
\DoxyCodeLine{205 \textcolor{comment}{/* information retrieval functions */}}
\DoxyCodeLine{206 }
\DoxyCodeLine{207 \textcolor{keyword}{struct }osmo\_twjit *osmo\_twrtp\_get\_twjit(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{208 }
\DoxyCodeLine{209 \textcolor{keyword}{const} \textcolor{keyword}{struct }osmo\_twrtp\_stats *osmo\_twrtp\_get\_stats(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{210 }
\DoxyCodeLine{211 \textcolor{comment}{/* have we received at least one RTCP RR matching our RTP Tx output? */}}
\DoxyCodeLine{212 \textcolor{keywordtype}{bool} osmo\_twrtp\_got\_rtcp\_rr(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{213 }
\DoxyCodeLine{214 \textcolor{comment}{/* retrieving RTCP RR info: valid only if above function returned true */}}
\DoxyCodeLine{215 uint32\_t osmo\_twrtp\_rr\_lost\_word(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{216 int32\_t osmo\_twrtp\_rr\_lost\_cumulative(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{217 uint32\_t osmo\_twrtp\_rr\_jitter\_last(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{218 uint32\_t osmo\_twrtp\_rr\_jitter\_max(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{219 }
\DoxyCodeLine{220 \textcolor{comment}{/* socket-\/related miscellany */}}
\DoxyCodeLine{221 }
\DoxyCodeLine{222 \textcolor{keywordtype}{int} osmo\_twrtp\_get\_rtp\_fd(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{223 \textcolor{keywordtype}{int} osmo\_twrtp\_get\_rtcp\_fd(\textcolor{keyword}{struct} osmo\_twrtp *endp);}
\DoxyCodeLine{224 }
\DoxyCodeLine{225 \textcolor{keywordtype}{int} osmo\_twrtp\_set\_dscp(\textcolor{keyword}{struct} osmo\_twrtp *endp, uint8\_t dscp);}
\DoxyCodeLine{226 \textcolor{keywordtype}{int} osmo\_twrtp\_set\_socket\_prio(\textcolor{keyword}{struct} osmo\_twrtp *endp, \textcolor{keywordtype}{int} prio);}
\DoxyCodeLine{227 }

\end{DoxyCode}
