\doxysection{src/ipa.c File Reference}
\label{ipa_8c}\index{src/ipa.c@{src/ipa.c}}
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/write\+\_\+queue.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/timer.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/socket.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/byteswap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/ipa.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/ipaccess.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/netif/ipa.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/mtp\+\_\+sap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/sccp\+\_\+sap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/osmo\+\_\+ss7.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/protocol/m3ua.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/protocol/sua.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/protocol/mtp.\+h$>$}\newline
{\ttfamily \#include \char`\"{}mtp3\+\_\+hmdc.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}ss7\+\_\+as.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}ss7\+\_\+asp.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}ss7\+\_\+internal.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}xua\+\_\+asp\+\_\+fsm.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}xua\+\_\+internal.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}xua\+\_\+msg.\+h\char`\"{}}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct msgb $\ast$ \textbf{ ipa\+\_\+gen\+\_\+ping} (void)
\item 
struct msgb $\ast$ \textbf{ ipa\+\_\+to\+\_\+msg} (struct \textbf{ xua\+\_\+msg} $\ast$xua)
\item 
int \textbf{ ipa\+\_\+tx\+\_\+xua\+\_\+as} (struct \textbf{ osmo\+\_\+ss7\+\_\+as} $\ast$as, struct \textbf{ xua\+\_\+msg} $\ast$xua)
\begin{DoxyCompactList}\small\item\em Send a given x\+UA message via a given IPA \char`\"{}\+Application Server\char`\"{}. \end{DoxyCompactList}\item 
static int \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+ccm} (struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$asp, struct msgb $\ast$msg)
\item 
struct \textbf{ osmo\+\_\+ss7\+\_\+as} $\ast$ \textbf{ ipa\+\_\+find\+\_\+as\+\_\+for\+\_\+asp} (struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$asp)
\item 
static struct msgb $\ast$ \textbf{ patch\+\_\+sccp\+\_\+with\+\_\+pc} (const struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$asp, const struct msgb $\ast$sccp\+\_\+msg\+\_\+in, uint32\+\_\+t \textbf{ opc}, uint32\+\_\+t \textbf{ dpc})
\item 
static int \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+up} (struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$asp, struct msgb $\ast$msg, uint8\+\_\+t \textbf{ sls})
\item 
int \textbf{ ipa\+\_\+rx\+\_\+msg} (struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$asp, struct msgb $\ast$msg, uint8\+\_\+t \textbf{ sls})
\begin{DoxyCompactList}\small\item\em process M3\+UA message received from socket \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\label{ipa_8c_a12edf7cefcd3d762bed8d90334498121}} 
\index{ipa.c@{ipa.c}!ipa\_find\_as\_for\_asp@{ipa\_find\_as\_for\_asp}}
\index{ipa\_find\_as\_for\_asp@{ipa\_find\_as\_for\_asp}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_find\_as\_for\_asp()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+ss7\+\_\+as} $\ast$ ipa\+\_\+find\+\_\+as\+\_\+for\+\_\+asp (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$}]{asp }\end{DoxyParamCaption})}



References \textbf{ osmo\+\_\+ss7\+\_\+instance\+::as\+\_\+list}, \textbf{ osmo\+\_\+ss7\+\_\+asp\+::inst}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::list}, \textbf{ NULL}, and \textbf{ osmo\+\_\+ss7\+\_\+as\+\_\+has\+\_\+asp()}.



Referenced by \textbf{ ipa\+\_\+asp\+\_\+fsm\+\_\+start()}, \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+osmo\+\_\+ext\+\_\+tcap\+\_\+routing()}, and \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+up()}.

