ServerCore/html/classcore_1_1EPoll.html

375 lines
20 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>My Project: core::EPoll Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">My Project
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>core</b></li><li class="navelem"><a class="el" href="classcore_1_1EPoll.html">EPoll</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="classcore_1_1EPoll-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">core::EPoll Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include &lt;<a class="el" href="EPoll_8h_source.html">EPoll.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for core::EPoll:</div>
<div class="dyncontent">
<div class="center"><img src="classcore_1_1EPoll__inherit__graph.png" border="0" usemap="#acore_1_1EPoll_inherit__map" alt="Inheritance graph"/></div>
<map name="acore_1_1EPoll_inherit__map" id="acore_1_1EPoll_inherit__map">
<area shape="rect" title=" " alt="" coords="23,80,113,107"/>
<area shape="rect" href="classcore_1_1Command.html" title=" " alt="" coords="5,5,131,32"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for core::EPoll:</div>
<div class="dyncontent">
<div class="center"><img src="classcore_1_1EPoll__coll__graph.png" border="0" usemap="#acore_1_1EPoll_coll__map" alt="Collaboration graph"/></div>
<map name="acore_1_1EPoll_coll__map" id="acore_1_1EPoll_coll__map">
<area shape="rect" title=" " alt="" coords="23,80,113,107"/>
<area shape="rect" href="classcore_1_1Command.html" title=" " alt="" coords="5,5,131,32"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a2fd5cc4336b5f72990ecc0e7ea3d7641"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a2fd5cc4336b5f72990ecc0e7ea3d7641">EPoll</a> ()</td></tr>
<tr class="separator:a2fd5cc4336b5f72990ecc0e7ea3d7641"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e7a2496d684b745a6410f9bd3e88534"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a8e7a2496d684b745a6410f9bd3e88534">~EPoll</a> ()</td></tr>
<tr class="separator:a8e7a2496d684b745a6410f9bd3e88534"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaefe2caef75eb538af90cb34682d277b"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#aaefe2caef75eb538af90cb34682d277b">start</a> (int numberOfThreads, int <a class="el" href="classcore_1_1EPoll.html#acfcef2513d94f7b9a191fed3dc744d90">maxSockets</a>)</td></tr>
<tr class="memdesc:aaefe2caef75eb538af90cb34682d277b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start the BMAEPoll processing. <a href="classcore_1_1EPoll.html#aaefe2caef75eb538af90cb34682d277b">More...</a><br /></td></tr>
<tr class="separator:aaefe2caef75eb538af90cb34682d277b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c2865acd31d14fbf19dbc42cc084ddc"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a0c2865acd31d14fbf19dbc42cc084ddc">stop</a> ()</td></tr>
<tr class="memdesc:a0c2865acd31d14fbf19dbc42cc084ddc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop and shut down the BMAEPoll processing. <a href="classcore_1_1EPoll.html#a0c2865acd31d14fbf19dbc42cc084ddc">More...</a><br /></td></tr>
<tr class="separator:a0c2865acd31d14fbf19dbc42cc084ddc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a301b46b71ac7ac61a687ff723fe269b3"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a301b46b71ac7ac61a687ff723fe269b3">isStopping</a> ()</td></tr>
<tr class="memdesc:a301b46b71ac7ac61a687ff723fe269b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a true if the stop command has been requested. <a href="classcore_1_1EPoll.html#a301b46b71ac7ac61a687ff723fe269b3">More...</a><br /></td></tr>
<tr class="separator:a301b46b71ac7ac61a687ff723fe269b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e52017e1deae15c1c87c6b6a099e1ed"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a1e52017e1deae15c1c87c6b6a099e1ed">getDescriptor</a> ()</td></tr>
<tr class="memdesc:a1e52017e1deae15c1c87c6b6a099e1ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the descriptor for the ePoll socket. <a href="classcore_1_1EPoll.html#a1e52017e1deae15c1c87c6b6a099e1ed">More...</a><br /></td></tr>
<tr class="separator:a1e52017e1deae15c1c87c6b6a099e1ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3238b150b5d0a57eb2e1b17daa236d3b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a3238b150b5d0a57eb2e1b17daa236d3b">eventReceived</a> (struct epoll_event event)</td></tr>
<tr class="memdesc:a3238b150b5d0a57eb2e1b17daa236d3b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Dispatch event to appropriate socket. <a href="classcore_1_1EPoll.html#a3238b150b5d0a57eb2e1b17daa236d3b">More...</a><br /></td></tr>
<tr class="separator:a3238b150b5d0a57eb2e1b17daa236d3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22b5f1545aff3162040844be043abcce"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#a22b5f1545aff3162040844be043abcce">processCommand</a> (coreutils::ZString &amp;request, <a class="el" href="classcore_1_1TCPSession.html">TCPSession</a> &amp;session) override</td></tr>
<tr class="memdesc:a22b5f1545aff3162040844be043abcce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Output the threads array to the console. <a href="classcore_1_1EPoll.html#a22b5f1545aff3162040844be043abcce">More...</a><br /></td></tr>
<tr class="separator:a22b5f1545aff3162040844be043abcce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classcore_1_1Command"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classcore_1_1Command')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classcore_1_1Command.html">core::Command</a></td></tr>
<tr class="memitem:ab6352ce5650e70a5c76c3d6e4eefd292 inherit pub_methods_classcore_1_1Command"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1Command.html#ab6352ce5650e70a5c76c3d6e4eefd292">output</a> (std::stringstream &amp;out)</td></tr>
<tr class="separator:ab6352ce5650e70a5c76c3d6e4eefd292 inherit pub_methods_classcore_1_1Command"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a61aa8c4c90733287fd497f860bf521ab"><td class="memItemLeft" align="right" valign="top"><a id="a61aa8c4c90733287fd497f860bf521ab"></a>
volatile long long&#160;</td><td class="memItemRight" valign="bottom"><b>eventId</b> = 0</td></tr>
<tr class="separator:a61aa8c4c90733287fd497f860bf521ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acfcef2513d94f7b9a191fed3dc744d90"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1EPoll.html#acfcef2513d94f7b9a191fed3dc744d90">maxSockets</a></td></tr>
<tr class="memdesc:acfcef2513d94f7b9a191fed3dc744d90"><td class="mdescLeft">&#160;</td><td class="mdescRight">The maximum number of socket allowed. <a href="classcore_1_1EPoll.html#acfcef2513d94f7b9a191fed3dc744d90">More...</a><br /></td></tr>
<tr class="separator:acfcef2513d94f7b9a191fed3dc744d90"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classcore_1_1EPoll.html">EPoll</a></p>
<p>Manage socket events from the epoll system call.</p>
<p>Use this object to establish a socket server using the epoll network structure of Linux.</p>
<p>Use this object to establish the basis of working with multiple sockets of all sorts using the epoll capabilities of the Linux platform. <a class="el" href="classcore_1_1Socket.html">Socket</a> objects can register with <a class="el" href="classcore_1_1EPoll.html">EPoll</a> which will establish a communication mechanism with that socket.</p>
<p>The maximum number of sockets to communicate with is specified on the start method.</p>
<p>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. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a2fd5cc4336b5f72990ecc0e7ea3d7641"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2fd5cc4336b5f72990ecc0e7ea3d7641">&#9670;&nbsp;</a></span>EPoll()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">core::EPoll::EPoll </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>The constructor for the BMAEPoll object. </p>
</div>
</div>
<a id="a8e7a2496d684b745a6410f9bd3e88534"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8e7a2496d684b745a6410f9bd3e88534">&#9670;&nbsp;</a></span>~EPoll()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">core::EPoll::~EPoll </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>The destructor for the BMAEPoll object. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a3238b150b5d0a57eb2e1b17daa236d3b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3238b150b5d0a57eb2e1b17daa236d3b">&#9670;&nbsp;</a></span>eventReceived()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void core::EPoll::eventReceived </td>
<td>(</td>
<td class="paramtype">struct epoll_event&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Dispatch event to appropriate socket. </p>
<p>Receive the epoll events and dispatch the event to the socket making the request. </p>
</div>
</div>
<a id="a1e52017e1deae15c1c87c6b6a099e1ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1e52017e1deae15c1c87c6b6a099e1ed">&#9670;&nbsp;</a></span>getDescriptor()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int core::EPoll::getDescriptor </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the descriptor for the ePoll socket. </p>
<p>Use this method to obtain the current descriptor socket number for the epoll function call. </p>
</div>
</div>
<a id="a301b46b71ac7ac61a687ff723fe269b3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a301b46b71ac7ac61a687ff723fe269b3">&#9670;&nbsp;</a></span>isStopping()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool core::EPoll::isStopping </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a true if the stop command has been requested. </p>
<p>This method returns a true if the <a class="el" href="classcore_1_1EPoll.html#a0c2865acd31d14fbf19dbc42cc084ddc" title="Stop and shut down the BMAEPoll processing.">stop()</a> method has been called and the epoll system is shutting. </p>
</div>
</div>
<a id="a22b5f1545aff3162040844be043abcce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a22b5f1545aff3162040844be043abcce">&#9670;&nbsp;</a></span>processCommand()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int core::EPoll::processCommand </td>
<td>(</td>
<td class="paramtype">coreutils::ZString &amp;&#160;</td>
<td class="paramname"><em>request</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classcore_1_1TCPSession.html">TCPSession</a> &amp;&#160;</td>
<td class="paramname"><em>session</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Output the threads array to the console. </p>
<p>The <a class="el" href="classcore_1_1EPoll.html#a22b5f1545aff3162040844be043abcce" title="Output the threads array to the console.">processCommand()</a> method displays the thread array to the requesting console via the session passed as parameter.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">session</td><td>the session to write the requested data to. </td></tr>
</table>
</dd>
</dl>
<p>Reimplemented from <a class="el" href="classcore_1_1Command.html#a95176f2532c38ee14e3fee40ee28b1bd">core::Command</a>.</p>
</div>
</div>
<a id="aaefe2caef75eb538af90cb34682d277b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaefe2caef75eb538af90cb34682d277b">&#9670;&nbsp;</a></span>start()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool core::EPoll::start </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>numberOfThreads</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>maxSockets</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start the BMAEPoll processing. </p>
<p>Use the <a class="el" href="classcore_1_1EPoll.html#aaefe2caef75eb538af90cb34682d277b" title="Start the BMAEPoll processing.">start()</a> method to initiate the threads and begin epoll queue processing.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">numberOfThreads</td><td>the number of threads to start for processing epoll entries. </td></tr>
<tr><td class="paramname">maxSockets</td><td>the maximum number of open sockets that epoll will manage. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a0c2865acd31d14fbf19dbc42cc084ddc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0c2865acd31d14fbf19dbc42cc084ddc">&#9670;&nbsp;</a></span>stop()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool core::EPoll::stop </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Stop and shut down the BMAEPoll processing. </p>
<p>Use the <a class="el" href="classcore_1_1EPoll.html#a0c2865acd31d14fbf19dbc42cc084ddc" title="Stop and shut down the BMAEPoll processing.">stop()</a> method to initiate the shutdown process for the epoll socket management.</p>
<p>A complete shutdown of all managed sockets will be initiated by this method call. </p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="acfcef2513d94f7b9a191fed3dc744d90"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acfcef2513d94f7b9a191fed3dc744d90">&#9670;&nbsp;</a></span>maxSockets</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int core::EPoll::maxSockets</td>
</tr>
</table>
</div><div class="memdoc">
<p>The maximum number of socket allowed. </p>
<p>The maximum number of sockets that can be managed by the epoll system. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="EPoll_8h_source.html">EPoll.h</a></li>
<li>EPoll.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>