\hypertarget{classcore_1_1TCPServer}{}\doxysection{core\+::T\+C\+P\+Server Class Reference}
\label{classcore_1_1TCPServer}\index{core::TCPServer@{core::TCPServer}}


{\ttfamily \#include $<$T\+C\+P\+Server.\+h$>$}



Inheritance diagram for core\+::T\+C\+P\+Server\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=304pt]{classcore_1_1TCPServer__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for core\+::T\+C\+P\+Server\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classcore_1_1TCPServer__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classcore_1_1TCPServer_a418924164fd6e59800272fbd6f069bb9}{T\+C\+P\+Server}} (\mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} \&e\+Poll, \mbox{\hyperlink{classcore_1_1IPAddress}{I\+P\+Address}} address, std\+::string text=\char`\"{}\char`\"{})
\item 
\mbox{\hyperlink{classcore_1_1TCPServer_a7ccdc057c9eee8504fce796301f82088}{$\sim$\+T\+C\+P\+Server}} ()
\item 
\mbox{\Hypertarget{classcore_1_1TCPServer_a554ec6e67d368e7bb545d95635c0a0df}\label{classcore_1_1TCPServer_a554ec6e67d368e7bb545d95635c0a0df}} 
virtual void {\bfseries session\+Error\+Handler} (std\+::string error\+String, std\+::stringstream \&out)
\item 
virtual \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_a841f02799ad8529aad7cea132f4de8a9}{get\+Socket\+Accept}} (\mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} \&epoll)
\item 
\mbox{\Hypertarget{classcore_1_1TCPServer_a88c603cd5df9dbc1632fd4b5e164d75b}\label{classcore_1_1TCPServer_a88c603cd5df9dbc1632fd4b5e164d75b}} 
void {\bfseries remove\+From\+Session\+List} (\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$session)
\item 
\mbox{\Hypertarget{classcore_1_1TCPServer_a120d5031360cc62251bdc43fa2d9813a}\label{classcore_1_1TCPServer_a120d5031360cc62251bdc43fa2d9813a}} 
void \mbox{\hyperlink{classcore_1_1TCPServer_a120d5031360cc62251bdc43fa2d9813a}{output}} (\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$session)
\begin{DoxyCompactList}\small\item\em Output the consoles array to the console. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
std\+::vector$<$ \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$ $>$ \mbox{\hyperlink{classcore_1_1TCPServer_aeed1bc55d099667ccda51cd682bfc633}{sessions}}
\item 
\mbox{\hyperlink{classcore_1_1CommandList}{Command\+List}} \mbox{\hyperlink{classcore_1_1TCPServer_afcc44802b988e2f4292504e804dccf8b}{commands}}
\item 
\mbox{\hyperlink{classcore_1_1IPAddressList}{I\+P\+Address\+List}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_a82f6bf16e4ab20d8b30da09e034fffff}{black\+List}}
\item 
\mbox{\hyperlink{classcore_1_1IPAddressList}{I\+P\+Address\+List}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_abad6300b6234ca8b69cef9128755342e}{white\+List}}
\end{DoxyCompactItemize}
\doxysubsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classcore_1_1TCPServer_a276ccbc8cb9b4380ebd78807b97f0159}{on\+Data\+Received}} (std\+::string data) override
\item 
int \mbox{\hyperlink{classcore_1_1TCPServer_ad08e04a2ff44c9c40419cdc6bd0e4b79}{process\+Command}} (coreutils\+::\+Z\+String command, \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$session, std\+::stringstream \&data) override
\item 
void \mbox{\hyperlink{classcore_1_1TCPServer_a151f29593c0d1fa998e2b86b19c631f4}{send\+To\+All}} (std\+::stringstream \&out, \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$sender, \mbox{\hyperlink{classcore_1_1SessionFilter}{Session\+Filter}} \&filter)
\item 
void \mbox{\hyperlink{classcore_1_1TCPServer_aa225cd2b704167ff22503e1897fe538f}{send\+To\+All}} (std\+::stringstream \&out, \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$sender)
\end{DoxyCompactItemize}
\doxysubsection*{Additional Inherited Members}


\doxysubsection{Detailed Description}
\mbox{\hyperlink{classcore_1_1TCPServer}{T\+C\+P\+Server}}

Manage a socket connection as a T\+CP server type. Connections to the socket are processed through the accept functionality.

A list of connections is maintained in a vector object.

This object extends the B\+M\+A\+Command object as well so it can be added to a Console object and process commands to display status information. 

