\doxysection{src/gb/gprs\+\_\+ns2\+\_\+frgre.c File Reference}
\label{gprs__ns2__frgre_8c}\index{src/gb/gprs\_ns2\_frgre.c@{src/gb/gprs\_ns2\_frgre.c}}


NS-\/over-\/\+FR-\/over-\/\+GRE implementation.  


{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$sys/socket.\+h$>$}\newline
{\ttfamily \#include $<$netinet/in.\+h$>$}\newline
{\ttfamily \#include $<$netinet/ip.\+h$>$}\newline
{\ttfamily \#include $<$netinet/ip6.\+h$>$}\newline
{\ttfamily \#include $<$arpa/inet.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/byteswap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/select.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/socket.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gprs/gprs\+\_\+ns2.\+h$>$}\newline
{\ttfamily \#include \char`\"{}gprs\+\_\+ns2\+\_\+internal.\+h\char`\"{}}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gre\+\_\+hdr}
\item 
struct \textbf{ priv\+\_\+bind}
\item 
struct \textbf{ priv\+\_\+vc}
\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+FR}~0x6559
\item 
\#define \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+IPv4}~0x0800
\item 
\#define \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+IPv6}~0x86dd
\item 
\#define \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+KAR}~0x0000 /$\ast$ keepalive response $\ast$/
\item 
\#define \textbf{ IPPROTO\+\_\+\+GRE}~47
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gre\+\_\+hdr} \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+} ((packed))
\item 
static void \textbf{ free\+\_\+bind} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$bind)
\begin{DoxyCompactList}\small\item\em clean up all private driver state. \end{DoxyCompactList}\item 
static int \textbf{ frgre\+\_\+sendmsg} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$bind, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct \textbf{ osmo\+\_\+sockaddr} $\ast$dest)
\item 
static void \textbf{ free\+\_\+vc} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$nsvc)
\item 
static struct \textbf{ priv\+\_\+vc} $\ast$ \textbf{ frgre\+\_\+alloc\+\_\+vc} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$bind, struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$nsvc, struct \textbf{ osmo\+\_\+sockaddr} $\ast$remote, uint16\+\_\+t dlci)
\item 
static int \textbf{ handle\+\_\+rx\+\_\+gre\+\_\+ipv6} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct ip6\+\_\+hdr $\ast$ip6hdr, struct \textbf{ gre\+\_\+hdr} $\ast$greh)
\item 
static int \textbf{ handle\+\_\+rx\+\_\+gre\+\_\+ipv4} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct iphdr $\ast$iph, struct \textbf{ gre\+\_\+hdr} $\ast$greh)
\item 
static struct \textbf{ msgb} $\ast$ \textbf{ read\+\_\+nsfrgre\+\_\+msg} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd, int $\ast$error, struct \textbf{ osmo\+\_\+sockaddr} $\ast$saddr, uint16\+\_\+t $\ast$dlci, const struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$bind)
\item 
static int \textbf{ ns2\+\_\+find\+\_\+vc\+\_\+by\+\_\+dlci} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$bind, uint16\+\_\+t dlci, struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$$\ast$result)
\item 
static int \textbf{ handle\+\_\+nsfrgre\+\_\+read} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd)
\item 
static int \textbf{ handle\+\_\+nsfrgre\+\_\+write} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd)
\item 
static int \textbf{ frgre\+\_\+vc\+\_\+sendmsg} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$nsvc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static int \textbf{ frgre\+\_\+fd\+\_\+cb} (struct \textbf{ osmo\+\_\+fd} $\ast$bfd, unsigned int what)
\item 
int \textbf{ gprs\+\_\+ns2\+\_\+is\+\_\+frgre\+\_\+bind} (struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$bind)
\begin{DoxyCompactList}\small\item\em determine if given bind is for FR-\/\+GRE encapsulation. \end{DoxyCompactList}\item 
int \textbf{ gprs\+\_\+ns2\+\_\+frgre\+\_\+bind} (struct \textbf{ gprs\+\_\+ns2\+\_\+inst} $\ast$nsi, const char $\ast$\textbf{ name}, const struct \textbf{ osmo\+\_\+sockaddr} $\ast$local, int dscp, struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$$\ast$result)
\begin{DoxyCompactList}\small\item\em Create a new bind for NS over FR-\/\+GRE. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
uint16\+\_\+t \textbf{ flags}
\item 
uint16\+\_\+t \textbf{ ptype}
\item 
struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+driver} \textbf{ vc\+\_\+driver\+\_\+frgre}
\item 
struct \textbf{ priv\+\_\+bind} \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
NS-\/over-\/\+FR-\/over-\/\+GRE implementation. 

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 

