\doxysection{src/core/tdef.c File Reference}
\label{tdef_8c}\index{src/core/tdef.c@{src/core/tdef.c}}


Implementation to define Tnnn timers globally and use for FSM state changes.  


{\ttfamily \#include $<$limits.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$osmocom/core/fsm.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/tdef.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static unsigned long \textbf{ osmo\+\_\+tdef\+\_\+factor} (enum \textbf{ osmo\+\_\+tdef\+\_\+unit} a, enum \textbf{ osmo\+\_\+tdef\+\_\+unit} b)
\begin{DoxyCompactList}\small\item\em a = return\+\_\+val $\ast$ b. \end{DoxyCompactList}\item 
static unsigned long \textbf{ osmo\+\_\+tdef\+\_\+round} (unsigned long val, enum \textbf{ osmo\+\_\+tdef\+\_\+unit} from\+\_\+unit, enum \textbf{ osmo\+\_\+tdef\+\_\+unit} to\+\_\+unit)
\item 
void \textbf{ osmo\+\_\+tdefs\+\_\+reset} (struct \textbf{ osmo\+\_\+tdef} $\ast$\textbf{ tdefs})
\begin{DoxyCompactList}\small\item\em Set all \doxyref{osmo\+\_\+tdef}{p.}{structosmo__tdef} values to the default\+\_\+val. \end{DoxyCompactList}\item 
unsigned long \textbf{ osmo\+\_\+tdef\+\_\+get} (const struct \textbf{ osmo\+\_\+tdef} $\ast$\textbf{ tdefs}, int T, enum \textbf{ osmo\+\_\+tdef\+\_\+unit} as\+\_\+unit, long val\+\_\+if\+\_\+not\+\_\+present)
\begin{DoxyCompactList}\small\item\em Return the value of a T timer from a list of \doxyref{osmo\+\_\+tdef}{p.}{structosmo__tdef}, in the given unit. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+tdef} $\ast$ \textbf{ osmo\+\_\+tdef\+\_\+get\+\_\+entry} (struct \textbf{ osmo\+\_\+tdef} $\ast$\textbf{ tdefs}, int T)
\begin{DoxyCompactList}\small\item\em Find tdef entry matching T. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tdef\+\_\+set} (struct \textbf{ osmo\+\_\+tdef} $\ast$\textbf{ tdefs}, int T, unsigned long val, enum \textbf{ osmo\+\_\+tdef\+\_\+unit} val\+\_\+unit)
\begin{DoxyCompactList}\small\item\em Set value in entry matching T, converting val from val\+\_\+unit to unit of T. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+tdef\+\_\+val\+\_\+in\+\_\+range} (struct \textbf{ osmo\+\_\+tdef} $\ast$tdef, unsigned long new\+\_\+val)
\begin{DoxyCompactList}\small\item\em Check if value new\+\_\+val is in range of valid possible values for timer entry tdef. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tdef\+\_\+range\+\_\+str\+\_\+buf} (char $\ast$buf, size\+\_\+t buf\+\_\+len, struct \textbf{ osmo\+\_\+tdef} $\ast$t)
\begin{DoxyCompactList}\small\item\em Write string representation of \doxyref{osmo\+\_\+tdef}{p.}{structosmo__tdef} range into buf. \end{DoxyCompactList}\item 
const struct \textbf{ osmo\+\_\+tdef\+\_\+state\+\_\+timeout} $\ast$ \textbf{ osmo\+\_\+tdef\+\_\+get\+\_\+state\+\_\+timeout} (uint32\+\_\+t state, const struct \textbf{ osmo\+\_\+tdef\+\_\+state\+\_\+timeout} $\ast$timeouts\+\_\+array)
\begin{DoxyCompactList}\small\item\em Using \doxyref{osmo\+\_\+tdef}{p.}{structosmo__tdef} for \doxyref{osmo\+\_\+fsm\+\_\+inst}{p.}{structosmo__fsm__inst}\+: find a given state\textquotesingle{}s \doxyref{osmo\+\_\+tdef\+\_\+state\+\_\+timeout}{p.}{structosmo__tdef__state__timeout} entry. \end{DoxyCompactList}\item 
int \textbf{ \+\_\+osmo\+\_\+tdef\+\_\+fsm\+\_\+inst\+\_\+state\+\_\+chg} (struct \textbf{ osmo\+\_\+fsm\+\_\+inst} $\ast$fi, uint32\+\_\+t state, const struct \textbf{ osmo\+\_\+tdef\+\_\+state\+\_\+timeout} $\ast$timeouts\+\_\+array, const struct \textbf{ osmo\+\_\+tdef} $\ast$\textbf{ tdefs}, long default\+\_\+timeout, const char $\ast$\textbf{ file}, int line)
\begin{DoxyCompactList}\small\item\em See invocation macro \doxyref{osmo\+\_\+tdef\+\_\+fsm\+\_\+inst\+\_\+state\+\_\+chg()}{p.}{group__Tdef_ga62ef360585a2162bcac01c588025ce97} instead. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
const struct \textbf{ value\+\_\+string} \textbf{ osmo\+\_\+tdef\+\_\+unit\+\_\+names} [$\,$]
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Implementation to define Tnnn timers globally and use for FSM state changes. 

