\doxysection{include/osmocom/core/stats.h File Reference}
\label{stats_8h}\index{include/osmocom/core/stats.h@{include/osmocom/core/stats.h}}
{\ttfamily \#include $<$sys/socket.\+h$>$}\newline
{\ttfamily \#include $<$arpa/inet.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+stats\+\_\+reporter}
\begin{DoxyCompactList}\small\item\em One statistics reporter instance. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stats\+\_\+config}
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ osmo\+\_\+stats\+\_\+class} \{ \newline
\textbf{ OSMO\+\_\+\+STATS\+\_\+\+CLASS\+\_\+\+UNKNOWN}
, \newline
\textbf{ OSMO\+\_\+\+STATS\+\_\+\+CLASS\+\_\+\+GLOBAL}
, \newline
\textbf{ OSMO\+\_\+\+STATS\+\_\+\+CLASS\+\_\+\+PEER}
, \newline
\textbf{ OSMO\+\_\+\+STATS\+\_\+\+CLASS\+\_\+\+SUBSCRIBER}
 \}
\begin{DoxyCompactList}\small\item\em Statistics Class definitions. \end{DoxyCompactList}\item 
enum \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+type} \{ \newline
\textbf{ OSMO\+\_\+\+STATS\+\_\+\+REPORTER\+\_\+\+LOG}
, \newline
\textbf{ OSMO\+\_\+\+STATS\+\_\+\+REPORTER\+\_\+\+STATSD}
 \}
\begin{DoxyCompactList}\small\item\em Statistics Reporter Type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ osmo\+\_\+stats\+\_\+init} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Initialize the stats reporting module; call this once in your program. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stats\+\_\+report} (void)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+set\+\_\+interval} (int interval)
\begin{DoxyCompactList}\small\item\em Set the reporting interval (common for all reporters) \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$ \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+alloc} (enum \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+type} \textbf{ type}, const char $\ast$\textbf{ name})
\item 
void \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+free} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep)
\begin{DoxyCompactList}\small\item\em Destroy a given stats\+\_\+reporter. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$ \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+find} (enum \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+type} \textbf{ type}, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Find a stats\+\_\+reporter of given {\itshape type} and {\itshape name}. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+remote\+\_\+addr} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, const char $\ast$addr)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+remote\+\_\+port} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, int port)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+local\+\_\+addr} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, const char $\ast$addr)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+mtu} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, int mtu)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+max\+\_\+class} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, enum \textbf{ osmo\+\_\+stats\+\_\+class} class\+\_\+id)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+name\+\_\+prefix} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, const char $\ast$prefix)
\begin{DoxyCompactList}\small\item\em Set the name prefix of a given stats\+\_\+reporter. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+enable} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep)
\begin{DoxyCompactList}\small\item\em Enable the given stats\+\_\+reporter. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+disable} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep)
\begin{DoxyCompactList}\small\item\em Disable the given stats\+\_\+reporter. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+set\+\_\+flush\+\_\+period} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, unsigned int period)
\begin{DoxyCompactList}\small\item\em Set the regular flush period for a given stats\+\_\+reporter. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$ \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+create\+\_\+log} (const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Create a stats\+\_\+reporter that logs via libosmocore logging. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$ \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+create\+\_\+statsd} (const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Create a stats\+\_\+reporter reporting to statsd. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+send} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep, const char $\ast$\textbf{ data}, int data\+\_\+len)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+send\+\_\+buffer} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+udp\+\_\+open} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep)
\item 
int \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+udp\+\_\+close} (struct \textbf{ osmo\+\_\+stats\+\_\+reporter} $\ast$srep)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ llist\+\_\+head} \textbf{ osmo\+\_\+stats\+\_\+reporter\+\_\+list}
\item 
struct \textbf{ osmo\+\_\+stats\+\_\+config} $\ast$ \textbf{ osmo\+\_\+stats\+\_\+config}
\end{DoxyCompactItemize}
