\doxysection{src/gb/gprs\+\_\+ns.c File Reference}
\label{gprs__ns_8c}\index{src/gb/gprs\_ns.c@{src/gb/gprs\_ns.c}}


GPRS Networks Service (NS) messages on the Gb interface.  


{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$sys/types.\+h$>$}\newline
{\ttfamily \#include $<$sys/socket.\+h$>$}\newline
{\ttfamily \#include $<$arpa/inet.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/fsm.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/byteswap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/tlv.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/select.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/rate\+\_\+ctr.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/stat\+\_\+item.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/stats.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/socket.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/signal.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gprs/gprs\+\_\+ns.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gprs/gprs\+\_\+bssgp.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gprs/gprs\+\_\+ns\+\_\+frgre.\+h$>$}\newline
{\ttfamily \#include \char`\"{}common\+\_\+vty.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}gb\+\_\+internal.\+h\char`\"{}}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ ns\+\_\+set\+\_\+state}(ns\+\_\+,  st\+\_\+)~\textbf{ ns\+\_\+set\+\_\+state\+\_\+with\+\_\+log}(ns\+\_\+, st\+\_\+, false, \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\item 
\#define \textbf{ ns\+\_\+set\+\_\+remote\+\_\+state}(ns\+\_\+,  st\+\_\+)~\textbf{ ns\+\_\+set\+\_\+state\+\_\+with\+\_\+log}(ns\+\_\+, st\+\_\+, true, \+\_\+\+\_\+\+FILE\+\_\+\+\_\+, \+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\item 
\#define \textbf{ ns\+\_\+mark\+\_\+blocked}(ns\+\_\+)~\textbf{ ns\+\_\+set\+\_\+state}(ns\+\_\+, (ns\+\_\+)-\/$>$state $\vert$ \textbf{ NSE\+\_\+\+S\+\_\+\+BLOCKED})
\item 
\#define \textbf{ ns\+\_\+mark\+\_\+unblocked}(ns\+\_\+)~\textbf{ ns\+\_\+set\+\_\+state}(ns\+\_\+, (ns\+\_\+)-\/$>$state \& ($\sim$\textbf{ NSE\+\_\+\+S\+\_\+\+BLOCKED}));
\item 
\#define \textbf{ ns\+\_\+mark\+\_\+alive}(ns\+\_\+)~\textbf{ ns\+\_\+set\+\_\+state}(ns\+\_\+, (ns\+\_\+)-\/$>$state $\vert$ \textbf{ NSE\+\_\+\+S\+\_\+\+ALIVE})
\item 
\#define \textbf{ ns\+\_\+mark\+\_\+dead}(ns\+\_\+)~\textbf{ ns\+\_\+set\+\_\+state}(ns\+\_\+, (ns\+\_\+)-\/$>$state \& ($\sim$\textbf{ NSE\+\_\+\+S\+\_\+\+ALIVE}));
\item 
\#define \textbf{ ERR\+\_\+\+IF\+\_\+\+NSVC\+\_\+\+USES\+\_\+\+SNS}(nsvc,  reason)
\item 
\#define \textbf{ CHECK\+\_\+\+TX\+\_\+\+RC}(rc,  nsvc)
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ ns\+\_\+ctr} \{ \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+IN}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+OUT}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+IN}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+OUT}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BLOCKED}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+DEAD}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+REPLACED}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+NSEI\+\_\+\+CHG}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+INV\+\_\+\+VCI}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+INV\+\_\+\+NSEI}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+LOST\+\_\+\+ALIVE}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+LOST\+\_\+\+RESET}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+IN}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+OUT}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+OUT\+\_\+\+DROP}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+IN}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+OUT}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+OUT\+\_\+\+DROP}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+BLOCKED}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+UNBLOCKED}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+DEAD}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+REPLACED}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+NSEI\+\_\+\+CHG}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+INV\+\_\+\+VCI}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+INV\+\_\+\+NSEI}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+LOST\+\_\+\+ALIVE}
, \newline
\textbf{ NS\+\_\+\+CTR\+\_\+\+LOST\+\_\+\+RESET}
 \}
