\doxysection{src/sccp\+\_\+user.c File Reference}
\label{sccp__user_8c}\index{src/sccp\_user.c@{src/sccp\_user.c}}
{\ttfamily \#include $<$stdbool.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$limits.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/osmo\+\_\+ss7.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/sccp\+\_\+sap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/mtp\+\_\+sap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/protocol/mtp.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sigtran/sccp\+\_\+helpers.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/sccp/sccp\+\_\+types.\+h$>$}\newline
{\ttfamily \#include "{}sccp\+\_\+connection.\+h"{}}\newline
{\ttfamily \#include "{}sccp\+\_\+instance.\+h"{}}\newline
{\ttfamily \#include "{}sccp\+\_\+internal.\+h"{}}\newline
{\ttfamily \#include "{}sccp\+\_\+user.\+h"{}}\newline
{\ttfamily \#include "{}xua\+\_\+internal.\+h"{}}\newline
{\ttfamily \#include "{}ss7\+\_\+as.\+h"{}}\newline
{\ttfamily \#include "{}ss7\+\_\+asp.\+h"{}}\newline
{\ttfamily \#include "{}ss7\+\_\+route.\+h"{}}\newline
{\ttfamily \#include "{}ss7\+\_\+route\+\_\+table.\+h"{}}\newline
{\ttfamily \#include "{}ss7\+\_\+internal.\+h"{}}\newline
{\ttfamily \#include "{}ss7\+\_\+xua\+\_\+srv.\+h"{}}\newline
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$ \textbf{ sccp\+\_\+user\+\_\+alloc} (struct \textbf{ osmo\+\_\+sccp\+\_\+instance} $\ast$inst, const char $\ast$name, osmo\+\_\+prim\+\_\+cb prim\+\_\+cb, uint16\+\_\+t \textbf{ ssn}, uint32\+\_\+t \textbf{ pc})
\item 
static void \textbf{ sccp\+\_\+user\+\_\+flush\+\_\+connections} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu)
\item 
void \textbf{ sccp\+\_\+user\+\_\+free} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu)
\item 
void \textbf{ osmo\+\_\+sccp\+\_\+user\+\_\+unbind} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu)
\begin{DoxyCompactList}\small\item\em Unbind a given SCCP user. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+sccp\+\_\+user\+\_\+set\+\_\+priv} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu, void $\ast$priv)
\item 
void $\ast$ \textbf{ osmo\+\_\+sccp\+\_\+user\+\_\+get\+\_\+priv} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu)
\item 
int \textbf{ sccp\+\_\+user\+\_\+prim\+\_\+up} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu, struct \textbf{ osmo\+\_\+scu\+\_\+prim} $\ast$prim)
\begin{DoxyCompactList}\small\item\em Send a SCCP User SAP Primitive up to the User. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+sccp\+\_\+user\+\_\+name} (struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu)
\begin{DoxyCompactList}\small\item\em Compose a human readable string to describe the SCCP user\textquotesingle{}s connection. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+sccp\+\_\+instance} $\ast$ \textbf{ osmo\+\_\+sccp\+\_\+get\+\_\+sccp} (const struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$scu)
\begin{DoxyCompactList}\small\item\em get the SCCP instance that is related to the given sccp user \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\label{sccp__user_8c_a2d9b935c8121fab24c082eb19ba4c61d} 
\index{sccp\_user.c@{sccp\_user.c}!osmo\_sccp\_get\_sccp@{osmo\_sccp\_get\_sccp}}
\index{osmo\_sccp\_get\_sccp@{osmo\_sccp\_get\_sccp}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{osmo\_sccp\_get\_sccp()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+sccp\+\_\+instance} $\ast$ osmo\+\_\+sccp\+\_\+get\+\_\+sccp (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu }\end{DoxyParamCaption})}



get the SCCP instance that is related to the given sccp user 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em scu} & SCCP user \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
SCCP instance; NULL if scu was NULL 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+sccp\+\_\+user\+::inst}, and \textbf{ NULL}.

\label{sccp__user_8c_a7454eca93e50d156d85fccc82073ac76} 
\index{sccp\_user.c@{sccp\_user.c}!osmo\_sccp\_user\_get\_priv@{osmo\_sccp\_user\_get\_priv}}
\index{osmo\_sccp\_user\_get\_priv@{osmo\_sccp\_user\_get\_priv}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{osmo\_sccp\_user\_get\_priv()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+sccp\+\_\+user\+\_\+get\+\_\+priv (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu }\end{DoxyParamCaption})}