\doxysubsection{Macro Definition Documentation}
\mbox{\label{gprs__ns2__frgre_8c_a8f21d6a9aa6a76a99064adede0069eaa}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!GRE\_PTYPE\_FR@{GRE\_PTYPE\_FR}}
\index{GRE\_PTYPE\_FR@{GRE\_PTYPE\_FR}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{GRE\_PTYPE\_FR}
{\footnotesize\ttfamily \#define GRE\+\_\+\+PTYPE\+\_\+\+FR~0x6559}

\mbox{\label{gprs__ns2__frgre_8c_a62ecd933e8d4e55dcb50528774e5628c}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!GRE\_PTYPE\_IPv4@{GRE\_PTYPE\_IPv4}}
\index{GRE\_PTYPE\_IPv4@{GRE\_PTYPE\_IPv4}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{GRE\_PTYPE\_IPv4}
{\footnotesize\ttfamily \#define GRE\+\_\+\+PTYPE\+\_\+\+IPv4~0x0800}

\mbox{\label{gprs__ns2__frgre_8c_a4394e647277ad4c9a325d0a65e0ed4e6}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!GRE\_PTYPE\_IPv6@{GRE\_PTYPE\_IPv6}}
\index{GRE\_PTYPE\_IPv6@{GRE\_PTYPE\_IPv6}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{GRE\_PTYPE\_IPv6}
{\footnotesize\ttfamily \#define GRE\+\_\+\+PTYPE\+\_\+\+IPv6~0x86dd}

\mbox{\label{gprs__ns2__frgre_8c_ae81d806ca5ef853fc65003d6c1cd88df}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!GRE\_PTYPE\_KAR@{GRE\_PTYPE\_KAR}}
\index{GRE\_PTYPE\_KAR@{GRE\_PTYPE\_KAR}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{GRE\_PTYPE\_KAR}
{\footnotesize\ttfamily \#define GRE\+\_\+\+PTYPE\+\_\+\+KAR~0x0000 /$\ast$ keepalive response $\ast$/}

\mbox{\label{gprs__ns2__frgre_8c_a62b96b4d881982b3a6d911ddc0294f09}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!IPPROTO\_GRE@{IPPROTO\_GRE}}
\index{IPPROTO\_GRE@{IPPROTO\_GRE}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{IPPROTO\_GRE}
{\footnotesize\ttfamily \#define IPPROTO\+\_\+\+GRE~47}



\doxysubsection{Function Documentation}
\mbox{\label{gprs__ns2__frgre_8c_aa89cc0502634be0baf2ef0adbf2a38ac}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!free\_bind@{free\_bind}}
\index{free\_bind@{free\_bind}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{free\_bind()}
{\footnotesize\ttfamily static void free\+\_\+bind (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$}]{bind }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



clean up all private driver state. 

Should be only called by \doxyref{gprs\+\_\+ns2\+\_\+free\+\_\+bind()}{p.}{group__libgb_ga60ce0e2a04d5ac46598ebd123fe744f6} 

References \textbf{ priv\+\_\+bind\+::fd}, \textbf{ llist\+\_\+empty()}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::nsvc}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ osmo\+\_\+fd\+\_\+close()}, and \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::priv}.

\mbox{\label{gprs__ns2__frgre_8c_af69dea93a93b1e8edcedc44f5a27e8f8}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!free\_vc@{free\_vc}}
\index{free\_vc@{free\_vc}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{free\_vc()}
{\footnotesize\ttfamily static void free\+\_\+vc (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$}]{nsvc }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ gprs\+\_\+ns2\+\_\+vc\+::priv}.



Referenced by \textbf{ gprs\+\_\+ns2\+\_\+frgre\+\_\+bind()}.

\mbox{\label{gprs__ns2__frgre_8c_a18cb4141e03b24be0be2e65249c52060}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!frgre\_alloc\_vc@{frgre\_alloc\_vc}}
\index{frgre\_alloc\_vc@{frgre\_alloc\_vc}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{frgre\_alloc\_vc()}
{\footnotesize\ttfamily static struct \textbf{ priv\+\_\+vc} $\ast$ frgre\+\_\+alloc\+\_\+vc (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$}]{bind,  }\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$}]{nsvc,  }\item[{struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{remote,  }\item[{uint16\+\_\+t}]{dlci }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ priv\+\_\+vc\+::dlci}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+::priv}, and \textbf{ priv\+\_\+vc\+::remote}.



Referenced by \textbf{ handle\+\_\+nsfrgre\+\_\+read()}.

\mbox{\label{gprs__ns2__frgre_8c_aa51b30419173c9af1f5d90645037be18}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!frgre\_fd\_cb@{frgre\_fd\_cb}}
\index{frgre\_fd\_cb@{frgre\_fd\_cb}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{frgre\_fd\_cb()}
{\footnotesize\ttfamily static int frgre\+\_\+fd\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{bfd,  }\item[{unsigned int}]{what }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ handle\+\_\+nsfrgre\+\_\+read()}, \textbf{ handle\+\_\+nsfrgre\+\_\+write()}, \textbf{ OSMO\+\_\+\+FD\+\_\+\+READ}, and \textbf{ OSMO\+\_\+\+FD\+\_\+\+WRITE}.



Referenced by \textbf{ gprs\+\_\+ns2\+\_\+frgre\+\_\+bind()}.

\mbox{\label{gprs__ns2__frgre_8c_a9083166364c2e4fd80f91e004fba8b43}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!frgre\_sendmsg@{frgre\_sendmsg}}
\index{frgre\_sendmsg@{frgre\_sendmsg}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{frgre\_sendmsg()}
{\footnotesize\ttfamily static int frgre\+\_\+sendmsg (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$}]{bind,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{dest }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ osmo\+\_\+fd\+::fd}, \textbf{ priv\+\_\+bind\+::fd}, \textbf{ msg}, \textbf{ msgb\+\_\+free()}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::priv}, \textbf{ osmo\+\_\+sockaddr\+::sa}, and \textbf{ osmo\+\_\+sockaddr\+::u}.



Referenced by \textbf{ frgre\+\_\+vc\+\_\+sendmsg()}, and \textbf{ handle\+\_\+nsfrgre\+\_\+read()}.

\mbox{\label{gprs__ns2__frgre_8c_a950c8e075d771de04daa65bfa99d8871}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!frgre\_vc\_sendmsg@{frgre\_vc\_sendmsg}}
\index{frgre\_vc\_sendmsg@{frgre\_vc\_sendmsg}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{frgre\_vc\_sendmsg()}
{\footnotesize\ttfamily static int frgre\+\_\+vc\+\_\+sendmsg (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$}]{nsvc,  }\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ priv\+\_\+bind\+::dlci}, \textbf{ gre\+\_\+hdr\+::flags}, \textbf{ frgre\+\_\+sendmsg()}, \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+FR}, \textbf{ msg}, \textbf{ msgb\+\_\+length()}, \textbf{ msgb\+\_\+push()}, \textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+OUT}, \textbf{ NS\+\_\+\+CTR\+\_\+\+BYTES\+\_\+\+OUT\+\_\+\+DROP}, \textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+OUT}, \textbf{ NS\+\_\+\+CTR\+\_\+\+PKTS\+\_\+\+OUT\+\_\+\+DROP}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::nsvc}, \textbf{ osmo\+\_\+htons}, \textbf{ OSMO\+\_\+\+LIKELY}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+::priv}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::priv}, \textbf{ gre\+\_\+hdr\+::ptype}, \textbf{ RATE\+\_\+\+CTR\+\_\+\+ADD\+\_\+\+NS}, \textbf{ RATE\+\_\+\+CTR\+\_\+\+INC\+\_\+\+NS}, and \textbf{ priv\+\_\+vc\+::remote}.



Referenced by \textbf{ gprs\+\_\+ns2\+\_\+frgre\+\_\+bind()}.

\mbox{\label{gprs__ns2__frgre_8c_a84ca7c73ad1ba0823050a3a294bca51a}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!gprs\_ns2\_frgre\_bind@{gprs\_ns2\_frgre\_bind}}
\index{gprs\_ns2\_frgre\_bind@{gprs\_ns2\_frgre\_bind}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{gprs\_ns2\_frgre\_bind()}
{\footnotesize\ttfamily int gprs\+\_\+ns2\+\_\+frgre\+\_\+bind (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+inst} $\ast$}]{nsi,  }\item[{const char $\ast$}]{name,  }\item[{const struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{local,  }\item[{int}]{dscp,  }\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$$\ast$}]{result }\end{DoxyParamCaption})}



