Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 00862db86d46065a3a8f965b33c95850 > files > 24

echolib-devel-0.13.1-5.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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"/>
<title>EchoLib: EchoLink::Dispatcher Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceEchoLink.html">EchoLink</a>::<a class="el" href="classEchoLink_1_1Dispatcher.html">Dispatcher</a>
  </div>
</div>
<div class="contents">
<h1>EchoLink::Dispatcher Class Reference</h1><!-- doxytag: class="EchoLink::Dispatcher" -->
<p>A class for handling incoming connections and dispatch active connections.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="EchoLinkDispatcher_8h_source.html">EchoLinkDispatcher.h</a>&gt;</code></p>

<p><a href="classEchoLink_1_1Dispatcher-members.html">List of all members.</a></p>
<h2>Classes</h2>
<ul>
<li>struct <b>ConData</b>
<li>struct <b>ipaddr_lt</b>
</ul>
<h2>Public Member Functions</h2>
<ul>
<li><a class="el" href="classEchoLink_1_1Dispatcher.html#ae62d8713d3e4db4370e6af555f618171">~Dispatcher</a> (void)
<dl class="el"><dd class="mdescRight">Destructor.  <a href="#ae62d8713d3e4db4370e6af555f618171"></a><br/></dl></ul>
<h2>Static Public Member Functions</h2>
<ul>
<li>static void <a class="el" href="classEchoLink_1_1Dispatcher.html#a969eb6f697f2c2055801ee463f7f8808">setPortBase</a> (int base)
<dl class="el"><dd class="mdescRight">Set the port base for the two UDP ports.  <a href="#a969eb6f697f2c2055801ee463f7f8808"></a><br/></dl><li>static <a class="el" href="classEchoLink_1_1Dispatcher.html">Dispatcher</a> * <a class="el" href="classEchoLink_1_1Dispatcher.html#a77f851ece2c53eb2fe6e35720d630009">instance</a> (void)
<dl class="el"><dd class="mdescRight">Get the Singleton instance.  <a href="#a77f851ece2c53eb2fe6e35720d630009"></a><br/></dl></ul>
<h2>Public Attributes</h2>
<ul>
<li>SigC::Signal3&lt; void, const <br class="typebreak"/>
Async::IpAddress &amp;, const <br class="typebreak"/>
std::string &amp;, const <br class="typebreak"/>
std::string &amp; &gt; <a class="el" href="classEchoLink_1_1Dispatcher.html#a24ae3ef2cb2622b31849684572883a50">incomingConnection</a>
<dl class="el"><dd class="mdescRight">A signal that is emitted when someone is trying to connect.  <a href="#a24ae3ef2cb2622b31849684572883a50"></a><br/></dl></ul>
<h2>Friends</h2>
<ul>
<li>class <a class="el" href="classEchoLink_1_1Dispatcher.html#a25785244b50837725d1a9e6b67a4aaa0">Qso</a>
</ul>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A class for handling incoming connections and dispatch active connections. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Tobias Blomberg </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>2003-03-30</dd></dl>
<p>This is a class that listens to incoming packets on the two <a class="el" href="namespaceEchoLink.html" title="Namespace to encapsulate EchoLink communication classes.">EchoLink</a> UDP-ports. The incoming packets are dispatched to the associated connection object (<a class="el" href="classEchoLink_1_1Qso.html" title="A class for creating an EchoLink connection.">EchoLink::Qso</a>), if it exists. If the connection does not exist, a signal will be emitted to indicate that an incoming connection is on its way. The <a class="el" href="classEchoLink_1_1Qso.html" title="A class for creating an EchoLink connection.">Qso</a> objects will register themselfs automatically with the <a class="el" href="classEchoLink_1_1Dispatcher.html" title="A class for handling incoming connections and dispatch active connections.">Dispatcher</a> upon creation.</p>
<p>This class is a Singleton object. That is, there can be only one object. The constructor is private so the only way to create a <a class="el" href="classEchoLink_1_1Dispatcher.html" title="A class for handling incoming connections and dispatch active connections.">Dispatcher</a> object is to use the static method <a class="el" href="classEchoLink_1_1Dispatcher.html#a77f851ece2c53eb2fe6e35720d630009" title="Get the Singleton instance.">Dispatcher::instance</a>. It will create a new object if it does not exist and return the object if it exists. On error, a NULL pointer will be returned.</p>
<p>Start your application by creating a <a class="el" href="classEchoLink_1_1Dispatcher.html" title="A class for handling incoming connections and dispatch active connections.">Dispatcher</a> object. It will then start to listen to the <a class="el" href="namespaceEchoLink.html" title="Namespace to encapsulate EchoLink communication classes.">EchoLink</a> ports for incoming connections. Also, be sure to check the returned pointer. If it is NULL, something went wrong. If it is not checked, you will have trouble later when creating <a class="el" href="classEchoLink_1_1Qso.html" title="A class for creating an EchoLink connection.">Qso</a> objects. So, a typical start in your application would be something like the code below.</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;cstdlib&gt;</span>
<span class="preprocessor">#include &lt;AsyncCppApplication.h&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="EchoLinkDispatcher_8h.html" title="Contains a class for handling incoming/active EchoLink Qso connections.">EchoLinkDispatcher.h</a>&gt;</span>

<span class="keyword">using namespace </span>std;
<span class="keyword">using namespace </span>Async;
<span class="keyword">using namespace </span>EchoLink;