References \textbf{ osmo\+\_\+sccp\+\_\+user\+::priv}.

\label{sccp__user_8c_ac95418f1985ff6dd5661c4aaad92b373} 
\index{sccp\_user.c@{sccp\_user.c}!osmo\_sccp\_user\_name@{osmo\_sccp\_user\_name}}
\index{osmo\_sccp\_user\_name@{osmo\_sccp\_user\_name}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{osmo\_sccp\_user\_name()}
{\footnotesize\ttfamily const char $\ast$ osmo\+\_\+sccp\+\_\+user\+\_\+name (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu }\end{DoxyParamCaption})}



Compose a human readable string to describe the SCCP user\textquotesingle{}s connection. 

The output follows [\textquotesingle{}$<$scu.\+name$>$\textquotesingle{}\+:]$<$local-\/sccp-\/addr$>$, e.\+g. "{}\textquotesingle{}\+Osmo\+HNBW\textquotesingle{}\+:\+RI=\+SSN\+\_\+\+PC,\+PC=0.\+23.\+5,\+SSN=\+RANAP"{}, or just "{}\+RI=\+SSN\+\_\+\+PC,\+PC=0.\+23.\+5,\+SSN=\+RANAP"{} if no scu-\/$>$name is set. This calls \doxyref{osmo\+\_\+sccp\+\_\+addr\+\_\+name()}{p.}{sccp__helpers_8h_ab751c4579907146b3194fda7eb54a5ec}, which returns a static buffer; hence calling this function and \doxyref{osmo\+\_\+sccp\+\_\+addr\+\_\+name()}{p.}{sccp__helpers_8h_ab751c4579907146b3194fda7eb54a5ec} in the same printf statement is likely to conflict. 

References \textbf{ osmo\+\_\+sccp\+\_\+user\+::inst}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::name}, \textbf{ osmo\+\_\+sccp\+\_\+addr\+\_\+name()}, \textbf{ osmo\+\_\+sccp\+\_\+make\+\_\+addr\+\_\+pc\+\_\+ssn()}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::pc}, \textbf{ osmo\+\_\+sccp\+\_\+instance\+::ss7}, and \textbf{ osmo\+\_\+sccp\+\_\+user\+::ssn}.

\label{sccp__user_8c_a232a3859dff9bb004f12999c9717c82c} 
\index{sccp\_user.c@{sccp\_user.c}!osmo\_sccp\_user\_set\_priv@{osmo\_sccp\_user\_set\_priv}}
\index{osmo\_sccp\_user\_set\_priv@{osmo\_sccp\_user\_set\_priv}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{osmo\_sccp\_user\_set\_priv()}
{\footnotesize\ttfamily void osmo\+\_\+sccp\+\_\+user\+\_\+set\+\_\+priv (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu,  }\item[{void $\ast$}]{priv }\end{DoxyParamCaption})}



References \textbf{ osmo\+\_\+sccp\+\_\+user\+::priv}.

\label{sccp__user_8c_ae2b5a2f259d5c4cf9b0e9dd9ba298665} 
\index{sccp\_user.c@{sccp\_user.c}!osmo\_sccp\_user\_unbind@{osmo\_sccp\_user\_unbind}}
\index{osmo\_sccp\_user\_unbind@{osmo\_sccp\_user\_unbind}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{osmo\_sccp\_user\_unbind()}
{\footnotesize\ttfamily void osmo\+\_\+sccp\+\_\+user\+\_\+unbind (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu }\end{DoxyParamCaption})}



Unbind a given SCCP user. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em scu} & SCCP User which is to be un-\/bound. Will be destroyed at the time this function returns. \\
\hline
\end{DoxyParams}


References \textbf{ LOGPSCU}, and \textbf{ sccp\+\_\+user\+\_\+free()}.



Referenced by \textbf{ osmo\+\_\+sccp\+\_\+instance\+\_\+destroy()}.

