\doxysection{include/osmocom/vty/buffer.h File Reference}
\label{buffer_8h}\index{include/osmocom/vty/buffer.h@{include/osmocom/vty/buffer.h}}


Buffering to output and input.  


{\ttfamily \#include $<$sys/types.\+h$>$}\newline
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ buffer\+\_\+status\+\_\+t} \{ \newline
\textbf{ BUFFER\+\_\+\+ERROR} = -\/1
, \newline
\textbf{ BUFFER\+\_\+\+EMPTY} = 0
, \newline
\textbf{ BUFFER\+\_\+\+PENDING} = 1
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ buffer} $\ast$ \textbf{ buffer\+\_\+new} (void $\ast$ctx, size\+\_\+t)
\item 
void \textbf{ buffer\+\_\+reset} (struct \textbf{ buffer} $\ast$)
\item 
void \textbf{ buffer\+\_\+free} (struct \textbf{ buffer} $\ast$)
\item 
void \textbf{ buffer\+\_\+put} (struct \textbf{ buffer} $\ast$, const void $\ast$, size\+\_\+t)
\item 
void \textbf{ buffer\+\_\+putc} (struct \textbf{ buffer} $\ast$, unsigned char)
\item 
void \textbf{ buffer\+\_\+putstr} (struct \textbf{ buffer} $\ast$, const char $\ast$)
\item 
char $\ast$ \textbf{ buffer\+\_\+getstr} (struct \textbf{ buffer} $\ast$)
\item 
int \textbf{ buffer\+\_\+empty} (struct \textbf{ buffer} $\ast$)
\item 
\textbf{ buffer\+\_\+status\+\_\+t} \textbf{ buffer\+\_\+write} (struct \textbf{ buffer} $\ast$, int \textbf{ fd}, const void $\ast$, size\+\_\+t)
\item 
\textbf{ buffer\+\_\+status\+\_\+t} \textbf{ buffer\+\_\+flush\+\_\+available} (struct \textbf{ buffer} $\ast$, int \textbf{ fd})
\item 
\textbf{ buffer\+\_\+status\+\_\+t} \textbf{ buffer\+\_\+flush\+\_\+all} (struct \textbf{ buffer} $\ast$, int \textbf{ fd})
\item 
\textbf{ buffer\+\_\+status\+\_\+t} \textbf{ buffer\+\_\+flush\+\_\+window} (struct \textbf{ buffer} $\ast$, int \textbf{ fd}, int width, int height, int erase, int no\+\_\+more)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Buffering to output and input. 



\doxysubsection{Enumeration Type Documentation}
\mbox{\label{buffer_8h_a11b72623a9601834584c5ecf08dd6e27}} 
\index{buffer.h@{buffer.h}!buffer\_status\_t@{buffer\_status\_t}}
\index{buffer\_status\_t@{buffer\_status\_t}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_status\_t}
{\footnotesize\ttfamily enum \textbf{ buffer\+\_\+status\+\_\+t}}

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{BUFFER\_ERROR@{BUFFER\_ERROR}!buffer.h@{buffer.h}}\index{buffer.h@{buffer.h}!BUFFER\_ERROR@{BUFFER\_ERROR}}}\mbox{\label{buffer_8h_a11b72623a9601834584c5ecf08dd6e27a6185688e62ce527910fd779f2093c6f1}} 
BUFFER\+\_\+\+ERROR&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{BUFFER\_EMPTY@{BUFFER\_EMPTY}!buffer.h@{buffer.h}}\index{buffer.h@{buffer.h}!BUFFER\_EMPTY@{BUFFER\_EMPTY}}}\mbox{\label{buffer_8h_a11b72623a9601834584c5ecf08dd6e27a78d7168c875c46a0fbb5835cd160e2ba}} 
BUFFER\+\_\+\+EMPTY&\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{BUFFER\_PENDING@{BUFFER\_PENDING}!buffer.h@{buffer.h}}\index{buffer.h@{buffer.h}!BUFFER\_PENDING@{BUFFER\_PENDING}}}\mbox{\label{buffer_8h_a11b72623a9601834584c5ecf08dd6e27a6a5c775497aad93877d86b6a334de110}} 
BUFFER\+\_\+\+PENDING&\\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\label{buffer_8h_a52b607c4b58938a160938b5a4ed7382e}} 
\index{buffer.h@{buffer.h}!buffer\_empty@{buffer\_empty}}
\index{buffer\_empty@{buffer\_empty}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_empty()}
{\footnotesize\ttfamily int buffer\+\_\+empty (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b }\end{DoxyParamCaption})}



