/OverSim-20101103/doc/doxy/Nice_8cc_source.html
HTML | 3516 lines | 3515 code | 0 blank | 1 comment | 0 complexity | ec2494a4e33ab27d0f9378bf631c9140 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, GPL-2.0, Apache-2.0, JSON
Large files files are truncated, but you can click here to view the full file
- <!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>OverSim: Nice.cc Source File</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.7.1 -->
- <div class="navigation" id="top">
- <div class="tabs">
- <ul class="tablist">
- <li><a href="main.html"><span>Main Page</span></a></li>
- <li><a href="pages.html"><span>Related Pages</span></a></li>
- <li><a href="namespaces.html"><span>Namespaces</span></a></li>
- <li><a href="annotated.html"><span>Classes</span></a></li>
- <li class="current"><a href="files.html"><span>Files</span></a></li>
- <li><a href="dirs.html"><span>Directories</span></a></li>
- </ul>
- </div>
- <div class="tabs2">
- <ul class="tablist">
- <li><a href="files.html"><span>File List</span></a></li>
- <li><a href="globals.html"><span>File Members</span></a></li>
- </ul>
- </div>
- <div class="navpath">
- <ul>
- <li><a class="el" href="dir_668dee661430860db5868c2621a9c372.html">src</a> </li>
- <li><a class="el" href="dir_6302e9405fe106175d386473fd676d2e.html">overlay</a> </li>
- <li><a class="el" href="dir_3b7439cc863d448c2d91c48bb8f106aa.html">nice</a> </li>
- </ul>
- </div>
- </div>
- <div class="header">
- <div class="headertitle">
- <h1>Nice.cc</h1> </div>
- </div>
- <div class="contents">
- <a href="Nice_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//</span>
- <a name="l00002"></a>00002 <span class="comment">// Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH)</span>
- <a name="l00003"></a>00003 <span class="comment">//</span>
- <a name="l00004"></a>00004 <span class="comment">// This program is free software; you can redistribute it and/or</span>
- <a name="l00005"></a>00005 <span class="comment">// modify it under the terms of the GNU General Public License</span>
- <a name="l00006"></a>00006 <span class="comment">// as published by the Free Software Foundation; either version 2</span>
- <a name="l00007"></a>00007 <span class="comment">// of the License, or (at your option) any later version.</span>
- <a name="l00008"></a>00008 <span class="comment">//</span>
- <a name="l00009"></a>00009 <span class="comment">// This program is distributed in the hope that it will be useful,</span>
- <a name="l00010"></a>00010 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
- <a name="l00011"></a>00011 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
- <a name="l00012"></a>00012 <span class="comment">// GNU General Public License for more details.</span>
- <a name="l00013"></a>00013 <span class="comment">//</span>
- <a name="l00014"></a>00014 <span class="comment">// You should have received a copy of the GNU General Public License</span>
- <a name="l00015"></a>00015 <span class="comment">// along with this program; if not, write to the Free Software</span>
- <a name="l00016"></a>00016 <span class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span>
- <a name="l00017"></a>00017 <span class="comment">//</span>
- <a name="l00018"></a>00018
- <a name="l00025"></a>00025 <span class="preprocessor">#include <stdio.h></span>
- <a name="l00026"></a>00026
- <a name="l00027"></a>00027 <span class="preprocessor">#include <<a class="code" href="GlobalStatistics_8h.html">GlobalStatistics.h</a>></span>
- <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="SimpleInfo_8h.html">SimpleInfo.h</a>"</span>
- <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="SimpleNodeEntry_8h.html">SimpleNodeEntry.h</a>"</span>
- <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="SimpleUDP_8h.html">SimpleUDP.h</a>"</span>
- <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="GlobalNodeListAccess_8h.html">GlobalNodeListAccess.h</a>"</span>
- <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="BootstrapList_8h.html">BootstrapList.h</a>></span>
- <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="Nice_8h.html">Nice.h</a>"</span>
- <a name="l00034"></a>00034
- <a name="l00035"></a>00035 <span class="keyword">namespace </span>oversim
- <a name="l00036"></a>00036 {
- <a name="l00037"></a>00037
- <a name="l00041"></a>00041 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="namespaceoversim.html#a068481bf2793ad703ca213dcca1e4a6f" title="Define colors for layers in visualization.">clustercolors</a>[] = { <span class="stringliteral">"yellow"</span>,
- <a name="l00042"></a>00042 <span class="stringliteral">"magenta"</span>,
- <a name="l00043"></a>00043 <span class="stringliteral">"red"</span>,
- <a name="l00044"></a>00044 <span class="stringliteral">"orange"</span>,
- <a name="l00045"></a>00045 <span class="stringliteral">"green"</span>,
- <a name="l00046"></a>00046 <span class="stringliteral">"aquamarine"</span>,
- <a name="l00047"></a>00047 <span class="stringliteral">"cyan"</span>,
- <a name="l00048"></a>00048 <span class="stringliteral">"blue"</span>,
- <a name="l00049"></a>00049 <span class="stringliteral">"navy"</span>,
- <a name="l00050"></a>00050 <span class="stringliteral">"yellow"</span>
- <a name="l00051"></a><a class="code" href="namespaceoversim.html#aa3b63c2cc07d2571efe93e9004ca0172">00051</a> };
- <a name="l00052"></a>00052
- <a name="l00053"></a>00053 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="namespaceoversim.html#aa3b63c2cc07d2571efe93e9004ca0172">clusterarrows</a>[] = { <span class="stringliteral">"m=m,50,50,50,50;ls=yellow,2"</span>,
- <a name="l00054"></a>00054 <span class="stringliteral">"m=m,50,50,50,50;ls=magenta,3"</span>,
- <a name="l00055"></a>00055 <span class="stringliteral">"m=m,50,50,50,50;ls=red,4"</span>,
- <a name="l00056"></a>00056 <span class="stringliteral">"m=m,50,50,50,50;ls=orange,5"</span>,
- <a name="l00057"></a>00057 <span class="stringliteral">"m=m,50,50,50,50;ls=green,6"</span>,
- <a name="l00058"></a>00058 <span class="stringliteral">"m=m,50,50,50,50;ls=aquamarine,7"</span>,
- <a name="l00059"></a>00059 <span class="stringliteral">"m=m,50,50,50,50;ls=cyan,8"</span>,
- <a name="l00060"></a>00060 <span class="stringliteral">"m=m,50,50,50,50;ls=blue,9"</span>,
- <a name="l00061"></a>00061 <span class="stringliteral">"m=m,50,50,50,50;ls=navy,10"</span>,
- <a name="l00062"></a>00062 <span class="stringliteral">"m=m,50,50,50,50;ls=yellow,11"</span>
- <a name="l00063"></a>00063 };
- <a name="l00064"></a>00064
- <a name="l00065"></a>00065 <a class="code" href="namespaceoversim.html#aac274bdf33ee20fba3e03edadb79cb5b">Define_Module</a>(Nice);
- <a name="l00066"></a>00066
- <a name="l00067"></a>00067 <span class="keyword">const</span> <span class="keywordtype">short</span> <a class="code" href="classoversim_1_1Nice.html#a960f2035d499686a97fe7163542b8647">Nice::maxLayers</a>;
- <a name="l00068"></a>00068
- <a name="l00069"></a>00069 <span class="comment">/******************************************************************************</span>
- <a name="l00070"></a><a class="code" href="classoversim_1_1Nice.html#a7ffce18253e937f405a232fd8555b60e">00070</a> <span class="comment"> * Constructor</span>
- <a name="l00071"></a>00071 <span class="comment"> */</span>
- <a name="l00072"></a>00072 <a class="code" href="classoversim_1_1Nice.html#a7ffce18253e937f405a232fd8555b60e">Nice::Nice</a>() : isRendevouzPoint(false),
- <a name="l00073"></a>00073 isTempPeered(false),
- <a name="l00074"></a>00074 numInconsistencies(0),
- <a name="l00075"></a>00075 numQueryTimeouts(0),
- <a name="l00076"></a>00076 numPeerTimeouts(0),
- <a name="l00077"></a>00077 numTempPeerTimeouts(0),
- <a name="l00078"></a>00078 numStructurePartitions(0),
- <a name="l00079"></a>00079 numOwnMessagesReceived(0),
- <a name="l00080"></a>00080 totalSCMinCompare(0),
- <a name="l00081"></a>00081 numJoins(0),
- <a name="l00082"></a>00082 totalForwardBytes(0),
- <a name="l00083"></a>00083 numReceived(0),
- <a name="l00084"></a>00084 totalReceivedBytes(0),
- <a name="l00085"></a>00085 numHeartbeat(0),
- <a name="l00086"></a>00086 totalHeartbeatBytes(0)
- <a name="l00087"></a>00087 {
- <a name="l00088"></a>00088
- <a name="l00089"></a>00089 <span class="comment">/* do nothing at this point of time, OverSim calls initializeOverlay */</span>
- <a name="l00090"></a>00090
- <a name="l00091"></a>00091 } <span class="comment">// Nice</span>
- <a name="l00092"></a>00092
- <a name="l00093"></a>00093
- <a name="l00094"></a>00094 <span class="comment">/******************************************************************************</span>
- <a name="l00095"></a><a class="code" href="classoversim_1_1Nice.html#a9788a3d4f0f81f204edaaa16a492cf50">00095</a> <span class="comment"> * Destructor</span>
- <a name="l00096"></a>00096 <span class="comment"> */</span>
- <a name="l00097"></a>00097 <a class="code" href="classoversim_1_1Nice.html#a9788a3d4f0f81f204edaaa16a492cf50">Nice::~Nice</a>()
- <a name="l00098"></a>00098 {
- <a name="l00099"></a>00099
- <a name="l00100"></a>00100 <span class="comment">// destroy self timer messages</span>
- <a name="l00101"></a>00101 cancelAndDelete(<a class="code" href="classoversim_1_1Nice.html#a687c425a685e47b47d989b24a1fe6165">heartbeatTimer</a>);
- <a name="l00102"></a>00102 cancelAndDelete(<a class="code" href="classoversim_1_1Nice.html#ace2ed47b84cbee1c7cc71cbc44a4fea8">maintenanceTimer</a>);
- <a name="l00103"></a>00103 cancelAndDelete(<a class="code" href="classoversim_1_1Nice.html#a4a913c4be6eabc80fac48dffed005771">rpPollTimer</a>);
- <a name="l00104"></a>00104 cancelAndDelete(<a class="code" href="classoversim_1_1Nice.html#a4648efb65dd8c13990a571c275d3bd04">queryTimer</a>);
- <a name="l00105"></a>00105 cancelAndDelete(<a class="code" href="classoversim_1_1Nice.html#aa31f386f8403d2ba88f43a1a57fcba57">visualizationTimer</a>);
- <a name="l00106"></a>00106
- <a name="l00107"></a>00107 std::map<TransportAddress, NicePeerInfo*>::iterator it = <a class="code" href="classoversim_1_1Nice.html#abfd784a7eb10c0af88d835308cf66ff6">peerInfos</a>.begin();
- <a name="l00108"></a>00108
- <a name="l00109"></a>00109 <span class="keywordflow">for</span> (; it != <a class="code" href="classoversim_1_1Nice.html#abfd784a7eb10c0af88d835308cf66ff6">peerInfos</a>.end(); it++) {
- <a name="l00110"></a>00110
- <a name="l00111"></a>00111 <span class="keyword">delete</span> it->second;
- <a name="l00112"></a>00112
- <a name="l00113"></a>00113 }
- <a name="l00114"></a>00114
- <a name="l00115"></a>00115 } <span class="comment">// ~NICE</span>
- <a name="l00116"></a>00116
- <a name="l00117"></a>00117
- <a name="l00118"></a>00118 <span class="comment">/******************************************************************************</span>
- <a name="l00119"></a>00119 <span class="comment"> * initializeOverlay</span>
- <a name="l00120"></a><a class="code" href="classoversim_1_1Nice.html#a63977effde493b185fb9230ec5c2a608">00120</a> <span class="comment"> * see BaseOverlay.h</span>
- <a name="l00121"></a>00121 <span class="comment"> */</span>
- <a name="l00122"></a>00122 <span class="keywordtype">void</span> <a class="code" href="classoversim_1_1Nice.html#a63977effde493b185fb9230ec5c2a608" title="Initializes derived-class-attributes.">Nice::initializeOverlay</a>( <span class="keywordtype">int</span> stage )
- <a name="l00123"></a>00123 {
- <a name="l00124"></a>00124
- <a name="l00125"></a>00125 <span class="comment">/* Because of IPAddressResolver, we need to wait until interfaces</span>
- <a name="l00126"></a>00126 <span class="comment"> * are registered, address auto-assignment takes place etc. */</span>
- <a name="l00127"></a>00127 <span class="keywordflow">if</span> (stage != <a class="code" href="InitStages_8h.html#a42fde1aa1e14a1c45d29061d6e87e532a58e83c497c7c8495e9c592ff3148b6b9" title="first stage for overlay modules (Tier 0 / KBR)">MIN_STAGE_OVERLAY</a>)
- <a name="l00128"></a>00128 <span class="keywordflow">return</span>;
- <a name="l00129"></a>00129
- <a name="l00130"></a>00130 <span class="comment">/* Set appearance of node in visualization */</span>
- <a name="l00131"></a>00131 getParentModule()->getParentModule()->getDisplayString().setTagArg(<span class="stringliteral">"i"</span>, 0, <span class="stringliteral">"device/pc_vs"</span>);
- <a name="l00132"></a>00132 getParentModule()->getParentModule()->getDisplayString().setTagArg(<span class="stringliteral">"i2"</span>, 0, <span class="stringliteral">"block/circle_vs"</span>);
- <a name="l00133"></a>00133
- <a name="l00134"></a>00134 <span class="comment">/* Initially clear all clusters */</span>
- <a name="l00135"></a>00135 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<<a class="code" href="classoversim_1_1Nice.html#a960f2035d499686a97fe7163542b8647">maxLayers</a>; i++) {
- <a name="l00136"></a>00136
- <a name="l00137"></a>00137 <span class="keywordflow">for</span> (TaSet::iterator itn = <a class="code" href="classoversim_1_1Nice.html#a644c991f567da9990713bba00e3dacac">clusters</a>[i].begin(); itn != <a class="code" href="classoversim_1_1Nice.html#a644c991f567da9990713bba00e3dacac">clusters</a>[i].<a class="code" href="classNiceCluster.html#aed386323e43a572eb51c3e2a97790a6c" title="Returns const iterator to end of cluster.">end</a>(); ++itn) {
- <a name="l00138"></a>00138 <a class="code" href="classTopologyVis.html#ae9629882d5f3bb7865f9c9501b23a172" title="Removes an arrow from this node to neighbor.">deleteOverlayNeighborArrow</a>(*itn);
- <a name="l00139"></a>00139 }
- <a name="l00140"></a>00140 <a class="code" href="classoversim_1_1Nice.html#a644c991f567da9990713bba00e3dacac">clusters</a>[i].<a class="code" href="classNiceCluster.html#ad66e5cfc867561bef65fcfd43dbc7d13" title="Removes all addresses from cluster, sets leader to unspecified address and sets last lt to 0...">clear</a>();
- <a name="l00141"></a>00141
- <a name="l00142"></a>00142 }
- <a name="l00143"></a>00143
- <a name="l00144"></a>00144 <span class="comment">/* Initialize Self-Messages */</span>
- <a name="l00145"></a>00145
- <a name="l00146"></a>00146 <span class="comment">// Periodic Heartbeat Messages</span>
- <a name="l00147"></a>00147 <a class="code" href="classoversim_1_1Nice.html#a58d3d6285e2a84acb277e220d1a35807">heartbeatInterval</a> = par(<span class="stringliteral">"heartbeatInterval"</span>);
- <a name="l00148"></a>00148 <a class="code" href="classoversim_1_1Nice.html#a687c425a685e47b47d989b24a1fe6165">heartbeatTimer</a> = <span class="keyword">new</span> cMessage(<span class="stringliteral">"heartbeatTimer"</span>);
- <a name="l00149"></a>00149
- <a name="l00150"></a>00150 <span class="comment">// Periodic Protocol Maintenance</span>
- <a name="l00151"></a>00151 <a class="code" href="classoversim_1_1Nice.html#a6d14d42d813222d9ee8c5d395ba60365">maintenanceInterval</a> = par(<span class="stringliteral">"maintenanceInterval"</span>);
- <a name="l00152"></a>00152 <a class="code" href="classoversim_1_1Nice.html#ace2ed47b84cbee1c7cc71cbc44a4fea8">maintenanceTimer</a> = <span class="keyword">new</span> cMessage(<span class="stringliteral">"maintenanceTimer"</span>);
- <a name="l00153"></a>00153
- <a name="l00154"></a>00154 <a class="code" href="classoversim_1_1Nice.html#a6e3e4cdfa221e6f9980e3c51a5452570">queryInterval</a> = par(<span class="stringliteral">"queryInterval"</span>);
- <a name="l00155"></a>00155 <a class="code" href="classoversim_1_1Nice.html#a4648efb65dd8c13990a571c275d3bd04">queryTimer</a> = <span class="keyword">new</span> cMessage(<span class="stringliteral">"queryTimer"</span>);
- <a name="l00156"></a>00156
- <a name="l00157"></a>00157 <a class="code" href="classoversim_1_1Nice.html#a4a913c4be6eabc80fac48dffed005771">rpPollTimer</a> = <span class="keyword">new</span> cMessage(<span class="stringliteral">"rpPollTimer"</span>);
- <a name="l00158"></a>00158 <a class="code" href="classoversim_1_1Nice.html#a417d95b2b0bdad377d0613f4dde77b66">rpPollTimerInterval</a> = par(<span class="stringliteral">"rpPollTimerInterval"</span>);
- <a name="l00159"></a>00159
- <a name="l00160"></a>00160 <a class="code" href="classoversim_1_1Nice.html#abffc50a7507069a0d97997f269c2d130">peerTimeoutHeartbeats</a> = par(<span class="stringliteral">"peerTimeoutHeartbeats"</span>);
- <a name="l00161"></a>00161
- <a name="l00162"></a>00162 <a class="code" href="classoversim_1_1Nice.html#a8603dc65c59516ee5dc237ce651659c6">pimp</a> = par(<span class="stringliteral">"enhancedMode"</span>);
- <a name="l00163"></a>00163
- <a name="l00164"></a>00164 <a class="code" href="classoversim_1_1Nice.html#aaad03fa2518f9122314129e4afd433d8">isRendevouzPoint</a> = <span class="keyword">false</span>;
- <a name="l00165"></a>00165
- <a name="l00166"></a>00166 <a class="code" href="classoversim_1_1Nice.html#ac00b0f8d11b8f3f7c3e5c2eb78511cc6">polledRendevouzPoint</a> = <a class="code" href="classTransportAddress.html#ac1709545db722cbbce1367034142d31f" title="TransportAddress without specified ip and port.">TransportAddress::UNSPECIFIED_NODE</a>;
- <a name="l00167"></a>00167
- <a name="l00168"></a>00168 <span class="comment">/* DEBUG */</span>
- <a name="l00169"></a>00169 <a class="code" href="classoversim_1_1Nice.html#aebff401d083e6f6b20fb9253181465ff">clusterrefinement</a> = par(<span class="stringliteral">"debug_clusterrefinement"</span>);
- <a name="l00170"></a>00170 <a class="code" href="classoversim_1_1Nice.html#ae8b24bedc06f07fe2c03ec7b135c63a5">debug_heartbeats</a> = par(<span class="stringliteral">"debug_heartbeats"</span>);
- <a name="l00171"></a>00171 <a class="code" href="classoversim_1_1Nice.html#a1a3aaae38bf78dc32e177868afbde6c7">debug_visualization</a> = par(<span class="stringliteral">"debug_visualization"</span>);
- <a name="l00172"></a>00172 <a class="code" href="classoversim_1_1Nice.html#afa26359a3e0160724c4f36bbb02df6f4">debug_join</a> = par(<span class="stringliteral">"debug_join"</span>);
- <a name="l00173"></a>00173 <a class="code" href="classoversim_1_1Nice.html#a6af70b0196fd0d482286c0ff5a46f5ae">debug_peertimeouts</a> = par(<span class="stringliteral">"debug_peertimeouts"</span>);
- <a name="l00174"></a>00174 <a class="code" href="classoversim_1_1Nice.html#a12a2bd46343643e35473ab74900db70a">debug_removes</a> = par(<span class="stringliteral">"debug_removes"</span>);
- <a name="l00175"></a>00175 <a class="code" href="classoversim_1_1Nice.html#a65ded61488d36484e3529f3e23b6e713">debug_queries</a> = par(<span class="stringliteral">"debug_queries"</span>);
- <a name="l00176"></a>00176
- <a name="l00177"></a>00177 <a class="code" href="classoversim_1_1Nice.html#aa31f386f8403d2ba88f43a1a57fcba57">visualizationTimer</a> = <span class="keyword">new</span> cMessage(<span class="stringliteral">"visualizationTimer"</span>);
- <a name="l00178"></a>00178
- <a name="l00179"></a>00179 <span class="comment">/* Read cluster parameter k */</span>
- <a name="l00180"></a>00180 <a class="code" href="classoversim_1_1Nice.html#a29f5e69b521aa1eb0047e64272b84562">k</a> = par(<span class="stringliteral">"k"</span>);
- <a name="l00181"></a>00181
- <a name="l00182"></a>00182 <a class="code" href="classoversim_1_1Nice.html#a3469d510d59a1cc3577e5d24a6628275">CLUSTERLEADERBOUND</a> = par(<span class="stringliteral">"clusterLeaderBound"</span>);
- <a name="l00183"></a>00183 <a class="code" href="classoversim_1_1Nice.html#ad83625b73a292aa04380837e7d6c3944">CLUSTERLEADERCOMPAREDIST</a> = par(<span class="stringliteral">"clusterLeaderCompareDist"</span>);
- <a name="l00184"></a>00184 <a class="code" href="classoversim_1_1Nice.html#a4368d509b0c5ac9950cf8fa52fa5f176">SC_PROC_DISTANCE</a> = par(<span class="stringliteral">"scProcDistance"</span>);
- <a name="l00185"></a>00185 <a class="code" href="classoversim_1_1Nice.html#a02292a0c465a7bbb80f66fbd7187cc9b">SC_MIN_OFFSET</a> = par(<span class="stringliteral">"scMinOffset"</span>);
- <a name="l00186"></a>00186
- <a name="l00187"></a>00187 <span class="comment">/* Add own node to peerInfos */</span>
- <a name="l00188"></a>00188 <a class="code" href="classoversim_1_1NicePeerInfo.html">NicePeerInfo</a>* pi = <span class="keyword">new</span> <a class="code" href="classoversim_1_1Nice.html#a6b71884e13dc73c1a1c81351b031cb64">NicePeerInfo</a>(<span class="keyword">this</span>);
- <a name="l00189"></a>00189 pi-><a class="code" href="classoversim_1_1NicePeerInfo.html#a582f40941e6e0e51010bc032560218b2">set_distance</a>(0);
- <a name="l00190"></a>00190 <a class="code" href="classoversim_1_1Nice.html#abfd784a7eb10c0af88d835308cf66ff6">peerInfos</a>.insert(std::make_pair(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>, pi));
- <a name="l00191"></a>00191
- <a name="l00192"></a>00192 <span class="comment">/* Set evaluation layer to not specified */</span>
- <a name="l00193"></a>00193 <a class="code" href="classoversim_1_1Nice.html#a71935c17b8b4804bc6dd823d696dbf3e">evalLayer</a> = -1;
- <a name="l00194"></a>00194 <a class="code" href="classoversim_1_1Nice.html#a46807673c62fb160eaf202a0eac29058">joinLayer</a> = -1;
- <a name="l00195"></a>00195
- <a name="l00196"></a>00196 <a class="code" href="classoversim_1_1Nice.html#a36ec304efa445340c9c1f72e950b076b">first_leader</a> = <a class="code" href="classTransportAddress.html#ac1709545db722cbbce1367034142d31f" title="TransportAddress without specified ip and port.">TransportAddress::UNSPECIFIED_NODE</a>;
- <a name="l00197"></a>00197 <a class="code" href="classoversim_1_1Nice.html#ad6115b6ca9ae33de7308570d8aaceaf7">second_leader</a> = <a class="code" href="classTransportAddress.html#ac1709545db722cbbce1367034142d31f" title="TransportAddress without specified ip and port.">TransportAddress::UNSPECIFIED_NODE</a>;
- <a name="l00198"></a>00198
- <a name="l00199"></a>00199 <span class="comment">// add some watches</span>
- <a name="l00200"></a>00200 WATCH(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l00201"></a>00201 <a class="code" href="hashWatch_8h.html#ae5678c8f482eb1afddaea5022e654865" title="Makes pointer_maps inspectable in Tkenv.">WATCH_POINTER_MAP</a>(<a class="code" href="classoversim_1_1Nice.html#abfd784a7eb10c0af88d835308cf66ff6">peerInfos</a>);
- <a name="l00202"></a>00202 WATCH(<a class="code" href="classoversim_1_1Nice.html#a71935c17b8b4804bc6dd823d696dbf3e">evalLayer</a>);
- <a name="l00203"></a>00203 WATCH(<a class="code" href="classoversim_1_1Nice.html#aa604bd27a4b737fd179c2b09debebc84">query_start</a>);
- <a name="l00204"></a>00204 WATCH(<a class="code" href="classoversim_1_1Nice.html#a687c425a685e47b47d989b24a1fe6165">heartbeatTimer</a>);
- <a name="l00205"></a>00205 WATCH_MAP(<a class="code" href="classoversim_1_1Nice.html#ab4e95531a9f00a8c4ed022749d263238">tempPeers</a>);
- <a name="l00206"></a>00206 WATCH(<a class="code" href="classoversim_1_1Nice.html#a28c155327e18edb17d6ab2a4c67cf0a8">RendevouzPoint</a>);
- <a name="l00207"></a>00207 WATCH(<a class="code" href="classoversim_1_1Nice.html#aaad03fa2518f9122314129e4afd433d8">isRendevouzPoint</a>);
- <a name="l00208"></a>00208
- <a name="l00209"></a>00209 WATCH(<a class="code" href="classoversim_1_1Nice.html#a50dd1e20f4c56dc45f9ffa1c52d2716f">numInconsistencies</a>);
- <a name="l00210"></a>00210 WATCH(<a class="code" href="classoversim_1_1Nice.html#ac151ea0f3d5ac1d60b32d92c08d89e44">numQueryTimeouts</a>);
- <a name="l00211"></a>00211 WATCH(<a class="code" href="classoversim_1_1Nice.html#a82e217903a688c47656a56dc4a593ebc">numPeerTimeouts</a>);
- <a name="l00212"></a>00212 WATCH(<a class="code" href="classoversim_1_1Nice.html#a97964c134da4da5b58b3c7dff32a0800">numTempPeerTimeouts</a>);
- <a name="l00213"></a>00213 WATCH(<a class="code" href="classoversim_1_1Nice.html#acd1effc337560f6677e63608b3e53af8">numStructurePartitions</a>);
- <a name="l00214"></a>00214 WATCH(<a class="code" href="classoversim_1_1Nice.html#ab0a8837fcffd376b822166d048a401fa">numOwnMessagesReceived</a>);
- <a name="l00215"></a>00215 WATCH(<a class="code" href="classoversim_1_1Nice.html#a063a91a0c9cbd3bcfeca7ce10944eb70">totalSCMinCompare</a>);
- <a name="l00216"></a>00216 WATCH(<a class="code" href="classoversim_1_1Nice.html#a765b5d96a57bf709b6a8ce28541d55a6">numJoins</a>);
- <a name="l00217"></a>00217 WATCH(<a class="code" href="classoversim_1_1Nice.html#ade427df4fbd3edb53e04467984384927">totalForwardBytes</a>);
- <a name="l00218"></a>00218 WATCH(<a class="code" href="classoversim_1_1Nice.html#ab0165945cd4929e57f66e595ce76cc14">numReceived</a>);
- <a name="l00219"></a>00219 WATCH(<a class="code" href="classoversim_1_1Nice.html#ab70712e9a475d6ab12690cf36a31ffe1">totalReceivedBytes</a>);
- <a name="l00220"></a>00220 WATCH(<a class="code" href="classoversim_1_1Nice.html#aed41149eb142ad3c71d6a639b113a5f7">numHeartbeat</a>);
- <a name="l00221"></a>00221 WATCH(<a class="code" href="classoversim_1_1Nice.html#ad186e77457bdad45888594517319a02b">totalHeartbeatBytes</a>);
- <a name="l00222"></a>00222
- <a name="l00223"></a>00223 } <span class="comment">// initializeOverlay</span>
- <a name="l00224"></a>00224
- <a name="l00225"></a>00225
- <a name="l00226"></a>00226 <span class="comment">/******************************************************************************</span>
- <a name="l00227"></a>00227 <span class="comment"> * joinOverlay</span>
- <a name="l00228"></a><a class="code" href="classoversim_1_1Nice.html#a642dd901f2f5b0561cde5a1c3e932d8e">00228</a> <span class="comment"> * see BaseOverlay.h</span>
- <a name="l00229"></a>00229 <span class="comment"> */</span>
- <a name="l00230"></a>00230 <span class="keywordtype">void</span> <a class="code" href="classoversim_1_1Nice.html#a642dd901f2f5b0561cde5a1c3e932d8e" title="Join the overlay with a given nodeID in thisNode.key.">Nice::joinOverlay</a>()
- <a name="l00231"></a>00231 {
- <a name="l00232"></a>00232 <a class="code" href="classoversim_1_1Nice.html#ad1d32ea267badf0b9a482d7c415aa03c" title="changes node state">changeState</a>(<a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fa4c1b397f6c4682baf7db280e7f15520a">INIT</a>);
- <a name="l00233"></a>00233 <a class="code" href="classoversim_1_1Nice.html#ad1d32ea267badf0b9a482d7c415aa03c" title="changes node state">changeState</a>(<a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab746fc2a119638665d6ac9d493146662">BOOTSTRAP</a>);
- <a name="l00234"></a><a class="code" href="classoversim_1_1Nice.html#a9f2264e7a35474365104f15854108700">00234</a> } <span class="comment">// joinOverlay</span>
- <a name="l00235"></a>00235
- <a name="l00236"></a>00236 <span class="keywordtype">void</span> <a class="code" href="classoversim_1_1Nice.html#a9f2264e7a35474365104f15854108700" title="This method gets call **.gracefulLeaveDelay seconds before it is killed.">Nice::handleNodeLeaveNotification</a>() {
- <a name="l00237"></a>00237 <span class="keywordflow">if</span> (<a class="code" href="classoversim_1_1Nice.html#aaad03fa2518f9122314129e4afd433d8">isRendevouzPoint</a>) {
- <a name="l00238"></a>00238 opp_error(<span class="stringliteral">"The NICE Rendevouz Point is being churned out and the simulation cannot continue. "</span>
- <a name="l00239"></a>00239 <span class="stringliteral">"Please, check your config and make sure that the Chrun Generator's configuration is correct. "</span>
- <a name="l00240"></a>00240 <span class="stringliteral">"Specifically, the Rendevouz Point must not get churned out during the simulation."</span>);
- <a name="l00241"></a>00241 }
- <a name="l00242"></a>00242 }
- <a name="l00243"></a>00243
- <a name="l00244"></a>00244 <span class="comment">/******************************************************************************</span>
- <a name="l00245"></a>00245 <span class="comment"> * changeState</span>
- <a name="l00246"></a><a class="code" href="classoversim_1_1Nice.html#ad1d32ea267badf0b9a482d7c415aa03c">00246</a> <span class="comment"> * see BaseOverlay.h</span>
- <a name="l00247"></a>00247 <span class="comment"> */</span>
- <a name="l00248"></a>00248 <span class="keywordtype">void</span> <a class="code" href="classoversim_1_1Nice.html#ad1d32ea267badf0b9a482d7c415aa03c" title="changes node state">Nice::changeState</a>( <span class="keywordtype">int</span> toState )
- <a name="l00249"></a>00249 {
- <a name="l00250"></a>00250 <span class="keywordflow">switch</span> (toState) {
- <a name="l00251"></a>00251
- <a name="l00252"></a>00252 <span class="keywordflow">case</span> <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fa4c1b397f6c4682baf7db280e7f15520a">INIT</a>:
- <a name="l00253"></a>00253
- <a name="l00254"></a>00254 <a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> = INIT;
- <a name="l00255"></a>00255
- <a name="l00256"></a>00256 getParentModule()->getParentModule()->getDisplayString().setTagArg(<span class="stringliteral">"i2"</span>, 1, <span class="stringliteral">"red"</span>);
- <a name="l00257"></a>00257
- <a name="l00258"></a>00258 scheduleAt(simTime() + 1, <a class="code" href="classoversim_1_1Nice.html#aa31f386f8403d2ba88f43a1a57fcba57">visualizationTimer</a>);
- <a name="l00259"></a>00259
- <a name="l00260"></a>00260 <span class="keywordflow">break</span>;
- <a name="l00261"></a>00261
- <a name="l00262"></a>00262 <span class="keywordflow">case</span> <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab746fc2a119638665d6ac9d493146662">BOOTSTRAP</a>:
- <a name="l00263"></a>00263
- <a name="l00264"></a>00264 <a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> = BOOTSTRAP;
- <a name="l00265"></a>00265
- <a name="l00266"></a>00266 <span class="comment">/* get rendevouz point */</span>
- <a name="l00267"></a>00267 <a class="code" href="classoversim_1_1Nice.html#a28c155327e18edb17d6ab2a4c67cf0a8">RendevouzPoint</a> = <a class="code" href="classBaseOverlay.html#abe4dea93564123116c97d5c4721f0504" title="pointer to the BootstrapList module">bootstrapList</a>-><a class="code" href="classBootstrapList.html#af6e1422372d548ba574e136c1a10ccaa" title="Get a bootstrap node from the bootstrap list.">getBootstrapNode</a>();
- <a name="l00268"></a>00268 <span class="keywordflow">if</span> (<a class="code" href="classoversim_1_1Nice.html#a28c155327e18edb17d6ab2a4c67cf0a8">RendevouzPoint</a>.<a class="code" href="classTransportAddress.html#a026e777c423ff2a0280edd2fa5472e74" title="indicates if TransportAddress is specified">isUnspecified</a>()) {
- <a name="l00269"></a>00269
- <a name="l00270"></a>00270 <a class="code" href="classoversim_1_1Nice.html#a28c155327e18edb17d6ab2a4c67cf0a8">RendevouzPoint</a> = <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>;
- <a name="l00271"></a>00271 <a class="code" href="classoversim_1_1Nice.html#aaad03fa2518f9122314129e4afd433d8">isRendevouzPoint</a> = <span class="keyword">true</span>;
- <a name="l00272"></a>00272
- <a name="l00273"></a>00273 <span class="comment">/* join cluster layer 0 as first node */</span>
- <a name="l00274"></a>00274 <a class="code" href="classoversim_1_1Nice.html#a644c991f567da9990713bba00e3dacac">clusters</a>[0].<a class="code" href="classNiceCluster.html#abf66af103a6767b2c7fbce63bc18ce19" title="Adds address to cluster.">add</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l00275"></a>00275 <a class="code" href="classoversim_1_1Nice.html#a644c991f567da9990713bba00e3dacac">clusters</a>[0].<a class="code" href="classNiceCluster.html#a1e05f1adaf751ab276de29c3eb8fbe56" title="Set leader to given address.">setLeader</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l00276"></a>00276
- <a name="l00277"></a>00277 <a class="code" href="classoversim_1_1Nice.html#ad1d32ea267badf0b9a482d7c415aa03c" title="changes node state">changeState</a>(<a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab3a263fb274a58d63b15cd61ba910335">READY</a>);
- <a name="l00278"></a>00278
- <a name="l00279"></a>00279 <span class="keywordflow">return</span>;
- <a name="l00280"></a>00280
- <a name="l00281"></a>00281 }
- <a name="l00282"></a>00282 <span class="keywordflow">else</span> {
- <a name="l00283"></a>00283
- <a name="l00284"></a>00284 <a class="code" href="classoversim_1_1Nice.html#ac1b9865b490cf352d83680020939c270">pollRP</a>(-1);
- <a name="l00285"></a>00285
- <a name="l00286"></a>00286 <span class="comment">/* initiate NICE structure joining */</span>
- <a name="l00287"></a>00287 <a class="code" href="classoversim_1_1Nice.html#ad3b7430e484451777e58ea163e4fc049">BasicJoinLayer</a>(-1);
- <a name="l00288"></a>00288
- <a name="l00289"></a>00289 }
- <a name="l00290"></a>00290
- <a name="l00291"></a>00291 <span class="keywordflow">break</span>;
- <a name="l00292"></a>00292
- <a name="l00293"></a>00293 <span class="keywordflow">case</span> <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab3a263fb274a58d63b15cd61ba910335">READY</a>:
- <a name="l00294"></a>00294
- <a name="l00295"></a>00295 <a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> = READY;
- <a name="l00296"></a>00296
- <a name="l00297"></a>00297 cancelEvent(<a class="code" href="classoversim_1_1Nice.html#a687c425a685e47b47d989b24a1fe6165">heartbeatTimer</a>);
- <a name="l00298"></a>00298 scheduleAt(simTime() + <a class="code" href="classoversim_1_1Nice.html#a58d3d6285e2a84acb277e220d1a35807">heartbeatInterval</a>, <a class="code" href="classoversim_1_1Nice.html#a687c425a685e47b47d989b24a1fe6165">heartbeatTimer</a>);
- <a name="l00299"></a>00299 cancelEvent(<a class="code" href="classoversim_1_1Nice.html#ace2ed47b84cbee1c7cc71cbc44a4fea8">maintenanceTimer</a>);
- <a name="l00300"></a>00300 scheduleAt(simTime() + <a class="code" href="classoversim_1_1Nice.html#a6d14d42d813222d9ee8c5d395ba60365">maintenanceInterval</a>, <a class="code" href="classoversim_1_1Nice.html#ace2ed47b84cbee1c7cc71cbc44a4fea8">maintenanceTimer</a>);
- <a name="l00301"></a>00301
- <a name="l00302"></a>00302 getParentModule()->getParentModule()->getDisplayString().setTagArg
- <a name="l00303"></a>00303 (<span class="stringliteral">"i2"</span>, 1, <a class="code" href="namespaceoversim.html#a068481bf2793ad703ca213dcca1e4a6f" title="Define colors for layers in visualization.">clustercolors</a>[<a class="code" href="classoversim_1_1Nice.html#ac29c7ecdf6590c8f7fd4ea9b546f72f8">getHighestLayer</a>()]);
- <a name="l00304"></a>00304
- <a name="l00305"></a>00305 <a class="code" href="classBaseOverlay.html#a9da615809e832cbc4645cc732d510277" title="Sets the overlay ready icon and register/deregisters the node at the GlobalNodeList.">setOverlayReady</a>(<span class="keyword">true</span>);
- <a name="l00306"></a>00306 <span class="comment">/* allow only rendevouz point to be bootstrap node */</span>
- <a name="l00307"></a>00307 <span class="keywordflow">if</span> (!<a class="code" href="classoversim_1_1Nice.html#aaad03fa2518f9122314129e4afd433d8">isRendevouzPoint</a>) <a class="code" href="classBaseOverlay.html#abe4dea93564123116c97d5c4721f0504" title="pointer to the BootstrapList module">bootstrapList</a>-><a class="code" href="classBootstrapList.html#ae3599c25687b302037e58d3ca68411cd">removeBootstrapNode</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l00308"></a>00308
- <a name="l00309"></a>00309 <span class="keywordflow">break</span>;
- <a name="l00310"></a>00310
- <a name="l00311"></a>00311 }
- <a name="l00312"></a>00312
- <a name="l00313"></a>00313 } <span class="comment">// changeState</span>
- <a name="l00314"></a>00314
- <a name="l00315"></a>00315
- <a name="l00316"></a>00316 <span class="comment">/******************************************************************************</span>
- <a name="l00317"></a>00317 <span class="comment"> * changeState</span>
- <a name="l00318"></a><a class="code" href="classoversim_1_1Nice.html#aebd1289938fa0c32bceda56deafaf302">00318</a> <span class="comment"> * see BaseOverlay.h</span>
- <a name="l00319"></a>00319 <span class="comment"> */</span>
- <a name="l00320"></a>00320 <span class="keywordtype">void</span> <a class="code" href="classoversim_1_1Nice.html#aebd1289938fa0c32bceda56deafaf302">Nice::handleTimerEvent</a>( cMessage* msg )
- <a name="l00321"></a>00321 {
- <a name="l00322"></a>00322
- <a name="l00323"></a>00323 <span class="keywordflow">if</span> (msg->isName(<span class="stringliteral">"visualizationTimer"</span>)) {
- <a name="l00324"></a>00324
- <a name="l00325"></a>00325 <a class="code" href="classoversim_1_1Nice.html#a71a14940853660afb14b6c8f6b5d448c">updateVisualization</a>();
- <a name="l00326"></a>00326 scheduleAt(simTime() + 1, <a class="code" href="classoversim_1_1Nice.html#aa31f386f8403d2ba88f43a1a57fcba57">visualizationTimer</a>);
- <a name="l00327"></a>00327
- <a name="l00328"></a>00328 }
- <a name="l00329"></a>00329 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg->isName(<span class="stringliteral">"heartbeatTimer"</span>)) {
- <a name="l00330"></a>00330
- <a name="l00331"></a>00331 <a class="code" href="classoversim_1_1Nice.html#a1ffd3a3b39866e51502fee0bf37480f7">sendHeartbeats</a>();
- <a name="l00332"></a>00332 scheduleAt(simTime() + <a class="code" href="classoversim_1_1Nice.html#a58d3d6285e2a84acb277e220d1a35807">heartbeatInterval</a>, <a class="code" href="classoversim_1_1Nice.html#a687c425a685e47b47d989b24a1fe6165">heartbeatTimer</a>);
- <a name="l00333"></a>00333
- <a name="l00334"></a>00334 }
- <a name="l00335"></a>00335 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg->isName(<span class="stringliteral">"maintenanceTimer"</span>)) {
- <a name="l00336"></a>00336
- <a name="l00337"></a>00337 <a class="code" href="classoversim_1_1Nice.html#a0a808dd35aedab035a7bb8ba1a5d6f9a">maintenance</a>();
- <a name="l00338"></a>00338 cancelEvent(<a class="code" href="classoversim_1_1Nice.html#ace2ed47b84cbee1c7cc71cbc44a4fea8">maintenanceTimer</a>);
- <a name="l00339"></a>00339 scheduleAt(simTime() + <a class="code" href="classoversim_1_1Nice.html#a6d14d42d813222d9ee8c5d395ba60365">maintenanceInterval</a>, <a class="code" href="classoversim_1_1Nice.html#ace2ed47b84cbee1c7cc71cbc44a4fea8">maintenanceTimer</a>);
- <a name="l00340"></a>00340
- <a name="l00341"></a>00341 }
- <a name="l00342"></a>00342 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg->isName(<span class="stringliteral">"queryTimer"</span>)) {
- <a name="l00343"></a>00343
- <a name="l00344"></a>00344 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(++<a class="code" href="classoversim_1_1Nice.html#a50dd1e20f4c56dc45f9ffa1c52d2716f">numInconsistencies</a>; ++<a class="code" href="classoversim_1_1Nice.html#ac151ea0f3d5ac1d60b32d92c08d89e44">numQueryTimeouts</a>);
- <a name="l00345"></a>00345 <span class="keywordflow">if</span> (!<a class="code" href="classoversim_1_1Nice.html#a974f1212dc063af0d943b5fa350cc57a">tempResolver</a>.<a class="code" href="classTransportAddress.html#a026e777c423ff2a0280edd2fa5472e74" title="indicates if TransportAddress is specified">isUnspecified</a>() &&
- <a name="l00346"></a>00346 (<a class="code" href="classoversim_1_1Nice.html#a974f1212dc063af0d943b5fa350cc57a">tempResolver</a> == <a class="code" href="classoversim_1_1Nice.html#a28c155327e18edb17d6ab2a4c67cf0a8">RendevouzPoint</a> ||
- <a name="l00347"></a>00347 (!<a class="code" href="classoversim_1_1Nice.html#ac00b0f8d11b8f3f7c3e5c2eb78511cc6">polledRendevouzPoint</a>.<a class="code" href="classTransportAddress.html#a026e777c423ff2a0280edd2fa5472e74" title="indicates if TransportAddress is specified">isUnspecified</a>() && <a class="code" href="classoversim_1_1Nice.html#a974f1212dc063af0d943b5fa350cc57a">tempResolver</a> == <a class="code" href="classoversim_1_1Nice.html#ac00b0f8d11b8f3f7c3e5c2eb78511cc6">polledRendevouzPoint</a>))) {
- <a name="l00348"></a>00348 <a class="code" href="classoversim_1_1Nice.html#a6acafcf8008939d12f8db7e002a2ebb5">Query</a>(<a class="code" href="classoversim_1_1Nice.html#a28c155327e18edb17d6ab2a4c67cf0a8">RendevouzPoint</a>, <a class="code" href="classoversim_1_1Nice.html#a46807673c62fb160eaf202a0eac29058">joinLayer</a>);
- <a name="l00349"></a>00349 }
- <a name="l00350"></a>00350 <span class="keywordflow">else</span> {
- <a name="l00351"></a>00351 <a class="code" href="classoversim_1_1Nice.html#a6acafcf8008939d12f8db7e002a2ebb5">Query</a>(<a class="code" href="classoversim_1_1Nice.html#a974f1212dc063af0d943b5fa350cc57a">tempResolver</a>, <a class="code" href="classoversim_1_1Nice.html#a46807673c62fb160eaf202a0eac29058">joinLayer</a>);
- <a name="l00352"></a>00352 }
- <a name="l00353"></a>00353
- <a name="l00354"></a>00354 }
- <a name="l00355"></a>00355 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg->isName(<span class="stringliteral">"rpPollTimer"</span>)) {
- <a name="l00356"></a>00356
- <a name="l00357"></a>00357 <a class="code" href="classoversim_1_1Nice.html#ac1b9865b490cf352d83680020939c270">pollRP</a>(-1);
- <a name="l00358"></a>00358
- <a name="l00359"></a>00359 }
- <a name="l00360"></a>00360
- <a name="l00361"></a>00361 } <span class="comment">// handleTimerEvent</span>
- <a name="l00362"></a>00362
- <a name="l00363"></a>00363
- <a name="l00364"></a>00364 <span class="comment">/******************************************************************************</span>
- <a name="l00365"></a>00365 <span class="comment"> * handleUDPMessage</span>
- <a name="l00366"></a><a class="code" href="classoversim_1_1Nice.html#aa7b0abef7e007a2a032614cd1e5be597">00366</a> <span class="comment"> * see BaseOverlay.h</span>
- <a name="l00367"></a>00367 <span class="comment"> */</span>
- <a name="l00368"></a>00368 <span class="keywordtype">void</span> <a class="code" href="classoversim_1_1Nice.html#aa7b0abef7e007a2a032614cd1e5be597" title="Processes messages from underlay.">Nice::handleUDPMessage</a>(<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg)
- <a name="l00369"></a>00369 {
- <a name="l00370"></a>00370
- <a name="l00371"></a>00371 <span class="comment">// try message cast to NICE base message</span>
- <a name="l00372"></a>00372 <span class="keywordflow">if</span> (dynamic_cast<NiceMessage*>(msg) != NULL) {
- <a name="l00373"></a>00373
- <a name="l00374"></a>00374 <a class="code" href="classNiceMessage.html" title="Class generated from overlay/nice/NiceMessage.msg by opp_msgc.">NiceMessage</a>* niceMsg = check_and_cast<<a class="code" href="classNiceMessage.html" title="Class generated from overlay/nice/NiceMessage.msg by opp_msgc.">NiceMessage</a>*>(msg);
- <a name="l00375"></a>00375
- <a name="l00376"></a>00376 <span class="comment">// First of all, update activity information for sourcenode</span>
- <a name="l00377"></a>00377 std::map<TransportAddress, NicePeerInfo*>::iterator it = <a class="code" href="classoversim_1_1Nice.html#abfd784a7eb10c0af88d835308cf66ff6">peerInfos</a>.find(niceMsg-><a class="code" href="classNiceMessage.html#aecd3c064af0f390ca24b0364f8490e36">getSrcNode</a>());
- <a name="l00378"></a>00378
- <a name="l00379"></a>00379 <span class="keywordflow">if</span> (it != <a class="code" href="classoversim_1_1Nice.html#abfd784a7eb10c0af88d835308cf66ff6">peerInfos</a>.end()) {
- <a name="l00380"></a>00380
- <a name="l00381"></a>00381 it->second->touch();
- <a name="l00382"></a>00382
- <a name="l00383"></a>00383 }
- <a name="l00384"></a>00384
- <a name="l00385"></a>00385 <span class="comment">/* Dispatch message, possibly downcasting to a more concrete type */</span>
- <a name="l00386"></a>00386 <span class="keywordflow">switch</span> (niceMsg-><a class="code" href="classNiceMessage.html#a3569492f722da94c494a21014e51240f">getCommand</a>()) {
- <a name="l00387"></a>00387
- <a name="l00388"></a>00388 <span class="comment">/* More concrete types, to which the message is cast if needed */</span>
- <a name="l00389"></a>00389 <a class="code" href="classNiceMemberMessage.html" title="Class generated from overlay/nice/NiceMessage.msg by opp_msgc.">NiceMemberMessage</a>* queryRspMsg;
- <a name="l00390"></a>00390 <a class="code" href="classNiceClusterMerge.html" title="Class generated from overlay/nice/NiceMessage.msg by opp_msgc.">NiceClusterMerge</a>* mergeMsg;
- <a name="l00391"></a>00391 <a class="code" href="classNiceMulticastMessage.html" title="Class generated from overlay/nice/NiceMessage.msg by opp_msgc.">NiceMulticastMessage</a>* multicastMsg;
- <a name="l00392"></a>00392
- <a name="l00393"></a>00393 <span class="keywordflow">case</span> <a class="code" href="NiceMessage__m_8h.html#a53eb6ab4c3521dbc1b971f43f68001e7a8d5e84b5d60df22479df8355d6347834">NICE_QUERY</a>:
- <a name="l00394"></a>00394
- <a name="l00395"></a>00395 <a class="code" href="classoversim_1_1Nice.html#afeb7081be1f7f76b2108aad45c49abfe">handleNiceQuery</a>(niceMsg);
- <a name="l00396"></a>00396
- <a name="l00397"></a>00397 <span class="keywordflow">break</span>;
- <a name="l00398"></a>00398
- <a name="l00399"></a>00399 <span class="keywordflow">case</span> <a class="code" href="NiceMessage__m_8h.html#a53eb6ab4c3521dbc1b971f43f68001e7a0ee562452c946bccf6069ac9e42b066e">NICE_QUERY_RESPONSE</a>:
- <a name="l00400"></a>00400
- <a name="l00401"></a>00401 queryRspMsg = check_and_cast<<a class="code" href="classNiceMemberMessage.html" title="Class generated from overlay/nice/NiceMessage.msg by opp_msgc.">NiceMemberMessage</a>*>(niceMsg);
- <a name="l00402"></a>00402 <a class="code" href="classoversim_1_1Nice.html#ab36bfc01b3cd042da92e1b27782ce7bd">handleNiceQueryResponse</a>(queryRspMsg);
- <a name="l00403"></a>00403
- <a name="l00404"></a>00404 <span class="keywordflow">break</span>;
- <a name="l00405"></a>00405
- <a name="l00406"></a>00406 <span class="keywordflow">case</span> <a class="code" href="NiceMessage__m_8h.html#a53eb6ab4c3521dbc1b971f43f68001e7a6fd9bbfeec6702e13ecfa8ddf57fa018">NICE_JOIN_CLUSTER</a>:
- <a name="l00407"></a>00407
- <a name="l00408"></a>00408 <a class="code" href="classoversim_1_1Nice.html#a0757be556541e2d8efd235be889f2ab6">handleNiceJoinCluster</a>(niceMsg);
- <a name="l00409"></a>00409
- <a name="l00410"></a>00410 <span class="keywordflow">break</span>;
- <a name="l00411"></a>00411
- <a name="l00412"></a>00412 <span class="keywordflow">case</span> <a class="code" href="NiceMessage__m_8h.html#a53eb6ab4c3521dbc1b971f43f68001e7a8bf3ffec79cbd15ef9c801ec8fdcc1db">NICE_POLL_RP</a>:
- <a name="l00413"></a>00413
- <a name="l00414"></a>00414 <a class="code" href="classoversim_1_1Nice.html#a10494e710344144e515c7e22b83e786c">handleNicePollRp</a>(niceMsg);
- <a name="l00415"></a>00415
- <a name="l00416"></a>00416 <span class="keywordflow">break</span>;
- <a name="l00417"></a>00417
- <a name="l00418"></a>00418 <span class="keywordflow">case</sp…
Large files files are truncated, but you can click here to view the full file