\doxysection{ipa.\+h}
\label{ipa_8h_source}\index{include/osmocom/netif/ipa.h@{include/osmocom/netif/ipa.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ \_OSMO\_NETIF\_IPA\_H\_}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ \_OSMO\_NETIF\_IPA\_H\_}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <osmocom/gsm/protocol/ipaccess.h>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <osmocom/gsm/ipa.h>}}
\DoxyCodeLine{00006\ }
\DoxyCodeLine{00007\ \textcolor{comment}{/*\ This\ is\ like\ 'struct\ ipaccess\_head'\ in\ libosmocore,\ but\ 'ipa\_head'\ is}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ actually\ the\ more\ apropriate\ name,\ so\ rather\ than\ making\ more\ code}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ use\ the\ wrong\ name,\ let's\ keep\ the\ duplicate\ header\ definitions\ below\ */}}
\DoxyCodeLine{00010\ \textcolor{keyword}{struct\ }ipa\_head\ \{}
\DoxyCodeLine{00011\ \ \ \ \ \ \ \ \ uint16\_t\ len;\ \ \ \textcolor{comment}{/*\ network\ byte\ order\ */}}
\DoxyCodeLine{00012\ \ \ \ \ \ \ \ \ uint8\_t\ proto;}
\DoxyCodeLine{00013\ \ \ \ \ \ \ \ \ uint8\_t\ data[0];}
\DoxyCodeLine{00014\ \}\ \_\_attribute\_\_\ ((packed));}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{keyword}{struct\ }ipa\_head\_ext\ \{}
\DoxyCodeLine{00017\ \ \ \ \ \ \ \ \ uint8\_t\ proto;}
\DoxyCodeLine{00018\ \ \ \ \ \ \ \ \ uint8\_t\ data[0];}
\DoxyCodeLine{00019\ \}\ \_\_attribute\_\_\ ((packed));}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{keyword}{struct\ }osmo\_ipa\_msgb\_cb\ \{}
\DoxyCodeLine{00022\ \ \ \ \ \ \ \ \ uint8\_t\ proto;}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ uint8\_t\ proto\_ext;}
\DoxyCodeLine{00024\ \}\ \_\_attribute\_\_\ ((packed));}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{comment}{/*\ We\ don't\ just\ cast\ to\ 'struct\ osmo\_ipa\_msgb\_cb\ *',\ because\ that\ would}}
\DoxyCodeLine{00028\ \textcolor{comment}{\ *\ break\ the\ strict\ aliasing\ rule.\ Casting\ to\ a\ reference\ to\ a\ union\ with}}
\DoxyCodeLine{00029\ \textcolor{comment}{\ *\ a\ compatible\ struct\ member\ seems\ to\ be\ allowed,\ though,\ see:}}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ \ \ \ \ \ N1570\ Committee\ Draft\ —\ April\ 12,\ 2011\ ISO/IEC\ 9899:201x,}}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ \ \ \ \ \ Section\ 6.5,\ §7\ */}}
\DoxyCodeLine{00032\ \textcolor{preprocessor}{\#define\ OSMO\_IPA\_MSGB\_CB(\_\_msg)\ (\&(((\ \(\backslash\)}}
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ union\ \{\ \(\backslash\)}}
\DoxyCodeLine{00034\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ unsigned\ long\ cb;\ \(\backslash\)}}
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ osmo\_ipa\_msgb\_cb\ \_cb;\ \(\backslash\)}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \(\backslash\)}}
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *)\&((\_\_msg)-\/>cb[0]))-\/>\_cb))}}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \textcolor{preprocessor}{\#define\ osmo\_ipa\_msgb\_cb\_proto(\_\_x)\ \ \ \ \ OSMO\_IPA\_MSGB\_CB(\_\_x)-\/>proto}}
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#define\ osmo\_ipa\_msgb\_cb\_proto\_ext(\_\_x)\ OSMO\_IPA\_MSGB\_CB(\_\_x)-\/>proto\_ext}}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \textcolor{keyword}{struct\ }msgb\ *osmo\_ipa\_msg\_alloc(\textcolor{keywordtype}{int}\ headroom);}
\DoxyCodeLine{00043\ \textcolor{keyword}{struct\ }msgb\ *osmo\_ipa\_ext\_msg\_alloc(\textcolor{keywordtype}{size\_t}\ headroom);}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \textcolor{keywordtype}{void}\ osmo\_ipa\_msg\_push\_header(\textcolor{keyword}{struct}\ msgb\ *msg,\ uint8\_t\ proto);}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00047\ \textcolor{keywordtype}{int}\ osmo\_ipa\_process\_msg(\textcolor{keyword}{struct}\ msgb\ *msg);}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ \textcolor{keyword}{struct\ }osmo\_fd;}
\DoxyCodeLine{00050\ \textcolor{keyword}{struct\ }tlv\_parsed;}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ \textcolor{keywordtype}{int}\ osmo\_ipa\_rcvmsg\_base(\textcolor{keyword}{struct}\ msgb\ *msg,\ \textcolor{keyword}{struct}\ osmo\_fd\ *bfd,\ \textcolor{keywordtype}{int}\ server);}
\DoxyCodeLine{00053\ \textcolor{keywordtype}{int}\ osmo\_ipa\_parse\_unitid(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *str,\ \textcolor{keyword}{struct}\ ipaccess\_unit\ *unit\_data);}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \textcolor{keywordtype}{int}\ ipaccess\_send\_pong(\textcolor{keywordtype}{int}\ fd);}
\DoxyCodeLine{00056\ \textcolor{keywordtype}{int}\ ipaccess\_send\_id\_ack(\textcolor{keywordtype}{int}\ fd);}
\DoxyCodeLine{00057\ \textcolor{keywordtype}{int}\ ipaccess\_send\_id\_req(\textcolor{keywordtype}{int}\ fd);}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \textcolor{keyword}{struct\ }osmo\_ipa\_unit;}
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ \textcolor{keyword}{struct\ }msgb\ *ipa\_cli\_id\_resp(\textcolor{keyword}{struct}\ osmo\_ipa\_unit\ *dev,\ uint8\_t\ *data,\ \textcolor{keywordtype}{int}\ len);}
\DoxyCodeLine{00062\ \textcolor{keyword}{struct\ }msgb\ *ipa\_cli\_id\_ack(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \textcolor{keywordtype}{int}\ osmo\_ipa\_parse\_msg\_id\_resp(\textcolor{keyword}{struct}\ msgb\ *msg,\ \textcolor{keyword}{struct}\ ipaccess\_unit\ *unit\_data);}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \textcolor{keywordtype}{int}\ osmo\_ipa\_segmentation\_cb(\textcolor{keyword}{struct}\ msgb\ *msg);}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \textcolor{keywordtype}{void}\ osmo\_ipa\_msg\_push\_headers(\textcolor{keyword}{struct}\ msgb\ *msg,\ \textcolor{keyword}{enum}\ ipaccess\_proto\ p,\ \textcolor{keyword}{enum}\ ipaccess\_proto\_ext\ pe);}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{00071\ \textcolor{comment}{\ *\ IPA\ Keep-\/Alive\ FSM}}
\DoxyCodeLine{00072\ \textcolor{comment}{\ ***********************************************************************/}}
\DoxyCodeLine{00073\ \textcolor{keyword}{struct\ }osmo\_ipa\_ka\_fsm\_inst;}
\DoxyCodeLine{00074\ \textcolor{keyword}{typedef}\ int\ (*osmo\_ipa\_ka\_fsm\_timeout\_cb\_t)(\textcolor{keyword}{struct\ }osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ \textcolor{keywordtype}{void}\ *data);}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ \textcolor{keyword}{typedef}\ int\ (*osmo\_ipa\_ka\_fsm\_send\_cb\_t)(\textcolor{keyword}{struct\ }osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ \textcolor{keyword}{struct\ }msgb\ *msg,\ \textcolor{keywordtype}{void}\ *data);}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ \textcolor{keyword}{struct\ }osmo\_ipa\_ka\_fsm\_inst\ *osmo\_ipa\_ka\_fsm\_alloc(\textcolor{keywordtype}{void}\ *ctx,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\textcolor{keywordtype}{id});}
\DoxyCodeLine{00079\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_free(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi);}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \textcolor{keywordtype}{int}\ osmo\_ipa\_ka\_fsm\_set\_id(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *\textcolor{keywordtype}{id});}
\DoxyCodeLine{00082\ \textcolor{keywordtype}{int}\ osmo\_ipa\_ka\_fsm\_set\_ping\_interval(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ interval);}
\DoxyCodeLine{00083\ \textcolor{keywordtype}{int}\ osmo\_ipa\_ka\_fsm\_set\_pong\_timeout(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ timeout);}
\DoxyCodeLine{00084\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_set\_data(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ \textcolor{keywordtype}{void}\ *cb\_data);}
\DoxyCodeLine{00085\ \textcolor{keywordtype}{void}\ *osmo\_ipa\_ka\_fsm\_get\_data(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi);}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_set\_send\_cb(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ osmo\_ipa\_ka\_fsm\_send\_cb\_t\ send\_cb);}
\DoxyCodeLine{00088\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_set\_timeout\_cb(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi,\ osmo\_ipa\_ka\_fsm\_timeout\_cb\_t\ timeout\_cb);}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00090\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_start(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi);}
\DoxyCodeLine{00091\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_pong\_received(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi);}
\DoxyCodeLine{00092\ \textcolor{keywordtype}{void}\ osmo\_ipa\_ka\_fsm\_stop(\textcolor{keyword}{struct}\ osmo\_ipa\_ka\_fsm\_inst\ *ka\_fi);}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
