178 lines
14 KiB
TeX
178 lines
14 KiB
TeX
\hypertarget{classcore_1_1TCPSession}{}\doxysection{core\+::T\+C\+P\+Session Class Reference}
|
|
\label{classcore_1_1TCPSession}\index{core::TCPSession@{core::TCPSession}}
|
|
|
|
|
|
{\ttfamily \#include $<$T\+C\+P\+Session.\+h$>$}
|
|
|
|
|
|
|
|
Inheritance diagram for core\+::T\+C\+P\+Session\+:\nopagebreak
|
|
\begin{figure}[H]
|
|
\begin{center}
|
|
\leavevmode
|
|
\includegraphics[width=320pt]{classcore_1_1TCPSession__inherit__graph}
|
|
\end{center}
|
|
\end{figure}
|
|
|
|
|
|
Collaboration diagram for core\+::T\+C\+P\+Session\+:\nopagebreak
|
|
\begin{figure}[H]
|
|
\begin{center}
|
|
\leavevmode
|
|
\includegraphics[width=350pt]{classcore_1_1TCPSession__coll__graph}
|
|
\end{center}
|
|
\end{figure}
|
|
\doxysubsection*{Public Member Functions}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_a7e1192babcdeb688f463d3e9e85d0979}\label{classcore_1_1TCPSession_a7e1192babcdeb688f463d3e9e85d0979}}
|
|
{\bfseries T\+C\+P\+Session} (\mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} \&e\+Poll, \mbox{\hyperlink{classcore_1_1TCPServer}{T\+C\+P\+Server}} \&server, std\+::string text=\char`\"{}\char`\"{})
|
|
\item
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_a50037cbfc515650e04054e5481785981}{output}} (std\+::stringstream \&data)
|
|
\item
|
|
void \mbox{\hyperlink{classcore_1_1TCPSession_a2b09eeafef5e44009a77d9da43e3b889}{send}} ()
|
|
\item
|
|
void \mbox{\hyperlink{classcore_1_1TCPSession_afdfe135694c6689f5365fac6c090ec33}{send\+To\+All}} ()
|
|
\item
|
|
void \mbox{\hyperlink{classcore_1_1TCPSession_a05c489dcd2ebd74f527864759929e351}{send\+To\+All}} (\mbox{\hyperlink{classcore_1_1SessionFilter}{Session\+Filter}} filter)
|
|
\item
|
|
void \mbox{\hyperlink{classcore_1_1TCPSession_a34936745e8d7669d5400e78d353a56d3}{terminate}} ()
|
|
\end{DoxyCompactItemize}
|
|
\doxysubsection*{Public Attributes}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_a2c39191d695d79891989ea628f42c0a8}\label{classcore_1_1TCPSession_a2c39191d695d79891989ea628f42c0a8}}
|
|
\mbox{\hyperlink{classcore_1_1Command}{Command}} $\ast$ {\bfseries grab} = N\+U\+LL
|
|
\item
|
|
std\+::stringstream \mbox{\hyperlink{classcore_1_1TCPSession_abb302bbb3d7e7bc75490c736364f0d4d}{out}}
|
|
\item
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_a265d9493fa544e601b5ad5fb1663340c}\label{classcore_1_1TCPSession_a265d9493fa544e601b5ad5fb1663340c}}
|
|
\mbox{\hyperlink{classcore_1_1TCPServer}{T\+C\+P\+Server}} \& {\bfseries server}
|
|
\end{DoxyCompactItemize}
|
|
\doxysubsection*{Protected Member Functions}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_aed4ed499b978bcea57a8efefe929fc98}\label{classcore_1_1TCPSession_aed4ed499b978bcea57a8efefe929fc98}}
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_aed4ed499b978bcea57a8efefe929fc98}{on\+Registered}} () override
|
|
\begin{DoxyCompactList}\small\item\em Called after the socket has been registered with epoll processing. \end{DoxyCompactList}\item
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_ac2c3ffef9ded12a8867e3d27902b001a}{on\+Data\+Received}} (char $\ast$data, int len) override
|
|
\item
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_a0f209620e9f11e70bfde54852b5c5460}{on\+Line\+Received}} (std\+::string line)
|
|
\item
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_a4403ef0a92b119dfa2e74667788e4ba1}{on\+Block\+Received}} (std\+::string block)
|
|
\item
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_a8719952f7bb00bf7239ec40aa2868626}{on\+Connected}} ()
|
|
\item
|
|
virtual void \mbox{\hyperlink{classcore_1_1TCPSession_ae90dc64e2d3c4b3239117923145edb3f}{protocol}} (std\+::string data)
|
|
\item
|
|
void \mbox{\hyperlink{classcore_1_1TCPSession_a836fb3fd5ee543ebc93262a980ae88b5}{set\+Block\+Size}} (int size=0)
|
|
\end{DoxyCompactItemize}
|
|
\doxysubsection*{Additional Inherited Members}
|
|
|
|
|
|
\doxysubsection{Detailed Description}
|
|
\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}}
|
|
|
|
\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} defines the nature of the interaction with the client and stores persistent data for a defined session. \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} objects are not sockets but instead provide a communications control mechanism. Protocol conversations are provided through extensions from this object.
|
|
|
|
\doxysubsection{Member Function Documentation}
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_a4403ef0a92b119dfa2e74667788e4ba1}\label{classcore_1_1TCPSession_a4403ef0a92b119dfa2e74667788e4ba1}}
|
|
\index{core::TCPSession@{core::TCPSession}!onBlockReceived@{onBlockReceived}}
|
|
\index{onBlockReceived@{onBlockReceived}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{onBlockReceived()}{onBlockReceived()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::on\+Block\+Received (\begin{DoxyParamCaption}\item[{std\+::string}]{block }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}
|
|
|
|
Override the on\+Block\+Received method to receive a string of characters that represents a single block of data of length determined by the block length value. If on\+Data\+Received was overriden this method will not be called unless the on\+Data\+Received calls this method explicitly using the class and member name. \mbox{\Hypertarget{classcore_1_1TCPSession_a8719952f7bb00bf7239ec40aa2868626}\label{classcore_1_1TCPSession_a8719952f7bb00bf7239ec40aa2868626}}
|
|
\index{core::TCPSession@{core::TCPSession}!onConnected@{onConnected}}
|
|
\index{onConnected@{onConnected}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{onConnected()}{onConnected()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::on\+Connected (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}
|
|
|
|
This method is called from within the protocol method when protocol is called on the initial connection where the data is an empty string. Use this method to deliver a message to the connection upon connection. \mbox{\Hypertarget{classcore_1_1TCPSession_ac2c3ffef9ded12a8867e3d27902b001a}\label{classcore_1_1TCPSession_ac2c3ffef9ded12a8867e3d27902b001a}}
|
|
\index{core::TCPSession@{core::TCPSession}!onDataReceived@{onDataReceived}}
|
|
\index{onDataReceived@{onDataReceived}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{onDataReceived()}{onDataReceived()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::on\+Data\+Received (\begin{DoxyParamCaption}\item[{char $\ast$}]{data, }\item[{int}]{len }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [protected]}, {\ttfamily [virtual]}}
|
|
|
|
Override this method to receive data directly from the socket as data is received. If you need data split by line termination characters then override the on\+Line\+Received method instead.
|
|
|
|
Reimplemented from \mbox{\hyperlink{classcore_1_1Socket}{core\+::\+Socket}}.
|
|
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_a0f209620e9f11e70bfde54852b5c5460}\label{classcore_1_1TCPSession_a0f209620e9f11e70bfde54852b5c5460}}
|
|
\index{core::TCPSession@{core::TCPSession}!onLineReceived@{onLineReceived}}
|
|
\index{onLineReceived@{onLineReceived}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{onLineReceived()}{onLineReceived()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::on\+Line\+Received (\begin{DoxyParamCaption}\item[{std\+::string}]{line }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}
|
|
|
|
Override the on\+Line\+Received method to receive a string of characters that represents a single line of data terminated by a LF or C\+R\+LF. If on\+Data\+Received was overriden this method will not be called unless the on\+Data\+Received calls this method explicitly using the class and member name. \mbox{\Hypertarget{classcore_1_1TCPSession_a50037cbfc515650e04054e5481785981}\label{classcore_1_1TCPSession_a50037cbfc515650e04054e5481785981}}
|
|
\index{core::TCPSession@{core::TCPSession}!output@{output}}
|
|
\index{output@{output}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{output()}{output()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::output (\begin{DoxyParamCaption}\item[{std\+::stringstream \&}]{out }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}
|
|
|
|
The output method is called by a socket session (\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}}) and will output the detail information for the client socket. When extending B\+M\+A\+T\+C\+P\+Socket or B\+M\+A\+Session you can override the method to add attributes to the list.
|
|
|
|
Reimplemented from \mbox{\hyperlink{classcore_1_1TCPSocket_afacf7528ff3c9ac077d7b5a49e2116fd}{core\+::\+T\+C\+P\+Socket}}.
|
|
|
|
|
|
|
|
Reimplemented in \mbox{\hyperlink{classcore_1_1TLSSession_ae55de8a035d1ddc560cf619b2030af43}{core\+::\+T\+L\+S\+Session}}.
|
|
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_ae90dc64e2d3c4b3239117923145edb3f}\label{classcore_1_1TCPSession_ae90dc64e2d3c4b3239117923145edb3f}}
|
|
\index{core::TCPSession@{core::TCPSession}!protocol@{protocol}}
|
|
\index{protocol@{protocol}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{protocol()}{protocol()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::protocol (\begin{DoxyParamCaption}\item[{std\+::string}]{data = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}
|
|
|
|
Override the protocol method to manage and control the session communications in your inherited session. If you do not override this method then the Session default will process the \textquotesingle{}commands\textquotesingle{} added to the server object using the process\+Request method on the session input.
|
|
|
|
When data is received within the session two modes are available to pass the data through the protocol method\+: L\+I\+NE or B\+L\+O\+CK.
|
|
|
|
Reimplemented in \mbox{\hyperlink{classcore_1_1TLSSession_a547c436ab69f75307f065eca8cfcd109}{core\+::\+T\+L\+S\+Session}}, and \mbox{\hyperlink{classcore_1_1ConsoleSession_a830cc1e1e0c3fe3b066f0a9f7f469490}{core\+::\+Console\+Session}}.
|
|
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_a2b09eeafef5e44009a77d9da43e3b889}\label{classcore_1_1TCPSession_a2b09eeafef5e44009a77d9da43e3b889}}
|
|
\index{core::TCPSession@{core::TCPSession}!send@{send}}
|
|
\index{send@{send}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{send()}{send()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::send (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
|
|
|
The send method is used to output the contents of the out stream to the session containing the stream. \mbox{\Hypertarget{classcore_1_1TCPSession_afdfe135694c6689f5365fac6c090ec33}\label{classcore_1_1TCPSession_afdfe135694c6689f5365fac6c090ec33}}
|
|
\index{core::TCPSession@{core::TCPSession}!sendToAll@{sendToAll}}
|
|
\index{sendToAll@{sendToAll}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{sendToAll()}{sendToAll()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::send\+To\+All (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
|
|
|
Use this send\+To\+All method to output the contents of the out stream to all the connections on the server excluding the sender session. \mbox{\Hypertarget{classcore_1_1TCPSession_a05c489dcd2ebd74f527864759929e351}\label{classcore_1_1TCPSession_a05c489dcd2ebd74f527864759929e351}}
|
|
\index{core::TCPSession@{core::TCPSession}!sendToAll@{sendToAll}}
|
|
\index{sendToAll@{sendToAll}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{sendToAll()}{sendToAll()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::send\+To\+All (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1SessionFilter}{Session\+Filter}}}]{filter }\end{DoxyParamCaption})}
|
|
|
|
Use this send\+To\+All method to output the contents of the out stream to all the connections on the server excluding the sender session and the entries identified by the passed in filter object. \mbox{\Hypertarget{classcore_1_1TCPSession_a836fb3fd5ee543ebc93262a980ae88b5}\label{classcore_1_1TCPSession_a836fb3fd5ee543ebc93262a980ae88b5}}
|
|
\index{core::TCPSession@{core::TCPSession}!setBlockSize@{setBlockSize}}
|
|
\index{setBlockSize@{setBlockSize}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{setBlockSize()}{setBlockSize()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::set\+Block\+Size (\begin{DoxyParamCaption}\item[{int}]{size = {\ttfamily 0} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}}
|
|
|
|
Use set\+Block\+Size to set the amount of data that should be read at once from the session data buffer. If this value is set to 0 then the data will be retrieved \mbox{\Hypertarget{classcore_1_1TCPSession_a34936745e8d7669d5400e78d353a56d3}\label{classcore_1_1TCPSession_a34936745e8d7669d5400e78d353a56d3}}
|
|
\index{core::TCPSession@{core::TCPSession}!terminate@{terminate}}
|
|
\index{terminate@{terminate}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{terminate()}{terminate()}}
|
|
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Session\+::terminate (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
|
|
|
Use this method to terminate this \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}}.
|
|
|
|
\doxysubsection{Member Data Documentation}
|
|
\mbox{\Hypertarget{classcore_1_1TCPSession_abb302bbb3d7e7bc75490c736364f0d4d}\label{classcore_1_1TCPSession_abb302bbb3d7e7bc75490c736364f0d4d}}
|
|
\index{core::TCPSession@{core::TCPSession}!out@{out}}
|
|
\index{out@{out}!core::TCPSession@{core::TCPSession}}
|
|
\doxysubsubsection{\texorpdfstring{out}{out}}
|
|
{\footnotesize\ttfamily std\+::stringstream core\+::\+T\+C\+P\+Session\+::out}
|
|
|
|
Use out to send data to the session socket or other session sockets.
|
|
|
|
The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
|
|
\item
|
|
T\+C\+P\+Session.\+h\item
|
|
T\+C\+P\+Session.\+cpp\end{DoxyCompactItemize}
|