\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classcore_1_1TCPServer_a418924164fd6e59800272fbd6f069bb9}\label{classcore_1_1TCPServer_a418924164fd6e59800272fbd6f069bb9}} 
\index{core::TCPServer@{core::TCPServer}!TCPServer@{TCPServer}}
\index{TCPServer@{TCPServer}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{TCPServer()}{TCPServer()}}
{\footnotesize\ttfamily core\+::\+T\+C\+P\+Server\+::\+T\+C\+P\+Server (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} \&}]{e\+Poll,  }\item[{\mbox{\hyperlink{classcore_1_1IPAddress}{I\+P\+Address}}}]{address,  }\item[{std\+::string}]{text = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}

The constructor for the \mbox{\hyperlink{classcore_1_1TCPServer}{T\+C\+P\+Server}} object.


\begin{DoxyParams}{Parameters}
{\em e\+Poll} & the \mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} instance that manages the socket. \\
\hline
{\em url} & the IP address for the socket to receive connection requests. \\
\hline
{\em port} & the port number that the socket will listen on. \\
\hline
{\em command\+Name} & the name of the command used to invoke the status display for this object. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classcore_1_1TCPServer_a7ccdc057c9eee8504fce796301f82088}\label{classcore_1_1TCPServer_a7ccdc057c9eee8504fce796301f82088}} 
\index{core::TCPServer@{core::TCPServer}!````~TCPServer@{$\sim$TCPServer}}
\index{````~TCPServer@{$\sim$TCPServer}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{$\sim$TCPServer()}{~TCPServer()}}
{\footnotesize\ttfamily core\+::\+T\+C\+P\+Server\+::$\sim$\+T\+C\+P\+Server (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

The destructor for this object. 

\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classcore_1_1TCPServer_a841f02799ad8529aad7cea132f4de8a9}\label{classcore_1_1TCPServer_a841f02799ad8529aad7cea132f4de8a9}} 
\index{core::TCPServer@{core::TCPServer}!getSocketAccept@{getSocketAccept}}
\index{getSocketAccept@{getSocketAccept}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{getSocketAccept()}{getSocketAccept()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$ core\+::\+T\+C\+P\+Server\+::get\+Socket\+Accept (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} \&}]{epoll }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

get\+Socket\+Accept is designed to allow a polymorphic extension of this object to return a type of object that extends the definition of the server socket. Returning the appropriate session object that extends from Session provides the mechanism where the server can select the protocol dialog for the desired service. 

Reimplemented in \mbox{\hyperlink{classcore_1_1ConsoleServer_a80d9ea7f3fc5e07c50d5b9e0d4943ca8}{core\+::\+Console\+Server}}.

\mbox{\Hypertarget{classcore_1_1TCPServer_a276ccbc8cb9b4380ebd78807b97f0159}\label{classcore_1_1TCPServer_a276ccbc8cb9b4380ebd78807b97f0159}} 
\index{core::TCPServer@{core::TCPServer}!onDataReceived@{onDataReceived}}
\index{onDataReceived@{onDataReceived}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{onDataReceived()}{onDataReceived()}}
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Server\+::on\+Data\+Received (\begin{DoxyParamCaption}\item[{std\+::string}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [protected]}, {\ttfamily [virtual]}}

Override the virtual data\+Received since for the server these are requests to accept the new connection socket. No data is to be read or written when this method is called. It is the response to the fact that a new connection is coming into the system


\begin{DoxyParams}{Parameters}
{\em data} & the pointer to the buffer containing the received data. \\
\hline
{\em length} & the length of the associated data buffer. \\
\hline
\end{DoxyParams}


Reimplemented from \mbox{\hyperlink{classcore_1_1Socket_ac8d6a2c54696eb6fc2024cf6bcf6b4e5}{core\+::\+Socket}}.

\mbox{\Hypertarget{classcore_1_1TCPServer_ad08e04a2ff44c9c40419cdc6bd0e4b79}\label{classcore_1_1TCPServer_ad08e04a2ff44c9c40419cdc6bd0e4b79}} 
\index{core::TCPServer@{core::TCPServer}!processCommand@{processCommand}}
\index{processCommand@{processCommand}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{processCommand()}{processCommand()}}
{\footnotesize\ttfamily int core\+::\+T\+C\+P\+Server\+::process\+Command (\begin{DoxyParamCaption}\item[{coreutils\+::\+Z\+String}]{command,  }\item[{\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$}]{session,  }\item[{std\+::stringstream \&}]{data }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [protected]}, {\ttfamily [virtual]}}