\mbox{\label{ipa_8c_aee15f093ba0a2da1d52404d8180c8e8f}} 
\index{ipa.c@{ipa.c}!ipa\_gen\_ping@{ipa\_gen\_ping}}
\index{ipa\_gen\_ping@{ipa\_gen\_ping}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_gen\_ping()}
{\footnotesize\ttfamily struct msgb $\ast$ ipa\+\_\+gen\+\_\+ping (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



References \textbf{ NULL}.



Referenced by \textbf{ ipa\+\_\+t\+\_\+beat\+\_\+send()}.

\mbox{\label{ipa_8c_a1b8e22b504c31fbddfa6ddbdf1e5c9a3}} 
\index{ipa.c@{ipa.c}!ipa\_rx\_msg@{ipa\_rx\_msg}}
\index{ipa\_rx\_msg@{ipa\_rx\_msg}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_rx\_msg()}
{\footnotesize\ttfamily int ipa\+\_\+rx\+\_\+msg (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$}]{asp,  }\item[{struct msgb $\ast$}]{msg,  }\item[{uint8\+\_\+t}]{sls }\end{DoxyParamCaption})}



process M3\+UA message received from socket 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em asp} & Application Server Process receiving {\itshape msg} \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & received message buffer. It is kept owned by the caller. \\
\hline
\mbox{\texttt{ in}}  & {\em sls} & The SLS (signaling link selector) field to use in the generated M3\+UA header \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+ss7\+\_\+asp\+::cfg}, \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+ccm()}, \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+osmo\+\_\+ext\+\_\+tcap\+\_\+routing()}, \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+up()}, \textbf{ OSMO\+\_\+\+SS7\+\_\+\+ASP\+\_\+\+PROT\+\_\+\+IPA}, \textbf{ osmo\+\_\+ss7\+\_\+asp\+::proto}, and \textbf{ sls}.



Referenced by \textbf{ ipa\+\_\+cli\+\_\+read\+\_\+cb()}, and \textbf{ ss7\+\_\+asp\+\_\+ipa\+\_\+srv\+\_\+conn\+\_\+rx\+\_\+cb()}.

\mbox{\label{ipa_8c_aaa9c94e32279253d3bcd5fedc14851b1}} 
\index{ipa.c@{ipa.c}!ipa\_rx\_msg\_ccm@{ipa\_rx\_msg\_ccm}}
\index{ipa\_rx\_msg\_ccm@{ipa\_rx\_msg\_ccm}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_rx\_msg\_ccm()}
{\footnotesize\ttfamily static int ipa\+\_\+rx\+\_\+msg\+\_\+ccm (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$}]{asp,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+ss7\+\_\+asp\+::fi}, \textbf{ IPA\+\_\+\+ASP\+\_\+\+E\+\_\+\+ID\+\_\+\+ACK}, \textbf{ IPA\+\_\+\+ASP\+\_\+\+E\+\_\+\+ID\+\_\+\+GET}, \textbf{ IPA\+\_\+\+ASP\+\_\+\+E\+\_\+\+ID\+\_\+\+RESP}, \textbf{ LOGPASP}, \textbf{ msg\+\_\+type}, \textbf{ XUA\+\_\+\+ASP\+\_\+\+E\+\_\+\+ASPSM\+\_\+\+BEAT}, and \textbf{ XUA\+\_\+\+ASP\+\_\+\+E\+\_\+\+ASPSM\+\_\+\+BEAT\+\_\+\+ACK}.



Referenced by \textbf{ ipa\+\_\+rx\+\_\+msg()}.