References \textbf{ buffer\+::head}.

\mbox{\label{buffer_8h_a760a7d10d8c3a02e0c4ebc5f776f9cc3}} 
\index{buffer.h@{buffer.h}!buffer\_flush\_all@{buffer\_flush\_all}}
\index{buffer\_flush\_all@{buffer\_flush\_all}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_flush\_all()}
{\footnotesize\ttfamily \textbf{ buffer\+\_\+status\+\_\+t} buffer\+\_\+flush\+\_\+all (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b,  }\item[{int}]{fd }\end{DoxyParamCaption})}



References \textbf{ BUFFER\+\_\+\+EMPTY}, \textbf{ buffer\+\_\+flush\+\_\+available()}, \textbf{ BUFFER\+\_\+\+PENDING}, \textbf{ fd}, \textbf{ buffer\+::head}, and \textbf{ buffer\+\_\+data\+::sp}.



Referenced by \textbf{ client\+\_\+data()}, \textbf{ vty\+\_\+close()}, and \textbf{ vty\+\_\+flush()}.

\mbox{\label{buffer_8h_a342361ac4584b5612bfc8848144ed59b}} 
\index{buffer.h@{buffer.h}!buffer\_flush\_available@{buffer\_flush\_available}}
\index{buffer\_flush\_available@{buffer\_flush\_available}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_flush\_available()}
{\footnotesize\ttfamily \textbf{ buffer\+\_\+status\+\_\+t} buffer\+\_\+flush\+\_\+available (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b,  }\item[{int}]{fd }\end{DoxyParamCaption})}



References \textbf{ BUFFER\+\_\+\+DATA\+\_\+\+FREE}, \textbf{ BUFFER\+\_\+\+EMPTY}, \textbf{ BUFFER\+\_\+\+ERROR}, \textbf{ BUFFER\+\_\+\+PENDING}, \textbf{ buffer\+\_\+data\+::cp}, \textbf{ buffer\+\_\+data\+::data}, \textbf{ ERRNO\+\_\+\+IO\+\_\+\+RETRY}, \textbf{ fd}, \textbf{ buffer\+::head}, \textbf{ MAX\+\_\+\+CHUNKS}, \textbf{ MAX\+\_\+\+FLUSH}, \textbf{ buffer\+\_\+data\+::next}, \textbf{ buffer\+\_\+data\+::sp}, and \textbf{ buffer\+::tail}.



Referenced by \textbf{ buffer\+\_\+flush\+\_\+all()}, and \textbf{ buffer\+\_\+write()}.

\mbox{\label{buffer_8h_afcb12bf93399b19962893c0e16caa705}} 
\index{buffer.h@{buffer.h}!buffer\_flush\_window@{buffer\_flush\_window}}
\index{buffer\_flush\_window@{buffer\_flush\_window}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_flush\_window()}
{\footnotesize\ttfamily \textbf{ buffer\+\_\+status\+\_\+t} buffer\+\_\+flush\+\_\+window (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{,  }\item[{int}]{fd,  }\item[{int}]{width,  }\item[{int}]{height,  }\item[{int}]{erase,  }\item[{int}]{no\+\_\+more }\end{DoxyParamCaption})}

\mbox{\label{buffer_8h_a1e0559eaa1a32cd36154b90ab0eb910f}} 
\index{buffer.h@{buffer.h}!buffer\_free@{buffer\_free}}
\index{buffer\_free@{buffer\_free}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_free()}
{\footnotesize\ttfamily void buffer\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b }\end{DoxyParamCaption})}



References \textbf{ buffer\+\_\+reset()}.



Referenced by \textbf{ vty\+\_\+close()}, and \textbf{ vty\+\_\+new()}.

\mbox{\label{buffer_8h_a0eaa56cbd76766aa69adf91177ecad82}} 
\index{buffer.h@{buffer.h}!buffer\_getstr@{buffer\_getstr}}
\index{buffer\_getstr@{buffer\_getstr}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_getstr()}
{\footnotesize\ttfamily char $\ast$ buffer\+\_\+getstr (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b }\end{DoxyParamCaption})}



References \textbf{ data}, \textbf{ buffer\+::head}, and \textbf{ tall\+\_\+vty\+\_\+ctx}.

