\hypertarget{classcore_1_1_t_c_p_server}{}\doxysection{core\+::T\+C\+P\+Server Class Reference}
\label{classcore_1_1_t_c_p_server}\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_1_t_c_p_server__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_1_t_c_p_server__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classcore_1_1_t_c_p_server_a418924164fd6e59800272fbd6f069bb9}{T\+C\+P\+Server}} (\mbox{\hyperlink{classcore_1_1_e_poll}{E\+Poll}} \&\mbox{\hyperlink{classcore_1_1_socket_a3b0b139ac7da581f0d969f6ae9a0c97c}{e\+Poll}}, \mbox{\hyperlink{classcore_1_1_i_p_address}{I\+P\+Address}} address, std\+::string text=\char`\"{}\char`\"{})
\item 
\mbox{\hyperlink{classcore_1_1_t_c_p_server_a7ccdc057c9eee8504fce796301f82088}{$\sim$\+T\+C\+P\+Server}} ()
\item 
void \mbox{\hyperlink{classcore_1_1_t_c_p_server_a88c603cd5df9dbc1632fd4b5e164d75b}{remove\+From\+Session\+List}} (\mbox{\hyperlink{classcore_1_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$session)
\item 
virtual void \mbox{\hyperlink{classcore_1_1_t_c_p_server_a554ec6e67d368e7bb545d95635c0a0df}{session\+Error\+Handler}} (std\+::string error\+String, std\+::stringstream \&out)
\item 
virtual \mbox{\hyperlink{classcore_1_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$ \mbox{\hyperlink{classcore_1_1_t_c_p_server_a841f02799ad8529aad7cea132f4de8a9}{get\+Socket\+Accept}} (\mbox{\hyperlink{classcore_1_1_e_poll}{E\+Poll}} \&epoll)
\item 
void \mbox{\hyperlink{classcore_1_1_t_c_p_server_a120d5031360cc62251bdc43fa2d9813a}{output}} (\mbox{\hyperlink{classcore_1_1_t_c_p_session}{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 
\mbox{\hyperlink{classcore_1_1_i_p_address_list}{I\+P\+Address\+List}} $\ast$ \mbox{\hyperlink{classcore_1_1_t_c_p_server_a82f6bf16e4ab20d8b30da09e034fffff}{black\+List}}
\item 
\mbox{\hyperlink{classcore_1_1_i_p_address_list}{I\+P\+Address\+List}} $\ast$ \mbox{\hyperlink{classcore_1_1_t_c_p_server_abad6300b6234ca8b69cef9128755342e}{white\+List}}
\item 
std\+::vector$<$ \mbox{\hyperlink{classcore_1_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$ $>$ \mbox{\hyperlink{classcore_1_1_t_c_p_server_aeed1bc55d099667ccda51cd682bfc633}{sessions}}
\item 
\mbox{\hyperlink{classcore_1_1_command_list}{Command\+List}} \mbox{\hyperlink{classcore_1_1_t_c_p_server_afcc44802b988e2f4292504e804dccf8b}{commands}}
\end{DoxyCompactItemize}
\doxysubsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classcore_1_1_t_c_p_server_a276ccbc8cb9b4380ebd78807b97f0159}{on\+Data\+Received}} (std\+::string data) override
\item 
int \mbox{\hyperlink{classcore_1_1_t_c_p_server_a93f64f81bc63f145799af91138a064dc}{process\+Command}} (std\+::string command, \mbox{\hyperlink{classcore_1_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$session, std\+::stringstream \&data) override
\end{DoxyCompactItemize}
\doxysubsection*{Additional Inherited Members}


\doxysubsection{Detailed Description}
\mbox{\hyperlink{classcore_1_1_t_c_p_server}{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_1_t_c_p_server_a418924164fd6e59800272fbd6f069bb9}\label{classcore_1_1_t_c_p_server_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_1_e_poll}{E\+Poll}} \&}]{e\+Poll,  }\item[{\mbox{\hyperlink{classcore_1_1_i_p_address}{I\+P\+Address}}}]{address,  }\item[{std\+::string}]{text = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}

The constructor for the B\+M\+A\+T\+C\+P\+Socket object.


\begin{DoxyParams}{Parameters}
{\em e\+Poll} & the \mbox{\hyperlink{classcore_1_1_e_poll}{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}
\begin{DoxyReturn}{Returns}
the instance of the B\+M\+A\+T\+C\+P\+Server\+Socket. 
\end{DoxyReturn}
\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a7ccdc057c9eee8504fce796301f82088}\label{classcore_1_1_t_c_p_server_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_1_t_c_p_server_a841f02799ad8529aad7cea132f4de8a9}\label{classcore_1_1_t_c_p_server_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_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$ core\+::\+T\+C\+P\+Server\+::get\+Socket\+Accept (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1_e_poll}{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_1_console_server_a80d9ea7f3fc5e07c50d5b9e0d4943ca8}{core\+::\+Console\+Server}}.

\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a276ccbc8cb9b4380ebd78807b97f0159}\label{classcore_1_1_t_c_p_server_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_1_socket_ac8d6a2c54696eb6fc2024cf6bcf6b4e5}{core\+::\+Socket}}.

\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a120d5031360cc62251bdc43fa2d9813a}\label{classcore_1_1_t_c_p_server_a120d5031360cc62251bdc43fa2d9813a}} 
\index{core::TCPServer@{core::TCPServer}!output@{output}}
\index{output@{output}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{output()}{output()}}
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Server\+::output (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$}]{session }\end{DoxyParamCaption})}



Output the consoles array to the console. 

\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a93f64f81bc63f145799af91138a064dc}\label{classcore_1_1_t_c_p_server_a93f64f81bc63f145799af91138a064dc}} 
\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[{std\+::string}]{command,  }\item[{\mbox{\hyperlink{classcore_1_1_t_c_p_session}{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_1_command}{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_1_command_a068ebc22f7a067cf23ed2c17f95b06e9}{core\+::\+Command}}.

\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a88c603cd5df9dbc1632fd4b5e164d75b}\label{classcore_1_1_t_c_p_server_a88c603cd5df9dbc1632fd4b5e164d75b}} 
\index{core::TCPServer@{core::TCPServer}!removeFromSessionList@{removeFromSessionList}}
\index{removeFromSessionList@{removeFromSessionList}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{removeFromSessionList()}{removeFromSessionList()}}
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Server\+::remove\+From\+Session\+List (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1_t_c_p_session}{T\+C\+P\+Session}} $\ast$}]{session }\end{DoxyParamCaption})}