Create a new bind for NS over FR-\/\+GRE. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em nsi} & NS instance in which to create the bind \\
\hline
\mbox{\texttt{ in}}  & {\em local} & local address on which to bind \\
\hline
\mbox{\texttt{ in}}  & {\em dscp} & DSCP/\+TOS bits to use for transmitted data on this bind \\
\hline
\mbox{\texttt{ out}}  & {\em result} & pointer to the created bind or if a bind with the name exists return the bind. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative on error. -\/EALREADY returned in case a bind with the name exists 
\end{DoxyReturn}


References \textbf{ priv\+\_\+bind\+::addr}, \textbf{ osmo\+\_\+fd\+::cb}, \textbf{ osmo\+\_\+fd\+::data}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::driver}, \textbf{ priv\+\_\+bind\+::dscp}, \textbf{ priv\+\_\+bind\+::fd}, \textbf{ FRAME\+\_\+\+RELAY\+\_\+\+SDU}, \textbf{ free\+\_\+vc()}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::free\+\_\+vc}, \textbf{ frgre\+\_\+fd\+\_\+cb()}, \textbf{ frgre\+\_\+vc\+\_\+sendmsg()}, \textbf{ gprs\+\_\+ns2\+\_\+bind\+\_\+by\+\_\+name()}, \textbf{ gprs\+\_\+ns2\+\_\+free\+\_\+bind()}, \textbf{ GPRS\+\_\+\+NS2\+\_\+\+LL\+\_\+\+FR\+\_\+\+GRE}, \textbf{ INIT\+\_\+\+LLIST\+\_\+\+HEAD}, \textbf{ IPPROTO\+\_\+\+GRE}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::ll}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::mtu}, \textbf{ name}, \textbf{ ns2\+\_\+bind\+\_\+alloc()}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::nsi}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::nsvc}, \textbf{ OSMO\+\_\+\+SOCK\+\_\+\+F\+\_\+\+BIND}, \textbf{ OSMO\+\_\+\+SOCK\+\_\+\+F\+\_\+\+DSCP}, \textbf{ osmo\+\_\+sock\+\_\+init\+\_\+osa\+\_\+ofd()}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::priv}, \textbf{ osmo\+\_\+sockaddr\+::sa}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::send\+\_\+vc}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::transfer\+\_\+capability}, \textbf{ osmo\+\_\+sockaddr\+::u}, and \textbf{ vc\+\_\+driver\+\_\+frgre}.