\item 
enum \textbf{ ns\+\_\+stat} \{ \textbf{ NS\+\_\+\+STAT\+\_\+\+ALIVE\+\_\+\+DELAY}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static bool \textbf{ nsvc\+\_\+is\+\_\+not\+\_\+used} (const struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
struct \textbf{ msgb} $\ast$ \textbf{ gprs\+\_\+ns\+\_\+msgb\+\_\+alloc} (void)
\item 
static void \textbf{ ns\+\_\+set\+\_\+state\+\_\+with\+\_\+log} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint32\+\_\+t state, bool is\+\_\+remote, const char $\ast$\textbf{ file}, unsigned line)
\item 
struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+nsvc\+\_\+by\+\_\+nsvci} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, uint16\+\_\+t nsvci)
\begin{DoxyCompactList}\small\item\em Lookup struct \doxyref{gprs\+\_\+nsvc}{p.}{structgprs__nsvc} based on NSVCI. \end{DoxyCompactList}\item 
struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+nsvc\+\_\+by\+\_\+nsei} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, uint16\+\_\+t \textbf{ nsei})
\begin{DoxyCompactList}\small\item\em Lookup struct \doxyref{gprs\+\_\+nsvc}{p.}{structgprs__nsvc} based on NSEI. \end{DoxyCompactList}\item 
static struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+active\+\_\+nsvc\+\_\+by\+\_\+nsei} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, uint16\+\_\+t \textbf{ nsei}, uint16\+\_\+t \textbf{ bvci})
\begin{DoxyCompactList}\small\item\em Determine active NS-\/\+VC for given NSEI + BVCI. \end{DoxyCompactList}\item 
struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+nsvc\+\_\+by\+\_\+rem\+\_\+addr} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, const struct sockaddr\+\_\+in $\ast$sin)
\begin{DoxyCompactList}\small\item\em Lookup NS-\/\+VC based on specified remote peer socket addr. \end{DoxyCompactList}\item 
static void \textbf{ gprs\+\_\+ns\+\_\+timer\+\_\+cb} (void $\ast$\textbf{ data})
\item 
struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+nsvc\+\_\+create2} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, uint16\+\_\+t nsvci, uint8\+\_\+t \textbf{ sig\+\_\+weight}, uint8\+\_\+t \textbf{ data\+\_\+weight})
\begin{DoxyCompactList}\small\item\em Create a new NS-\/\+VC (Virtual Circuit) within given instance. \end{DoxyCompactList}\item 
void \textbf{ gprs\+\_\+nsvc\+\_\+delete} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Delete given NS-\/\+VC. \end{DoxyCompactList}\item 
static void \textbf{ ns\+\_\+osmo\+\_\+signal\+\_\+dispatch} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, unsigned int signal, uint8\+\_\+t \textbf{ cause})
\item 
static void \textbf{ ns\+\_\+osmo\+\_\+signal\+\_\+dispatch\+\_\+mismatch} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t \textbf{ pdu\+\_\+type}, uint8\+\_\+t ie\+\_\+type)
\item 
static void \textbf{ ns\+\_\+osmo\+\_\+signal\+\_\+dispatch\+\_\+replaced} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ gprs\+\_\+nsvc} $\ast$old\+\_\+nsvc)
\item 
const char $\ast$ \textbf{ gprs\+\_\+ns\+\_\+cause\+\_\+str} (enum \textbf{ ns\+\_\+cause} \textbf{ cause})
\begin{DoxyCompactList}\small\item\em Obtain a human-\/readable string for NS cause value. \end{DoxyCompactList}\item 
static int \textbf{ nsip\+\_\+sendmsg} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
int \textbf{ grps\+\_\+ns\+\_\+frgre\+\_\+sendmsg} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static bool \textbf{ ns\+\_\+is\+\_\+sns} (uint8\+\_\+t \textbf{ pdu\+\_\+type})
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+tx} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+simple} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t \textbf{ pdu\+\_\+type})
\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+reset} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t \textbf{ cause})
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+RESET on a given NSVC. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+status} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t \textbf{ cause}, uint16\+\_\+t \textbf{ bvci}, struct \textbf{ msgb} $\ast$orig\+\_\+msg)
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+STATUS on a given NSVC. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+block} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t \textbf{ cause})
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+BLOCK on a given NS-\/\+VC. \end{DoxyCompactList}\item 
static int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+block\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+BLOCK-\/\+ACK on a given NS-\/\+VC. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+unblock} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+UNBLOCK on a given NS-\/\+VC. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+alive} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+ALIVE on a given NS-\/\+VC. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+alive\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Transmit a NS-\/\+ALIVE-\/\+ACK on a given NS-\/\+VC. \end{DoxyCompactList}\item 
static void \textbf{ nsvc\+\_\+start\+\_\+timer} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, enum \textbf{ nsvc\+\_\+timer\+\_\+mode} \textbf{ mode})
\item 
static int \textbf{ nsvc\+\_\+timer\+\_\+elapsed\+\_\+ms} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+reset\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+sns\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t trans\+\_\+id, uint8\+\_\+t $\ast$\textbf{ cause}, const struct \textbf{ gprs\+\_\+ns\+\_\+ie\+\_\+ip4\+\_\+elem} $\ast$ip4\+\_\+elems, unsigned int num\+\_\+ip4\+\_\+elems)
\begin{DoxyCompactList}\small\item\em Encode + Transmit a SNS-\/\+ACK as per Section 9.\+3.\+1. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+sns\+\_\+config} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, bool end\+\_\+flag, const struct \textbf{ gprs\+\_\+ns\+\_\+ie\+\_\+ip4\+\_\+elem} $\ast$ip4\+\_\+elems, unsigned int num\+\_\+ip4\+\_\+elems)
\begin{DoxyCompactList}\small\item\em Encode + Transmit a SNS-\/\+CONFIG as per Section 9.\+3.\+4. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+sns\+\_\+config\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t $\ast$\textbf{ cause})
\begin{DoxyCompactList}\small\item\em Encode + Transmit a SNS-\/\+CONFIG-\/\+ACK as per Section 9.\+3.\+5. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+sns\+\_\+size} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, bool reset\+\_\+flag, uint16\+\_\+t max\+\_\+nr\+\_\+nsvc, uint16\+\_\+t $\ast$ip4\+\_\+ep\+\_\+nr, uint16\+\_\+t $\ast$ip6\+\_\+ep\+\_\+nr)
\begin{DoxyCompactList}\small\item\em Encode + transmit a SNS-\/\+SIZE as per Section 9.\+3.\+7. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+tx\+\_\+sns\+\_\+size\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t $\ast$\textbf{ cause})
\begin{DoxyCompactList}\small\item\em Encode + Transmit a SNS-\/\+SIZE-\/\+ACK as per Section 9.\+3.\+8. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+sendmsg} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em High-\/level function for transmitting a NS-\/\+UNITDATA messsage. \end{DoxyCompactList}\item 
static int \textbf{ gprs\+\_\+ns\+\_\+rx\+\_\+unitdata} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+rx\+\_\+status} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static int \textbf{ gprs\+\_\+nsvc\+\_\+replace\+\_\+if\+\_\+found} (uint16\+\_\+t nsvci, struct \textbf{ gprs\+\_\+nsvc} $\ast$$\ast$nsvc, struct \textbf{ gprs\+\_\+nsvc} $\ast$$\ast$old\+\_\+nsvc)
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+rx\+\_\+reset} (struct \textbf{ gprs\+\_\+nsvc} $\ast$$\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+rx\+\_\+reset\+\_\+ack} (struct \textbf{ gprs\+\_\+nsvc} $\ast$$\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static int \textbf{ gprs\+\_\+ns\+\_\+rx\+\_\+block} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
int \textbf{ gprs\+\_\+ns\+\_\+vc\+\_\+create} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct \textbf{ gprs\+\_\+nsvc} $\ast$fallback\+\_\+nsvc, struct \textbf{ gprs\+\_\+nsvc} $\ast$$\ast$new\+\_\+nsvc)
\begin{DoxyCompactList}\small\item\em Create/get NS-\/\+VC independently from underlying transport layer. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+process\+\_\+msg} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct \textbf{ gprs\+\_\+nsvc} $\ast$$\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Process NS message independently from underlying transport layer. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns\+\_\+rcvmsg} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct sockaddr\+\_\+in $\ast$saddr, enum \textbf{ gprs\+\_\+ns\+\_\+ll} ll)
\begin{DoxyCompactList}\small\item\em Receive incoming NS message from underlying transport layer. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ gprs\+\_\+ns\+\_\+ll\+\_\+str\+\_\+buf} (char $\ast$buf, size\+\_\+t buf\+\_\+len, const struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
const char $\ast$ \textbf{ gprs\+\_\+ns\+\_\+ll\+\_\+str} (const struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
char $\ast$ \textbf{ gprs\+\_\+ns\+\_\+ll\+\_\+str\+\_\+c} (const void $\ast$ctx, const struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
void \textbf{ gprs\+\_\+ns\+\_\+ll\+\_\+copy} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, struct \textbf{ gprs\+\_\+nsvc} $\ast$other)
\item 
void \textbf{ gprs\+\_\+ns\+\_\+ll\+\_\+clear} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\item 
struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$ \textbf{ gprs\+\_\+ns\+\_\+instantiate} (\textbf{ gprs\+\_\+ns\+\_\+cb\+\_\+t} $\ast$cb, void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Create a new GPRS NS instance. \end{DoxyCompactList}\item 
void \textbf{ gprs\+\_\+ns\+\_\+close} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi)
\item 
void \textbf{ gprs\+\_\+ns\+\_\+destroy} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi)
\begin{DoxyCompactList}\small\item\em Destroy an entire NS instance. \end{DoxyCompactList}\item 
static struct \textbf{ msgb} $\ast$ \textbf{ read\+\_\+nsip\+\_\+msg} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd, int $\ast$error, struct sockaddr\+\_\+in $\ast$saddr)
\item 
static int \textbf{ handle\+\_\+nsip\+\_\+read} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd)
\item 
static int \textbf{ handle\+\_\+nsip\+\_\+write} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd)
\item 
static int \textbf{ nsip\+\_\+fd\+\_\+cb} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd, unsigned int what)
\item 
int \textbf{ gprs\+\_\+ns\+\_\+nsip\+\_\+listen} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi)
\begin{DoxyCompactList}\small\item\em Create a listening socket for GPRS NS/\+UDP/\+IP. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+nsvc\+\_\+reset} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc, uint8\+\_\+t \textbf{ cause})
\begin{DoxyCompactList}\small\item\em Initiate a RESET procedure. \end{DoxyCompactList}\item 
struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+ns\+\_\+nsip\+\_\+connect} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, struct sockaddr\+\_\+in $\ast$dest, uint16\+\_\+t \textbf{ nsei}, uint16\+\_\+t nsvci)
\begin{DoxyCompactList}\small\item\em Establish a NS connection (from the BSS) to the SGSN. \end{DoxyCompactList}\item 
struct \textbf{ gprs\+\_\+nsvc} $\ast$ \textbf{ gprs\+\_\+ns\+\_\+nsip\+\_\+connect\+\_\+sns} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi, struct sockaddr\+\_\+in $\ast$dest, uint16\+\_\+t \textbf{ nsei}, uint16\+\_\+t nsvci)
\begin{DoxyCompactList}\small\item\em Establish a NS connection (from the BSS) to the SGSN using SNS auto-\/configuration. \end{DoxyCompactList}\item 
void \textbf{ gprs\+\_\+ns\+\_\+set\+\_\+log\+\_\+ss} (int ss)
\item 
char $\ast$ \textbf{ gprs\+\_\+nsvc\+\_\+state\+\_\+append} (char $\ast$s, struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Append the nsvc state to a talloc string. \end{DoxyCompactList}\item 
void \textbf{ gprs\+\_\+nsvc\+\_\+start\+\_\+test} (struct \textbf{ gprs\+\_\+nsvc} $\ast$nsvc)
\begin{DoxyCompactList}\small\item\em Start the ALIVE timer procedure in all NS-\/\+VCs part of this NS Instance. \end{DoxyCompactList}\item 
void \textbf{ gprs\+\_\+start\+\_\+alive\+\_\+all\+\_\+nsvcs} (struct \textbf{ gprs\+\_\+ns\+\_\+inst} $\ast$nsi)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
static const struct \textbf{ tlv\+\_\+definition} \textbf{ ns\+\_\+att\+\_\+tlvdef}
\item 
static const struct \textbf{ rate\+\_\+ctr\+\_\+desc} \textbf{ nsvc\+\_\+ctr\+\_\+description} [$\,$]
\item 
static const struct \textbf{ rate\+\_\+ctr\+\_\+group\+\_\+desc} \textbf{ nsvc\+\_\+ctrg\+\_\+desc}
\item 
static const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+desc} \textbf{ nsvc\+\_\+stat\+\_\+description} [$\,$]
\item 
static const struct \textbf{ osmo\+\_\+stat\+\_\+item\+\_\+group\+\_\+desc} \textbf{ nsvc\+\_\+statg\+\_\+desc}
\item 
const struct \textbf{ value\+\_\+string} \textbf{ gprs\+\_\+ns\+\_\+signal\+\_\+ns\+\_\+names} [$\,$]
\item 
const struct \textbf{ value\+\_\+string} \textbf{ gprs\+\_\+ns\+\_\+pdu\+\_\+strings} [$\,$]
\item 
static const struct \textbf{ value\+\_\+string} \textbf{ ns\+\_\+cause\+\_\+str} [$\,$]
\item 
static enum \textbf{ ns\+\_\+timeout} \textbf{ timer\+\_\+mode\+\_\+tout} [\textbf{ \+\_\+\+NSVC\+\_\+\+TIMER\+\_\+\+NR}]
\item 
static const struct \textbf{ value\+\_\+string} \textbf{ timer\+\_\+mode\+\_\+strs} [$\,$]
\item 
static bool \textbf{ gprs\+\_\+sns\+\_\+fsm\+\_\+registered} = false
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
GPRS Networks Service (NS) messages on the Gb interface. 

3GPP TS 08.\+16 version 8.\+0.\+1 Release 1999 / ETSI TS 101 299 V8.\+0.\+1 (2002-\/05) as well as its successor 3GPP TS 48.\+016