\doxysection{src/vty/fsm\+\_\+vty.c File Reference}
\label{fsm__vty_8c}\index{src/vty/fsm\_vty.c@{src/vty/fsm\_vty.c}}


Osmocom FSM introspection via VTY.  


{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$osmocom/vty/command.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/vty/buffer.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/vty/vty.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/vty/telnet\+\_\+interface.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/vty/misc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/fsm.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ SH\+\_\+\+FSM\+\_\+\+STR}~\textbf{ SHOW\+\_\+\+STR} \char`\"{}Show information about finite state \textbf{ machines\textbackslash{}n}\char`\"{}
\item 
\#define \textbf{ SH\+\_\+\+FSMI\+\_\+\+STR}~\textbf{ SHOW\+\_\+\+STR} \char`\"{}Show information about finite state machine \textbf{ instances\textbackslash{}n}\char`\"{}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ vty\+\_\+out\+\_\+fsm2} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$prefix, struct \textbf{ osmo\+\_\+fsm} $\ast$fsm)
\begin{DoxyCompactList}\small\item\em Print information about a FSM [class] to the given VTY. \end{DoxyCompactList}\item 
void \textbf{ vty\+\_\+out\+\_\+fsm} (struct \textbf{ vty} $\ast$\textbf{ vty}, struct \textbf{ osmo\+\_\+fsm} $\ast$fsm)
\begin{DoxyCompactList}\small\item\em Print information about a FSM [class] to the given VTY. \end{DoxyCompactList}\item 
void \textbf{ vty\+\_\+out\+\_\+fsm\+\_\+inst2} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$prefix, struct \textbf{ osmo\+\_\+fsm\+\_\+inst} $\ast$fsmi)
\begin{DoxyCompactList}\small\item\em Print a FSM instance to the given VTY. \end{DoxyCompactList}\item 
void \textbf{ vty\+\_\+out\+\_\+fsm\+\_\+inst} (struct \textbf{ vty} $\ast$\textbf{ vty}, struct \textbf{ osmo\+\_\+fsm\+\_\+inst} $\ast$fsmi)
\begin{DoxyCompactList}\small\item\em Print a FSM instance to the given VTY. \end{DoxyCompactList}\item 
\textbf{ DEFUN} (show\+\_\+fsms, show\+\_\+fsms\+\_\+cmd, \char`\"{}show fsm all\char`\"{}, SH\+\_\+\+FSM\+\_\+\+STR \char`\"{}Display a \textbf{ list} of all registered finite state \textbf{ machines\textbackslash{}n}\char`\"{})
\item 
\textbf{ DEFUN} (show\+\_\+fsm, show\+\_\+fsm\+\_\+cmd, \char`\"{}show fsm NAME\char`\"{}, SH\+\_\+\+FSM\+\_\+\+STR \char`\"{}Display information about a single named finite state \textbf{ machine\textbackslash{}n}\char`\"{})
\item 
\textbf{ DEFUN} (show\+\_\+fsm\+\_\+insts, show\+\_\+fsm\+\_\+insts\+\_\+cmd, \char`\"{}show fsm-\/instances all\char`\"{}, SH\+\_\+\+FSMI\+\_\+\+STR \char`\"{}Display a \textbf{ list} of all FSM instances of all finite state machine\char`\"{})
\item 
\textbf{ DEFUN} (show\+\_\+fsm\+\_\+inst, show\+\_\+fsm\+\_\+inst\+\_\+cmd, \char`\"{}show fsm-\/instances NAME\char`\"{}, SH\+\_\+\+FSMI\+\_\+\+STR \char`\"{}Display a \textbf{ list} of all FSM instances of the named finite state machine\char`\"{})
\item 
void \textbf{ osmo\+\_\+fsm\+\_\+vty\+\_\+add\+\_\+cmds} (void)
\begin{DoxyCompactList}\small\item\em Install VTY commands for FSM introspection This installs a couple of VTY commands for introspection of FSM classes as well as FSM instances. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ llist\+\_\+head} \textbf{ osmo\+\_\+g\+\_\+fsms}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Osmocom FSM introspection via VTY. 

This is code implementing generic VTY access to Osmocom FSMs from libosmocore. This means that any application can expose all state of all instances of all registered FSM classes by calling a single command during startup\+: \doxyref{osmo\+\_\+fsm\+\_\+vty\+\_\+add\+\_\+cmds}{p.}{fsm__vty_8c_a2a0ceb760bb02a48f84913f9f693fd9c} 

\doxysubsection{Macro Definition Documentation}
\mbox{\label{fsm__vty_8c_a6f30ddc96288c65bcc1f06704568a373}} 
\index{fsm\_vty.c@{fsm\_vty.c}!SH\_FSM\_STR@{SH\_FSM\_STR}}
\index{SH\_FSM\_STR@{SH\_FSM\_STR}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{SH\_FSM\_STR}
{\footnotesize\ttfamily \#define SH\+\_\+\+FSM\+\_\+\+STR~\textbf{ SHOW\+\_\+\+STR} \char`\"{}Show information about finite state \textbf{ machines\textbackslash{}n}\char`\"{}}

\mbox{\label{fsm__vty_8c_ac232b5712952480f19954fc80174f4d7}} 
\index{fsm\_vty.c@{fsm\_vty.c}!SH\_FSMI\_STR@{SH\_FSMI\_STR}}
\index{SH\_FSMI\_STR@{SH\_FSMI\_STR}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{SH\_FSMI\_STR}
{\footnotesize\ttfamily \#define SH\+\_\+\+FSMI\+\_\+\+STR~\textbf{ SHOW\+\_\+\+STR} \char`\"{}Show information about finite state machine \textbf{ instances\textbackslash{}n}\char`\"{}}



\doxysubsection{Function Documentation}
\mbox{\label{fsm__vty_8c_a7ba83ff3dd6f909686602ffcb495261f}} 
\index{fsm\_vty.c@{fsm\_vty.c}!DEFUN@{DEFUN}}
\index{DEFUN@{DEFUN}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{DEFUN()\hspace{0.1cm}{\footnotesize\ttfamily [1/4]}}
{\footnotesize\ttfamily DEFUN (\begin{DoxyParamCaption}\item[{show\+\_\+fsm}]{,  }\item[{show\+\_\+fsm\+\_\+cmd}]{,  }\item[{\char`\"{}show fsm NAME\char`\"{}}]{,  }\item[{\textbf{ SH\+\_\+\+FSM\+\_\+\+STR} \char`\"{}Display information about a single named finite state \textbf{ machine\textbackslash{}n}\char`\"{}}]{ }\end{DoxyParamCaption})}



References \textbf{ argv}, \textbf{ CMD\+\_\+\+SUCCESS}, \textbf{ CMD\+\_\+\+WARNING}, \textbf{ osmo\+\_\+fsm\+\_\+find\+\_\+by\+\_\+name()}, \textbf{ VTY\+\_\+\+NEWLINE}, \textbf{ vty\+\_\+out()}, and \textbf{ vty\+\_\+out\+\_\+fsm()}.

\mbox{\label{fsm__vty_8c_afa45e4849cc698fd189105c5cbbd965d}} 
\index{fsm\_vty.c@{fsm\_vty.c}!DEFUN@{DEFUN}}
\index{DEFUN@{DEFUN}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{DEFUN()\hspace{0.1cm}{\footnotesize\ttfamily [2/4]}}
{\footnotesize\ttfamily DEFUN (\begin{DoxyParamCaption}\item[{show\+\_\+fsm\+\_\+inst}]{,  }\item[{show\+\_\+fsm\+\_\+inst\+\_\+cmd}]{,  }\item[{\char`\"{}show fsm-\/instances NAME\char`\"{}}]{,  }\item[{\textbf{ SH\+\_\+\+FSMI\+\_\+\+STR} \char`\"{}Display a \textbf{ list} of all FSM instances of the named finite state machine\char`\"{}}]{ }\end{DoxyParamCaption})}



References \textbf{ argv}, \textbf{ CMD\+\_\+\+SUCCESS}, \textbf{ CMD\+\_\+\+WARNING}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::fsm}, \textbf{ osmo\+\_\+fsm\+::instances}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, \textbf{ osmo\+\_\+fsm\+\_\+find\+\_\+by\+\_\+name()}, \textbf{ VTY\+\_\+\+NEWLINE}, \textbf{ vty\+\_\+out()}, and \textbf{ vty\+\_\+out\+\_\+fsm\+\_\+inst()}.

\mbox{\label{fsm__vty_8c_a0cce96a30a97b9edc455709c25b2eb6d}} 
\index{fsm\_vty.c@{fsm\_vty.c}!DEFUN@{DEFUN}}
\index{DEFUN@{DEFUN}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{DEFUN()\hspace{0.1cm}{\footnotesize\ttfamily [3/4]}}
{\footnotesize\ttfamily DEFUN (\begin{DoxyParamCaption}\item[{show\+\_\+fsm\+\_\+insts}]{,  }\item[{show\+\_\+fsm\+\_\+insts\+\_\+cmd}]{,  }\item[{\char`\"{}show fsm-\/instances all\char`\"{}}]{,  }\item[{\textbf{ SH\+\_\+\+FSMI\+\_\+\+STR} \char`\"{}Display a \textbf{ list} of all FSM instances of all finite state machine\char`\"{}}]{ }\end{DoxyParamCaption})}



References \textbf{ CMD\+\_\+\+SUCCESS}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::fsm}, \textbf{ osmo\+\_\+fsm\+::instances}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, \textbf{ osmo\+\_\+g\+\_\+fsms}, and \textbf{ vty\+\_\+out\+\_\+fsm\+\_\+inst()}.

\mbox{\label{fsm__vty_8c_ab08aea7443d5db4b7b831dce068bd050}} 
\index{fsm\_vty.c@{fsm\_vty.c}!DEFUN@{DEFUN}}
\index{DEFUN@{DEFUN}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{DEFUN()\hspace{0.1cm}{\footnotesize\ttfamily [4/4]}}
{\footnotesize\ttfamily DEFUN (\begin{DoxyParamCaption}\item[{show\+\_\+fsms}]{,  }\item[{show\+\_\+fsms\+\_\+cmd}]{,  }\item[{\char`\"{}show fsm all\char`\"{}}]{,  }\item[{\textbf{ SH\+\_\+\+FSM\+\_\+\+STR} \char`\"{}Display a \textbf{ list} of all registered finite state \textbf{ machines\textbackslash{}n}\char`\"{}}]{ }\end{DoxyParamCaption})}



References \textbf{ CMD\+\_\+\+SUCCESS}, \textbf{ list}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, \textbf{ osmo\+\_\+g\+\_\+fsms}, and \textbf{ vty\+\_\+out\+\_\+fsm()}.

\mbox{\label{fsm__vty_8c_a2a0ceb760bb02a48f84913f9f693fd9c}} 
\index{fsm\_vty.c@{fsm\_vty.c}!osmo\_fsm\_vty\_add\_cmds@{osmo\_fsm\_vty\_add\_cmds}}
\index{osmo\_fsm\_vty\_add\_cmds@{osmo\_fsm\_vty\_add\_cmds}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{osmo\_fsm\_vty\_add\_cmds()}
{\footnotesize\ttfamily void osmo\+\_\+fsm\+\_\+vty\+\_\+add\+\_\+cmds (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Install VTY commands for FSM introspection This installs a couple of VTY commands for introspection of FSM classes as well as FSM instances. 

Call this once from your application if you want to support those commands. 

References \textbf{ install\+\_\+lib\+\_\+element\+\_\+ve()}.

\mbox{\label{fsm__vty_8c_a87dfbb27e5d0a1def0aacc8d82b80598}} 
\index{fsm\_vty.c@{fsm\_vty.c}!vty\_out\_fsm@{vty\_out\_fsm}}
\index{vty\_out\_fsm@{vty\_out\_fsm}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{vty\_out\_fsm()}
{\footnotesize\ttfamily void vty\+\_\+out\+\_\+fsm (\begin{DoxyParamCaption}\item[{struct \textbf{ vty} $\ast$}]{vty,  }\item[{struct \textbf{ osmo\+\_\+fsm} $\ast$}]{fsm }\end{DoxyParamCaption})}



Print information about a FSM [class] to the given VTY. 


\begin{DoxyParams}[1]{Parameters}
 & {\em vty} & The VTY to which to print \\
\hline
\mbox{\texttt{ in}}  & {\em fsm} & The FSM class to print \\
\hline
\end{DoxyParams}


References \textbf{ vty\+\_\+out\+\_\+fsm2()}.



Referenced by \textbf{ DEFUN()}.

\mbox{\label{fsm__vty_8c_a111cba8800b4de239d4f7236adb1bcb0}} 
\index{fsm\_vty.c@{fsm\_vty.c}!vty\_out\_fsm2@{vty\_out\_fsm2}}
\index{vty\_out\_fsm2@{vty\_out\_fsm2}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{vty\_out\_fsm2()}
{\footnotesize\ttfamily void vty\+\_\+out\+\_\+fsm2 (\begin{DoxyParamCaption}\item[{struct \textbf{ vty} $\ast$}]{vty,  }\item[{const char $\ast$}]{prefix,  }\item[{struct \textbf{ osmo\+\_\+fsm} $\ast$}]{fsm }\end{DoxyParamCaption})}



Print information about a FSM [class] to the given VTY. 


\begin{DoxyParams}[1]{Parameters}
 & {\em vty} & The VTY to which to print \\
\hline
\mbox{\texttt{ in}}  & {\em prefix} & prefix to print at start of each line (typically indenting) \\
\hline
\mbox{\texttt{ in}}  & {\em fsm} & The FSM class to print \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+fsm\+::event\+\_\+names}, \textbf{ osmo\+\_\+fsm\+\_\+state\+::in\+\_\+event\+\_\+mask}, \textbf{ log\+\_\+category\+\_\+name()}, \textbf{ osmo\+\_\+fsm\+::log\+\_\+subsys}, \textbf{ osmo\+\_\+fsm\+::name}, \textbf{ osmo\+\_\+fsm\+\_\+state\+::name}, \textbf{ osmo\+\_\+fsm\+::num\+\_\+states}, \textbf{ osmo\+\_\+fsm\+\_\+state\+::out\+\_\+state\+\_\+mask}, \textbf{ osmo\+\_\+fsm\+::states}, \textbf{ value\+\_\+string\+::str}, \textbf{ value\+\_\+string\+::value}, \textbf{ VTY\+\_\+\+NEWLINE}, and \textbf{ vty\+\_\+out()}.



Referenced by \textbf{ vty\+\_\+out\+\_\+fsm()}.

\mbox{\label{fsm__vty_8c_a8a7cb1a5f5e4a8f3f65af28c21233a02}} 
\index{fsm\_vty.c@{fsm\_vty.c}!vty\_out\_fsm\_inst@{vty\_out\_fsm\_inst}}
\index{vty\_out\_fsm\_inst@{vty\_out\_fsm\_inst}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{vty\_out\_fsm\_inst()}
{\footnotesize\ttfamily void vty\+\_\+out\+\_\+fsm\+\_\+inst (\begin{DoxyParamCaption}\item[{struct \textbf{ vty} $\ast$}]{vty,  }\item[{struct \textbf{ osmo\+\_\+fsm\+\_\+inst} $\ast$}]{fsmi }\end{DoxyParamCaption})}



Print a FSM instance to the given VTY. 


\begin{DoxyParams}[1]{Parameters}
 & {\em vty} & The VTY to which to print \\
\hline
\mbox{\texttt{ in}}  & {\em fsmi} & The FSM instance to print \\
\hline
\end{DoxyParams}


References \textbf{ vty\+\_\+out\+\_\+fsm\+\_\+inst2()}.



Referenced by \textbf{ DEFUN()}.

\mbox{\label{fsm__vty_8c_a71184bbde194141f314aa443a4e35494}} 
\index{fsm\_vty.c@{fsm\_vty.c}!vty\_out\_fsm\_inst2@{vty\_out\_fsm\_inst2}}
\index{vty\_out\_fsm\_inst2@{vty\_out\_fsm\_inst2}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{vty\_out\_fsm\_inst2()}
{\footnotesize\ttfamily void vty\+\_\+out\+\_\+fsm\+\_\+inst2 (\begin{DoxyParamCaption}\item[{struct \textbf{ vty} $\ast$}]{vty,  }\item[{const char $\ast$}]{prefix,  }\item[{struct \textbf{ osmo\+\_\+fsm\+\_\+inst} $\ast$}]{fsmi }\end{DoxyParamCaption})}



Print a FSM instance to the given VTY. 


\begin{DoxyParams}[1]{Parameters}
 & {\em vty} & The VTY to which to print \\
\hline
\mbox{\texttt{ in}}  & {\em prefix} & prefix to print at start of each line (typically indenting) \\
\hline
\mbox{\texttt{ in}}  & {\em fsmi} & The FSM instance to print \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+fsm\+\_\+inst\+::child}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::children}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::fsm}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::id}, \textbf{ llist\+\_\+for\+\_\+each\+\_\+entry}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::log\+\_\+level}, \textbf{ log\+\_\+level\+\_\+str()}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::name}, \textbf{ osmo\+\_\+fsm\+\_\+event\+\_\+name()}, \textbf{ osmo\+\_\+fsm\+\_\+state\+\_\+name()}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::parent}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::parent\+\_\+term\+\_\+event}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::proc}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::state}, \textbf{ osmo\+\_\+fsm\+\_\+inst\+::T}, \textbf{ VTY\+\_\+\+NEWLINE}, and \textbf{ vty\+\_\+out()}.



Referenced by \textbf{ vty\+\_\+out\+\_\+fsm\+\_\+inst()}.



\doxysubsection{Variable Documentation}
\mbox{\label{fsm__vty_8c_a1586bff70544ee2c0ffa0374a6b50741}} 
\index{fsm\_vty.c@{fsm\_vty.c}!osmo\_g\_fsms@{osmo\_g\_fsms}}
\index{osmo\_g\_fsms@{osmo\_g\_fsms}!fsm\_vty.c@{fsm\_vty.c}}
\doxysubsubsection{osmo\_g\_fsms}
{\footnotesize\ttfamily struct \textbf{ llist\+\_\+head} osmo\+\_\+g\+\_\+fsms\hspace{0.3cm}{\ttfamily [extern]}}



Referenced by \textbf{ DEFUN()}.

