\doxysection{include/osmocom/vty/vty.h File Reference}
\label{vty_8h}\index{include/osmocom/vty/vty.h@{include/osmocom/vty/vty.h}}
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdarg.\+h$>$}\newline
{\ttfamily \#include $<$stdbool.\+h$>$}\newline
{\ttfamily \#include $<$time.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/defs.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ vty}
\begin{DoxyCompactList}\small\item\em Internal representation of a single VTY. \end{DoxyCompactList}\item 
struct \textbf{ vty\+\_\+app\+\_\+info}
\begin{DoxyCompactList}\small\item\em Information an application registers with the VTY. \end{DoxyCompactList}\item 
struct \textbf{ vty\+\_\+signal\+\_\+data}
\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ VTY\+\_\+\+PRINTF\+\_\+\+ATTRIBUTE}(a,  b)
\item 
\#define \textbf{ ERRNO\+\_\+\+IO\+\_\+\+RETRY}(EN)~ (((EN) == EAGAIN) $\vert$$\vert$ ((EN) == EWOULDBLOCK) $\vert$$\vert$ ((EN) == EINTR))
\item 
\#define \textbf{ VTY\+\_\+\+READ\+\_\+\+BUFSIZ}~512
\item 
\#define \textbf{ VTY\+\_\+\+BUFSIZ}~512
\item 
\#define \textbf{ VTY\+\_\+\+MAXHIST}~20
\item 
\#define \textbf{ VTY\+\_\+\+CMD\+\_\+\+USR\+\_\+\+ATTR\+\_\+\+NUM}~32
\item 
\#define \textbf{ VTY\+\_\+\+CMD\+\_\+\+ATTR\+\_\+\+FLAGS\+\_\+\+RESERVED}~ \{ \textquotesingle{}.\textquotesingle{}, \textquotesingle{}!\textquotesingle{}, \textquotesingle{}@\textquotesingle{}, \textquotesingle{}$^\wedge$\textquotesingle{} \}
\item 
\#define \textbf{ TELNET\+\_\+\+NAWS\+\_\+\+SB\+\_\+\+LEN}~5
\item 
\#define \textbf{ VTY\+\_\+\+NEWLINE}~((\textbf{ vty}-\/$>$\textbf{ type} == \textbf{ VTY\+\_\+\+TERM}) ? \char`\"{}\textbackslash{}r\textbackslash{}n\char`\"{} \+: \char`\"{}\textbackslash{}\textbf{ n}\char`\"{})
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ event} \{ \newline
\textbf{ VTY\+\_\+\+SERV}
, \newline
\textbf{ VTY\+\_\+\+READ}
, \newline
\textbf{ VTY\+\_\+\+WRITE}
, \newline
\textbf{ VTY\+\_\+\+CLOSED}
, \newline
\textbf{ VTY\+\_\+\+TIMEOUT\+\_\+\+RESET}
 \}
\begin{DoxyCompactList}\small\item\em VTY events. \end{DoxyCompactList}\item 
enum \textbf{ vty\+\_\+type} \{ \newline
\textbf{ VTY\+\_\+\+TERM}
, \newline
\textbf{ VTY\+\_\+\+FILE}
, \newline
\textbf{ VTY\+\_\+\+SHELL}
, \newline
\textbf{ VTY\+\_\+\+SHELL\+\_\+\+SERV}
 \}
\item 
enum \textbf{ signal\+\_\+vty} \{ \textbf{ S\+\_\+\+VTY\+\_\+\+EVENT}
 \}