\label{sccp__user_8c_afb4322f88ee265f1c791e51406dfad0b} 
\index{sccp\_user.c@{sccp\_user.c}!sccp\_user\_alloc@{sccp\_user\_alloc}}
\index{sccp\_user\_alloc@{sccp\_user\_alloc}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{sccp\_user\_alloc()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$ sccp\+\_\+user\+\_\+alloc (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+instance} $\ast$}]{inst,  }\item[{const char $\ast$}]{name,  }\item[{osmo\+\_\+prim\+\_\+cb}]{prim\+\_\+cb,  }\item[{uint16\+\_\+t}]{ssn,  }\item[{uint32\+\_\+t}]{pc }\end{DoxyParamCaption})}



References \textbf{ osmo\+\_\+sccp\+\_\+user\+::inst}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::list}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::name}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::pc}, \textbf{ pc}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::prim\+\_\+cb}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::ssn}, \textbf{ ssn}, and \textbf{ osmo\+\_\+sccp\+\_\+instance\+::users}.



Referenced by \textbf{ sccp\+\_\+user\+\_\+bind\+\_\+pc()}.

\label{sccp__user_8c_a9c68ef79315b7ad266e4d5c00253716d} 
\index{sccp\_user.c@{sccp\_user.c}!sccp\_user\_flush\_connections@{sccp\_user\_flush\_connections}}
\index{sccp\_user\_flush\_connections@{sccp\_user\_flush\_connections}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{sccp\_user\_flush\_connections()}
{\footnotesize\ttfamily static void sccp\+\_\+user\+\_\+flush\+\_\+connections (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+sccp\+\_\+instance\+::connections}, \textbf{ osmo\+\_\+sccp\+\_\+user\+::inst}, \textbf{ sccp\+\_\+connection\+::node}, \textbf{ sccp\+\_\+conn\+\_\+free()}, and \textbf{ sccp\+\_\+connection\+::user}.



Referenced by \textbf{ sccp\+\_\+user\+\_\+free()}.

\label{sccp__user_8c_a804c5c2daea1c5377605bb77498c5358} 
\index{sccp\_user.c@{sccp\_user.c}!sccp\_user\_free@{sccp\_user\_free}}
\index{sccp\_user\_free@{sccp\_user\_free}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{sccp\_user\_free()}
{\footnotesize\ttfamily void sccp\+\_\+user\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu }\end{DoxyParamCaption})}



References \textbf{ osmo\+\_\+sccp\+\_\+user\+::list}, and \textbf{ sccp\+\_\+user\+\_\+flush\+\_\+connections()}.



Referenced by \textbf{ osmo\+\_\+sccp\+\_\+user\+\_\+unbind()}.

\label{sccp__user_8c_a26760477f3cab4b33aa24e964bb2d91a} 
\index{sccp\_user.c@{sccp\_user.c}!sccp\_user\_prim\_up@{sccp\_user\_prim\_up}}
\index{sccp\_user\_prim\_up@{sccp\_user\_prim\_up}!sccp\_user.c@{sccp\_user.c}}
\doxysubsubsection{sccp\_user\_prim\_up()}
{\footnotesize\ttfamily int sccp\+\_\+user\+\_\+prim\+\_\+up (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+sccp\+\_\+user} $\ast$}]{scu,  }\item[{struct \textbf{ osmo\+\_\+scu\+\_\+prim} $\ast$}]{prim }\end{DoxyParamCaption})}



Send a SCCP User SAP Primitive up to the User. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em scu} & SCCP User to whom to send the primitive \\
\hline
\mbox{\texttt{ in}}  & {\em prim} & Primitive to send to the user \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
return value of the SCCP User\textquotesingle{}s prim\+\_\+cb() function
\end{DoxyReturn}
Ownership of prim-\/$>$oph-\/$>$msg is passed to the user of the registered callback 

References \textbf{ LOGPSCU}, \textbf{ osmo\+\_\+scu\+\_\+prim\+::oph}, \textbf{ osmo\+\_\+scu\+\_\+prim\+\_\+name()}, and \textbf{ osmo\+\_\+sccp\+\_\+user\+::prim\+\_\+cb}.



Referenced by \textbf{ sccp\+\_\+conn\+\_\+scu\+\_\+gen\+\_\+encode\+\_\+and\+\_\+send()}, \textbf{ sccp\+\_\+lbcs\+\_\+local\+\_\+bcast\+\_\+pcstate()}, \textbf{ sccp\+\_\+lbcs\+\_\+local\+\_\+bcast\+\_\+state()}, \textbf{ sclc\+\_\+rx\+\_\+cldr()}, and \textbf{ sclc\+\_\+rx\+\_\+cldt()}.