\mbox{\label{gprs__ns2__frgre_8c_a0454d2aa6998d2f7035bb65ae09f5338}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!gprs\_ns2\_is\_frgre\_bind@{gprs\_ns2\_is\_frgre\_bind}}
\index{gprs\_ns2\_is\_frgre\_bind@{gprs\_ns2\_is\_frgre\_bind}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{gprs\_ns2\_is\_frgre\_bind()}
{\footnotesize\ttfamily int gprs\+\_\+ns2\+\_\+is\+\_\+frgre\+\_\+bind (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$}]{bind }\end{DoxyParamCaption})}



determine if given bind is for FR-\/\+GRE encapsulation. 



References \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::driver}, and \textbf{ vc\+\_\+driver\+\_\+frgre}.

\mbox{\label{gprs__ns2__frgre_8c_a51b56c06de7c56f60a3d573c92ddbfa8}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!handle\_nsfrgre\_read@{handle\_nsfrgre\_read}}
\index{handle\_nsfrgre\_read@{handle\_nsfrgre\_read}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{handle\_nsfrgre\_read()}
{\footnotesize\ttfamily static int handle\+\_\+nsfrgre\+\_\+read (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{bfd }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+fd\+::data}, \textbf{ frgre\+\_\+alloc\+\_\+vc()}, \textbf{ frgre\+\_\+sendmsg()}, \textbf{ LOGBIND}, \textbf{ LOGL\+\_\+\+INFO}, \textbf{ msg}, \textbf{ msgb\+\_\+free()}, \textbf{ ns2\+\_\+create\+\_\+vc()}, \textbf{ NS2\+\_\+\+CS\+\_\+\+CREATED}, \textbf{ NS2\+\_\+\+CS\+\_\+\+ERROR}, \textbf{ NS2\+\_\+\+CS\+\_\+\+FOUND}, \textbf{ NS2\+\_\+\+CS\+\_\+\+REJECTED}, \textbf{ NS2\+\_\+\+CS\+\_\+\+SKIPPED}, \textbf{ ns2\+\_\+find\+\_\+vc\+\_\+by\+\_\+dlci()}, \textbf{ ns2\+\_\+recv\+\_\+vc()}, \textbf{ ns2\+\_\+vc\+\_\+fsm\+\_\+start()}, and \textbf{ read\+\_\+nsfrgre\+\_\+msg()}.



Referenced by \textbf{ frgre\+\_\+fd\+\_\+cb()}.

\mbox{\label{gprs__ns2__frgre_8c_a1cae912a76240e07b4077c30c2d4759b}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!handle\_nsfrgre\_write@{handle\_nsfrgre\_write}}
\index{handle\_nsfrgre\_write@{handle\_nsfrgre\_write}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{handle\_nsfrgre\_write()}
{\footnotesize\ttfamily static int handle\+\_\+nsfrgre\+\_\+write (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{bfd }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ frgre\+\_\+fd\+\_\+cb()}.

\mbox{\label{gprs__ns2__frgre_8c_a51aaeff1f93914c4650e7ab3d633ac64}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!handle\_rx\_gre\_ipv4@{handle\_rx\_gre\_ipv4}}
\index{handle\_rx\_gre\_ipv4@{handle\_rx\_gre\_ipv4}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{handle\_rx\_gre\_ipv4()}
{\footnotesize\ttfamily static int handle\+\_\+rx\+\_\+gre\+\_\+ipv4 (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{bfd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{struct iphdr $\ast$}]{iph,  }\item[{struct \textbf{ gre\+\_\+hdr} $\ast$}]{greh }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+fd\+::data}, \textbf{ osmo\+\_\+fd\+::fd}, \textbf{ priv\+\_\+bind\+::fd}, \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+KAR}, \textbf{ IPPROTO\+\_\+\+GRE}, \textbf{ LOGBIND}, \textbf{ LOGL\+\_\+\+DEBUG}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ msg}, \textbf{ osmo\+\_\+htons}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::priv}, and \textbf{ gre\+\_\+hdr\+::ptype}.



Referenced by \textbf{ read\+\_\+nsfrgre\+\_\+msg()}.

\mbox{\label{gprs__ns2__frgre_8c_a9e904329fd8a11dbc3d6aa34ea865281}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!handle\_rx\_gre\_ipv6@{handle\_rx\_gre\_ipv6}}
\index{handle\_rx\_gre\_ipv6@{handle\_rx\_gre\_ipv6}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{handle\_rx\_gre\_ipv6()}
{\footnotesize\ttfamily static int handle\+\_\+rx\+\_\+gre\+\_\+ipv6 (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{bfd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{struct ip6\+\_\+hdr $\ast$}]{ip6hdr,  }\item[{struct \textbf{ gre\+\_\+hdr} $\ast$}]{greh }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+fd\+::data}, \textbf{ osmo\+\_\+fd\+::fd}, \textbf{ priv\+\_\+bind\+::fd}, \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+KAR}, \textbf{ IPPROTO\+\_\+\+GRE}, \textbf{ LOGBIND}, \textbf{ LOGL\+\_\+\+DEBUG}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ msg}, \textbf{ osmo\+\_\+htons}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::priv}, and \textbf{ gre\+\_\+hdr\+::ptype}.



Referenced by \textbf{ read\+\_\+nsfrgre\+\_\+msg()}.

\mbox{\label{gprs__ns2__frgre_8c_a8c5afaf05e7c6765be7123f6bd91d573}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!ns2\_find\_vc\_by\_dlci@{ns2\_find\_vc\_by\_dlci}}
\index{ns2\_find\_vc\_by\_dlci@{ns2\_find\_vc\_by\_dlci}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{ns2\_find\_vc\_by\_dlci()}
{\footnotesize\ttfamily static int ns2\+\_\+find\+\_\+vc\+\_\+by\+\_\+dlci (\begin{DoxyParamCaption}\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$}]{bind,  }\item[{uint16\+\_\+t}]{dlci,  }\item[{struct \textbf{ gprs\+\_\+ns2\+\_\+vc} $\ast$$\ast$}]{result }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ priv\+\_\+vc\+::dlci}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind\+::nsvc}, and \textbf{ gprs\+\_\+ns2\+\_\+vc\+::priv}.



Referenced by \textbf{ handle\+\_\+nsfrgre\+\_\+read()}.

\mbox{\label{gprs__ns2__frgre_8c_a526bffd5c8447f52e7dd730c44a12e3b}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!read\_nsfrgre\_msg@{read\_nsfrgre\_msg}}
\index{read\_nsfrgre\_msg@{read\_nsfrgre\_msg}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{read\_nsfrgre\_msg()}
{\footnotesize\ttfamily static struct \textbf{ msgb} $\ast$ read\+\_\+nsfrgre\+\_\+msg (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+fd} $\ast$}]{bfd,  }\item[{int $\ast$}]{error,  }\item[{struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{saddr,  }\item[{uint16\+\_\+t $\ast$}]{dlci,  }\item[{const struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+bind} $\ast$}]{bind }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+fd\+::fd}, \textbf{ gre\+\_\+hdr\+::flags}, \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+FR}, \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+IPv4}, \textbf{ GRE\+\_\+\+PTYPE\+\_\+\+IPv6}, \textbf{ handle\+\_\+rx\+\_\+gre\+\_\+ipv4()}, \textbf{ handle\+\_\+rx\+\_\+gre\+\_\+ipv6()}, \textbf{ if()}, \textbf{ LOGBIND}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGL\+\_\+\+NOTICE}, \textbf{ msg}, \textbf{ msgb\+\_\+alloc()}, \textbf{ msgb\+\_\+free()}, \textbf{ msgb\+\_\+put()}, \textbf{ NS\+\_\+\+ALLOC\+\_\+\+SIZE}, \textbf{ osmo\+\_\+ntohs}, \textbf{ gre\+\_\+hdr\+::ptype}, \textbf{ osmo\+\_\+sockaddr\+::sa}, and \textbf{ osmo\+\_\+sockaddr\+::u}.