\mbox{\label{ipa_8c_ac50c451535bde924f7efa536f5cb5444}} 
\index{ipa.c@{ipa.c}!ipa\_rx\_msg\_up@{ipa\_rx\_msg\_up}}
\index{ipa\_rx\_msg\_up@{ipa\_rx\_msg\_up}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_rx\_msg\_up()}
{\footnotesize\ttfamily static int ipa\+\_\+rx\+\_\+msg\+\_\+up (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$}]{asp,  }\item[{struct msgb $\ast$}]{msg,  }\item[{uint8\+\_\+t}]{sls }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+ss7\+\_\+as\+::cfg}, \textbf{ osmo\+\_\+ss7\+\_\+asp\+::cfg}, \textbf{ osmo\+\_\+ss7\+\_\+instance\+::cfg}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::ctrg}, \textbf{ dpc}, \textbf{ m3ua\+\_\+data\+\_\+hdr\+::dpc}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::dpc}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::inst}, \textbf{ osmo\+\_\+ss7\+\_\+asp\+::inst}, \textbf{ ipa\+\_\+find\+\_\+as\+\_\+for\+\_\+asp()}, \textbf{ LOGPASP}, \textbf{ m3ua\+\_\+dh\+\_\+to\+\_\+xfer\+\_\+param()}, \textbf{ m3ua\+\_\+xfer\+\_\+from\+\_\+data()}, \textbf{ xua\+\_\+msg\+::mtp}, \textbf{ mtp3\+\_\+hmdc\+\_\+rx\+\_\+from\+\_\+l2()}, \textbf{ MTP\+\_\+\+SI\+\_\+\+NI11\+\_\+\+OSMO\+\_\+\+IPA}, \textbf{ MTP\+\_\+\+SI\+\_\+\+SCCP}, \textbf{ osmo\+\_\+ss7\+\_\+instance\+::network\+\_\+indicator}, \textbf{ m3ua\+\_\+data\+\_\+hdr\+::ni}, \textbf{ NULL}, \textbf{ opc}, \textbf{ m3ua\+\_\+data\+\_\+hdr\+::opc}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::opc}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::opc\+\_\+enabled}, \textbf{ OSMO\+\_\+\+SS7\+\_\+\+ASP\+\_\+\+ROLE\+\_\+\+ASP}, \textbf{ OSMO\+\_\+\+SS7\+\_\+\+PATCH\+\_\+\+BOTH}, \textbf{ patch\+\_\+sccp\+\_\+with\+\_\+pc()}, \textbf{ osmo\+\_\+ss7\+\_\+routing\+\_\+key\+::pc}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::pc\+\_\+override}, \textbf{ osmo\+\_\+ss7\+\_\+asp\+::role}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::routing\+\_\+key}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::sccp\+\_\+mode}, \textbf{ m3ua\+\_\+data\+\_\+hdr\+::si}, \textbf{ sls}, \textbf{ m3ua\+\_\+data\+\_\+hdr\+::sls}, \textbf{ SS7\+\_\+\+AS\+\_\+\+CTR\+\_\+\+RX\+\_\+\+MSU\+\_\+\+SLS\+\_\+0}, \textbf{ SS7\+\_\+\+AS\+\_\+\+CTR\+\_\+\+RX\+\_\+\+MSU\+\_\+\+TOTAL}, and \textbf{ tcap\+\_\+as\+\_\+rx\+\_\+sccp\+\_\+asp()}.



Referenced by \textbf{ ipa\+\_\+rx\+\_\+msg()}.

\mbox{\label{ipa_8c_a3b1da84bb13edb98e00a12829804c1d6}} 
\index{ipa.c@{ipa.c}!ipa\_to\_msg@{ipa\_to\_msg}}
\index{ipa\_to\_msg@{ipa\_to\_msg}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_to\_msg()}
{\footnotesize\ttfamily struct msgb $\ast$ ipa\+\_\+to\+\_\+msg (\begin{DoxyParamCaption}\item[{struct \textbf{ xua\+\_\+msg} $\ast$}]{xua }\end{DoxyParamCaption})}



References \textbf{ xua\+\_\+msg\+\_\+part\+::dat}, \textbf{ xua\+\_\+msg\+\_\+part\+::len}, \textbf{ M3\+UA\+\_\+\+IEI\+\_\+\+PROT\+\_\+\+DATA}, \textbf{ MTP\+\_\+\+SI\+\_\+\+NI11\+\_\+\+OSMO\+\_\+\+IPA}, \textbf{ MTP\+\_\+\+SI\+\_\+\+SCCP}, \textbf{ NULL}, \textbf{ m3ua\+\_\+data\+\_\+hdr\+::si}, and \textbf{ xua\+\_\+msg\+\_\+find\+\_\+tag()}.



