ServerCore/latex/classcore_1_1EPoll.tex

218 lines
12 KiB
TeX

\hypertarget{classcore_1_1EPoll}{}\doxysection{core\+::E\+Poll Class Reference}
\label{classcore_1_1EPoll}\index{core::EPoll@{core::EPoll}}
{\ttfamily \#include $<$E\+Poll.\+h$>$}
Inheritance diagram for core\+::E\+Poll\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=174pt]{classcore_1_1EPoll__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for core\+::E\+Poll\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=174pt]{classcore_1_1EPoll__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\mbox{\hyperlink{classcore_1_1EPoll_a2fd5cc4336b5f72990ecc0e7ea3d7641}{E\+Poll}} ()
\item
\mbox{\hyperlink{classcore_1_1EPoll_a8e7a2496d684b745a6410f9bd3e88534}{$\sim$\+E\+Poll}} ()
\item
bool \mbox{\hyperlink{classcore_1_1EPoll_aaefe2caef75eb538af90cb34682d277b}{start}} (int number\+Of\+Threads, int \mbox{\hyperlink{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}{max\+Sockets}})
\begin{DoxyCompactList}\small\item\em Start the B\+M\+A\+E\+Poll processing. \end{DoxyCompactList}\item
bool \mbox{\hyperlink{classcore_1_1EPoll_a0c2865acd31d14fbf19dbc42cc084ddc}{stop}} ()
\begin{DoxyCompactList}\small\item\em Stop and shut down the B\+M\+A\+E\+Poll processing. \end{DoxyCompactList}\item
bool \mbox{\hyperlink{classcore_1_1EPoll_a301b46b71ac7ac61a687ff723fe269b3}{is\+Stopping}} ()
\begin{DoxyCompactList}\small\item\em Returns a true if the stop command has been requested. \end{DoxyCompactList}\item
bool \mbox{\hyperlink{classcore_1_1EPoll_a3d813c7bbf0da70ebc8e3cb6aeeacfb4}{register\+Socket}} (\mbox{\hyperlink{classcore_1_1Socket}{Socket}} $\ast$socket)
\begin{DoxyCompactList}\small\item\em Register a B\+M\+A\+Socket for monitoring by B\+M\+A\+E\+Poll. \end{DoxyCompactList}\item
bool \mbox{\hyperlink{classcore_1_1EPoll_a5ab5e82ab51e0952fc8fbcc128f52900}{unregister\+Socket}} (\mbox{\hyperlink{classcore_1_1Socket}{Socket}} $\ast$socket)
\begin{DoxyCompactList}\small\item\em Unregister a B\+M\+A\+Socket from monitoring by B\+M\+A\+E\+Poll. \end{DoxyCompactList}\item
int \mbox{\hyperlink{classcore_1_1EPoll_a1e52017e1deae15c1c87c6b6a099e1ed}{get\+Descriptor}} ()
\begin{DoxyCompactList}\small\item\em Return the descriptor for the e\+Poll socket. \end{DoxyCompactList}\item
void \mbox{\hyperlink{classcore_1_1EPoll_a3238b150b5d0a57eb2e1b17daa236d3b}{event\+Received}} (struct epoll\+\_\+event event)
\begin{DoxyCompactList}\small\item\em Dispatch event to appropriate socket. \end{DoxyCompactList}\item
int \mbox{\hyperlink{classcore_1_1EPoll_a5cb8a89fb45922c8c88472ec3eae7858}{process\+Command}} (coreutils\+::\+Z\+String command, \mbox{\hyperlink{classcore_1_1TCPSession}{T\+C\+P\+Session}} $\ast$session, std\+::stringstream \&data) override
\begin{DoxyCompactList}\small\item\em Output the threads array to the console. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classcore_1_1EPoll_a033633714311f3edc4127ddd1c37f299}\label{classcore_1_1EPoll_a033633714311f3edc4127ddd1c37f299}}
void {\bfseries reset\+Socket} (\mbox{\hyperlink{classcore_1_1Socket}{Socket}} $\ast$socket)
\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item
int \mbox{\hyperlink{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}{max\+Sockets}}
\begin{DoxyCompactList}\small\item\em The maximum number of socket allowed. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection{Detailed Description}
\mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}}
Manage socket events from the epoll system call.
Use this object to establish a socket server using the epoll network structure of Linux.
Use this object to establish the basis of working with multiple sockets of all sorts using the epoll capabilities of the Linux platform. \mbox{\hyperlink{classcore_1_1Socket}{Socket}} objects can register with \mbox{\hyperlink{classcore_1_1EPoll}{E\+Poll}} which will establish a communication mechanism with that socket.
The maximum number of sockets to communicate with is specified on the start method.
Threads are used to establish a read queue for epoll. The desired number of threads (or queues) is established by a parameter on the start method.
\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classcore_1_1EPoll_a2fd5cc4336b5f72990ecc0e7ea3d7641}\label{classcore_1_1EPoll_a2fd5cc4336b5f72990ecc0e7ea3d7641}}
\index{core::EPoll@{core::EPoll}!EPoll@{EPoll}}
\index{EPoll@{EPoll}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{EPoll()}{EPoll()}}
{\footnotesize\ttfamily core\+::\+E\+Poll\+::\+E\+Poll (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
The constructor for the B\+M\+A\+E\+Poll object. \mbox{\Hypertarget{classcore_1_1EPoll_a8e7a2496d684b745a6410f9bd3e88534}\label{classcore_1_1EPoll_a8e7a2496d684b745a6410f9bd3e88534}}
\index{core::EPoll@{core::EPoll}!````~EPoll@{$\sim$EPoll}}
\index{````~EPoll@{$\sim$EPoll}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{$\sim$EPoll()}{~EPoll()}}
{\footnotesize\ttfamily core\+::\+E\+Poll\+::$\sim$\+E\+Poll (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
The destructor for the B\+M\+A\+E\+Poll object.
\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classcore_1_1EPoll_a3238b150b5d0a57eb2e1b17daa236d3b}\label{classcore_1_1EPoll_a3238b150b5d0a57eb2e1b17daa236d3b}}
\index{core::EPoll@{core::EPoll}!eventReceived@{eventReceived}}
\index{eventReceived@{eventReceived}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{eventReceived()}{eventReceived()}}
{\footnotesize\ttfamily void core\+::\+E\+Poll\+::event\+Received (\begin{DoxyParamCaption}\item[{struct epoll\+\_\+event}]{event }\end{DoxyParamCaption})}
Dispatch event to appropriate socket.
Receive the epoll events and dispatch the event to the socket making the request. \mbox{\Hypertarget{classcore_1_1EPoll_a1e52017e1deae15c1c87c6b6a099e1ed}\label{classcore_1_1EPoll_a1e52017e1deae15c1c87c6b6a099e1ed}}
\index{core::EPoll@{core::EPoll}!getDescriptor@{getDescriptor}}
\index{getDescriptor@{getDescriptor}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{getDescriptor()}{getDescriptor()}}
{\footnotesize\ttfamily int core\+::\+E\+Poll\+::get\+Descriptor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Return the descriptor for the e\+Poll socket.
Use this method to obtain the current descriptor socket number for the epoll function call. \mbox{\Hypertarget{classcore_1_1EPoll_a301b46b71ac7ac61a687ff723fe269b3}\label{classcore_1_1EPoll_a301b46b71ac7ac61a687ff723fe269b3}}
\index{core::EPoll@{core::EPoll}!isStopping@{isStopping}}
\index{isStopping@{isStopping}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{isStopping()}{isStopping()}}
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::is\+Stopping (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Returns a true if the stop command has been requested.
This method returns a true if the \mbox{\hyperlink{classcore_1_1EPoll_a0c2865acd31d14fbf19dbc42cc084ddc}{stop()}} method has been called and the epoll system is shutting. \mbox{\Hypertarget{classcore_1_1EPoll_a5cb8a89fb45922c8c88472ec3eae7858}\label{classcore_1_1EPoll_a5cb8a89fb45922c8c88472ec3eae7858}}
\index{core::EPoll@{core::EPoll}!processCommand@{processCommand}}
\index{processCommand@{processCommand}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{processCommand()}{processCommand()}}
{\footnotesize\ttfamily int core\+::\+E\+Poll\+::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 [virtual]}}
Output the threads array to the console.
The \mbox{\hyperlink{classcore_1_1EPoll_a5cb8a89fb45922c8c88472ec3eae7858}{process\+Command()}} method displays the thread array to the requesting console via the session passed as parameter.
\begin{DoxyParams}{Parameters}
{\em session} & the session to write the requested data to. \\
\hline
\end{DoxyParams}
Reimplemented from \mbox{\hyperlink{classcore_1_1Command_ad8eecee5b179a0030d2f34bcfa30d4f4}{core\+::\+Command}}.
\mbox{\Hypertarget{classcore_1_1EPoll_a3d813c7bbf0da70ebc8e3cb6aeeacfb4}\label{classcore_1_1EPoll_a3d813c7bbf0da70ebc8e3cb6aeeacfb4}}
\index{core::EPoll@{core::EPoll}!registerSocket@{registerSocket}}
\index{registerSocket@{registerSocket}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{registerSocket()}{registerSocket()}}
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::register\+Socket (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1Socket}{Socket}} $\ast$}]{socket }\end{DoxyParamCaption})}
Register a B\+M\+A\+Socket for monitoring by B\+M\+A\+E\+Poll.
Use register\+Socket to add a new socket to the e\+Poll event watch list. This enables a new B\+M\+A\+Socket object to receive events when data is received as well as to write data output to the socket.
\begin{DoxyParams}{Parameters}
{\em socket} & a pointer to a B\+M\+A\+Socket object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a booelean that indicates the socket was registered or not.
\end{DoxyReturn}
\mbox{\Hypertarget{classcore_1_1EPoll_aaefe2caef75eb538af90cb34682d277b}\label{classcore_1_1EPoll_aaefe2caef75eb538af90cb34682d277b}}
\index{core::EPoll@{core::EPoll}!start@{start}}
\index{start@{start}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{start()}{start()}}
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::start (\begin{DoxyParamCaption}\item[{int}]{number\+Of\+Threads, }\item[{int}]{max\+Sockets }\end{DoxyParamCaption})}
Start the B\+M\+A\+E\+Poll processing.
Use the \mbox{\hyperlink{classcore_1_1EPoll_aaefe2caef75eb538af90cb34682d277b}{start()}} method to initiate the threads and begin epoll queue processing.
\begin{DoxyParams}{Parameters}
{\em number\+Of\+Threads} & the number of threads to start for processing epoll entries. \\
\hline
{\em max\+Sockets} & the maximum number of open sockets that epoll will manage. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classcore_1_1EPoll_a0c2865acd31d14fbf19dbc42cc084ddc}\label{classcore_1_1EPoll_a0c2865acd31d14fbf19dbc42cc084ddc}}
\index{core::EPoll@{core::EPoll}!stop@{stop}}
\index{stop@{stop}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{stop()}{stop()}}
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::stop (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
Stop and shut down the B\+M\+A\+E\+Poll processing.
Use the \mbox{\hyperlink{classcore_1_1EPoll_a0c2865acd31d14fbf19dbc42cc084ddc}{stop()}} method to initiate the shutdown process for the epoll socket management.
A complete shutdown of all managed sockets will be initiated by this method call. \mbox{\Hypertarget{classcore_1_1EPoll_a5ab5e82ab51e0952fc8fbcc128f52900}\label{classcore_1_1EPoll_a5ab5e82ab51e0952fc8fbcc128f52900}}
\index{core::EPoll@{core::EPoll}!unregisterSocket@{unregisterSocket}}
\index{unregisterSocket@{unregisterSocket}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{unregisterSocket()}{unregisterSocket()}}
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::unregister\+Socket (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classcore_1_1Socket}{Socket}} $\ast$}]{socket }\end{DoxyParamCaption})}
Unregister a B\+M\+A\+Socket from monitoring by B\+M\+A\+E\+Poll.
Use this method to remove a socket from receiving events from the epoll system.
\doxysubsection{Member Data Documentation}
\mbox{\Hypertarget{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}\label{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}}
\index{core::EPoll@{core::EPoll}!maxSockets@{maxSockets}}
\index{maxSockets@{maxSockets}!core::EPoll@{core::EPoll}}
\doxysubsubsection{\texorpdfstring{maxSockets}{maxSockets}}
{\footnotesize\ttfamily int core\+::\+E\+Poll\+::max\+Sockets}
The maximum number of socket allowed.
The maximum number of sockets that can be managed by the epoll system.
The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item
E\+Poll.\+h\item
E\+Poll.\+cpp\end{DoxyCompactItemize}