Referenced by \textbf{ handle\+\_\+nsfrgre\+\_\+read()}.



\doxysubsection{Variable Documentation}
\mbox{\label{gprs__ns2__frgre_8c_ab33cdbca36274dfa2ccf4934ba102760}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!\_\_attribute\_\_@{\_\_attribute\_\_}}
\index{\_\_attribute\_\_@{\_\_attribute\_\_}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{\_\_attribute\_\_}
{\footnotesize\ttfamily struct \textbf{ priv\+\_\+bind} \+\_\+\+\_\+attribute\+\_\+\+\_\+}

\mbox{\label{gprs__ns2__frgre_8c_a1e87af3c18a2fd36c61faf89949bdc3f}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!flags@{flags}}
\index{flags@{flags}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{flags}
{\footnotesize\ttfamily uint16\+\_\+t flags}

\mbox{\label{gprs__ns2__frgre_8c_ab4891e9b77eb26f33d21cfde982564cb}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!ptype@{ptype}}
\index{ptype@{ptype}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{ptype}
{\footnotesize\ttfamily uint16\+\_\+t ptype}

\mbox{\label{gprs__ns2__frgre_8c_a535e28589621c35d674d4a25c2b989e4}} 
\index{gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}!vc\_driver\_frgre@{vc\_driver\_frgre}}
\index{vc\_driver\_frgre@{vc\_driver\_frgre}!gprs\_ns2\_frgre.c@{gprs\_ns2\_frgre.c}}
\doxysubsubsection{vc\_driver\_frgre}
{\footnotesize\ttfamily struct \textbf{ gprs\+\_\+ns2\+\_\+vc\+\_\+driver} vc\+\_\+driver\+\_\+frgre}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        .name = \textcolor{stringliteral}{"{}GB frame relay over GRE"{}},}
\DoxyCodeLine{        .free\_bind = free\_bind,}
\DoxyCodeLine{\}}

\end{DoxyCode}


Referenced by \textbf{ gprs\+\_\+ns2\+\_\+frgre\+\_\+bind()}, and \textbf{ gprs\+\_\+ns2\+\_\+is\+\_\+frgre\+\_\+bind()}.

