\section{ost::Unix\-Stream Class Reference} \label{classost_1_1_unix_stream}\index{ost::UnixStream@{ost::UnixStream}} Unix streams are used to represent Unix domain client connections to a local server for accepting client connections.streamable Unix domain socket connection. {\tt \#include $<$unix.h$>$} Inheritance diagram for ost::Unix\-Stream::\begin{figure}[H] \begin{center} \leavevmode \includegraphics[height=3cm]{classost_1_1_unix_stream} \end{center} \end{figure} \subsection*{Public Member Functions} \begin{CompactItemize} \item {\bf Unix\-Stream} ({\bf Unix\-Socket} \&server, int size=512, bool throwflag=true, {\bf timeout\_\-t} {\bf timeout}=0) \begin{CompactList}\small\item\em Create a Unix domain stream by accepting a connection from a bound Unix domain socket acting as a server. \item\end{CompactList}\item {\bf Unix\-Stream} (const char $\ast$pathname, int size=512, bool throwflag=true, {\bf timeout\_\-t} to=0) \begin{CompactList}\small\item\em Create a Unix domain stream by connecting to a Unix domain socket. \item\end{CompactList}\item void {\bf set\-Timeout} ({\bf timeout\_\-t} to) \begin{CompactList}\small\item\em Set the I/O operation timeout for socket I/O operations. \item\end{CompactList}\item {\bf Unix\-Stream} (const {\bf Unix\-Stream} \&source) \begin{CompactList}\small\item\em A copy constructor creates a new stream buffer. \item\end{CompactList}\item virtual {\bf $\sim$Unix\-Stream} () \begin{CompactList}\small\item\em Flush and empty all buffers, and then remove the allocated buffers. \item\end{CompactList}\item int {\bf sync} (void) \begin{CompactList}\small\item\em Flushes the stream input and output buffers, writes pending output. \item\end{CompactList}\item bool {\bf is\-Pending} ({\bf Pending} pend, {\bf timeout\_\-t} {\bf timeout}=TIMEOUT\_\-INF) \begin{CompactList}\small\item\em Get the status of pending stream data. \item\end{CompactList}\item int {\bf get\-Buffer\-Size} (void) const \begin{CompactList}\small\item\em Return the size of the current stream buffering used. \item\end{CompactList}\end{CompactItemize} \subsection*{Protected Member Functions} \begin{CompactItemize} \item {\bf Unix\-Stream} (bool throwflag=true) \begin{CompactList}\small\item\em The constructor required for \char`\"{}unixstream\char`\"{}, a more C++ style version of the {\bf TCPStream}{\rm (p.\,\pageref{classost_1_1_t_c_p_stream})} class. \item\end{CompactList}\item void {\bf allocate} (int size) \begin{CompactList}\small\item\em Used to allocate the buffer space needed for iostream operations. \item\end{CompactList}\item void {\bf end\-Stream} (void) \begin{CompactList}\small\item\em Used to terminate the buffer space and cleanup the socket connection. \item\end{CompactList}\item virtual int {\bf underflow} (void) \begin{CompactList}\small\item\em This streambuf method is used to load the input buffer through the established unix domain socket connection. \item\end{CompactList}\item int {\bf uflow} (void) \begin{CompactList}\small\item\em This streambuf method is used for doing unbuffered reads through the established unix domain socket connection when in interactive mode. \item\end{CompactList}\item int {\bf overflow} (int ch) \begin{CompactList}\small\item\em This streambuf method is used to write the output buffer through the established unix domain connection. \item\end{CompactList}\item void {\bf connect} (const char $\ast$pathname, int size) \begin{CompactList}\small\item\em Create a Unix domain stream by connecting to a Unix domain socket. \item\end{CompactList}\item std::iostream $\ast$ {\bf unixstr} (void) \begin{CompactList}\small\item\em Used in derived classes to refer to the current object via it's iostream. \item\end{CompactList}\end{CompactItemize} \subsection*{Protected Attributes} \begin{CompactItemize} \item {\bf timeout\_\-t} {\bf timeout} \item int {\bf bufsize} \item char $\ast$ {\bf gbuf} \item char $\ast$ {\bf pbuf} \end{CompactItemize} \subsection{Detailed Description} Unix streams are used to represent Unix domain client connections to a local server for accepting client connections.streamable Unix domain socket connection. The Unix stream is a C++ \char`\"{}stream\char`\"{} class, and can accept streaming of data to and from other C++ objects using the $<$$<$ and $>$$>$ operators. Unix Stream itself can be formed either by connecting to a bound network address of a Unix domain server, or can be created when \char`\"{}accepting\char`\"{} a network connection from a Unix domain server. \begin{Desc} \item[Author:]Alex Pavloff $<${\tt alex@pavloff.net}$>$ \end{Desc} \subsection{Constructor \& Destructor Documentation} \index{ost::UnixStream@{ost::Unix\-Stream}!UnixStream@{UnixStream}} \index{UnixStream@{UnixStream}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Unix\-Stream::Unix\-Stream (bool {\em throwflag} = {\tt true})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_d7716a7585a96013b5617737b3b6ad15} The constructor required for \char`\"{}unixstream\char`\"{}, a more C++ style version of the {\bf TCPStream}{\rm (p.\,\pageref{classost_1_1_t_c_p_stream})} class. \index{ost::UnixStream@{ost::Unix\-Stream}!UnixStream@{UnixStream}} \index{UnixStream@{UnixStream}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Unix\-Stream::Unix\-Stream ({\bf Unix\-Socket} \& {\em server}, int {\em size} = {\tt 512}, bool {\em throwflag} = {\tt true}, {\bf timeout\_\-t} {\em timeout} = {\tt 0})}\label{classost_1_1_unix_stream_47aa1e84b6b30aaf685da37d1c33333d} Create a Unix domain stream by accepting a connection from a bound Unix domain socket acting as a server. This performs an \char`\"{}accept\char`\"{} call. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em server}]socket listening. \item[{\em size}]of streaming input and output buffers. \item[{\em throwflag}]flag to throw errors. \item[{\em timeout}]for all operations. \end{description} \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!UnixStream@{UnixStream}} \index{UnixStream@{UnixStream}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Unix\-Stream::Unix\-Stream (const char $\ast$ {\em pathname}, int {\em size} = {\tt 512}, bool {\em throwflag} = {\tt true}, {\bf timeout\_\-t} {\em to} = {\tt 0})}\label{classost_1_1_unix_stream_c3ab04484686582f0da458e445f8c54a} Create a Unix domain stream by connecting to a Unix domain socket. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em pathname}]path to socket \item[{\em size}]of streaming input and output buffers. \item[{\em throwflag}]flag to throw errors. \item[{\em to}]timeout for all operations. \end{description} \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!UnixStream@{UnixStream}} \index{UnixStream@{UnixStream}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Unix\-Stream::Unix\-Stream (const {\bf Unix\-Stream} \& {\em source})}\label{classost_1_1_unix_stream_85445b9696aef793efaf149ab4c0f17a} A copy constructor creates a new stream buffer. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em source}]of copy. \end{description} \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!~UnixStream@{$\sim$UnixStream}} \index{~UnixStream@{$\sim$UnixStream}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Unix\-Stream::$\sim$Unix\-Stream ()\hspace{0.3cm}{\tt [virtual]}}\label{classost_1_1_unix_stream_ca8dc404a29b1e82cda4668cf11a16f7} Flush and empty all buffers, and then remove the allocated buffers. \subsection{Member Function Documentation} \index{ost::UnixStream@{ost::Unix\-Stream}!allocate@{allocate}} \index{allocate@{allocate}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Unix\-Stream::allocate (int {\em size})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_61c6df3222ae19b4fcd3292355a40dad} Used to allocate the buffer space needed for iostream operations. This function is called by the constructor. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em size}]of stream buffers from constructor. \end{description} \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!connect@{connect}} \index{connect@{connect}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Unix\-Stream::connect (const char $\ast$ {\em pathname}, int {\em size})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_3077c8e255acdf561438c31010e96fe1} Create a Unix domain stream by connecting to a Unix domain socket. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em pathname}]path to socket \item[{\em size}]of streaming input and output buffers. \end{description} \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!endStream@{endStream}} \index{endStream@{endStream}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Unix\-Stream::end\-Stream (void)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_8e1d91df372138f19b184de24507cd7a} Used to terminate the buffer space and cleanup the socket connection. This fucntion is called by the destructor. \index{ost::UnixStream@{ost::Unix\-Stream}!getBufferSize@{getBufferSize}} \index{getBufferSize@{getBufferSize}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Unix\-Stream::get\-Buffer\-Size (void) const\hspace{0.3cm}{\tt [inline]}}\label{classost_1_1_unix_stream_47ee3a02e54d02259e2073f616b315b6} Return the size of the current stream buffering used. \begin{Desc} \item[Returns:]size of stream buffers. \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!isPending@{isPending}} \index{isPending@{isPending}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Unix\-Stream::is\-Pending ({\bf Pending} {\em pend}, {\bf timeout\_\-t} {\em timeout} = {\tt TIMEOUT\_\-INF})}\label{classost_1_1_unix_stream_c997ba048d1e2cfa30f2f73474571534} Get the status of pending stream data. This can be used to examine if input or output is waiting, or if an error or disconnect has occured on the stream. If a read buffer contains data then input is ready and if write buffer contains data it is first flushed and then checked. \index{ost::UnixStream@{ost::Unix\-Stream}!overflow@{overflow}} \index{overflow@{overflow}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Unix\-Stream::overflow (int {\em ch})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_f1da2e12a8f72df5210d9508e31da2b3} This streambuf method is used to write the output buffer through the established unix domain connection. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em ch}]char to push through. \end{description} \end{Desc} \begin{Desc} \item[Returns:]char pushed through. \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!setTimeout@{setTimeout}} \index{setTimeout@{setTimeout}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Unix\-Stream::set\-Timeout ({\bf timeout\_\-t} {\em to})\hspace{0.3cm}{\tt [inline]}}\label{classost_1_1_unix_stream_3a83e5c60400c15691e07cc1572f896e} Set the I/O operation timeout for socket I/O operations. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em to}]timeout to set. \end{description} \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!sync@{sync}} \index{sync@{sync}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Unix\-Stream::sync (void)}\label{classost_1_1_unix_stream_fb5c9e8757dd646f31ebbc9317dc009c} Flushes the stream input and output buffers, writes pending output. \begin{Desc} \item[Returns:]0 on success. \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!uflow@{uflow}} \index{uflow@{uflow}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Unix\-Stream::uflow (void)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_264a06acbe32b9af460f6c27fb7d9cf9} This streambuf method is used for doing unbuffered reads through the established unix domain socket connection when in interactive mode. Also this method will handle proper use of buffers if not in interative mode. \begin{Desc} \item[Returns:]char from unix domain socket connection, EOF if not connected. \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!underflow@{underflow}} \index{underflow@{underflow}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int ost::Unix\-Stream::underflow (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_unix_stream_f3f6b4f669ea0e3dca087824101545ce} This streambuf method is used to load the input buffer through the established unix domain socket connection. \begin{Desc} \item[Returns:]char from get buffer, EOF if not connected. \end{Desc} \index{ost::UnixStream@{ost::Unix\-Stream}!unixstr@{unixstr}} \index{unixstr@{unixstr}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}std::iostream$\ast$ ost::Unix\-Stream::unixstr (void)\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_unix_stream_4995485ba6ee8cb82ea680b07bb7f4d5} Used in derived classes to refer to the current object via it's iostream. For example, to send a set of characters in a derived method, one might use $\ast$tcp() $<$$<$ \char`\"{}test\char`\"{}. \begin{Desc} \item[Returns:]stream pointer of this object. \end{Desc} \subsection{Member Data Documentation} \index{ost::UnixStream@{ost::Unix\-Stream}!bufsize@{bufsize}} \index{bufsize@{bufsize}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf ost::Unix\-Stream::bufsize}\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_f46a88a033dff67d8b606462ae3b82ca} \index{ost::UnixStream@{ost::Unix\-Stream}!gbuf@{gbuf}} \index{gbuf@{gbuf}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf ost::Unix\-Stream::gbuf}\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_ae0c867b6f05f1acb04ddf264a80a0d4} \index{ost::UnixStream@{ost::Unix\-Stream}!pbuf@{pbuf}} \index{pbuf@{pbuf}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}char $\ast$ {\bf ost::Unix\-Stream::pbuf}\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_9eb647ea64a38e48ab3f2bf850c8ca59} \index{ost::UnixStream@{ost::Unix\-Stream}!timeout@{timeout}} \index{timeout@{timeout}!ost::UnixStream@{ost::Unix\-Stream}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf timeout\_\-t} {\bf ost::Unix\-Stream::timeout}\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_unix_stream_e7ec25f34d873ef18fd64d8b0f02cf79} The documentation for this class was generated from the following file:\begin{CompactItemize} \item {\bf unix.h}\end{CompactItemize}