\mbox{\label{buffer_8h_a6dd416196ef14875b303b628b7e9ce31}} 
\index{buffer.h@{buffer.h}!buffer\_new@{buffer\_new}}
\index{buffer\_new@{buffer\_new}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_new()}
{\footnotesize\ttfamily struct \textbf{ buffer} $\ast$ buffer\+\_\+new (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



References \textbf{ BUFFER\+\_\+\+SIZE\+\_\+\+DEFAULT}, and \textbf{ buffer\+::size}.



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

\mbox{\label{buffer_8h_a4ed00ae1d2325b0af2c079acb6299d07}} 
\index{buffer.h@{buffer.h}!buffer\_put@{buffer\_put}}
\index{buffer\_put@{buffer\_put}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_put()}
{\footnotesize\ttfamily void buffer\+\_\+put (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b,  }\item[{const void $\ast$}]{p,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



References \textbf{ buffer\+\_\+add()}, \textbf{ data}, \textbf{ buffer\+::size}, and \textbf{ buffer\+::tail}.



Referenced by \textbf{ buffer\+\_\+putc()}, \textbf{ buffer\+\_\+putstr()}, \textbf{ buffer\+\_\+write()}, \textbf{ vty\+\_\+out\+\_\+newline()}, \textbf{ vty\+\_\+out\+\_\+va()}, and \textbf{ vty\+\_\+write()}.

\mbox{\label{buffer_8h_ae0f9b1e7e87fe076ec4951f79702c7fa}} 
\index{buffer.h@{buffer.h}!buffer\_putc@{buffer\_putc}}
\index{buffer\_putc@{buffer\_putc}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_putc()}
{\footnotesize\ttfamily void buffer\+\_\+putc (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b,  }\item[{unsigned char}]{c }\end{DoxyParamCaption})}



References \textbf{ buffer\+\_\+put()}, and \textbf{ c}.

\mbox{\label{buffer_8h_ae444912a8f8038846d7b732d747579af}} 
\index{buffer.h@{buffer.h}!buffer\_putstr@{buffer\_putstr}}
\index{buffer\_putstr@{buffer\_putstr}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_putstr()}
{\footnotesize\ttfamily void buffer\+\_\+putstr (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b,  }\item[{const char $\ast$}]{c }\end{DoxyParamCaption})}



References \textbf{ buffer\+\_\+put()}, and \textbf{ c}.

\mbox{\label{buffer_8h_ac9fc6d7543026d750a2a1006988b4928}} 
\index{buffer.h@{buffer.h}!buffer\_reset@{buffer\_reset}}
\index{buffer\_reset@{buffer\_reset}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_reset()}
{\footnotesize\ttfamily void buffer\+\_\+reset (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b }\end{DoxyParamCaption})}



References \textbf{ BUFFER\+\_\+\+DATA\+\_\+\+FREE}, \textbf{ data}, \textbf{ buffer\+::head}, \textbf{ buffer\+\_\+data\+::next}, and \textbf{ buffer\+::tail}.



Referenced by \textbf{ buffer\+\_\+free()}, \textbf{ vty\+\_\+buffer\+\_\+reset()}, \textbf{ vty\+\_\+read()}, and \textbf{ vty\+\_\+reset()}.

\mbox{\label{buffer_8h_a617308d4628c6f30da50679a6a008cb1}} 
\index{buffer.h@{buffer.h}!buffer\_write@{buffer\_write}}
\index{buffer\_write@{buffer\_write}!buffer.h@{buffer.h}}
\doxysubsubsection{buffer\_write()}
{\footnotesize\ttfamily \textbf{ buffer\+\_\+status\+\_\+t} buffer\+\_\+write (\begin{DoxyParamCaption}\item[{struct \textbf{ buffer} $\ast$}]{b,  }\item[{int}]{fd,  }\item[{const void $\ast$}]{p,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



References \textbf{ BUFFER\+\_\+\+EMPTY}, \textbf{ BUFFER\+\_\+\+ERROR}, \textbf{ buffer\+\_\+flush\+\_\+available()}, \textbf{ BUFFER\+\_\+\+PENDING}, \textbf{ buffer\+\_\+put()}, \textbf{ ERRNO\+\_\+\+IO\+\_\+\+RETRY}, \textbf{ fd}, and \textbf{ buffer\+::head}.