This method is called when the \mbox{\hyperlink{classcore_1_1Command}{Command}} associated with this object is requested because a user has typed in the associated command name on a command entry line.


\begin{DoxyParams}{Parameters}
{\em the} & session object to write the output to. \\
\hline
\end{DoxyParams}


Reimplemented from \mbox{\hyperlink{classcore_1_1Command_ad8eecee5b179a0030d2f34bcfa30d4f4}{core\+::\+Command}}.

\mbox{\Hypertarget{classcore_1_1TCPServer_aa225cd2b704167ff22503e1897fe538f}\label{classcore_1_1TCPServer_aa225cd2b704167ff22503e1897fe538f}} 
\index{core::TCPServer@{core::TCPServer}!sendToAll@{sendToAll}}
\index{sendToAll@{sendToAll}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{sendToAll()}{sendToAll()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Server\+::send\+To\+All (\begin{DoxyParamCaption}\item[{std\+::stringstream \&}]{out,  }\item[{\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$}]{sender }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}}

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_1TCPServer_a151f29593c0d1fa998e2b86b19c631f4}\label{classcore_1_1TCPServer_a151f29593c0d1fa998e2b86b19c631f4}} 
\index{core::TCPServer@{core::TCPServer}!sendToAll@{sendToAll}}
\index{sendToAll@{sendToAll}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{sendToAll()}{sendToAll()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Server\+::send\+To\+All (\begin{DoxyParamCaption}\item[{std\+::stringstream \&}]{out,  }\item[{\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$}]{sender,  }\item[{\mbox{\hyperlink{classcore_1_1SessionFilter}{Session\+Filter}} \&}]{filter }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}}

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. 

\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{classcore_1_1TCPServer_a82f6bf16e4ab20d8b30da09e034fffff}\label{classcore_1_1TCPServer_a82f6bf16e4ab20d8b30da09e034fffff}} 
\index{core::TCPServer@{core::TCPServer}!blackList@{blackList}}
\index{blackList@{blackList}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{blackList}{blackList}}
{\footnotesize\ttfamily \mbox{\hyperlink{classcore_1_1IPAddressList}{I\+P\+Address\+List}}$\ast$ core\+::\+T\+C\+P\+Server\+::black\+List}

If not N\+U\+LL the blacklist object can be assigned to this server socket and the server IP addresses connecting to the server attempting to accept a socket are contained in this list then the connection is rejected and no accept is granted. \mbox{\Hypertarget{classcore_1_1TCPServer_afcc44802b988e2f4292504e804dccf8b}\label{classcore_1_1TCPServer_afcc44802b988e2f4292504e804dccf8b}} 
\index{core::TCPServer@{core::TCPServer}!commands@{commands}}
\index{commands@{commands}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{commands}{commands}}
{\footnotesize\ttfamily \mbox{\hyperlink{classcore_1_1CommandList}{Command\+List}} core\+::\+T\+C\+P\+Server\+::commands}

The commands object is a \mbox{\hyperlink{classcore_1_1CommandList}{Command\+List}} and is used to store \mbox{\hyperlink{classcore_1_1Command}{Command}} objects to be parsed and run as data comes into the session. \mbox{\Hypertarget{classcore_1_1TCPServer_aeed1bc55d099667ccda51cd682bfc633}\label{classcore_1_1TCPServer_aeed1bc55d099667ccda51cd682bfc633}} 
\index{core::TCPServer@{core::TCPServer}!sessions@{sessions}}
\index{sessions@{sessions}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{sessions}{sessions}}
{\footnotesize\ttfamily std\+::vector$<$\mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$$>$ core\+::\+T\+C\+P\+Server\+::sessions}

The list of sessions that are currently open and being maintained by this object. \mbox{\Hypertarget{classcore_1_1TCPServer_abad6300b6234ca8b69cef9128755342e}\label{classcore_1_1TCPServer_abad6300b6234ca8b69cef9128755342e}} 
\index{core::TCPServer@{core::TCPServer}!whiteList@{whiteList}}
\index{whiteList@{whiteList}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{whiteList}{whiteList}}
{\footnotesize\ttfamily \mbox{\hyperlink{classcore_1_1IPAddressList}{I\+P\+Address\+List}}$\ast$ core\+::\+T\+C\+P\+Server\+::white\+List}

If not N\+U\+LL the blacklist object can be assigned to this server socket and the server IP addresses connecting to the server attempting to accept a socket are contained in this list then the connection is rejected and no accept is granted. 

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
T\+C\+P\+Server.\+h\item 
T\+C\+P\+Server.\+cpp\end{DoxyCompactItemize}