\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a554ec6e67d368e7bb545d95635c0a0df}\label{classcore_1_1_t_c_p_server_a554ec6e67d368e7bb545d95635c0a0df}} 
\index{core::TCPServer@{core::TCPServer}!sessionErrorHandler@{sessionErrorHandler}}
\index{sessionErrorHandler@{sessionErrorHandler}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{sessionErrorHandler()}{sessionErrorHandler()}}
{\footnotesize\ttfamily void core\+::\+T\+C\+P\+Server\+::session\+Error\+Handler (\begin{DoxyParamCaption}\item[{std\+::string}]{error\+String,  }\item[{std\+::stringstream \&}]{out }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{classcore_1_1_t_c_p_server_a82f6bf16e4ab20d8b30da09e034fffff}\label{classcore_1_1_t_c_p_server_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_1_i_p_address_list}{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_1_t_c_p_server_afcc44802b988e2f4292504e804dccf8b}\label{classcore_1_1_t_c_p_server_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_1_command_list}{Command\+List}} core\+::\+T\+C\+P\+Server\+::commands}

The commands object is a \mbox{\hyperlink{classcore_1_1_command_list}{Command\+List}} and is used to store \mbox{\hyperlink{classcore_1_1_command}{Command}} objects to be parsed and run as data comes into the session. \mbox{\Hypertarget{classcore_1_1_t_c_p_server_aeed1bc55d099667ccda51cd682bfc633}\label{classcore_1_1_t_c_p_server_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_1_t_c_p_session}{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_1_t_c_p_server_abad6300b6234ca8b69cef9128755342e}\label{classcore_1_1_t_c_p_server_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_1_i_p_address_list}{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 
\mbox{\hyperlink{_t_c_p_server_8h}{T\+C\+P\+Server.\+h}}\item 
\mbox{\hyperlink{_t_c_p_server_8cpp}{T\+C\+P\+Server.\+cpp}}\end{DoxyCompactItemize}
