223 lines
12 KiB
TeX
223 lines
12 KiB
TeX
\hypertarget{classcore_1_1EPoll}{}\section{core\+:\+:E\+Poll Class Reference}
|
|
\label{classcore_1_1EPoll}\index{core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
|
|
|
|
{\ttfamily \#include $<$E\+Poll.\+h$>$}
|
|
|
|
|
|
|
|
Inheritance diagram for core\+:\+:E\+Poll\+:\nopagebreak
|
|
\begin{figure}[H]
|
|
\begin{center}
|
|
\leavevmode
|
|
\includegraphics[width=166pt]{classcore_1_1EPoll__inherit__graph}
|
|
\end{center}
|
|
\end{figure}
|
|
|
|
|
|
Collaboration diagram for core\+:\+:E\+Poll\+:\nopagebreak
|
|
\begin{figure}[H]
|
|
\begin{center}
|
|
\leavevmode
|
|
\includegraphics[width=166pt]{classcore_1_1EPoll__coll__graph}
|
|
\end{center}
|
|
\end{figure}
|
|
\subsection*{Public Member Functions}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
\hyperlink{classcore_1_1EPoll_a2fd5cc4336b5f72990ecc0e7ea3d7641}{E\+Poll} ()
|
|
\item
|
|
\hyperlink{classcore_1_1EPoll_a8e7a2496d684b745a6410f9bd3e88534}{$\sim$\+E\+Poll} ()
|
|
\item
|
|
bool \hyperlink{classcore_1_1EPoll_aaefe2caef75eb538af90cb34682d277b}{start} (int number\+Of\+Threads, int \hyperlink{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}{max\+Sockets})
|
|
\begin{DoxyCompactList}\small\item\em Start the B\+M\+A\+E\+Poll processing. \end{DoxyCompactList}\item
|
|
bool \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 \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 \hyperlink{classcore_1_1EPoll_a3d813c7bbf0da70ebc8e3cb6aeeacfb4}{register\+Socket} (\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 \hyperlink{classcore_1_1EPoll_a5ab5e82ab51e0952fc8fbcc128f52900}{unregister\+Socket} (\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 \hyperlink{classcore_1_1EPoll_a1e52017e1deae15c1c87c6b6a099e1ed}{get\+Descriptor} ()
|
|
\begin{DoxyCompactList}\small\item\em Return the descriptor for the e\+Poll socket. \end{DoxyCompactList}\item
|
|
void \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 \hyperlink{classcore_1_1EPoll_a0c2d7fdaec43d0a15abab0399d5727df}{process\+Command} (std\+::string command, \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} (\hyperlink{classcore_1_1Socket}{Socket} $\ast$socket)
|
|
\end{DoxyCompactItemize}
|
|
\subsection*{Public Attributes}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
int \hyperlink{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}{max\+Sockets}
|
|
\begin{DoxyCompactList}\small\item\em The maximum number of socket allowed. \end{DoxyCompactList}\end{DoxyCompactItemize}
|
|
|
|
|
|
\subsection{Detailed Description}
|
|
\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. \hyperlink{classcore_1_1Socket}{Socket} objects can register with B\+M\+A\+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.
|
|
|
|
\subsection{Constructor \& Destructor Documentation}
|
|
\mbox{\Hypertarget{classcore_1_1EPoll_a2fd5cc4336b5f72990ecc0e7ea3d7641}\label{classcore_1_1EPoll_a2fd5cc4336b5f72990ecc0e7ea3d7641}}
|
|
\index{core\+::\+E\+Poll@{core\+::\+E\+Poll}!E\+Poll@{E\+Poll}}
|
|
\index{E\+Poll@{E\+Poll}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{E\+Poll()}{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\+::\+E\+Poll@{core\+::\+E\+Poll}!````~E\+Poll@{$\sim$\+E\+Poll}}
|
|
\index{````~E\+Poll@{$\sim$\+E\+Poll}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{$\sim$\+E\+Poll()}{~EPoll()}}
|
|
{\footnotesize\ttfamily core\+::\+E\+Poll\+::$\sim$\+E\+Poll (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
|
|
|
The destructor for the B\+M\+A\+E\+Poll object.
|
|
|
|
\subsection{Member Function Documentation}
|
|
\mbox{\Hypertarget{classcore_1_1EPoll_a3238b150b5d0a57eb2e1b17daa236d3b}\label{classcore_1_1EPoll_a3238b150b5d0a57eb2e1b17daa236d3b}}
|
|
\index{core\+::\+E\+Poll@{core\+::\+E\+Poll}!event\+Received@{event\+Received}}
|
|
\index{event\+Received@{event\+Received}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{event\+Received()}{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\+::\+E\+Poll@{core\+::\+E\+Poll}!get\+Descriptor@{get\+Descriptor}}
|
|
\index{get\+Descriptor@{get\+Descriptor}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{get\+Descriptor()}{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\+::\+E\+Poll@{core\+::\+E\+Poll}!is\+Stopping@{is\+Stopping}}
|
|
\index{is\+Stopping@{is\+Stopping}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{is\+Stopping()}{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 \hyperlink{classcore_1_1EPoll_a0c2865acd31d14fbf19dbc42cc084ddc}{stop()} method has been called and the epoll system is shutting. \mbox{\Hypertarget{classcore_1_1EPoll_a0c2d7fdaec43d0a15abab0399d5727df}\label{classcore_1_1EPoll_a0c2d7fdaec43d0a15abab0399d5727df}}
|
|
\index{core\+::\+E\+Poll@{core\+::\+E\+Poll}!process\+Command@{process\+Command}}
|
|
\index{process\+Command@{process\+Command}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{process\+Command()}{processCommand()}}
|
|
{\footnotesize\ttfamily int core\+::\+E\+Poll\+::process\+Command (\begin{DoxyParamCaption}\item[{std\+::string}]{command, }\item[{\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 \hyperlink{classcore_1_1EPoll_a0c2d7fdaec43d0a15abab0399d5727df}{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 \hyperlink{classcore_1_1Command_a068ebc22f7a067cf23ed2c17f95b06e9}{core\+::\+Command}.
|
|
|
|
\mbox{\Hypertarget{classcore_1_1EPoll_a3d813c7bbf0da70ebc8e3cb6aeeacfb4}\label{classcore_1_1EPoll_a3d813c7bbf0da70ebc8e3cb6aeeacfb4}}
|
|
\index{core\+::\+E\+Poll@{core\+::\+E\+Poll}!register\+Socket@{register\+Socket}}
|
|
\index{register\+Socket@{register\+Socket}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{register\+Socket()}{registerSocket()}}
|
|
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::register\+Socket (\begin{DoxyParamCaption}\item[{\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\+::\+E\+Poll@{core\+::\+E\+Poll}!start@{start}}
|
|
\index{start@{start}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\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 \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\+::\+E\+Poll@{core\+::\+E\+Poll}!stop@{stop}}
|
|
\index{stop@{stop}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\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 \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\+::\+E\+Poll@{core\+::\+E\+Poll}!unregister\+Socket@{unregister\+Socket}}
|
|
\index{unregister\+Socket@{unregister\+Socket}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{unregister\+Socket()}{unregisterSocket()}}
|
|
{\footnotesize\ttfamily bool core\+::\+E\+Poll\+::unregister\+Socket (\begin{DoxyParamCaption}\item[{\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.
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em socket} & The \hyperlink{classcore_1_1Socket}{Socket} to unregister. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
|
|
|
|
\subsection{Member Data Documentation}
|
|
\mbox{\Hypertarget{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}\label{classcore_1_1EPoll_acfcef2513d94f7b9a191fed3dc744d90}}
|
|
\index{core\+::\+E\+Poll@{core\+::\+E\+Poll}!max\+Sockets@{max\+Sockets}}
|
|
\index{max\+Sockets@{max\+Sockets}!core\+::\+E\+Poll@{core\+::\+E\+Poll}}
|
|
\subsubsection{\texorpdfstring{max\+Sockets}{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}
|