ServerCore/latex/classcore_1_1TCPServer.tex
2023-02-11 17:24:25 -08:00

219 lines
16 KiB
TeX

\hypertarget{classcore_1_1TCPServer}{}\doxysection{core\+::TCPServer Class Reference}
\label{classcore_1_1TCPServer}\index{core::TCPServer@{core::TCPServer}}
{\ttfamily \#include $<$TCPServer.\+h$>$}
Inheritance diagram for core\+::TCPServer\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=304pt]{classcore_1_1TCPServer__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for core\+::TCPServer\+:\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_abaecb97c336b757d1029d45277f9fc5b}{TCPServer}} (\mbox{\hyperlink{classcore_1_1EPoll}{EPoll}} \&e\+Poll, \mbox{\hyperlink{classcore_1_1IPAddress}{IPAddress}} address, std\+::string delimiter=\char`\"{} \char`\"{}, int depth=10, std\+::string text=\char`\"{}\char`\"{})
\item
virtual \mbox{\hyperlink{classcore_1_1TCPServer_a7ccdc057c9eee8504fce796301f82088}{$\sim$\+TCPServer}} ()
\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
\mbox{\Hypertarget{classcore_1_1TCPServer_a308df2a080bb331e17b95431e4ab9412}\label{classcore_1_1TCPServer_a308df2a080bb331e17b95431e4ab9412}}
virtual bool {\bfseries compare\+Alias} (void $\ast$alias, void $\ast$compare)
\item
virtual \mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_a841f02799ad8529aad7cea132f4de8a9}{get\+Socket\+Accept}} (\mbox{\hyperlink{classcore_1_1EPoll}{EPoll}} \&epoll)
\item
\mbox{\Hypertarget{classcore_1_1TCPServer_a88c603cd5df9dbc1632fd4b5e164d75b}\label{classcore_1_1TCPServer_a88c603cd5df9dbc1632fd4b5e164d75b}}
void {\bfseries remove\+From\+Session\+List} (\mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} $\ast$session)
\item
\mbox{\Hypertarget{classcore_1_1TCPServer_a49e3ead1bf4e7830685780e73c4db5db}\label{classcore_1_1TCPServer_a49e3ead1bf4e7830685780e73c4db5db}}
void \mbox{\hyperlink{classcore_1_1TCPServer_a49e3ead1bf4e7830685780e73c4db5db}{output}} (std\+::stringstream \&out)
\begin{DoxyCompactList}\small\item\em Output the consoles array to the console. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classcore_1_1TCPServer_a9cfcf2984ddc7e1d8f157c9f07ad03e1}\label{classcore_1_1TCPServer_a9cfcf2984ddc7e1d8f157c9f07ad03e1}}
void {\bfseries send\+To\+All} (std\+::stringstream \&out)
\item
void \mbox{\hyperlink{classcore_1_1TCPServer_a7080f7d45e734087e81b83c5e1f8e676}{send\+To\+All}} (std\+::stringstream \&out, \mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} \&sender, \mbox{\hyperlink{classcore_1_1SessionFilter}{Session\+Filter}} filter)
\item
void \mbox{\hyperlink{classcore_1_1TCPServer_af708df59e1bc60077c16db97f9cc8ff0}{send\+To\+All}} (std\+::stringstream \&out, \mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} \&sender)
\item
\mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_a9042281193e227a6cd8dab3ff8b46a40}{get\+Session\+By\+Alias}} (void $\ast$alias)
\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item
std\+::vector$<$ \mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} $\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}{IPAddress\+List}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_a82f6bf16e4ab20d8b30da09e034fffff}{black\+List}}
\item
\mbox{\hyperlink{classcore_1_1IPAddressList}{IPAddress\+List}} $\ast$ \mbox{\hyperlink{classcore_1_1TCPServer_abad6300b6234ca8b69cef9128755342e}{white\+List}}
\item
\mbox{\hyperlink{classcore_1_1SubscriptionManager}{Subscription\+Manager}} \mbox{\hyperlink{classcore_1_1TCPServer_a28302dd844cfc971ee41de2000d24aa0}{subscriptions}}
\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_a6b7a7e1ac4132942fcaf418ed41c1437}{process\+Command}} (coreutils\+::\+ZString \&request, \mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} \&session) override
\end{DoxyCompactItemize}
\doxysubsection*{Additional Inherited Members}
\doxysubsection{Detailed Description}
\mbox{\hyperlink{classcore_1_1TCPServer}{TCPServer}}
Manage a socket connection as a TCP 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 BMACommand 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_abaecb97c336b757d1029d45277f9fc5b}\label{classcore_1_1TCPServer_abaecb97c336b757d1029d45277f9fc5b}}
\index{core::TCPServer@{core::TCPServer}!TCPServer@{TCPServer}}
\index{TCPServer@{TCPServer}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{TCPServer()}{TCPServer()}}
{\footnotesize\ttfamily core\+::\+TCPServer\+::\+TCPServer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1EPoll}{EPoll}} \&}]{e\+Poll, }\item[{\mbox{\hyperlink{classcore_1_1IPAddress}{IPAddress}}}]{address, }\item[{std\+::string}]{delimiter = {\ttfamily \char`\"{}~\char`\"{}}, }\item[{int}]{depth = {\ttfamily 10}, }\item[{std\+::string}]{text = {\ttfamily \char`\"{}\char`\"{}} }\end{DoxyParamCaption})}
The constructor for the \mbox{\hyperlink{classcore_1_1TCPServer}{TCPServer}} object.
\begin{DoxyParams}{Parameters}
{\em e\+Poll} & the \mbox{\hyperlink{classcore_1_1EPoll}{EPoll}} 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\+::\+TCPServer\+::$\sim$\+TCPServer (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}
The destructor for this object.
\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classcore_1_1TCPServer_a9042281193e227a6cd8dab3ff8b46a40}\label{classcore_1_1TCPServer_a9042281193e227a6cd8dab3ff8b46a40}}
\index{core::TCPServer@{core::TCPServer}!getSessionByAlias@{getSessionByAlias}}
\index{getSessionByAlias@{getSessionByAlias}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{getSessionByAlias()}{getSessionByAlias()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} $\ast$ core\+::\+TCPServer\+::get\+Session\+By\+Alias (\begin{DoxyParamCaption}\item[{void $\ast$}]{alias }\end{DoxyParamCaption})}
Use the get\+Session\+By\+Alias to retrieve a session pointer by the value of the alias pointer. \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}{TCPSession}} $\ast$ core\+::\+TCPServer\+::get\+Socket\+Accept (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1EPoll}{EPoll}} \&}]{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\+::\+TCPServer\+::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_a6b7a7e1ac4132942fcaf418ed41c1437}\label{classcore_1_1TCPServer_a6b7a7e1ac4132942fcaf418ed41c1437}}
\index{core::TCPServer@{core::TCPServer}!processCommand@{processCommand}}
\index{processCommand@{processCommand}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{processCommand()}{processCommand()}}
{\footnotesize\ttfamily int core\+::\+TCPServer\+::process\+Command (\begin{DoxyParamCaption}\item[{coreutils\+::\+ZString \&}]{request, }\item[{\mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} \&}]{session }\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_a95176f2532c38ee14e3fee40ee28b1bd}{core\+::\+Command}}.
\mbox{\Hypertarget{classcore_1_1TCPServer_af708df59e1bc60077c16db97f9cc8ff0}\label{classcore_1_1TCPServer_af708df59e1bc60077c16db97f9cc8ff0}}
\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\+::\+TCPServer\+::send\+To\+All (\begin{DoxyParamCaption}\item[{std\+::stringstream \&}]{out, }\item[{\mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} \&}]{sender }\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_1TCPServer_a7080f7d45e734087e81b83c5e1f8e676}\label{classcore_1_1TCPServer_a7080f7d45e734087e81b83c5e1f8e676}}
\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\+::\+TCPServer\+::send\+To\+All (\begin{DoxyParamCaption}\item[{std\+::stringstream \&}]{out, }\item[{\mbox{\hyperlink{classcore_1_1TCPSession}{TCPSession}} \&}]{sender, }\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.
\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}{IPAddress\+List}}$\ast$ core\+::\+TCPServer\+::black\+List}
If not NULL 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\+::\+TCPServer\+::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}{TCPSession}} $\ast$$>$ core\+::\+TCPServer\+::sessions}
The list of sessions that are currently open and being maintained by this object. \mbox{\Hypertarget{classcore_1_1TCPServer_a28302dd844cfc971ee41de2000d24aa0}\label{classcore_1_1TCPServer_a28302dd844cfc971ee41de2000d24aa0}}
\index{core::TCPServer@{core::TCPServer}!subscriptions@{subscriptions}}
\index{subscriptions@{subscriptions}!core::TCPServer@{core::TCPServer}}
\doxysubsubsection{\texorpdfstring{subscriptions}{subscriptions}}
{\footnotesize\ttfamily \mbox{\hyperlink{classcore_1_1SubscriptionManager}{Subscription\+Manager}} core\+::\+TCPServer\+::subscriptions}
The \mbox{\hyperlink{classcore_1_1Subscription}{Subscription}} Manager tracks all subscriptions on the server. \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}{IPAddress\+List}}$\ast$ core\+::\+TCPServer\+::white\+List}
If not NULL 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
TCPServer.\+h\item
TCPServer.\+cpp\end{DoxyCompactItemize}