Referenced by \textbf{ xua\+\_\+as\+\_\+encode\+\_\+msg()}.

\mbox{\label{ipa_8c_a4473443b022e57cc48e07677c14650ae}} 
\index{ipa.c@{ipa.c}!ipa\_tx\_xua\_as@{ipa\_tx\_xua\_as}}
\index{ipa\_tx\_xua\_as@{ipa\_tx\_xua\_as}!ipa.c@{ipa.c}}
\doxysubsubsection{ipa\_tx\_xua\_as()}
{\footnotesize\ttfamily int ipa\+\_\+tx\+\_\+xua\+\_\+as (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+ss7\+\_\+as} $\ast$}]{as,  }\item[{struct \textbf{ xua\+\_\+msg} $\ast$}]{xua }\end{DoxyParamCaption})}



Send a given x\+UA message via a given IPA \char`\"{}\+Application Server\char`\"{}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em as} & Application Server through which to send {\itshape xua} \\
\hline
\mbox{\texttt{ in}}  & {\em xua} & x\+UA message to be sent \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error
\end{DoxyReturn}
This function takes ownership of xua msg passed to it. 

References \textbf{ osmo\+\_\+ss7\+\_\+as\+::cfg}, \textbf{ OSMO\+\_\+\+SS7\+\_\+\+ASP\+\_\+\+PROT\+\_\+\+IPA}, \textbf{ osmo\+\_\+ss7\+\_\+as\+::proto}, and \textbf{ xua\+\_\+as\+\_\+transmit\+\_\+msg()}.



Referenced by \textbf{ mtp3\+\_\+hmrt\+\_\+message\+\_\+for\+\_\+routing()}.

\mbox{\label{ipa_8c_a25d7c0b6b9805f816365801ab6c45a5b}} 
\index{ipa.c@{ipa.c}!patch\_sccp\_with\_pc@{patch\_sccp\_with\_pc}}
\index{patch\_sccp\_with\_pc@{patch\_sccp\_with\_pc}!ipa.c@{ipa.c}}
\doxysubsubsection{patch\_sccp\_with\_pc()}
{\footnotesize\ttfamily static struct msgb $\ast$ patch\+\_\+sccp\+\_\+with\+\_\+pc (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+ss7\+\_\+asp} $\ast$}]{asp,  }\item[{const struct msgb $\ast$}]{sccp\+\_\+msg\+\_\+in,  }\item[{uint32\+\_\+t}]{opc,  }\item[{uint32\+\_\+t}]{dpc }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ dpc}, \textbf{ LOGPASP}, \textbf{ NULL}, \textbf{ opc}, \textbf{ OSMO\+\_\+\+SCCP\+\_\+\+ADDR\+\_\+\+T\+\_\+\+PC}, \textbf{ osmo\+\_\+sccp\+\_\+to\+\_\+xua()}, \textbf{ osmo\+\_\+sua\+\_\+to\+\_\+sccp()}, \textbf{ osmo\+\_\+sccp\+\_\+addr\+::pc}, \textbf{ osmo\+\_\+sccp\+\_\+addr\+::presence}, \textbf{ sua\+\_\+addr\+\_\+parse()}, \textbf{ SUA\+\_\+\+IEI\+\_\+\+DEST\+\_\+\+ADDR}, \textbf{ SUA\+\_\+\+IEI\+\_\+\+SRC\+\_\+\+ADDR}, \textbf{ xua\+\_\+msg\+\_\+add\+\_\+sccp\+\_\+addr()}, \textbf{ xua\+\_\+msg\+\_\+free()}, and \textbf{ xua\+\_\+msg\+\_\+free\+\_\+tag()}.



Referenced by \textbf{ ipa\+\_\+rx\+\_\+msg\+\_\+up()}.

