\doxysection{include/osmocom/core/mnl.h File Reference}
\label{mnl_8h}\index{include/osmocom/core/mnl.h@{include/osmocom/core/mnl.h}}
{\ttfamily \#include $<$osmocom/core/select.\+h$>$}\newline
{\ttfamily \#include $<$libmnl/libmnl.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+mnl}
\begin{DoxyCompactList}\small\item\em osmocom wrapper around libmnl abstraction of netlink socket \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+mnl} $\ast$ \textbf{ osmo\+\_\+mnl\+\_\+init} (void $\ast$ctx, int bus, unsigned int groups, mnl\+\_\+cb\+\_\+t mnl\+\_\+cb, void $\ast$priv)
\begin{DoxyCompactList}\small\item\em create an osmocom-\/wrapped limnl netlink socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+mnl\+\_\+destroy} (struct \textbf{ osmo\+\_\+mnl} $\ast$omnl)
\begin{DoxyCompactList}\small\item\em destroy an existing osmocom-\/wrapped mnl netlink socket\+: Unregister + close + free. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\label{mnl_8h_aa9759151d4d3fe75178a4e7786acef6d}} 
\index{mnl.h@{mnl.h}!osmo\_mnl\_destroy@{osmo\_mnl\_destroy}}
\index{osmo\_mnl\_destroy@{osmo\_mnl\_destroy}!mnl.h@{mnl.h}}
\doxysubsubsection{osmo\_mnl\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+mnl\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+mnl} $\ast$}]{omnl }\end{DoxyParamCaption})}



destroy an existing osmocom-\/wrapped mnl netlink socket\+: Unregister + close + free. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em omnl} & \doxyref{osmo\+\_\+mnl}{p.}{structosmo__mnl} socket previously returned by \doxyref{osmo\+\_\+mnl\+\_\+init()}{p.}{mnl_8c_afa1cb4b93b6a178b9f1152f7b1beec8e} \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+mnl\+::mnls}, \textbf{ osmo\+\_\+mnl\+::ofd}, and \textbf{ osmo\+\_\+fd\+\_\+unregister()}.



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+free()}.

\mbox{\label{mnl_8h_afa1cb4b93b6a178b9f1152f7b1beec8e}} 
\index{mnl.h@{mnl.h}!osmo\_mnl\_init@{osmo\_mnl\_init}}
\index{osmo\_mnl\_init@{osmo\_mnl\_init}!mnl.h@{mnl.h}}
\doxysubsubsection{osmo\_mnl\_init()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+mnl} $\ast$ osmo\+\_\+mnl\+\_\+init (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{int}]{bus,  }\item[{unsigned int}]{groups,  }\item[{mnl\+\_\+cb\+\_\+t}]{mnl\+\_\+cb,  }\item[{void $\ast$}]{priv }\end{DoxyParamCaption})}



create an osmocom-\/wrapped limnl netlink socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate \\
\hline
\mbox{\texttt{ in}}  & {\em bus} & netlink socket bus ID (see NETLINK\+\_\+$\ast$ constants) \\
\hline
\mbox{\texttt{ in}}  & {\em groups} & groups of messages to bind/subscribe to \\
\hline
\mbox{\texttt{ in}}  & {\em mnl\+\_\+cb} & callback function called for each incoming message \\
\hline
\mbox{\texttt{ in}}  & {\em priv} & opaque private user data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
newly-\/allocated \doxyref{osmo\+\_\+mnl}{p.}{structosmo__mnl} or NULL in case of error. 
\end{DoxyReturn}


References \textbf{ DLGLOBAL}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ osmo\+\_\+mnl\+::mnl\+\_\+cb}, \textbf{ osmo\+\_\+mnl\+::mnls}, \textbf{ osmo\+\_\+mnl\+::ofd}, \textbf{ OSMO\+\_\+\+FD\+\_\+\+READ}, \textbf{ osmo\+\_\+fd\+\_\+register()}, \textbf{ osmo\+\_\+fd\+\_\+setup()}, \textbf{ osmo\+\_\+mnl\+\_\+fd\+\_\+cb()}, and \textbf{ osmo\+\_\+mnl\+::priv}.



Referenced by \textbf{ netdev\+\_\+netns\+\_\+ctx\+\_\+init()}.