\begin{DoxyCompactList}\small\item\em signal handling \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static const char $\ast$ \textbf{ vty\+\_\+newline} (struct \textbf{ vty} $\ast$\textbf{ vty})
\item 
void \textbf{ vty\+\_\+init} (struct \textbf{ vty\+\_\+app\+\_\+info} $\ast$app\+\_\+info)
\begin{DoxyCompactList}\small\item\em Initialize VTY layer. \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+read\+\_\+config\+\_\+file} (const char $\ast$file\+\_\+name, void $\ast$priv)
\begin{DoxyCompactList}\small\item\em Read the configuration file using the VTY code. \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+read\+\_\+config\+\_\+filep} (FILE $\ast$confp, void $\ast$priv)
\begin{DoxyCompactList}\small\item\em Read up VTY configuration from a file stream. \end{DoxyCompactList}\item 
void \textbf{ vty\+\_\+init\+\_\+vtysh} (void)
\item 
void \textbf{ vty\+\_\+reset} (void)
\begin{DoxyCompactList}\small\item\em Reset all VTY status. \end{DoxyCompactList}\item 
struct \textbf{ vty} $\ast$ \textbf{ vty\+\_\+new} (void)
\begin{DoxyCompactList}\small\item\em Allocate a new vty interface structure. \end{DoxyCompactList}\item 
struct \textbf{ vty} $\ast$ \textbf{ vty\+\_\+create} (int vty\+\_\+sock, void $\ast$priv)
\begin{DoxyCompactList}\small\item\em Create new vty structure. \end{DoxyCompactList}\item 
bool \textbf{ vty\+\_\+is\+\_\+active} (struct \textbf{ vty} $\ast$\textbf{ vty})
\item 
int \textbf{ vty\+\_\+out} (struct \textbf{ vty} $\ast$, const char $\ast$,...) \textbf{ VTY\+\_\+\+PRINTF\+\_\+\+ATTRIBUTE}(2
\item 
int int \textbf{ vty\+\_\+out\+\_\+va} (struct \textbf{ vty} $\ast$\textbf{ vty}, const char $\ast$format, va\+\_\+list ap)
\item 
int \textbf{ vty\+\_\+out\+\_\+newline} (struct \textbf{ vty} $\ast$)
\begin{DoxyCompactList}\small\item\em print a newline on the given VTY \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+out\+\_\+uptime} (struct \textbf{ vty} $\ast$\textbf{ vty}, const struct timespec $\ast$\textbf{ starttime})
\begin{DoxyCompactList}\small\item\em calculates the time difference of a give timespec to the current time and prints in a human readable format (days, hours, minutes, seconds). \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+read} (struct \textbf{ vty} $\ast$\textbf{ vty})
\begin{DoxyCompactList}\small\item\em Read data via vty socket. \end{DoxyCompactList}\item 
void \textbf{ vty\+\_\+close} (struct \textbf{ vty} $\ast$)
\begin{DoxyCompactList}\small\item\em Close a given vty interface. \end{DoxyCompactList}\item 
void \textbf{ vty\+\_\+flush} (struct \textbf{ vty} $\ast$\textbf{ vty})
\item 
char $\ast$ \textbf{ vty\+\_\+get\+\_\+cwd} (void)
\item 
void \textbf{ vty\+\_\+log} (const char $\ast$\textbf{ level}, const char $\ast$\textbf{ proto}, const char $\ast$fmt, va\+\_\+list)
\item 
int \textbf{ vty\+\_\+config\+\_\+lock} (struct \textbf{ vty} $\ast$)
\begin{DoxyCompactList}\small\item\em Lock the configuration to a given VTY. \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+config\+\_\+unlock} (struct \textbf{ vty} $\ast$)
\begin{DoxyCompactList}\small\item\em Unlock the configuration from a given VTY. \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+shell} (struct \textbf{ vty} $\ast$)
\begin{DoxyCompactList}\small\item\em Return if this VTY is a shell or not. \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+shell\+\_\+serv} (struct \textbf{ vty} $\ast$)
\item 
void \textbf{ vty\+\_\+hello} (struct \textbf{ vty} $\ast$)
\item 
void $\ast$ \textbf{ vty\+\_\+current\+\_\+index} (struct \textbf{ vty} $\ast$)
\begin{DoxyCompactList}\small\item\em return the current index of a given VTY \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+current\+\_\+node} (struct \textbf{ vty} $\ast$\textbf{ vty})
\begin{DoxyCompactList}\small\item\em return the current node of a given VTY \end{DoxyCompactList}\item 
int \textbf{ vty\+\_\+go\+\_\+parent} (struct \textbf{ vty} $\ast$\textbf{ vty})
\item 
const char $\ast$ \textbf{ vty\+\_\+get\+\_\+bind\+\_\+addr} (void)
\item 
int \textbf{ vty\+\_\+get\+\_\+bind\+\_\+port} (int default\+\_\+port)
\begin{DoxyCompactList}\small\item\em Returns configured port passed to the \textquotesingle{}line vty\textquotesingle{}/\textquotesingle{}bind\textquotesingle{} command or default\+\_\+port. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
void $\ast$ \textbf{ tall\+\_\+vty\+\_\+ctx}
\item 
struct \textbf{ cmd\+\_\+element} \textbf{ cfg\+\_\+description\+\_\+cmd}
\item 
struct \textbf{ cmd\+\_\+element} \textbf{ cfg\+\_\+no\+\_\+description\+\_\+cmd}
\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{vty_8h_a3dc5068383c050852fa22207582a21cc}} 
\index{vty.h@{vty.h}!TELNET\_NAWS\_SB\_LEN@{TELNET\_NAWS\_SB\_LEN}}
\index{TELNET\_NAWS\_SB\_LEN@{TELNET\_NAWS\_SB\_LEN}!vty.h@{vty.h}}
\doxysubsubsection{TELNET\_NAWS\_SB\_LEN}
{\footnotesize\ttfamily \#define TELNET\+\_\+\+NAWS\+\_\+\+SB\+\_\+\+LEN~5}