<span class="keyword">class </span>MyClass : <span class="keyword">public</span> SigC::Object
{
  <span class="keyword">public</span>:
    MyClass(<span class="keywordtype">void</span>)
    {
      <span class="keywordflow">if</span> (<a class="code" href="classEchoLink_1_1Dispatcher.html#a77f851ece2c53eb2fe6e35720d630009" title="Get the Singleton instance.">Dispatcher::instance</a>() == 0)
      {
        cerr &lt;&lt; <span class="stringliteral">&quot;Could not create EchoLink listener (Dispatcher) object\n&quot;</span>;
        exit(1);
      }

      <a class="code" href="classEchoLink_1_1Dispatcher.html#a77f851ece2c53eb2fe6e35720d630009" title="Get the Singleton instance.">Dispatcher::instance</a>()-&gt;incomingConnection.connect(slot(*<span class="keyword">this</span>,
          &amp;MyClass::onIncomingConnection));
    }
    
  <span class="keyword">private</span>:
    <span class="keywordtype">void</span> onIncomingConnection(<span class="keyword">const</span> IpAddress&amp; ip, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; callsign,
                              <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; name)
    {
      cerr &lt;&lt; <span class="stringliteral">&quot;Incoming connection from &quot;</span> &lt;&lt; ip &lt;&lt; <span class="stringliteral">&quot;: &quot;</span> &lt;&lt; callsign
           &lt;&lt; <span class="stringliteral">&quot; (&quot;</span> &lt;&lt; name &lt;&lt; <span class="stringliteral">&quot;)\n&quot;</span>;
      <span class="comment">// Find out the station data by using the Directory class</span>
      <span class="comment">// Create a new Qso object to accept the connection</span>
    }
};

<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
  CppApplication app; <span class="comment">// or QtApplication</span>
  MyClass my_class;
  app.exec();
}
</pre></div> 
<p>Definition at line <a class="el" href="EchoLinkDispatcher_8h_source.html#l00144">144</a> of file <a class="el" href="EchoLinkDispatcher_8h_source.html">EchoLinkDispatcher.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ae62d8713d3e4db4370e6af555f618171"></a><!-- doxytag: member="EchoLink::Dispatcher::~Dispatcher" ref="ae62d8713d3e4db4370e6af555f618171" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">EchoLink::Dispatcher::~Dispatcher </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a77f851ece2c53eb2fe6e35720d630009"></a><!-- doxytag: member="EchoLink::Dispatcher::instance" ref="a77f851ece2c53eb2fe6e35720d630009" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classEchoLink_1_1Dispatcher.html">Dispatcher</a>* EchoLink::Dispatcher::instance </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the Singleton instance. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a dispatcher object. If the object does not already exist, a new object will be created. If the object can not be created, a NULL pointer is returned.</dd></dl>
<p>This function should be used to get access to the Singleton dispatcher object. Every time access to the dispatcher object is required, this function should be used to get the pointer. It is illegal to store it in a variable at program startup and then use that variable. It is possible that the dispatcher is deleted at some point in a program. The stored pointer would then be invalid. It is ok to use a local temporary variable to make access more convenient if no calls are made to other functions that access the dispatcher. </p>

</div>
</div>
<a class="anchor" id="a969eb6f697f2c2055801ee463f7f8808"></a><!-- doxytag: member="EchoLink::Dispatcher::setPortBase" ref="a969eb6f697f2c2055801ee463f7f8808" args="(int base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void EchoLink::Dispatcher::setPortBase </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>base</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the port base for the two UDP ports. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>base</em>&nbsp;</td><td>The port base to use</td></tr>
  </table>
  </dd>
</dl>
<p>This static function set the port base to use for the two UDP communications ports. This function may only be called when a dispatcher object does not exist. Typically, call this function before calling the <a class="el" href="classEchoLink_1_1Dispatcher.html#a77f851ece2c53eb2fe6e35720d630009" title="Get the Singleton instance.">Dispatcher::instance</a> function for the first time. If this function is not called at all, the default ports will be used. </p>

</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="a25785244b50837725d1a9e6b67a4aaa0"></a><!-- doxytag: member="EchoLink::Dispatcher::Qso" ref="a25785244b50837725d1a9e6b67a4aaa0" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classEchoLink_1_1Qso.html">Qso</a><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="EchoLinkDispatcher_8h_source.html#l00195">195</a> of file <a class="el" href="EchoLinkDispatcher_8h_source.html">EchoLinkDispatcher.h</a>.</p>

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a24ae3ef2cb2622b31849684572883a50"></a><!-- doxytag: member="EchoLink::Dispatcher::incomingConnection" ref="a24ae3ef2cb2622b31849684572883a50" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SigC::Signal3&lt;void, const Async::IpAddress&amp;, const std::string&amp;, const std::string&amp;&gt; <a class="el" href="classEchoLink_1_1Dispatcher.html#a24ae3ef2cb2622b31849684572883a50">EchoLink::Dispatcher::incomingConnection</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A signal that is emitted when someone is trying to connect. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>callsign</em>&nbsp;</td><td>The callsign of the connecting station </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the connecting station</td></tr>
  </table>
  </dd>
</dl>
<p>This signal is emitted when a remote station tries to connect. It will be emitted every time a connect datagram is received. </p>

<p>Definition at line <a class="el" href="EchoLinkDispatcher_8h_source.html#l00190">190</a> of file <a class="el" href="EchoLinkDispatcher_8h_source.html">EchoLinkDispatcher.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="EchoLinkDispatcher_8h_source.html">EchoLinkDispatcher.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>