/OverSim-20101103/doc/doxy/BaseOverlay_8cc_source.html
HTML | 2094 lines | 2093 code | 0 blank | 1 comment | 0 complexity | f753b4e198ec6916bd8c6dc7bce47050 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, GPL-2.0, Apache-2.0, JSON
- <!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: BaseOverlay.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_c6e45067cd9ed30d67160903d22a8d0a.html">common</a> </li>
- </ul>
- </div>
- </div>
- <div class="header">
- <div class="headertitle">
- <h1>BaseOverlay.cc</h1> </div>
- </div>
- <div class="contents">
- <a href="BaseOverlay_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) 2006 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="l00028"></a>00028 <span class="preprocessor">#include <cassert></span>
- <a name="l00029"></a>00029
- <a name="l00030"></a>00030 <span class="preprocessor">#include <<a class="code" href="RpcMacros_8h.html" title="This file declares some macros for RPC implementation.">RpcMacros.h</a>></span>
- <a name="l00031"></a>00031
- <a name="l00032"></a>00032 <span class="preprocessor">#include <UDPAppBase.h></span>
- <a name="l00033"></a>00033 <span class="preprocessor">#include <UDPSocket.h></span>
- <a name="l00034"></a>00034 <span class="preprocessor">#include <IPAddressResolver.h></span>
- <a name="l00035"></a>00035 <span class="preprocessor">#include <NotificationBoard.h></span>
- <a name="l00036"></a>00036
- <a name="l00037"></a>00037 <span class="preprocessor">#include <<a class="code" href="GlobalNodeListAccess_8h.html">GlobalNodeListAccess.h</a>></span>
- <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="UnderlayConfiguratorAccess_8h.html">UnderlayConfiguratorAccess.h</a>></span>
- <a name="l00039"></a>00039 <span class="preprocessor">#include <<a class="code" href="GlobalStatisticsAccess_8h.html">GlobalStatisticsAccess.h</a>></span>
- <a name="l00040"></a>00040 <span class="preprocessor">#include <<a class="code" href="GlobalParametersAccess_8h.html">GlobalParametersAccess.h</a>></span>
- <a name="l00041"></a>00041
- <a name="l00042"></a>00042 <span class="preprocessor">#include <<a class="code" href="LookupListener_8h.html">LookupListener.h</a>></span>
- <a name="l00043"></a>00043 <span class="preprocessor">#include <<a class="code" href="RecursiveLookup_8h.html">RecursiveLookup.h</a>></span>
- <a name="l00044"></a>00044 <span class="preprocessor">#include <<a class="code" href="IterativeLookup_8h.html">IterativeLookup.h</a>></span>
- <a name="l00045"></a>00045
- <a name="l00046"></a>00046 <span class="preprocessor">#include <<a class="code" href="BootstrapList_8h.html">BootstrapList.h</a>></span>
- <a name="l00047"></a>00047
- <a name="l00048"></a>00048 <span class="preprocessor">#include "<a class="code" href="BaseOverlay_8h.html">BaseOverlay.h</a>"</span>
- <a name="l00049"></a>00049
- <a name="l00050"></a>00050 <span class="keyword">using namespace </span>std;
- <a name="l00051"></a>00051
- <a name="l00052"></a>00052
- <a name="l00053"></a>00053 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00054"></a>00054 <span class="comment">//--- Initialization & finishing -----------------------------------------</span>
- <a name="l00055"></a>00055 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00056"></a>00056
- <a name="l00057"></a><a class="code" href="classBaseOverlay.html#a9d3fd0a833ef00d1a739ced007469505">00057</a> <a class="code" href="classBaseOverlay.html#a9d3fd0a833ef00d1a739ced007469505">BaseOverlay::BaseOverlay</a>()
- <a name="l00058"></a>00058 {
- <a name="l00059"></a>00059 <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a> = NULL;
- <a name="l00060"></a>00060 <a class="code" href="classBaseOverlay.html#af2f7102d7cc6f5ecb1c3ecb3d9c93df3" title="pointer to UnderlayConfigurator in this node">underlayConfigurator</a> = NULL;
- <a name="l00061"></a>00061 <a class="code" href="classBaseOverlay.html#af0704186e295039c92666176b0b91dae" title="pointer to NotificationBoard in this node">notificationBoard</a> = NULL;
- <a name="l00062"></a>00062 <a class="code" href="classBaseOverlay.html#a59bde2858b8537864fbad3eb487dbc55" title="pointer to the GlobalParameters module">globalParameters</a> = NULL;
- <a name="l00063"></a>00063 <a class="code" href="classBaseOverlay.html#abe4dea93564123116c97d5c4721f0504" title="pointer to the BootstrapList module">bootstrapList</a> = NULL;
- <a name="l00064"></a>00064 }
- <a name="l00065"></a>00065
- <a name="l00066"></a><a class="code" href="classBaseOverlay.html#a4fd9da1c26016b59e19ac0ca938ba312">00066</a> <a class="code" href="classBaseOverlay.html#a4fd9da1c26016b59e19ac0ca938ba312" title="Virtual destructor.">BaseOverlay::~BaseOverlay</a>()
- <a name="l00067"></a>00067 {
- <a name="l00068"></a>00068 <a class="code" href="classBaseOverlay.html#abaaca6fe44d8e317d56c90a14e0fcada" title="deletes entries in lookups">finishLookups</a>();
- <a name="l00069"></a>00069 <a class="code" href="classBaseRpc.html#a02b90067d0a0b630baca5808d7f82b5a" title="Deinitializes Remote-Procedure state.">finishRpcs</a>();
- <a name="l00070"></a>00070 }
- <a name="l00071"></a>00071
- <a name="l00072"></a><a class="code" href="classBaseOverlay.html#a3234dfcf81463984e88a42432734a615">00072</a> <span class="keywordtype">int</span> <a class="code" href="classBaseOverlay.html#a3234dfcf81463984e88a42432734a615" title="Sets init stage.">BaseOverlay::numInitStages</a>()<span class="keyword"> const</span>
- <a name="l00073"></a>00073 <span class="keyword"></span>{
- <a name="l00074"></a>00074 <span class="keywordflow">return</span> NUM_STAGES_ALL;
- <a name="l00075"></a>00075 }
- <a name="l00076"></a>00076
- <a name="l00077"></a><a class="code" href="classBaseOverlay.html#a9738ba6065b0f699f1921bbe82ab97be">00077</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a9738ba6065b0f699f1921bbe82ab97be" title="initializes base-class-attributes">BaseOverlay::initialize</a>(<span class="keywordtype">int</span> stage)
- <a name="l00078"></a>00078 {
- <a name="l00079"></a>00079 <span class="keywordflow">if</span> (stage == 0) {
- <a name="l00080"></a>00080 <a class="code" href="classOverlayKey.html#a4d1b67c81853679686ed8f9d52bade16" title="Set the length of an OverlayKey.">OverlayKey::setKeyLength</a>(par(<span class="stringliteral">"keyLength"</span>));
- <a name="l00081"></a>00081 }
- <a name="l00082"></a>00082
- <a name="l00083"></a>00083 <span class="keywordflow">if</span> (stage == <a class="code" href="InitStages_8h.html#a42fde1aa1e14a1c45d29061d6e87e532af7318a654ca995f5f66f3396e4ebf61a">REGISTER_STAGE</a>) {
- <a name="l00084"></a>00084 <a class="code" href="classBaseOverlay.html#a2096f89814b5740257cee106b60dda15">registerComp</a>(<a class="code" href="classBaseOverlay.html#a92e0d3f96a5716245465e05da60ef487">getThisCompType</a>(), <span class="keyword">this</span>);
- <a name="l00085"></a>00085 <span class="keywordflow">return</span>;
- <a name="l00086"></a>00086 }
- <a name="l00087"></a>00087
- <a name="l00088"></a>00088 <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="l00089"></a>00089 <span class="comment">// find friend modules</span>
- <a name="l00090"></a>00090 <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a> = <a class="code" href="classGlobalNodeListAccess.html" title="Gives access to the GlobalNodeList.">GlobalNodeListAccess</a>().get();
- <a name="l00091"></a>00091 <a class="code" href="classBaseOverlay.html#af2f7102d7cc6f5ecb1c3ecb3d9c93df3" title="pointer to UnderlayConfigurator in this node">underlayConfigurator</a> = <a class="code" href="classUnderlayConfiguratorAccess.html" title="Gives access to the UnderlayConfigurator.">UnderlayConfiguratorAccess</a>().get();
- <a name="l00092"></a>00092 <a class="code" href="classBaseOverlay.html#af0704186e295039c92666176b0b91dae" title="pointer to NotificationBoard in this node">notificationBoard</a> = NotificationBoardAccess().get();
- <a name="l00093"></a>00093 <a class="code" href="classBaseOverlay.html#a59bde2858b8537864fbad3eb487dbc55" title="pointer to the GlobalParameters module">globalParameters</a> = <a class="code" href="classGlobalParametersAccess.html" title="Gives access to the GlobalParameters module.">GlobalParametersAccess</a>().get();
- <a name="l00094"></a>00094 <a class="code" href="classBaseOverlay.html#abe4dea93564123116c97d5c4721f0504" title="pointer to the BootstrapList module">bootstrapList</a> = check_and_cast<<a class="code" href="classBootstrapList.html" title="The BootstrapList module maintains a list of bootstrap node candidates.">BootstrapList</a>*>(getParentModule()->
- <a name="l00095"></a>00095 getParentModule()->getSubmodule(<span class="stringliteral">"bootstrapList"</span>, 0));
- <a name="l00096"></a>00096
- <a name="l00097"></a>00097 <a class="code" href="classBaseOverlay.html#a2e2f70aa82a9b4920877b3a13dd1e0ea">udpGate</a> = gate(<span class="stringliteral">"udpIn"</span>);
- <a name="l00098"></a>00098 <a class="code" href="classBaseOverlay.html#a6523faf8f52af34c73643dc7f3e083eb">appGate</a> = gate(<span class="stringliteral">"appIn"</span>);
- <a name="l00099"></a>00099
- <a name="l00100"></a>00100 <span class="comment">// fetch some parameters</span>
- <a name="l00101"></a>00101 <a class="code" href="classBaseOverlay.html#a49ff0fb8c25792a1339d54a60c36f2cd" title="debug output ?">debugOutput</a> = par(<span class="stringliteral">"debugOutput"</span>);
- <a name="l00102"></a>00102 <a class="code" href="classBaseOverlay.html#a2694627a0082c456367bfa472fff56b9" title="collect delay for single hops">collectPerHopDelay</a> = par(<span class="stringliteral">"collectPerHopDelay"</span>);
- <a name="l00103"></a>00103 <a class="code" href="classBaseOverlay.html#aef12c08638b508af44f257824f9391ef" title="used UDP-port">localPort</a> = par(<span class="stringliteral">"localPort"</span>);
- <a name="l00104"></a>00104 <a class="code" href="classBaseOverlay.html#abffe6fbd25963bc2b7542f22ba6455b9" title="maximum hop count">hopCountMax</a> = par(<span class="stringliteral">"hopCountMax"</span>);
- <a name="l00105"></a>00105 <a class="code" href="classBaseOverlay.html#a79031cb868377512713e343a326dbbd9">drawOverlayTopology</a> = par(<span class="stringliteral">"drawOverlayTopology"</span>);
- <a name="l00106"></a>00106 <a class="code" href="classBaseOverlay.html#aecfcf5743d274d9c17730f2aeccf1635">rejoinOnFailure</a> = par(<span class="stringliteral">"rejoinOnFailure"</span>);
- <a name="l00107"></a>00107 <a class="code" href="classBaseOverlay.html#a84fe39074cd9dc69acf188abf3e2ea12" title="needed by KBR protocols for NAT support">sendRpcResponseToLastHop</a> = par(<span class="stringliteral">"sendRpcResponseToLastHop"</span>);
- <a name="l00108"></a>00108 <a class="code" href="classBaseOverlay.html#ab53aaadb5dfe6fea1ac6b90db356cc52" title="if node is malicious, it tries a findNode attack">dropFindNodeAttack</a> = par(<span class="stringliteral">"dropFindNodeAttack"</span>);
- <a name="l00109"></a>00109 <a class="code" href="classBaseOverlay.html#ae70528858c70e2404e0d83824d6f5bbc" title="if node is malicious, it tries a isSibling attack">isSiblingAttack</a> = par(<span class="stringliteral">"isSiblingAttack"</span>);
- <a name="l00110"></a>00110 <a class="code" href="classBaseOverlay.html#a319a6b16e55af5e67fbbf65f6d07d5d9" title="if node is malicious, it tries a invalidNode attack">invalidNodesAttack</a> = par(<span class="stringliteral">"invalidNodesAttack"</span>);
- <a name="l00111"></a>00111 <a class="code" href="classBaseOverlay.html#a3bcd2bdd704803d7ec8ae77633cf03fa" title="if node is malicious, it drops all received BaseRouteMessages">dropRouteMessageAttack</a> = par(<span class="stringliteral">"dropRouteMessageAttack"</span>);
- <a name="l00112"></a>00112 <a class="code" href="classBaseOverlay.html#ab0b0274a06e70c91e8bd8df0c23d435f" title="if true, measure the overhead of signatures in rpc messages">measureAuthBlock</a> = par(<span class="stringliteral">"measureAuthBlock"</span>);
- <a name="l00113"></a>00113 <a class="code" href="classBaseOverlay.html#a7d0beff122a0b5c573dd8ae90c9372d5" title="if true, a node rejoins with its old nodeId and malicious state">restoreContext</a> = par(<span class="stringliteral">"restoreContext"</span>);
- <a name="l00114"></a>00114
- <a name="l00115"></a>00115 <span class="comment">// we assume most overlays don't provide KBR services</span>
- <a name="l00116"></a>00116 <a class="code" href="classBaseOverlay.html#a53389ea3326d2e8ad53f02b388487d0b" title="set this to true, if the overlay provides KBR services">kbr</a> = <span class="keyword">false</span>;
- <a name="l00117"></a>00117
- <a name="l00118"></a>00118 <span class="comment">// set routing type</span>
- <a name="l00119"></a>00119 std::string temp = par(<span class="stringliteral">"routingType"</span>).stdstringValue();
- <a name="l00120"></a>00120 <span class="keywordflow">if</span> (temp == <span class="stringliteral">"iterative"</span>)
- <a name="l00121"></a>00121 <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a> = ITERATIVE_ROUTING;
- <a name="l00122"></a>00122 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (temp == <span class="stringliteral">"exhaustive-iterative"</span>)
- <a name="l00123"></a>00123 <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a> = EXHAUSTIVE_ITERATIVE_ROUTING;
- <a name="l00124"></a>00124 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (temp == <span class="stringliteral">"semi-recursive"</span>)
- <a name="l00125"></a>00125 <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a> = SEMI_RECURSIVE_ROUTING;
- <a name="l00126"></a>00126 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (temp == <span class="stringliteral">"full-recursive"</span>)
- <a name="l00127"></a>00127 <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a> = FULL_RECURSIVE_ROUTING;
- <a name="l00128"></a>00128 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (temp == <span class="stringliteral">"source-routing-recursive"</span>)
- <a name="l00129"></a>00129 <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a> = RECURSIVE_SOURCE_ROUTING;
- <a name="l00130"></a>00130 <span class="keywordflow">else</span> <span class="keywordflow">throw</span> cRuntimeError((std::string(<span class="stringliteral">"Wrong routing type: "</span>)
- <a name="l00131"></a>00131 + temp).c_str());
- <a name="l00132"></a>00132
- <a name="l00133"></a>00133 <a class="code" href="classBaseOverlay.html#ac9acbeb30646d54f620d87641d91b113" title="forward messages to applications?">useCommonAPIforward</a> = par(<span class="stringliteral">"useCommonAPIforward"</span>);
- <a name="l00134"></a>00134 <a class="code" href="classBaseOverlay.html#a6e9090bf68f45a31d727a6c7f0501d43" title="send ACK when receiving route message">routeMsgAcks</a> = par(<span class="stringliteral">"routeMsgAcks"</span>);
- <a name="l00135"></a>00135 <a class="code" href="classBaseOverlay.html#ad0094285f9af244aec5e5fe600126243" title="numRedundantNodes for recursive routing">recNumRedundantNodes</a> = par(<span class="stringliteral">"recNumRedundantNodes"</span>);
- <a name="l00136"></a>00136 <a class="code" href="classBaseOverlay.html#a61186fd8bd7368c8a91a63ecc9c62a89" title="record visited hops on route">recordRoute</a> = par(<span class="stringliteral">"recordRoute"</span>);
- <a name="l00137"></a>00137
- <a name="l00138"></a>00138 <span class="comment">// set base lookup parameters</span>
- <a name="l00139"></a>00139 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a5ffefd1d559420cc498307521ae1fac7" title="number of next hops in each step">redundantNodes</a> = par(<span class="stringliteral">"lookupRedundantNodes"</span>);
- <a name="l00140"></a>00140 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#ad847495e9bdd53b83437150b0b26381e" title="number of parallel paths">parallelPaths</a> = par(<span class="stringliteral">"lookupParallelPaths"</span>);
- <a name="l00141"></a>00141 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#ad0cc5694665de82ca47d2763d829238a" title="number of nodes to ask in parallel">parallelRpcs</a> = par(<span class="stringliteral">"lookupParallelRpcs"</span>);
- <a name="l00142"></a>00142 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#ac4f7617d2cf8e6a7a9d178b9092fec7f" title="true, if siblings need to be authenticated with a ping">verifySiblings</a> = par(<span class="stringliteral">"lookupVerifySiblings"</span>);
- <a name="l00143"></a>00143 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a948fd1a937d5d2fb516e0e9181183078" title="true, if sibling candidates are selected by a majority decision if using parallel paths...">majoritySiblings</a> = par(<span class="stringliteral">"lookupMajoritySiblings"</span>);
- <a name="l00144"></a>00144 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a1bb036f4f3d11da022eacb20c9175132" title="true, if parallel RPCs results should be merged">merge</a> = par(<span class="stringliteral">"lookupMerge"</span>);
- <a name="l00145"></a>00145 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a7e4a47e8ecba9deba2509cb674c53e8c" title="communicate failed nodes">failedNodeRpcs</a> = par(<span class="stringliteral">"lookupFailedNodeRpcs"</span>);
- <a name="l00146"></a>00146 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a4b0e4def1dc1071314091dc9e5ec854a" title="limited the number of concurrent RPCS to parameter parallelRpcs">strictParallelRpcs</a> =
- <a name="l00147"></a>00147 par(<span class="stringliteral">"lookupStrictParallelRpcs"</span>);
- <a name="l00148"></a>00148 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a0285a36b3308b2d9d9531658fe08cb29" title="merge all parallel responses from earlier steps">useAllParallelResponses</a> =
- <a name="l00149"></a>00149 par(<span class="stringliteral">"lookupUseAllParallelResponses"</span>);
- <a name="l00150"></a>00150 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a691b1a92109829e5a7e84bfbddd868ea" title="send a new RPC immediately after an RPC timeouts">newRpcOnEveryTimeout</a> =
- <a name="l00151"></a>00151 par(<span class="stringliteral">"lookupNewRpcOnEveryTimeout"</span>);
- <a name="l00152"></a>00152 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a9b8b8df5836e6d138869c54a0e59ca26" title="send a new RPC after every response, even if there was no progress">newRpcOnEveryResponse</a> =
- <a name="l00153"></a>00153 par(<span class="stringliteral">"lookupNewRpcOnEveryResponse"</span>);
- <a name="l00154"></a>00154 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a156800b5539367619349b4b55542931c" title="finish lookup, if the last pending RPC returned without progress">finishOnFirstUnchanged</a> =
- <a name="l00155"></a>00155 par(<span class="stringliteral">"lookupFinishOnFirstUnchanged"</span>);
- <a name="l00156"></a>00156 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#a7c59dacd3b232a23104bf8d6e9986f61" title="if true, the same node is never asked twice during a single lookup">visitOnlyOnce</a> =
- <a name="l00157"></a>00157 par(<span class="stringliteral">"lookupVisitOnlyOnce"</span>);
- <a name="l00158"></a>00158 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>.<a class="code" href="classIterativeLookupConfiguration.html#addae3ccd0ed97c72baea50ad03711f5a" title="if true, a FindNodeResponse with sibling flag set is always accepted, even if it is from a previous l...">acceptLateSiblings</a> =
- <a name="l00159"></a>00159 par(<span class="stringliteral">"lookupAcceptLateSiblings"</span>);
- <a name="l00160"></a>00160
- <a name="l00161"></a>00161 <a class="code" href="classBaseOverlay.html#af6573aac3c99626958737209309d7e99">recursiveLookupConfig</a>.<a class="code" href="classRecursiveLookupConfiguration.html#a344319f090e4d972a5514ef0e800836f" title="number of next hops in each step">redundantNodes</a> = par(<span class="stringliteral">"lookupRedundantNodes"</span>);
- <a name="l00162"></a>00162 <a class="code" href="classBaseOverlay.html#af6573aac3c99626958737209309d7e99">recursiveLookupConfig</a>.<a class="code" href="classRecursiveLookupConfiguration.html#acfc1d3d17ad0db3aa9654f399a1a93c9">numRetries</a> = 0; <span class="comment">//TODO</span>
- <a name="l00163"></a>00163
- <a name="l00164"></a>00164 <span class="comment">// statistics</span>
- <a name="l00165"></a>00165 <a class="code" href="classBaseOverlay.html#aa8c1469e21c59a08a84dec36218582b4" title="number of sent app data packets (incl. forwarded packets)">numAppDataSent</a> = 0;
- <a name="l00166"></a>00166 <a class="code" href="classBaseOverlay.html#ae6453766e7a58060722a6323ee3923e4" title="number of sent app data bytes (incl. forwarded bytes)">bytesAppDataSent</a> = 0;
- <a name="l00167"></a>00167 <a class="code" href="classBaseOverlay.html#a5b42fe053fd79b9b62680cbfc740ec4f" title="number of sent app loookup packets (incl. forwarded packets)">numAppLookupSent</a> = 0;
- <a name="l00168"></a>00168 <a class="code" href="classBaseOverlay.html#a118e46bc3e194c63a70e28846480ffe4" title="number of sent app lookup bytes (incl. forwarded bytes)">bytesAppLookupSent</a> = 0;
- <a name="l00169"></a>00169 <a class="code" href="classBaseOverlay.html#af1077d5c646390fb11d4f646fc22eaaa" title="number of sent maintenance packets (incl. forwarded packets)">numMaintenanceSent</a> = 0;
- <a name="l00170"></a>00170 <a class="code" href="classBaseOverlay.html#a27259327737ad8092c612756c0fe6fb4" title="number of sent maintenance bytes (incl. forwarded bytes)">bytesMaintenanceSent</a> = 0;
- <a name="l00171"></a>00171 <a class="code" href="classBaseOverlay.html#aa83e680792f987f9f5f779e12c055898" title="number of received app data packets (incl. packets to be forwarded )">numAppDataReceived</a> = 0;
- <a name="l00172"></a>00172 <a class="code" href="classBaseOverlay.html#a82cd1df80e31e2a9148a9efaacc4bc76" title="number of received app data bytes (incl. bytes to be forwarded)">bytesAppDataReceived</a> = 0;
- <a name="l00173"></a>00173 <a class="code" href="classBaseOverlay.html#a9298db97a2d651e02729ad197964bdca" title="number of received app lookup packets (incl. packets to be forwarded)">numAppLookupReceived</a> = 0;
- <a name="l00174"></a>00174 <a class="code" href="classBaseOverlay.html#a8527c9038c62bf66e58c07d41b308527" title="number of received app lookup bytes (incl. bytes to be forwarded)">bytesAppLookupReceived</a> = 0;
- <a name="l00175"></a>00175 <a class="code" href="classBaseOverlay.html#a4e7abb41a2c8698bf530015378a13e46" title="number of received maintenance packets (incl. packets to be forwarded)">numMaintenanceReceived</a> = 0;
- <a name="l00176"></a>00176 <a class="code" href="classBaseOverlay.html#ad7bd70b69842cc4db485eafa942332fb" title="number of received maintenance bytes (incl. bytes to be forwarded)">bytesMaintenanceReceived</a> = 0;
- <a name="l00177"></a>00177 <a class="code" href="classBaseOverlay.html#a341a65ab7c50dfbc8222c1adf4f08a99" title="number of forwarded app data packets">numAppDataForwarded</a> = 0;
- <a name="l00178"></a>00178 <a class="code" href="classBaseOverlay.html#a1c90204205e7e5b8f0f12fe4056914e6" title="number of forwarded app data bytes at out-gate">bytesAppDataForwarded</a> = 0;
- <a name="l00179"></a>00179 <a class="code" href="classBaseOverlay.html#a8f5ff290e99ab78f3e0bd4a489bfcadd" title="number of forwarded app lookup packets">numAppLookupForwarded</a> = 0;
- <a name="l00180"></a>00180 <a class="code" href="classBaseOverlay.html#adeff8c454760c6eb4ca847e8dda252a7" title="number of forwarded app lookup bytes at out-gate">bytesAppLookupForwarded</a> = 0;
- <a name="l00181"></a>00181 <a class="code" href="classBaseOverlay.html#a05fa895acb368180bbca74d92152d2f7" title="number of forwarded maintenance packets">numMaintenanceForwarded</a> = 0;
- <a name="l00182"></a>00182 <a class="code" href="classBaseOverlay.html#a8dbb1ce4eee057f23bea55e5e4a7d13b" title="number of forwarded maintenance bytes at out-gate">bytesMaintenanceForwarded</a> = 0;
- <a name="l00183"></a>00183 <a class="code" href="classBaseOverlay.html#a30e11530c77c2164f0a5c98a489a9fab" title="number of bytes sent for rpc message signatures">bytesAuthBlockSent</a> = 0;
- <a name="l00184"></a>00184
- <a name="l00185"></a>00185 <a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a> = 0;
- <a name="l00186"></a>00186 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> = 0;
- <a name="l00187"></a>00187 <a class="code" href="classBaseOverlay.html#a210e4277548e47f2ec8e772ae5b6eb7f">numFindNodeSent</a> = 0;
- <a name="l00188"></a>00188 <a class="code" href="classBaseOverlay.html#a99971f360cdde2d41d239418dfad7281">bytesFindNodeSent</a> = 0;
- <a name="l00189"></a>00189 <a class="code" href="classBaseOverlay.html#a248581eed6fedf10b2c350cbedd69773">numFindNodeResponseSent</a> = 0;
- <a name="l00190"></a>00190 <a class="code" href="classBaseOverlay.html#a4b2293e58a3bf5a7ddc0d28cb0669f2f">bytesFindNodeResponseSent</a> = 0;
- <a name="l00191"></a>00191 <a class="code" href="classBaseOverlay.html#a2fef63e0e6d6d7c991c9cb2c95db5733">numFailedNodeSent</a> = 0;
- <a name="l00192"></a>00192 <a class="code" href="classBaseOverlay.html#aca6ed5880fa17a3bfe432deff8d10e7c">bytesFailedNodeSent</a> = 0;
- <a name="l00193"></a>00193 <a class="code" href="classBaseOverlay.html#acf40707599a177a1dd5cd9ec4e854dc8">numFailedNodeResponseSent</a> = 0;
- <a name="l00194"></a>00194 <a class="code" href="classBaseOverlay.html#aa62ca9476d42c748e40dd0f287823445">bytesFailedNodeResponseSent</a> = 0;
- <a name="l00195"></a>00195
- <a name="l00196"></a>00196 <a class="code" href="classBaseOverlay.html#aee8e642813784a1f27a81756a4b93b9b" title="number of join retries">joinRetries</a> = 0;
- <a name="l00197"></a>00197
- <a name="l00198"></a>00198 <a class="code" href="classBaseOverlay.html#ae34cc8a058a4dae47a3815cba64ceba2" title="number of packets sent to same host but different port (SimpleMultiOverlayHost)">numInternalSent</a> = 0;
- <a name="l00199"></a>00199 <a class="code" href="classBaseOverlay.html#ad0af3d066a89ced910b082a980f68f25" title="number of bytes sent to same host but different port (SimpleMultiOverlayHost)">bytesInternalSent</a> = 0;
- <a name="l00200"></a>00200 <a class="code" href="classBaseOverlay.html#a7f185cb11a818d01dcc1a31553de16ef" title="number of packets received from same host but different port (SimpleMultiOverlayHost)">numInternalReceived</a> = 0;
- <a name="l00201"></a>00201 <a class="code" href="classBaseOverlay.html#a55ba3d595b6b23db700cb9f36f34f0ae" title="number of bytes received from same host but different port (SimpleMultiOverlayHost)">bytesInternalReceived</a> = 0;
- <a name="l00202"></a>00202
- <a name="l00203"></a>00203 WATCH(<a class="code" href="classBaseOverlay.html#aa8c1469e21c59a08a84dec36218582b4" title="number of sent app data packets (incl. forwarded packets)">numAppDataSent</a>);
- <a name="l00204"></a>00204 WATCH(<a class="code" href="classBaseOverlay.html#ae6453766e7a58060722a6323ee3923e4" title="number of sent app data bytes (incl. forwarded bytes)">bytesAppDataSent</a>);
- <a name="l00205"></a>00205 WATCH(<a class="code" href="classBaseOverlay.html#a5b42fe053fd79b9b62680cbfc740ec4f" title="number of sent app loookup packets (incl. forwarded packets)">numAppLookupSent</a>);
- <a name="l00206"></a>00206 WATCH(<a class="code" href="classBaseOverlay.html#a118e46bc3e194c63a70e28846480ffe4" title="number of sent app lookup bytes (incl. forwarded bytes)">bytesAppLookupSent</a>);
- <a name="l00207"></a>00207 WATCH(<a class="code" href="classBaseOverlay.html#af1077d5c646390fb11d4f646fc22eaaa" title="number of sent maintenance packets (incl. forwarded packets)">numMaintenanceSent</a>);
- <a name="l00208"></a>00208 WATCH(<a class="code" href="classBaseOverlay.html#a27259327737ad8092c612756c0fe6fb4" title="number of sent maintenance bytes (incl. forwarded bytes)">bytesMaintenanceSent</a>);
- <a name="l00209"></a>00209 WATCH(<a class="code" href="classBaseOverlay.html#aa83e680792f987f9f5f779e12c055898" title="number of received app data packets (incl. packets to be forwarded )">numAppDataReceived</a>);
- <a name="l00210"></a>00210 WATCH(<a class="code" href="classBaseOverlay.html#a82cd1df80e31e2a9148a9efaacc4bc76" title="number of received app data bytes (incl. bytes to be forwarded)">bytesAppDataReceived</a>);
- <a name="l00211"></a>00211 WATCH(<a class="code" href="classBaseOverlay.html#a9298db97a2d651e02729ad197964bdca" title="number of received app lookup packets (incl. packets to be forwarded)">numAppLookupReceived</a>);
- <a name="l00212"></a>00212 WATCH(<a class="code" href="classBaseOverlay.html#a8527c9038c62bf66e58c07d41b308527" title="number of received app lookup bytes (incl. bytes to be forwarded)">bytesAppLookupReceived</a>);
- <a name="l00213"></a>00213 WATCH(<a class="code" href="classBaseOverlay.html#a4e7abb41a2c8698bf530015378a13e46" title="number of received maintenance packets (incl. packets to be forwarded)">numMaintenanceReceived</a>);
- <a name="l00214"></a>00214 WATCH(<a class="code" href="classBaseOverlay.html#ad7bd70b69842cc4db485eafa942332fb" title="number of received maintenance bytes (incl. bytes to be forwarded)">bytesMaintenanceReceived</a>);
- <a name="l00215"></a>00215 WATCH(<a class="code" href="classBaseOverlay.html#a341a65ab7c50dfbc8222c1adf4f08a99" title="number of forwarded app data packets">numAppDataForwarded</a>);
- <a name="l00216"></a>00216 WATCH(<a class="code" href="classBaseOverlay.html#a1c90204205e7e5b8f0f12fe4056914e6" title="number of forwarded app data bytes at out-gate">bytesAppDataForwarded</a>);
- <a name="l00217"></a>00217 WATCH(<a class="code" href="classBaseOverlay.html#a8f5ff290e99ab78f3e0bd4a489bfcadd" title="number of forwarded app lookup packets">numAppLookupForwarded</a>);
- <a name="l00218"></a>00218 WATCH(<a class="code" href="classBaseOverlay.html#adeff8c454760c6eb4ca847e8dda252a7" title="number of forwarded app lookup bytes at out-gate">bytesAppLookupForwarded</a>);
- <a name="l00219"></a>00219 WATCH(<a class="code" href="classBaseOverlay.html#a05fa895acb368180bbca74d92152d2f7" title="number of forwarded maintenance packets">numMaintenanceForwarded</a>);
- <a name="l00220"></a>00220 WATCH(<a class="code" href="classBaseOverlay.html#a8dbb1ce4eee057f23bea55e5e4a7d13b" title="number of forwarded maintenance bytes at out-gate">bytesMaintenanceForwarded</a>);
- <a name="l00221"></a>00221
- <a name="l00222"></a>00222 WATCH(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>);
- <a name="l00223"></a>00223 WATCH(<a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a>);
- <a name="l00224"></a>00224 WATCH(<a class="code" href="classBaseOverlay.html#a210e4277548e47f2ec8e772ae5b6eb7f">numFindNodeSent</a>);
- <a name="l00225"></a>00225 WATCH(<a class="code" href="classBaseOverlay.html#a99971f360cdde2d41d239418dfad7281">bytesFindNodeSent</a>);
- <a name="l00226"></a>00226 WATCH(<a class="code" href="classBaseOverlay.html#a248581eed6fedf10b2c350cbedd69773">numFindNodeResponseSent</a>);
- <a name="l00227"></a>00227 WATCH(<a class="code" href="classBaseOverlay.html#a4b2293e58a3bf5a7ddc0d28cb0669f2f">bytesFindNodeResponseSent</a>);
- <a name="l00228"></a>00228 WATCH(<a class="code" href="classBaseOverlay.html#a2fef63e0e6d6d7c991c9cb2c95db5733">numFailedNodeSent</a>);
- <a name="l00229"></a>00229 WATCH(<a class="code" href="classBaseOverlay.html#aca6ed5880fa17a3bfe432deff8d10e7c">bytesFailedNodeSent</a>);
- <a name="l00230"></a>00230 WATCH(<a class="code" href="classBaseOverlay.html#acf40707599a177a1dd5cd9ec4e854dc8">numFailedNodeResponseSent</a>);
- <a name="l00231"></a>00231 WATCH(<a class="code" href="classBaseOverlay.html#aa62ca9476d42c748e40dd0f287823445">bytesFailedNodeResponseSent</a>);
- <a name="l00232"></a>00232
- <a name="l00233"></a>00233 WATCH(<a class="code" href="classBaseOverlay.html#aee8e642813784a1f27a81756a4b93b9b" title="number of join retries">joinRetries</a>);
- <a name="l00234"></a>00234
- <a name="l00235"></a>00235 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#abef37828b7f070044154f53bcd2a765b" title="Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost.">isInSimpleMultiOverlayHost</a>()) {
- <a name="l00236"></a>00236 WATCH(<a class="code" href="classBaseOverlay.html#ae34cc8a058a4dae47a3815cba64ceba2" title="number of packets sent to same host but different port (SimpleMultiOverlayHost)">numInternalSent</a>);
- <a name="l00237"></a>00237 WATCH(<a class="code" href="classBaseOverlay.html#ad0af3d066a89ced910b082a980f68f25" title="number of bytes sent to same host but different port (SimpleMultiOverlayHost)">bytesInternalSent</a>);
- <a name="l00238"></a>00238 WATCH(<a class="code" href="classBaseOverlay.html#a7f185cb11a818d01dcc1a31553de16ef" title="number of packets received from same host but different port (SimpleMultiOverlayHost)">numInternalReceived</a>);
- <a name="l00239"></a>00239 WATCH(<a class="code" href="classBaseOverlay.html#a55ba3d595b6b23db700cb9f36f34f0ae" title="number of bytes received from same host but different port (SimpleMultiOverlayHost)">bytesInternalReceived</a>);
- <a name="l00240"></a>00240 }
- <a name="l00241"></a>00241
- <a name="l00242"></a>00242 <span class="comment">// set up local nodehandle</span>
- <a name="l00243"></a>00243 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a1c7b834dc2e6e738f1f4db8711a12814" title="Sets the ip address, port and NAT type.">setIp</a>(IPAddressResolver().
- <a name="l00244"></a>00244 addressOf(getParentModule()->getParentModule()));
- <a name="l00245"></a>00245 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#af3992f1fda9ea42dc10bf4739e47700a" title="saves given key to NodeHandle::key">setKey</a>(<a class="code" href="classOverlayKey.html#ac0d4135dff2985e3582fdbed2a37eb75" title="OverlayKey without defined key.">OverlayKey::UNSPECIFIED_KEY</a>);
- <a name="l00246"></a>00246
- <a name="l00247"></a>00247 <a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> = INIT;
- <a name="l00248"></a>00248 <a class="code" href="classBaseOverlay.html#aa484556ed4ff9e4e97394106d0c1d323" title="internal overlay state used for setOverlayReady()">internalReadyState</a> = <span class="keyword">false</span>;
- <a name="l00249"></a>00249
- <a name="l00250"></a>00250 getDisplayString().setTagArg(<span class="stringliteral">"i"</span>, 1, <span class="stringliteral">"red"</span>);
- <a name="l00251"></a>00251 <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a>-><a class="code" href="classGlobalNodeList.html#a94604495a81e687f7492564d788c7c36" title="Colors module-icon blue (ready), green (ready, malicious) or red (not ready).">setOverlayReadyIcon</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>(), <span class="keyword">false</span>);
- <a name="l00252"></a>00252
- <a name="l00253"></a>00253 <span class="comment">// set up UDP</span>
- <a name="l00254"></a>00254 <a class="code" href="classBaseOverlay.html#a512084e3a224f0a3f284e5e240652a26" title="Tells UDP we want to get all packets arriving on the given port.">bindToPort</a>(<a class="code" href="classBaseOverlay.html#aef12c08638b508af44f257824f9391ef" title="used UDP-port">localPort</a>);
- <a name="l00255"></a>00255
- <a name="l00256"></a>00256 <span class="comment">// subscribe to the notification board</span>
- <a name="l00257"></a>00257 <a class="code" href="classBaseOverlay.html#af0704186e295039c92666176b0b91dae" title="pointer to NotificationBoard in this node">notificationBoard</a>->subscribe(<span class="keyword">this</span>, NF_OVERLAY_TRANSPORTADDRESS_CHANGED);
- <a name="l00258"></a>00258 <a class="code" href="classBaseOverlay.html#af0704186e295039c92666176b0b91dae" title="pointer to NotificationBoard in this node">notificationBoard</a>->subscribe(<span class="keyword">this</span>, NF_OVERLAY_NODE_LEAVE);
- <a name="l00259"></a>00259 <a class="code" href="classBaseOverlay.html#af0704186e295039c92666176b0b91dae" title="pointer to NotificationBoard in this node">notificationBoard</a>->subscribe(<span class="keyword">this</span>, NF_OVERLAY_NODE_GRACEFUL_LEAVE);
- <a name="l00260"></a>00260
- <a name="l00261"></a>00261 <span class="comment">// init visualization with terminal ptr</span>
- <a name="l00262"></a>00262 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a79031cb868377512713e343a326dbbd9">drawOverlayTopology</a>)
- <a name="l00263"></a>00263 <a class="code" href="classTopologyVis.html#ab551ff162d16d625b967f228f479bf72">initVis</a>(getParentModule()->getParentModule());
- <a name="l00264"></a>00264
- <a name="l00265"></a>00265 <span class="comment">// init rpcs</span>
- <a name="l00266"></a>00266 <a class="code" href="classBaseRpc.html#a270e68f0d93dfcf9c5f26dbafd0fba54" title="Initializes Remote-Procedure state.">initRpcs</a>();
- <a name="l00267"></a>00267 <a class="code" href="classBaseOverlay.html#af2c8b2108703c4df49217a719f280bb8" title="creates a LookupSet">initLookups</a>();
- <a name="l00268"></a>00268
- <a name="l00269"></a>00269 <span class="comment">// set TCP output gate</span>
- <a name="l00270"></a>00270 <a class="code" href="classBaseTcpSupport.html#a3de2e8b022586f387fdba1ca42dbdfd1" title="Member function to set local gate towards the TCP module during init phase.">setTcpOut</a>(gate(<span class="stringliteral">"tcpOut"</span>));
- <a name="l00271"></a>00271
- <a name="l00272"></a>00272 <span class="comment">// statistics</span>
- <a name="l00273"></a>00273 <a class="code" href="classBaseOverlay.html#af0eebaddea732ee4ab4d247c388e62bd" title="simtime when the node has been created">creationTime</a> = simTime();
- <a name="l00274"></a>00274 WATCH(<a class="code" href="classBaseOverlay.html#af0eebaddea732ee4ab4d247c388e62bd" title="simtime when the node has been created">creationTime</a>);
- <a name="l00275"></a>00275 }
- <a name="l00276"></a>00276
- <a name="l00277"></a>00277 <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> && stage <= <a class="code" href="InitStages_8h.html#a42fde1aa1e14a1c45d29061d6e87e532af261a91f9b71ec40c7c7c7e18b3455ac" title="last stage for overlay modules (Tier 0 / KBR)">MAX_STAGE_OVERLAY</a>)
- <a name="l00278"></a>00278 <a class="code" href="classBaseOverlay.html#a41f88dfbea856a2b38319ff52c758c96" title="Initializes derived-class-attributes.">initializeOverlay</a>(stage);
- <a name="l00279"></a>00279
- <a name="l00280"></a>00280 <span class="keywordflow">if</span> (stage == <a class="code" href="InitStages_8h.html#a42fde1aa1e14a1c45d29061d6e87e532adde3c0e76fb4c24e253ada0ac73e6d08" title="last stage for overlay application modules (Tier 1)">MAX_STAGE_TIER_1</a>) {
- <a name="l00281"></a>00281 <span class="comment">// bootstrapList registered its gate to the overlay 0</span>
- <a name="l00282"></a>00282 <span class="comment">// if this is not overlay 0, we may not have the gate, so retrieve it</span>
- <a name="l00283"></a>00283 <span class="comment">// this assumes that the overlay is in a container module!</span>
- <a name="l00284"></a>00284 <span class="keywordflow">if</span> (!<a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.count(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5ea6b7871eeda317b7934cc8fb0b84899c5">BOOTSTRAPLIST_COMP</a>)) {
- <a name="l00285"></a>00285 <a class="code" href="classBaseOverlay.html" title="Base class for overlays.">BaseOverlay</a> *firstOverlay = <span class="keyword">dynamic_cast<</span><a class="code" href="classBaseOverlay.html" title="Base class for overlays.">BaseOverlay</a>*<span class="keyword">></span>
- <a name="l00286"></a>00286 (getParentModule()->getParentModule()
- <a name="l00287"></a>00287 ->getSubmodule(<span class="stringliteral">"overlay"</span>, 0)->gate(<span class="stringliteral">"appIn"</span>)
- <a name="l00288"></a>00288 ->getNextGate()->getOwnerModule());
- <a name="l00289"></a>00289 <span class="keywordflow">if</span> (!firstOverlay) {
- <a name="l00290"></a>00290 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay.cc: "</span>
- <a name="l00291"></a>00291 <span class="stringliteral">"Couldn't obtain bootstrap gate"</span>);
- <a name="l00292"></a>00292 }
- <a name="l00293"></a>00293 <a class="code" href="classBaseOverlay.html#a2096f89814b5740257cee106b60dda15">registerComp</a>(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5ea6b7871eeda317b7934cc8fb0b84899c5">BOOTSTRAPLIST_COMP</a>,
- <a name="l00294"></a>00294 firstOverlay-><a class="code" href="classBaseOverlay.html#a3aba2b6e93094d3cc8107d33db4b5244">getCompModule</a>(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5ea6b7871eeda317b7934cc8fb0b84899c5">BOOTSTRAPLIST_COMP</a>));
- <a name="l00295"></a>00295 }
- <a name="l00296"></a>00296 }
- <a name="l00297"></a>00297 }
- <a name="l00298"></a>00298
- <a name="l00299"></a>00299
- <a name="l00300"></a><a class="code" href="classBaseOverlay.html#a41f88dfbea856a2b38319ff52c758c96">00300</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a41f88dfbea856a2b38319ff52c758c96" title="Initializes derived-class-attributes.">BaseOverlay::initializeOverlay</a>(<span class="keywordtype">int</span> stage)
- <a name="l00301"></a>00301 {
- <a name="l00302"></a>00302 }
- <a name="l00303"></a>00303
- <a name="l00304"></a><a class="code" href="classBaseOverlay.html#aed7e3f36b2c70cbdb0e6daa32925917c">00304</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#aed7e3f36b2c70cbdb0e6daa32925917c" title="collects statistical data">BaseOverlay::finish</a>()
- <a name="l00305"></a>00305 {
- <a name="l00306"></a>00306 <a class="code" href="classBaseOverlay.html#a8db85b9c706d04007154761d5a0cec16" title="collects statistical data in derived class">finishOverlay</a>();
- <a name="l00307"></a>00307
- <a name="l00308"></a>00308 simtime_t time = <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a610799ebfbf64696c59b811870cc8300">calcMeasuredLifetime</a>(<a class="code" href="classBaseOverlay.html#af0eebaddea732ee4ab4d247c388e62bd" title="simtime when the node has been created">creationTime</a>);
- <a name="l00309"></a>00309
- <a name="l00310"></a>00310 <span class="keywordflow">if</span> (time >= <a class="code" href="classGlobalStatistics.html#a169810c78519b271f7e32fdc7c9fc641" title="minimum useful measured lifetime in seconds">GlobalStatistics::MIN_MEASURED</a>) {
- <a name="l00311"></a>00311
- <a name="l00312"></a>00312 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a2694627a0082c456367bfa472fff56b9" title="collect delay for single hops">collectPerHopDelay</a>) {
- <a name="l00313"></a>00313 std::ostringstream singleHopName;
- <a name="l00314"></a>00314 <a class="code" href="structBaseOverlay_1_1HopDelayRecord.html" title="Structure for computing the average delay in one specific hop.">HopDelayRecord</a>* hdrl = NULL;
- <a name="l00315"></a>00315 <a class="code" href="structBaseOverlay_1_1HopDelayRecord.html" title="Structure for computing the average delay in one specific hop.">HopDelayRecord</a>* hdr = NULL;
- <a name="l00316"></a>00316 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < <a class="code" href="classBaseOverlay.html#a93d899c36b4b7b7b012413924c9fb4b5">singleHopDelays</a>.size();) {
- <a name="l00317"></a>00317 hdrl = <a class="code" href="classBaseOverlay.html#a93d899c36b4b7b7b012413924c9fb4b5">singleHopDelays</a>[i++];
- <a name="l00318"></a>00318 hdr = hdrl;
- <a name="l00319"></a>00319 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 1; j <= i; ++j) {
- <a name="l00320"></a>00320 <span class="keywordflow">if</span> (hdr-><a class="code" href="structBaseOverlay_1_1HopDelayRecord.html#a83f056780cd6b9b68f8eb999d5b45482">count</a> == 0) <span class="keywordflow">continue</span>;
- <a name="l00321"></a>00321 singleHopName.str(<span class="stringliteral">""</span>);
- <a name="l00322"></a>00322 singleHopName << <span class="stringliteral">"BaseOverlay: Average Delay in Hop "</span>
- <a name="l00323"></a>00323 << j << <span class="stringliteral">" of "</span> << i;
- <a name="l00324"></a>00324 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(singleHopName.str(),
- <a name="l00325"></a>00325 SIMTIME_DBL(hdr-><a class="code" href="structBaseOverlay_1_1HopDelayRecord.html#abcc398fdefba9230fcafb94e701f3071">val</a> / hdr-><a class="code" href="structBaseOverlay_1_1HopDelayRecord.html#a83f056780cd6b9b68f8eb999d5b45482">count</a>));
- <a name="l00326"></a>00326 ++hdr;
- <a name="l00327"></a>00327 }
- <a name="l00328"></a>00328 <span class="keyword">delete</span>[] hdrl;
- <a name="l00329"></a>00329 }
- <a name="l00330"></a>00330 <a class="code" href="classBaseOverlay.html#a93d899c36b4b7b7b012413924c9fb4b5">singleHopDelays</a>.clear();
- <a name="l00331"></a>00331 }
- <a name="l00332"></a>00332
- <a name="l00333"></a>00333 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Join Retries"</span>, <a class="code" href="classBaseOverlay.html#aee8e642813784a1f27a81756a4b93b9b" title="number of join retries">joinRetries</a>);
- <a name="l00334"></a>00334
- <a name="l00335"></a>00335 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent App Data Messages/s"</span>,
- <a name="l00336"></a>00336 <a class="code" href="classBaseOverlay.html#aa8c1469e21c59a08a84dec36218582b4" title="number of sent app data packets (incl. forwarded packets)">numAppDataSent</a> / time);
- <a name="l00337"></a>00337 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent App Data Bytes/s"</span>,
- <a name="l00338"></a>00338 <a class="code" href="classBaseOverlay.html#ae6453766e7a58060722a6323ee3923e4" title="number of sent app data bytes (incl. forwarded bytes)">bytesAppDataSent</a> / time);
- <a name="l00339"></a>00339 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#abef37828b7f070044154f53bcd2a765b" title="Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost.">isInSimpleMultiOverlayHost</a>()) {
- <a name="l00340"></a>00340 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Internal Sent Messages/s"</span>,
- <a name="l00341"></a>00341 <a class="code" href="classBaseOverlay.html#a7f185cb11a818d01dcc1a31553de16ef" title="number of packets received from same host but different port (SimpleMultiOverlayHost)">numInternalReceived</a> / time);
- <a name="l00342"></a>00342 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Internal Sent Bytes/s"</span>,
- <a name="l00343"></a>00343 <a class="code" href="classBaseOverlay.html#a55ba3d595b6b23db700cb9f36f34f0ae" title="number of bytes received from same host but different port (SimpleMultiOverlayHost)">bytesInternalReceived</a> / time);
- <a name="l00344"></a>00344 }
- <a name="l00345"></a>00345 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent App Lookup Messages/s"</span>,
- <a name="l00346"></a>00346 <a class="code" href="classBaseOverlay.html#a5b42fe053fd79b9b62680cbfc740ec4f" title="number of sent app loookup packets (incl. forwarded packets)">numAppLookupSent</a> / time);
- <a name="l00347"></a>00347 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent App Lookup Bytes/s"</span>,
- <a name="l00348"></a>00348 <a class="code" href="classBaseOverlay.html#a118e46bc3e194c63a70e28846480ffe4" title="number of sent app lookup bytes (incl. forwarded bytes)">bytesAppLookupSent</a> / time);
- <a name="l00349"></a>00349 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Maintenance Messages/s"</span>,
- <a name="l00350"></a>00350 <a class="code" href="classBaseOverlay.html#af1077d5c646390fb11d4f646fc22eaaa" title="number of sent maintenance packets (incl. forwarded packets)">numMaintenanceSent</a> / time);
- <a name="l00351"></a>00351 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Maintenance Bytes/s"</span>,
- <a name="l00352"></a>00352 <a class="code" href="classBaseOverlay.html#a27259327737ad8092c612756c0fe6fb4" title="number of sent maintenance bytes (incl. forwarded bytes)">bytesMaintenanceSent</a> / time);
- <a name="l00353"></a>00353
- <a name="l00354"></a>00354 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Total Messages/s"</span>,
- <a name="l00355"></a>00355 (<a class="code" href="classBaseOverlay.html#aa8c1469e21c59a08a84dec36218582b4" title="number of sent app data packets (incl. forwarded packets)">numAppDataSent</a> + <a class="code" href="classBaseOverlay.html#a5b42fe053fd79b9b62680cbfc740ec4f" title="number of sent app loookup packets (incl. forwarded packets)">numAppLookupSent</a> +
- <a name="l00356"></a>00356 <a class="code" href="classBaseOverlay.html#af1077d5c646390fb11d4f646fc22eaaa" title="number of sent maintenance packets (incl. forwarded packets)">numMaintenanceSent</a>) / time);
- <a name="l00357"></a>00357 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Total Bytes/s"</span>,
- <a name="l00358"></a>00358 (<a class="code" href="classBaseOverlay.html#ae6453766e7a58060722a6323ee3923e4" title="number of sent app data bytes (incl. forwarded bytes)">bytesAppDataSent</a> + <a class="code" href="classBaseOverlay.html#a118e46bc3e194c63a70e28846480ffe4" title="number of sent app lookup bytes (incl. forwarded bytes)">bytesAppLookupSent</a> +
- <a name="l00359"></a>00359 <a class="code" href="classBaseOverlay.html#a27259327737ad8092c612756c0fe6fb4" title="number of sent maintenance bytes (incl. forwarded bytes)">bytesMaintenanceSent</a>) / time);
- <a name="l00360"></a>00360 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FindNode Messages/s"</span>,
- <a name="l00361"></a>00361 <a class="code" href="classBaseOverlay.html#a210e4277548e47f2ec8e772ae5b6eb7f">numFindNodeSent</a> / time);
- <a name="l00362"></a>00362 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FindNode Bytes/s"</span>,
- <a name="l00363"></a>00363 <a class="code" href="classBaseOverlay.html#a99971f360cdde2d41d239418dfad7281">bytesFindNodeSent</a> / time);
- <a name="l00364"></a>00364
- <a name="l00365"></a>00365 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FindNodeResponse Messages/s"</span>,
- <a name="l00366"></a>00366 <a class="code" href="classBaseOverlay.html#a248581eed6fedf10b2c350cbedd69773">numFindNodeResponseSent</a> / time);
- <a name="l00367"></a>00367 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FindNodeResponse Bytes/s"</span>,
- <a name="l00368"></a>00368 <a class="code" href="classBaseOverlay.html#a4b2293e58a3bf5a7ddc0d28cb0669f2f">bytesFindNodeResponseSent</a> / time);
- <a name="l00369"></a>00369 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FailedNode Messages/s"</span>,
- <a name="l00370"></a>00370 <a class="code" href="classBaseOverlay.html#a2fef63e0e6d6d7c991c9cb2c95db5733">numFailedNodeSent</a> / time);
- <a name="l00371"></a>00371 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FailedNode Bytes/s"</span>,
- <a name="l00372"></a>00372 <a class="code" href="classBaseOverlay.html#aca6ed5880fa17a3bfe432deff8d10e7c">bytesFailedNodeSent</a> / time);
- <a name="l00373"></a>00373 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FailedNodeResponse Messages/s"</span>,
- <a name="l00374"></a>00374 <a class="code" href="classBaseOverlay.html#acf40707599a177a1dd5cd9ec4e854dc8">numFailedNodeResponseSent</a> / time);
- <a name="l00375"></a>00375 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent FailedNodeResponse Bytes/s"</span>,
- <a name="l00376"></a>00376 <a class="code" href="classBaseOverlay.html#aa62ca9476d42c748e40dd0f287823445">bytesFailedNodeResponseSent</a> / time);
- <a name="l00377"></a>00377 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received App Data Messages/s"</span>,
- <a name="l00378"></a>00378 <a class="code" href="classBaseOverlay.html#aa83e680792f987f9f5f779e12c055898" title="number of received app data packets (incl. packets to be forwarded )">numAppDataReceived</a> / time);
- <a name="l00379"></a>00379 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received App Data Bytes/s"</span>,
- <a name="l00380"></a>00380 <a class="code" href="classBaseOverlay.html#a82cd1df80e31e2a9148a9efaacc4bc76" title="number of received app data bytes (incl. bytes to be forwarded)">bytesAppDataReceived</a> / time);
- <a name="l00381"></a>00381 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#abef37828b7f070044154f53bcd2a765b" title="Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost.">isInSimpleMultiOverlayHost</a>()) {
- <a name="l00382"></a>00382 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Internal Received Messages/s"</span>,
- <a name="l00383"></a>00383 <a class="code" href="classBaseOverlay.html#a7f185cb11a818d01dcc1a31553de16ef" title="number of packets received from same host but different port (SimpleMultiOverlayHost)">numInternalReceived</a> / time);
- <a name="l00384"></a>00384 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Internal Received Bytes/s"</span>,
- <a name="l00385"></a>00385 <a class="code" href="classBaseOverlay.html#a55ba3d595b6b23db700cb9f36f34f0ae" title="number of bytes received from same host but different port (SimpleMultiOverlayHost)">bytesInternalReceived</a> / time);
- <a name="l00386"></a>00386 }
- <a name="l00387"></a>00387 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received App Lookup Messages/s"</span>,
- <a name="l00388"></a>00388 <a class="code" href="classBaseOverlay.html#a9298db97a2d651e02729ad197964bdca" title="number of received app lookup packets (incl. packets to be forwarded)">numAppLookupReceived</a> / time);
- <a name="l00389"></a>00389 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received App Lookup Bytes/s"</span>,
- <a name="l00390"></a>00390 <a class="code" href="classBaseOverlay.html#a8527c9038c62bf66e58c07d41b308527" title="number of received app lookup bytes (incl. bytes to be forwarded)">bytesAppLookupReceived</a> / time);
- <a name="l00391"></a>00391 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received Maintenance Messages/s"</span>,
- <a name="l00392"></a>00392 <a class="code" href="classBaseOverlay.html#a4e7abb41a2c8698bf530015378a13e46" title="number of received maintenance packets (incl. packets to be forwarded)">numMaintenanceReceived</a> / time);
- <a name="l00393"></a>00393 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received Maintenance Bytes/s"</span>,
- <a name="l00394"></a>00394 <a class="code" href="classBaseOverlay.html#ad7bd70b69842cc4db485eafa942332fb" title="number of received maintenance bytes (incl. bytes to be forwarded)">bytesMaintenanceReceived</a> / time);
- <a name="l00395"></a>00395
- <a name="l00396"></a>00396 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received Total Messages/s"</span>,
- <a name="l00397"></a>00397 (<a class="code" href="classBaseOverlay.html#aa83e680792f987f9f5f779e12c055898" title="number of received app data packets (incl. packets to be forwarded )">numAppDataReceived</a> + <a class="code" href="classBaseOverlay.html#a9298db97a2d651e02729ad197964bdca" title="number of received app lookup packets (incl. packets to be forwarded)">numAppLookupReceived</a> +
- <a name="l00398"></a>00398 <a class="code" href="classBaseOverlay.html#a4e7abb41a2c8698bf530015378a13e46" title="number of received maintenance packets (incl. packets to be forwarded)">numMaintenanceReceived</a>)/time);
- <a name="l00399"></a>00399 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Received Total Bytes/s"</span>,
- <a name="l00400"></a>00400 (<a class="code" href="classBaseOverlay.html#a82cd1df80e31e2a9148a9efaacc4bc76" title="number of received app data bytes (incl. bytes to be forwarded)">bytesAppDataReceived</a> + <a class="code" href="classBaseOverlay.html#a8527c9038c62bf66e58c07d41b308527" title="number of received app lookup bytes (incl. bytes to be forwarded)">bytesAppLookupReceived</a> +
- <a name="l00401"></a>00401 <a class="code" href="classBaseOverlay.html#ad7bd70b69842cc4db485eafa942332fb" title="number of received maintenance bytes (incl. bytes to be forwarded)">bytesMaintenanceReceived</a>)/time);
- <a name="l00402"></a>00402 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded App Data Messages/s"</span>,
- <a name="l00403"></a>00403 <a class="code" href="classBaseOverlay.html#a341a65ab7c50dfbc8222c1adf4f08a99" title="number of forwarded app data packets">numAppDataForwarded</a> / time);
- <a name="l00404"></a>00404 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded App Data Bytes/s"</span>,
- <a name="l00405"></a>00405 <a class="code" href="classBaseOverlay.html#a1c90204205e7e5b8f0f12fe4056914e6" title="number of forwarded app data bytes at out-gate">bytesAppDataForwarded</a> / time);
- <a name="l00406"></a>00406 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded App Lookup Messages/s"</span>,
- <a name="l00407"></a>00407 <a class="code" href="classBaseOverlay.html#a8f5ff290e99ab78f3e0bd4a489bfcadd" title="number of forwarded app lookup packets">numAppLookupForwarded</a> / time);
- <a name="l00408"></a>00408 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded App Lookup Bytes/s"</span>,
- <a name="l00409"></a>00409 <a class="code" href="classBaseOverlay.html#adeff8c454760c6eb4ca847e8dda252a7" title="number of forwarded app lookup bytes at out-gate">bytesAppLookupForwarded</a> / time);
- <a name="l00410"></a>00410 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded Maintenance Messages/s"</span>,
- <a name="l00411"></a>00411 <a class="code" href="classBaseOverlay.html#a05fa895acb368180bbca74d92152d2f7" title="number of forwarded maintenance packets">numMaintenanceForwarded</a> / time);
- <a name="l00412"></a>00412 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded Maintenance Bytes/s"</span>,
- <a name="l00413"></a>00413 <a class="code" href="classBaseOverlay.html#a8dbb1ce4eee057f23bea55e5e4a7d13b" title="number of forwarded maintenance bytes at out-gate">bytesMaintenanceForwarded</a> / time);
- <a name="l00414"></a>00414 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded Total Messages/s"</span>,
- <a name="l00415"></a>00415 (<a class="code" href="classBaseOverlay.html#a341a65ab7c50dfbc8222c1adf4f08a99" title="number of forwarded app data packets">numAppDataForwarded</a> + <a class="code" href="classBaseOverlay.html#a8f5ff290e99ab78f3e0bd4a489bfcadd" title="number of forwarded app lookup packets">numAppLookupForwarded</a> +
- <a name="l00416"></a>00416 <a class="code" href="classBaseOverlay.html#a05fa895acb368180bbca74d92152d2f7" title="number of forwarded maintenance packets">numMaintenanceForwarded</a>) / time);
- <a name="l00417"></a>00417 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Forwarded Total Bytes/s"</span>,
- <a name="l00418"></a>00418 (<a class="code" href="classBaseOverlay.html#a1c90204205e7e5b8f0f12fe4056914e6" title="number of forwarded app data bytes at out-gate">bytesAppDataForwarded</a> + <a class="code" href="classBaseOverlay.html#adeff8c454760c6eb4ca847e8dda252a7" title="number of forwarded app lookup bytes at out-gate">bytesAppLookupForwarded</a> +
- <a name="l00419"></a>00419 <a class="code" href="classBaseOverlay.html#a8dbb1ce4eee057f23bea55e5e4a7d13b" title="number of forwarded maintenance bytes at out-gate">bytesMaintenanceForwarded</a>) / time);
- <a name="l00420"></a>00420
- <a name="l00421"></a>00421 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Dropped Messages/s"</span>,
- <a name="l00422"></a>00422 <a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a> / time);
- <a name="l00423"></a>00423 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Dropped Bytes/s"</span>,
- <a name="l00424"></a>00424 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> / time);
- <a name="l00425"></a>00425
- <a name="l00426"></a>00426 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Measured Session Time"</span>,
- <a name="l00427"></a>00427 SIMTIME_DBL(simTime() - <a class="code" href="classBaseOverlay.html#af0eebaddea732ee4ab4d247c388e62bd" title="simtime when the node has been created">creationTime</a>));
- <a name="l00428"></a>00428
- <a name="l00429"></a>00429 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Ping Messages/s"</span>,
- <a name="l00430"></a>00430 <a class="code" href="classBaseRpc.html#a16d5d34610391c442e9f9cde71b2518a">numPingSent</a> / time);
- <a name="l00431"></a>00431 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Ping Bytes/s"</span>,
- <a name="l00432"></a>00432 <a class="code" href="classBaseRpc.html#a5653805d9dcb9a53bc240b388e735389">bytesPingSent</a> / time);
- <a name="l00433"></a>00433 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Ping Response Messages/s"</span>,
- <a name="l00434"></a>00434 <a class="code" href="classBaseRpc.html#a5f194baa9787f523bdbf6f8639356a62">numPingResponseSent</a> / time);
- <a name="l00435"></a>00435 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent Ping Response Bytes/s"</span>,
- <a name="l00436"></a>00436 <a class="code" href="classBaseRpc.html#a8525bc500487a2641a2a947b0d5e1946">bytesPingResponseSent</a> / time);
- <a name="l00437"></a>00437
- <a name="l00438"></a>00438 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a077a698fb5f760290bc67e4a50dfed9e">getMeasureAuthBlock</a>()) {
- <a name="l00439"></a>00439 <a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>-><a class="code" href="classGlobalStatistics.html#a6a697a0b67f344e4bc214159761f943a" title="Add a new value to the cStdDev container specified by the name parameter.">addStdDev</a>(<span class="stringliteral">"BaseOverlay: Sent AuthBlock Bytes/s"</span>,
- <a name="l00440"></a>00440 <a class="code" href="classBaseOverlay.html#a30e11530c77c2164f0a5c98a489a9fab" title="number of bytes sent for rpc message signatures">bytesAuthBlockSent</a> / time);
- <a name="l00441"></a>00441 }
- <a name="l00442"></a>00442 }
- <a name="l00443"></a>00443 }
- <a name="l00444"></a>00444
- <a name="l00445"></a><a class="code" href="classBaseOverlay.html#a8db85b9c706d04007154761d5a0cec16">00445</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a8db85b9c706d04007154761d5a0cec16" title="collects statistical data in derived class">BaseOverlay::finishOverlay</a>()
- <a name="l00446"></a>00446 {
- <a name="l00447"></a>00447 }
- <a name="l00448"></a>00448
- <a name="l00449"></a>00449 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00450"></a>00450 <span class="comment">//--- General Overlay Parameters (getter and setters) --------------------</span>
- <a name="l00451"></a>00451 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00452"></a><a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e">00452</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">BaseOverlay::isMalicious</a>()
- <a name="l00453"></a>00453 {
- <a name="l00454"></a>00454 <span class="keywordflow">return</span> <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a>-><a class="code" href="classGlobalNodeList.html#a8312d71c91eac1144c94c41fe121a755" title="Check if a node is malicious.">isMalicious</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>());
- <a name="l00455"></a>00455 }
- <a name="l00456"></a>00456
- <a name="l00457"></a><a class="code" href="classBaseOverlay.html#a92e0d3f96a5716245465e05da60ef487">00457</a> <a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> <a class="code" href="classBaseOverlay.html#a92e0d3f96a5716245465e05da60ef487">BaseOverlay::getThisCompType</a>()
- <a name="l00458"></a>00458 {
- <a name="l00459"></a>00459 <span class="keywordflow">return</span> OVERLAY_COMP;
- <a name="l00460"></a>00460 }
- <a name="l00461"></a>00461
- <a name="l00462"></a>00462 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00463"></a>00463 <span class="comment">//--- UDP functions copied from the INET framework .----------------------</span>
- <a name="l00464"></a>00464 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00465"></a><a class="code" href="classBaseOverlay.html#a512084e3a224f0a3f284e5e240652a26">00465</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a512084e3a224f0a3f284e5e240652a26" title="Tells UDP we want to get all packets arriving on the given port.">BaseOverlay::bindToPort</a>(<span class="keywordtype">int</span> port)
- <a name="l00466"></a>00466 {
- <a name="l00467"></a>00467 EV << <span class="stringliteral">"[BaseOverlay::bindToPort() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l00468"></a>00468 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l00469"></a>00469 << <span class="stringliteral">" Binding to UDP port "</span> << port
- <a name="l00470"></a>00470 << endl;
- <a name="l00471"></a>00471
- <a name="l00472"></a>00472 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a46a1b53760e5f2d3f8af8c9591160a48" title="sets this-&gt;port to the given port">setPort</a>(port);
- <a name="l00473"></a>00473
- <a name="l00474"></a>00474 <span class="comment">// TODO UDPAppBase should be ported to use UDPSocket sometime, but for now</span>
- <a name="l00475"></a>00475 <span class="comment">// we just manage the UDP socket by hand...</span>
- <a name="l00476"></a>00476 cMessage *msg = <span class="keyword">new</span> cMessage(<span class="stringliteral">"UDP_C_BIND"</span>, UDP_C_BIND);
- <a name="l00477"></a>00477 UDPControlInfo *ctrl = <span class="keyword">new</span> UDPControlInfo();
- <a name="l00478"></a>00478 ctrl->setSrcPort(port);
- <a name="l00479"></a>00479 ctrl->setSockId(UDPSocket::generateSocketId());
- <a name="l00480"></a>00480 msg->setControlInfo(ctrl);
- <a name="l00481"></a>00481 send(msg, <span class="stringliteral">"udpOut"</span>);
- <a name="l00482"></a>00482 }
- <a name="l00483"></a>00483
- <a name="l00484"></a>00484
- <a name="l00485"></a>00485 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00486"></a>00486 <span class="comment">//--- Overlay Common API: Key-based Routing ------------------------------</span>
- <a name="l00487"></a>00487 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00488"></a>00488
- <a name="l00489"></a><a class="code" href="classBaseOverlay.html#a432f79071b87baece93311300cfda0c3">00489</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a432f79071b87baece93311300cfda0c3" title="Calls deliver function in application.">BaseOverlay::callDeliver</a>(<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg,
- <a name="l00490"></a>00490 <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& destKey)
- <a name="l00491"></a>00491 {
- <a name="l00492"></a>00492 <a class="code" href="classKBRdeliver.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRdeliver</a>* deliverMsg = <span class="keyword">new</span> <a class="code" href="classKBRdeliver.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRdeliver</a>();
- <a name="l00493"></a>00493
- <a name="l00494"></a>00494 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo =
- <a name="l00495"></a>00495 check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>(msg->removeControlInfo());
- <a name="l00496"></a>00496
- <a name="l00497"></a>00497 <a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>* appDataMsg = <span class="keyword">dynamic_cast<</span><a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>*<span class="keyword">></span>(msg);
- <a name="l00498"></a>00498
- <a name="l00499"></a>00499 <span class="comment">// TODO GIA</span>
- <a name="l00500"></a>00500 <span class="keywordflow">if</span> (appDataMsg != NULL) {
- <a name="l00501"></a>00501 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a984d51d889959257fd74b9a35ca4ffb6">setSrcComp</a>(appDataMsg->getSrcComp());
- <a name="l00502"></a>00502 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a5db196b85bb865f24777badc887f0e66">setDestComp</a>(appDataMsg->getDestComp());
- <a name="l00503"></a>00503 }
- <a name="l00504"></a>00504
- <a name="l00505"></a>00505 deliverMsg->setControlInfo(overlayCtrlInfo);
- <a name="l00506"></a>00506 deliverMsg-><a class="code" href="classKBRdeliver.html#a961d293718a9481253585a7b0103e054">setDestKey</a>(destKey);
- <a name="l00507"></a>00507 deliverMsg->encapsulate(msg->decapsulate());
- <a name="l00508"></a>00508 deliverMsg-><a class="code" href="classCommonAPIMessage.html#a161ae8c663ecca1ada7f68f2b010d774">setType</a>(<a class="code" href="CommonMessages__m_8h.html#a61951439f8b8b0a1c54516d2e4c72297a9379c2a8f1bf319d3839652a3f3270ca">KBR_DELIVER</a>);
- <a name="l00509"></a>00509
- <a name="l00510"></a>00510 cGate* destGate = <a class="code" href="classBaseOverlay.html#a5fc03fda227c0cca828109842af1b320">getCompRpcGate</a>(static_cast<CompType>(
- <a name="l00511"></a>00511 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a082f26c9d0cac0aec9ca23da4d338134">getDestComp</a>()));
- <a name="l00512"></a>00512
- <a name="l00513"></a>00513 <span class="keywordflow">if</span> (destGate == NULL) {
- <a name="l00514"></a>00514 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::callDeliver(): Unknown destComp!"</span>);
- <a name="l00515"></a>00515 }
- <a name="l00516"></a>00516
- <a name="l00517"></a>00517 sendDirect(deliverMsg, destGate);
- <a name="l00518"></a>00518
- <a name="l00519"></a>00519 <span class="keyword">delete</span> msg;
- <a name="l00520"></a>00520 }
- <a name="l00521"></a>00521
- <a name="l00522"></a><a class="code" href="classBaseOverlay.html#a71bcb54aa4fc66bdf97cc9c87fffc318">00522</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a71bcb54aa4fc66bdf97cc9c87fffc318" title="Calls forward function in application.">BaseOverlay::callForward</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& key, <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* msg,
- <a name="l00523"></a>00523 <span class="keyword">const</span> <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>& nextHopNode)
- <a name="l00524"></a>00524 {
- <a name="l00525"></a>00525 <a class="code" href="classKBRforward.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRforward</a>* forwardMsg = <span class="keyword">new</span> <a class="code" href="classKBRforward.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRforward</a>();
- <a name="l00526"></a>00526
- <a name="l00527"></a>00527 forwardMsg-><a class="code" href="classKBRforward.html#abd3f6be7b4fcfa4549386076963cd352">setDestKey</a>(msg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>());
- <a name="l00528"></a>00528 forwardMsg-><a class="code" href="classKBRforward.html#aa6ef158528be8b36ba7cec392da0b1ba">setNextHopNode</a>(nextHopNode);
- <a name="l00529"></a>00529 forwardMsg->encapsulate(msg->getEncapsulatedPacket()->decapsulate());
- <a name="l00530"></a>00530
- <a name="l00531"></a>00531 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo =
- <a name="l00532"></a>00532 <span class="keyword">new</span> <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>();
- <a name="l00533"></a>00533 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a129cf7292587fa2ee6e4e6238c5e4d33">setTransportType</a>(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a03dcc78e081682d383ff0baec54dcf8c">ROUTE_TRANSPORT</a>);
- <a name="l00534"></a>00534 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a2e3bd66c1e71acd70a6d87817efe15db">setRoutingType</a>(msg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>());
- <a name="l00535"></a>00535 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a790ec1f663fccc40033e6a8e714adbff">setHopCount</a>(msg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>());
- <a name="l00536"></a>00536 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a57150c423c6413ed906a81402e8df0f5">setSrcNode</a>(msg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>());
- <a name="l00537"></a>00537 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a984d51d889959257fd74b9a35ca4ffb6">setSrcComp</a>(check_and_cast<BaseAppDataMessage*>
- <a name="l00538"></a>00538 (msg->getEncapsulatedPacket())->getSrcComp());
- <a name="l00539"></a>00539 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a5db196b85bb865f24777badc887f0e66">setDestComp</a>(check_and_cast<BaseAppDataMessage*>
- <a name="l00540"></a>00540 (msg->getEncapsulatedPacket())->getDestComp());
- <a name="l00541"></a>00541
- <a name="l00542"></a>00542 <span class="keywordflow">if</span> (msg->getControlInfo() != NULL) {
- <a name="l00543"></a>00543 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* ctrlInfo =
- <a name="l00544"></a>00544 check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>(msg->removeControlInfo());
- <a name="l00545"></a>00545
- <a name="l00546"></a>00546 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a6c2c1955d30ba60f696247685dc3d6ae">setLastHop</a>(ctrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad12b7ac74244fb7ab79ebf41e05fe79c">getLastHop</a>());
- <a name="l00547"></a>00547
- <a name="l00548"></a>00548 <span class="keyword">delete</span> ctrlInfo;
- <a name="l00549"></a>00549 }
- <a name="l00550"></a>00550
- <a name="l00551"></a>00551 forwardMsg->setControlInfo(overlayCtrlInfo);
- <a name="l00552"></a>00552
- <a name="l00553"></a>00553 forwardMsg-><a class="code" href="classCommonAPIMessage.html#a161ae8c663ecca1ada7f68f2b010d774">setType</a>(<a class="code" href="CommonMessages__m_8h.html#a61951439f8b8b0a1c54516d2e4c72297a0afbe139422edee97cf4f5998edbfc9e">KBR_FORWARD</a>);
- <a name="l00554"></a>00554
- <a name="l00555"></a>00555 send(forwardMsg, <span class="stringliteral">"appOut"</span>);
- <a name="l00556"></a>00556
- <a name="l00557"></a>00557 <span class="keyword">delete</span> msg;
- <a name="l00558"></a>00558 }
- <a name="l00559"></a>00559
- <a name="l00560"></a><a class="code" href="classBaseOverlay.html#a95851770a6ab3a176e1d7b5a7afba3f0">00560</a> <a class="code" href="classBaseKeySortedVector.html">NodeVector</a>* <a class="code" href="classBaseOverlay.html#a95851770a6ab3a176e1d7b5a7afba3f0" title="finds nodes closest to the given OverlayKey">BaseOverlay::local_lookup</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& key,
- <a name="l00561"></a>00561 <span class="keywordtype">int</span> num, <span class="keywordtype">bool</span> safe)
- <a name="l00562"></a>00562 {
- <a name="l00563"></a>00563 Enter_Method(<span class="stringliteral">"local_lookup()"</span>);
- <a name="l00564"></a>00564
- <a name="l00565"></a>00565 <span class="keywordflow">if</span> (safe == <span class="keyword">true</span>) {
- <a name="l00566"></a>00566 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::local_lookup(): "</span>
- <a name="l00567"></a>00567 <span class="stringliteral">"safe flag is not implemented!"</span>);
- <a name="l00568"></a>00568 }
- <a name="l00569"></a>00569
- <a name="l00570"></a>00570 <span class="keywordflow">if</span> (num < 0) num = INT_MAX;
- <a name="l00571"></a>00571 <a class="code" href="classBaseKeySortedVector.html">NodeVector</a>* nodeVector = <a class="code" href="classBaseOverlay.html#a7cbdce336237331b67a3c69c4e43d489" title="Implements the find node call.">findNode</a>(key, min(num, <a class="code" href="classBaseOverlay.html#ab4dadd02486560de3a58773b3a90fb41" title="Query the maximum number of redundant next hop nodes that are returned by findNode().">getMaxNumRedundantNodes</a>()),
- <a name="l00572"></a>00572 min(num,<a class="code" href="classBaseOverlay.html#acd3058ad15b470e024500dd4872e2f09" title="Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay proto...">getMaxNumSiblings</a>()));
- <a name="l00573"></a>00573
- <a name="l00574"></a>00574 <span class="keywordflow">if</span> (((<span class="keywordtype">int</span>)nodeVector->size()) > num)
- <a name="l00575"></a>00575 nodeVector->resize(num);
- <a name="l00576"></a>00576
- <a name="l00577"></a>00577 <span class="keywordflow">return</span> nodeVector;
- <a name="l00578"></a>00578 }
- <a name="l00579"></a>00579
- <a name="l00580"></a><a class="code" href="classBaseOverlay.html#acb8855faa86247ae37ab894891d9f4dd">00580</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#acb8855faa86247ae37ab894891d9f4dd" title="Join the overlay with a given nodeID.">BaseOverlay::join</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& nodeID)
- <a name="l00581"></a>00581 {
- <a name="l00582"></a>00582 Enter_Method(<span class="stringliteral">"join()"</span>);
- <a name="l00583"></a>00583
- <a name="l00584"></a>00584 <a class="code" href="classBaseOverlay.html#aee8e642813784a1f27a81756a4b93b9b" title="number of join retries">joinRetries</a>++;
- <a name="l00585"></a>00585
- <a name="l00586"></a>00586 <span class="keywordflow">if</span> (((<a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> == <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab3a263fb274a58d63b15cd61ba910335">READY</a>) || (<a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> == <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fa99c9df0220f7a63e3b548d19181dc2b1">FAILED</a>)) && !<a class="code" href="classBaseOverlay.html#aecfcf5743d274d9c17730f2aeccf1635">rejoinOnFailure</a>) {
- <a name="l00587"></a>00587 <a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> = FAILED;
- <a name="l00588"></a>00588 <span class="keywordflow">return</span>;
- <a name="l00589"></a>00589 }
- <a name="l00590"></a>00590
- <a name="l00591"></a>00591 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> != <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab3a263fb274a58d63b15cd61ba910335">READY</a>) {
- <a name="l00592"></a>00592 <span class="comment">// set nodeID and IP</span>
- <a name="l00593"></a>00593 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a1c7b834dc2e6e738f1f4db8711a12814" title="Sets the ip address, port and NAT type.">setIp</a>(
- <a name="l00594"></a>00594 IPAddressResolver().addressOf(getParentModule()->getParentModule()));
- <a name="l00595"></a>00595
- <a name="l00596"></a>00596 <span class="keywordflow">if</span> (!nodeID.<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>()) {
- <a name="l00597"></a>00597 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#af3992f1fda9ea42dc10bf4739e47700a" title="saves given key to NodeHandle::key">setKey</a>(nodeID);
- <a name="l00598"></a>00598 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>()) {
- <a name="l00599"></a>00599 std::string nodeIdStr = par(<span class="stringliteral">"nodeId"</span>).stdstringValue();
- <a name="l00600"></a>00600
- <a name="l00601"></a>00601 <span class="keywordflow">if</span> (nodeIdStr.size()) {
- <a name="l00602"></a>00602 <span class="comment">// manual configuration of nodeId in ini file</span>
- <a name="l00603"></a>00603 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#af3992f1fda9ea42dc10bf4739e47700a" title="saves given key to NodeHandle::key">setKey</a>(<a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>(nodeIdStr));
- <a name="l00604"></a>00604 } <span class="keywordflow">else</span> {
- <a name="l00605"></a>00605 <a class="code" href="classBaseOverlay.html#a31e60de81d77afdeb0e68f781ded0f9e" title="Overlay implementations can overwrite this virtual method to set a specific nodeID.">setOwnNodeID</a>();
- <a name="l00606"></a>00606 }
- <a name="l00607"></a>00607 }
- <a name="l00608"></a>00608 }
- <a name="l00609"></a>00609
- <a name="l00610"></a>00610 cObject** context = <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a>-><a class="code" href="classGlobalNodeList.html#a9c0e986f725906c17373fac655710e5c">getContext</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>());
- <a name="l00611"></a>00611 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a7d0beff122a0b5c573dd8ae90c9372d5" title="if true, a node rejoins with its old nodeId and malicious state">restoreContext</a> && context) {
- <a name="l00612"></a>00612 <span class="keywordflow">if</span> (*context == NULL) {
- <a name="l00613"></a>00613 *context = <span class="keyword">new</span> <a class="code" href="classBaseOverlay_1_1BaseOverlayContext.html">BaseOverlayContext</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>().getKey(),
- <a name="l00614"></a>00614 <a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">isMalicious</a>());
- <a name="l00615"></a>00615 }
- <a name="l00616"></a>00616 }
- <a name="l00617"></a>00617
- <a name="l00618"></a>00618 <a class="code" href="classBaseOverlay.html#a3eefb56c2396601373c89d21b5b58110" title="Join the overlay with a given nodeID in thisNode.key.">joinOverlay</a>();
- <a name="l00619"></a>00619 }
- <a name="l00620"></a>00620
- <a name="l00621"></a><a class="code" href="classBaseOverlay.html#ad032eda7f8a65884cf8c6d141224331e">00621</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#ad032eda7f8a65884cf8c6d141224331e" title="Join another overlay partition with the given node as bootstrap node.">BaseOverlay::joinForeignPartition</a>(<span class="keyword">const</span> <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>& node)
- <a name="l00622"></a>00622 {
- <a name="l00623"></a>00623 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::joinForeignPartition(): "</span>
- <a name="l00624"></a>00624 <span class="stringliteral">"This overlay doesn't support merging!"</span>);
- <a name="l00625"></a>00625 }
- <a name="l00626"></a>00626
- <a name="l00627"></a><a class="code" href="classBaseOverlay.html#a31e60de81d77afdeb0e68f781ded0f9e">00627</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a31e60de81d77afdeb0e68f781ded0f9e" title="Overlay implementations can overwrite this virtual method to set a specific nodeID.">BaseOverlay::setOwnNodeID</a>()
- <a name="l00628"></a>00628 {
- <a name="l00629"></a>00629 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#af3992f1fda9ea42dc10bf4739e47700a" title="saves given key to NodeHandle::key">setKey</a>(<a class="code" href="classOverlayKey.html#a1983e1b47e32783f8ccd5e59fe725290" title="Returns a random key.">OverlayKey::random</a>());
- <a name="l00630"></a>00630 }
- <a name="l00631"></a>00631
- <a name="l00632"></a><a class="code" href="classBaseOverlay.html#a08f453e70d8d295bdbabec4accbb9dad">00632</a> <a class="code" href="classBaseKeySortedVector.html">NodeVector</a>* <a class="code" href="classBaseOverlay.html#a08f453e70d8d295bdbabec4accbb9dad">BaseOverlay::neighborSet</a>(<span class="keywordtype">int</span> num)
- <a name="l00633"></a>00633 {
- <a name="l00634"></a>00634 Enter_Method(<span class="stringliteral">"neighborSet()"</span>);
- <a name="l00635"></a>00635
- <a name="l00636"></a>00636 <span class="keywordflow">return</span> <a class="code" href="classBaseOverlay.html#a95851770a6ab3a176e1d7b5a7afba3f0" title="finds nodes closest to the given OverlayKey">local_lookup</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>(), num, <span class="keyword">false</span>);
- <a name="l00637"></a>00637 }
- <a name="l00638"></a>00638
- <a name="l00639"></a><a class="code" href="classBaseOverlay.html#a1422696a8eb138dde850390152ff88c7">00639</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a1422696a8eb138dde850390152ff88c7" title="Informs application about state changes of nodes or newly joined nodes.">BaseOverlay::callUpdate</a>(<span class="keyword">const</span> <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>& node, <span class="keywordtype">bool</span> joined)
- <a name="l00640"></a>00640 {
- <a name="l00641"></a>00641 <span class="keywordflow">if</span> ((!node.<a class="code" href="classNodeHandle.html#ab5136375a4548ced7c2014a73c8743c9" title="indicates if this NodeHandle is specified">isUnspecified</a>()) && (node != <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>)) {
- <a name="l00642"></a>00642 <span class="keywordflow">if</span> (joined) {
- <a name="l00643"></a>00643 EV << <span class="stringliteral">"[BaseOverlay::callUpdate() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l00644"></a>00644 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l00645"></a>00645 << <span class="stringliteral">" ("</span> << node << <span class="stringliteral">", "</span> << joined << <span class="stringliteral">") joined"</span>
- <a name="l00646"></a>00646 << endl;
- <a name="l00647"></a>00647 } <span class="keywordflow">else</span> {
- <a name="l00648"></a>00648 EV << <span class="stringliteral">"[BaseOverlay::callUpdate() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l00649"></a>00649 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l00650"></a>00650 << <span class="stringliteral">" ("</span> << node << <span class="stringliteral">", "</span> << joined << <span class="stringliteral">") left"</span>
- <a name="l00651"></a>00651 << endl;
- <a name="l00652"></a>00652 }
- <a name="l00653"></a>00653 }
- <a name="l00654"></a>00654
- <a name="l00655"></a>00655 <a class="code" href="classKBRupdate.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRupdate</a>* updateMsg = <span class="keyword">new</span> <a class="code" href="classKBRupdate.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRupdate</a>(<span class="stringliteral">"UPDATE"</span>);
- <a name="l00656"></a>00656
- <a name="l00657"></a>00657 updateMsg-><a class="code" href="classKBRupdate.html#aa20a7893984b166f2d19abc501741a1e">setNode</a>(node);
- <a name="l00658"></a>00658 updateMsg-><a class="code" href="classKBRupdate.html#aa87ea437b7f9edbdb530c6ef50d65587">setJoined</a>(joined);
- <a name="l00659"></a>00659
- <a name="l00660"></a>00660 updateMsg-><a class="code" href="classCommonAPIMessage.html#a161ae8c663ecca1ada7f68f2b010d774">setType</a>(<a class="code" href="CommonMessages__m_8h.html#a61951439f8b8b0a1c54516d2e4c72297ac502d048ee6f6b1287c7b7843d2706b8">KBR_UPDATE</a>);
- <a name="l00661"></a>00661
- <a name="l00662"></a>00662 send(updateMsg, <span class="stringliteral">"appOut"</span>);
- <a name="l00663"></a>00663 }
- <a name="l00664"></a>00664
- <a name="l00665"></a><a class="code" href="classBaseOverlay.html#ab5887b89ba9da5973068e834feb69ce7">00665</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#ab5887b89ba9da5973068e834feb69ce7" title="Query if a node is among the siblings for a given key.">BaseOverlay::isSiblingFor</a>(<span class="keyword">const</span> <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>& node, <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& key,
- <a name="l00666"></a>00666 <span class="keywordtype">int</span> numSiblings, <span class="keywordtype">bool</span>* err)
- <a name="l00667"></a>00667 {
- <a name="l00668"></a>00668 Enter_Method(<span class="stringliteral">"isSiblingFor()"</span>);
- <a name="l00669"></a>00669
- <a name="l00670"></a>00670 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"isSiblingFor: Not implemented!"</span>);
- <a name="l00671"></a>00671
- <a name="l00672"></a>00672 <span class="keywordflow">return</span> <span class="keyword">false</span>;
- <a name="l00673"></a>00673 }
- <a name="l00674"></a>00674
- <a name="l00675"></a><a class="code" href="classBaseOverlay.html#acd3058ad15b470e024500dd4872e2f09">00675</a> <span class="keywordtype">int</span> <a class="code" href="classBaseOverlay.html#acd3058ad15b470e024500dd4872e2f09" title="Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay proto...">BaseOverlay::getMaxNumSiblings</a>()
- <a name="l00676"></a>00676 {
- <a name="l00677"></a>00677 Enter_Method(<span class="stringliteral">"getMaxNumSiblings()"</span>);
- <a name="l00678"></a>00678
- <a name="l00679"></a>00679 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"getMaxNumSiblings: Not implemented!"</span>);
- <a name="l00680"></a>00680
- <a name="l00681"></a>00681 <span class="keywordflow">return</span> <span class="keyword">false</span>;
- <a name="l00682"></a>00682 }
- <a name="l00683"></a>00683
- <a name="l00684"></a><a class="code" href="classBaseOverlay.html#ab4dadd02486560de3a58773b3a90fb41">00684</a> <span class="keywordtype">int</span> <a class="code" href="classBaseOverlay.html#ab4dadd02486560de3a58773b3a90fb41" title="Query the maximum number of redundant next hop nodes that are returned by findNode().">BaseOverlay::getMaxNumRedundantNodes</a>()
- <a name="l00685"></a>00685 {
- <a name="l00686"></a>00686 Enter_Method(<span class="stringliteral">"getMaxNumRedundantNodes()"</span>);
- <a name="l00687"></a>00687
- <a name="l00688"></a>00688 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"getMaxNumRedundantNodes: Not implemented!"</span>);
- <a name="l00689"></a>00689
- <a name="l00690"></a>00690 <span class="keywordflow">return</span> <span class="keyword">false</span>;
- <a name="l00691"></a>00691 }
- <a name="l00692"></a>00692
- <a name="l00693"></a>00693
- <a name="l00694"></a>00694 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00695"></a>00695 <span class="comment">//--- Message Handlers ---------------------------------------------------</span>
- <a name="l00696"></a>00696 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l00697"></a>00697
- <a name="l00698"></a>00698 <span class="comment">//private</span>
- <a name="l00699"></a><a class="code" href="classBaseOverlay.html#a870d24a243e4b0d1aeb31ea0861e53a7">00699</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a870d24a243e4b0d1aeb31ea0861e53a7" title="Checks for message type and calls corresponding method.">BaseOverlay::handleMessage</a>(cMessage* msg)
- <a name="l00700"></a>00700 {
- <a name="l00701"></a>00701 <span class="keywordflow">if</span> (msg->getArrivalGate() == <a class="code" href="classBaseOverlay.html#a2e2f70aa82a9b4920877b3a13dd1e0ea">udpGate</a>) {
- <a name="l00702"></a>00702 UDPControlInfo* udpControlInfo =
- <a name="l00703"></a>00703 check_and_cast<UDPControlInfo*>(msg->removeControlInfo());
- <a name="l00704"></a>00704 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo = <span class="keyword">new</span> <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>;
- <a name="l00705"></a>00705 overlayCtrlInfo->setLastHop(<a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>(
- <a name="l00706"></a>00706 udpControlInfo->getSrcAddr(),
- <a name="l00707"></a>00707 udpControlInfo->getSrcPort()));
- <a name="l00708"></a>00708 overlayCtrlInfo->setSrcRoute(overlayCtrlInfo->getLastHop());
- <a name="l00709"></a>00709 overlayCtrlInfo->setTransportType(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a01580b2e886cd821bd7f3f2bcd7c690c">UDP_TRANSPORT</a>);
- <a name="l00710"></a>00710
- <a name="l00711"></a>00711 msg->setControlInfo(overlayCtrlInfo);
- <a name="l00712"></a>00712 <span class="keyword">delete</span> udpControlInfo;
- <a name="l00713"></a>00713
- <a name="l00714"></a>00714 <span class="comment">// debug message</span>
- <a name="l00715"></a>00715 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a49ff0fb8c25792a1339d54a60c36f2cd" title="debug output ?">debugOutput</a>) {
- <a name="l00716"></a>00716 EV << <span class="stringliteral">"[BaseOverlay:handleMessage() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l00717"></a>00717 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l00718"></a>00718 << <span class="stringliteral">" Received "</span> << *msg << <span class="stringliteral">" from "</span>
- <a name="l00719"></a>00719 << overlayCtrlInfo->getLastHop().getIp() << endl;
- <a name="l00720"></a>00720 }
- <a name="l00721"></a>00721
- <a name="l00722"></a>00722 <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* baseOverlayMsg =
- <a name="l00723"></a>00723 <span class="keyword">dynamic_cast<</span><a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>*<span class="keyword">></span>(msg);
- <a name="l00724"></a>00724
- <a name="l00725"></a>00725 <span class="keywordflow">if</span> (baseOverlayMsg == NULL) {
- <a name="l00726"></a>00726 cPacket* packet = check_and_cast<cPacket*>(msg);
- <a name="l00727"></a>00727 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++; <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += packet->getByteLength());
- <a name="l00728"></a>00728 <span class="keyword">delete</span> msg;
- <a name="l00729"></a>00729 <span class="keywordflow">return</span>;
- <a name="l00730"></a>00730 }
- <a name="l00731"></a>00731
- <a name="l00732"></a>00732 <span class="comment">// records stats if message is not a UDP "self message"</span>
- <a name="l00733"></a>00733 <span class="keywordflow">if</span> (overlayCtrlInfo->getLastHop() != <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>) {
- <a name="l00734"></a>00734 <span class="comment">// is this from anywhere else?</span>
- <a name="l00735"></a>00735 <span class="keywordflow">if</span> (baseOverlayMsg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_DATA_STAT)
- <a name="l00736"></a>00736 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#aa83e680792f987f9f5f779e12c055898" title="number of received app data packets (incl. packets to be forwarded )">numAppDataReceived</a>++; <a class="code" href="classBaseOverlay.html#a82cd1df80e31e2a9148a9efaacc4bc76" title="number of received app data bytes (incl. bytes to be forwarded)">bytesAppDataReceived</a> +=
- <a name="l00737"></a>00737 baseOverlayMsg->getByteLength());
- <a name="l00738"></a>00738 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (baseOverlayMsg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_LOOKUP_STAT)
- <a name="l00739"></a>00739 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a9298db97a2d651e02729ad197964bdca" title="number of received app lookup packets (incl. packets to be forwarded)">numAppLookupReceived</a>++;<a class="code" href="classBaseOverlay.html#a8527c9038c62bf66e58c07d41b308527" title="number of received app lookup bytes (incl. bytes to be forwarded)">bytesAppLookupReceived</a> +=
- <a name="l00740"></a>00740 baseOverlayMsg->getByteLength());
- <a name="l00741"></a>00741 <span class="keywordflow">else</span> <span class="comment">// MAINTENANCE_STAT</span>
- <a name="l00742"></a>00742 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4e7abb41a2c8698bf530015378a13e46" title="number of received maintenance packets (incl. packets to be forwarded)">numMaintenanceReceived</a>++;
- <a name="l00743"></a>00743 <a class="code" href="classBaseOverlay.html#ad7bd70b69842cc4db485eafa942332fb" title="number of received maintenance bytes (incl. bytes to be forwarded)">bytesMaintenanceReceived</a> +=
- <a name="l00744"></a>00744 baseOverlayMsg->getByteLength());
- <a name="l00745"></a>00745 }
- <a name="l00746"></a>00746 <span class="keywordflow">if</span> (overlayCtrlInfo->getLastHop().getIp() == <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()) {
- <a name="l00747"></a>00747 <span class="comment">// is this from the same node?</span>
- <a name="l00748"></a>00748 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a7f185cb11a818d01dcc1a31553de16ef" title="number of packets received from same host but different port (SimpleMultiOverlayHost)">numInternalReceived</a>++; <a class="code" href="classBaseOverlay.html#a55ba3d595b6b23db700cb9f36f34f0ae" title="number of bytes received from same host but different port (SimpleMultiOverlayHost)">bytesInternalReceived</a> +=
- <a name="l00749"></a>00749 baseOverlayMsg->getByteLength());
- <a name="l00750"></a>00750 } <span class="keywordflow">else</span> overlayCtrlInfo->setHopCount(1);
- <a name="l00751"></a>00751
- <a name="l00752"></a>00752 <span class="comment">// process rpc calls/responses or BaseOverlayMessages</span>
- <a name="l00753"></a>00753 <span class="keywordflow">if</span> (!<a class="code" href="classBaseRpc.html#ad68b7208473ba1301deb59d51f0bba6c">internalHandleMessage</a>(msg)) {
- <a name="l00754"></a>00754 <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">handleBaseOverlayMessage</a>(baseOverlayMsg);
- <a name="l00755"></a>00755 }
- <a name="l00756"></a>00756 }
- <a name="l00757"></a>00757
- <a name="l00758"></a>00758 <span class="comment">// process timer events and rpc timeouts</span>
- <a name="l00759"></a>00759 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classBaseRpc.html#ad68b7208473ba1301deb59d51f0bba6c">internalHandleMessage</a>(msg)) <span class="keywordflow">return</span>;
- <a name="l00760"></a>00760
- <a name="l00761"></a>00761 <span class="comment">// process CommonAPIMessages from App</span>
- <a name="l00762"></a>00762 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast<CommonAPIMessage*>(msg) != NULL) {
- <a name="l00763"></a>00763 <span class="keywordflow">if</span> (dynamic_cast<KBRroute*>(msg) != NULL) {
- <a name="l00764"></a>00764 <a class="code" href="classKBRroute.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRroute</a>* apiMsg = <span class="keyword">static_cast<</span><a class="code" href="classKBRroute.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRroute</a>*<span class="keyword">></span>(msg);
- <a name="l00765"></a>00765
- <a name="l00766"></a>00766 std::vector<TransportAddress> sourceRoute;
- <a name="l00767"></a>00767 <span class="keywordflow">for</span> (uint32_t i = 0; i < apiMsg-><a class="code" href="classKBRroute.html#ad2ffb68e9163898b3a4846943c687a53">getSourceRouteArraySize</a>(); ++i)
- <a name="l00768"></a>00768 sourceRoute.push_back(apiMsg-><a class="code" href="classKBRroute.html#a40bab7a8989b1eb12246c9e014ba384c">getSourceRoute</a>(i));
- <a name="l00769"></a>00769
- <a name="l00770"></a>00770 <a class="code" href="classBaseOverlay.html#ad62efdef2b674f46e5368354efb6104f" title="Routes message through overlay.">route</a>(apiMsg-><a class="code" href="classKBRroute.html#acfbdd202d6783de8d6731d46ab382e00">getDestKey</a>(), <span class="keyword">static_cast<</span><a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a><span class="keyword">></span>(apiMsg-><a class="code" href="classKBRroute.html#a32e7dbb5aaeee13f316f1f6c8e55d2b3">getDestComp</a>()),
- <a name="l00771"></a>00771 static_cast<CompType>(apiMsg-><a class="code" href="classKBRroute.html#a1667fc25f4d80791d79e11c399196353">getSrcComp</a>()), apiMsg->decapsulate(),
- <a name="l00772"></a>00772 sourceRoute);
- <a name="l00773"></a>00773 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast<KBRforward*>(msg) != NULL) {
- <a name="l00774"></a>00774 <a class="code" href="classKBRforward.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRforward</a>* apiMsg = <span class="keyword">static_cast<</span><a class="code" href="classKBRforward.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">KBRforward</a>*<span class="keyword">></span>(msg);
- <a name="l00775"></a>00775 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo =
- <a name="l00776"></a>00776 check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>
- <a name="l00777"></a>00777 (msg->removeControlInfo());
- <a name="l00778"></a>00778
- <a name="l00779"></a>00779 <a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>* dataMsg =
- <a name="l00780"></a>00780 <span class="keyword">new</span> <a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>();
- <a name="l00781"></a>00781 dataMsg->setType(<a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17eab0641a3f5bcb1e08ee72afe9583ff5e6">APPDATA</a>);
- <a name="l00782"></a>00782 dataMsg->setBitLength(<a class="code" href="CommonMessages__m_8h.html#aebae47ba62d6bd9fe00ca6d779bf0e81">BASEAPPDATA_L</a>(dataMsg));
- <a name="l00783"></a>00783 dataMsg->setName(apiMsg->getEncapsulatedPacket()->getName());
- <a name="l00784"></a>00784 dataMsg->encapsulate(apiMsg->decapsulate());
- <a name="l00785"></a>00785 dataMsg->setSrcComp(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a79a35b8f98c2fecef8d6bc566c4a7437">getSrcComp</a>());
- <a name="l00786"></a>00786 dataMsg->setDestComp(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a082f26c9d0cac0aec9ca23da4d338134">getDestComp</a>());
- <a name="l00787"></a>00787 dataMsg->setStatType(<a class="code" href="CommonMessages__m_8h.html#a25418fa818fbb01cd8c0b2c4b0732cdfad8d082af8526e80f7de088c52ad1b7c0">APP_DATA_STAT</a>);
- <a name="l00788"></a>00788
- <a name="l00789"></a>00789 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* routeMsg = <span class="keyword">new</span> <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>(dataMsg->getName());
- <a name="l00790"></a>00790 routeMsg-><a class="code" href="classBaseOverlayMessage.html#a1441ce272062923bae9d821ac35ed7cf">setType</a>(<a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17ea9fb39f8e1c5f2ff00e45bb7294e5524f">OVERLAYROUTE</a>);
- <a name="l00791"></a>00791 routeMsg->setBitLength(<a class="code" href="CommonMessages__m_8h.html#aa51e9b4f9362c33b9a432fd496bc31d0">BASEROUTE_L</a>(routeMsg));
- <a name="l00792"></a>00792 routeMsg->encapsulate(dataMsg);
- <a name="l00793"></a>00793
- <a name="l00794"></a>00794 routeMsg-><a class="code" href="classBaseOverlayMessage.html#a46fd21016c6fad4f167d5510f0481f49">setStatType</a>(<a class="code" href="CommonMessages__m_8h.html#a25418fa818fbb01cd8c0b2c4b0732cdfad8d082af8526e80f7de088c52ad1b7c0">APP_DATA_STAT</a>);
- <a name="l00795"></a>00795 routeMsg-><a class="code" href="classBaseRouteMessage.html#a6cf1c098dabdf6382aa647054e2b85e3">setRoutingType</a>(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a4b81411df66c4c813b664665731ee38c">getRoutingType</a>());
- <a name="l00796"></a>00796 routeMsg-><a class="code" href="classBaseRouteMessage.html#ac3ad2fb57750487addb4611b52e5db71">setDestKey</a>(apiMsg-><a class="code" href="classKBRforward.html#a5c9aa80a6bd136a034e37af25f9beb42">getDestKey</a>());
- <a name="l00797"></a>00797 routeMsg-><a class="code" href="classBaseRouteMessage.html#a52ea5017b1de1775ee71c203864ba28f">setSrcNode</a>(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#af6e31869ed325ba04288a69346988343">getSrcNode</a>());
- <a name="l00798"></a>00798 routeMsg-><a class="code" href="classBaseRouteMessage.html#a1c843714ac5feca3c13f1e39b77e9b5c">setHopCount</a>(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a76fd4681ebb00eb023e35a88e4ba9042">getHopCount</a>());
- <a name="l00799"></a>00799 routeMsg->setControlInfo(overlayCtrlInfo);
- <a name="l00800"></a>00800
- <a name="l00801"></a>00801 <span class="comment">// message marked with this-pointer as already forwarded to tier1</span>
- <a name="l00802"></a>00802 routeMsg->setContextPointer(<span class="keyword">this</span>);
- <a name="l00803"></a>00803
- <a name="l00804"></a>00804 std::vector<TransportAddress> sourceRoute;
- <a name="l00805"></a>00805 sourceRoute.push_back(apiMsg-><a class="code" href="classKBRforward.html#a7e0e868fc677593aab3e8302e38f7274">getNextHopNode</a>());
- <a name="l00806"></a>00806 <a class="code" href="classBaseOverlay.html#a6f2c598f5d3989a63a8cc7220f1aaf76" title="Sends a message to an overlay node, with the generic routing algorithm.">sendToKey</a>(apiMsg-><a class="code" href="classKBRforward.html#a5c9aa80a6bd136a034e37af25f9beb42">getDestKey</a>(), routeMsg, 1, sourceRoute);
- <a name="l00807"></a>00807 }
- <a name="l00808"></a>00808
- <a name="l00809"></a>00809 <span class="keyword">delete</span> msg;
- <a name="l00810"></a>00810 }
- <a name="l00811"></a>00811
- <a name="l00812"></a>00812 <span class="comment">// process other messages from App</span>
- <a name="l00813"></a>00813 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg->getArrivalGate() == <a class="code" href="classBaseOverlay.html#a6523faf8f52af34c73643dc7f3e083eb">appGate</a>) {
- <a name="l00814"></a>00814 <a class="code" href="classBaseOverlay.html#aef92d042c22b47c123e59a831acb7033" title="Processes &quot;timer&quot; self-messages.">handleAppMessage</a>(msg);
- <a name="l00815"></a>00815 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(msg->arrivedOn(<span class="stringliteral">"tcpIn"</span>)) {
- <a name="l00816"></a>00816 <a class="code" href="classBaseTcpSupport.html#ac991906514dbe20b4546de49fad67756" title="Member function to handle incoming TCP messages.">handleTCPMessage</a>(msg);
- <a name="l00817"></a>00817 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast<CompReadyMessage*>(msg)) {
- <a name="l00818"></a>00818 <a class="code" href="classCompReadyMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">CompReadyMessage</a>* readyMsg = <span class="keyword">static_cast<</span><a class="code" href="classCompReadyMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">CompReadyMessage</a>*<span class="keyword">></span>(msg);
- <a name="l00819"></a>00819 <span class="keywordflow">if</span> (((<span class="keywordtype">bool</span>)par(<span class="stringliteral">"joinOnApplicationRequest"</span>) == <span class="keyword">false</span>) &&
- <a name="l00820"></a>00820 readyMsg-><a class="code" href="classCompReadyMessage.html#adbc73cb3852f357191584e7a9684838f">getReady</a>() &&
- <a name="l00821"></a>00821 readyMsg-><a class="code" href="classCompReadyMessage.html#a3804fb9b24445b1af5484da00634d075">getComp</a>() == NEIGHBORCACHE_COMP) {
- <a name="l00822"></a>00822 cObject** context = <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a>-><a class="code" href="classGlobalNodeList.html#a9c0e986f725906c17373fac655710e5c">getContext</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>());
- <a name="l00823"></a>00823 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a7d0beff122a0b5c573dd8ae90c9372d5" title="if true, a node rejoins with its old nodeId and malicious state">restoreContext</a> && context && *context) {
- <a name="l00824"></a>00824 <a class="code" href="classBaseOverlay_1_1BaseOverlayContext.html">BaseOverlayContext</a>* overlayContext = <span class="keyword">static_cast<</span><a class="code" href="classBaseOverlay_1_1BaseOverlayContext.html">BaseOverlayContext</a>*<span class="keyword">></span>(*context);
- <a name="l00825"></a>00825 <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a>-><a class="code" href="classGlobalNodeList.html#ae9b12c25d356b0f02eefc855e338dbd0" title="Set a node to be malicious.">setMalicious</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>(),
- <a name="l00826"></a>00826 overlayContext-><a class="code" href="classBaseOverlay_1_1BaseOverlayContext.html#aedc767ab6f5852af04b18666d131da1d">malicious</a>);
- <a name="l00827"></a>00827 <a class="code" href="classBaseOverlay.html#acb8855faa86247ae37ab894891d9f4dd" title="Join the overlay with a given nodeID.">join</a>(overlayContext-><a class="code" href="classBaseOverlay_1_1BaseOverlayContext.html#a7cc31b97afeb437fbb239423c621ad18">key</a>);
- <a name="l00828"></a>00828 } <span class="keywordflow">else</span> {
- <a name="l00829"></a>00829 <a class="code" href="classBaseOverlay.html#acb8855faa86247ae37ab894891d9f4dd" title="Join the overlay with a given nodeID.">join</a>();
- <a name="l00830"></a>00830 }
- <a name="l00831"></a>00831 }
- <a name="l00832"></a>00832 <span class="keyword">delete</span> msg;
- <a name="l00833"></a>00833 } <span class="keywordflow">else</span> {
- <a name="l00834"></a>00834 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::handleMessage(): Received msg with "</span>
- <a name="l00835"></a>00835 <span class="stringliteral">"unknown type!"</span>);
- <a name="l00836"></a>00836 <span class="keyword">delete</span> msg;
- <a name="l00837"></a>00837 }
- <a name="l00838"></a>00838 }
- <a name="l00839"></a>00839
- <a name="l00840"></a><a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8">00840</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">BaseOverlay::handleBaseOverlayMessage</a>(<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg,
- <a name="l00841"></a>00841 <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& destKey)
- <a name="l00842"></a>00842 {
- <a name="l00843"></a>00843 <span class="keywordflow">switch</span> (msg-><a class="code" href="classBaseOverlayMessage.html#a406e342c0841abe2d82b9bb5c1e2aabd">getType</a>()) {
- <a name="l00844"></a>00844 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17ea7c7b80e64b0ee54f9c64b4547d82e7fa">OVERLAYSIGNALING</a>:
- <a name="l00845"></a>00845 <a class="code" href="classBaseOverlay.html#a31d7dd39ddc9e62ad92f69f6d7210344" title="Processes messages from underlay.">handleUDPMessage</a>(msg);
- <a name="l00846"></a>00846 <span class="keywordflow">return</span>;
- <a name="l00847"></a>00847
- <a name="l00848"></a>00848 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17ea7f7e32ed10aea1dd73b80e96c70e8abf">RPC</a>: {
- <a name="l00849"></a>00849 <span class="comment">// process rpc-messages</span>
- <a name="l00850"></a>00850 <a class="code" href="classBaseRpcMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRpcMessage</a>* rpcMsg = check_and_cast<<a class="code" href="classBaseRpcMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRpcMessage</a>*>(msg);
- <a name="l00851"></a>00851
- <a name="l00852"></a>00852 <a class="code" href="classBaseRpc.html#a26c06fa9558c497e6dfe1ba6c5153042" title="Handles incoming rpc messages and delegates them to the corresponding listeners or handlers...">internalHandleRpcMessage</a>(rpcMsg);
- <a name="l00853"></a>00853 <span class="keywordflow">return</span>;
- <a name="l00854"></a>00854 }
- <a name="l00855"></a>00855
- <a name="l00856"></a>00856 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17eab0641a3f5bcb1e08ee72afe9583ff5e6">APPDATA</a>: {
- <a name="l00857"></a>00857 <span class="comment">//TODO use route messages? here: set transport type to ROUTE for "naked"</span>
- <a name="l00858"></a>00858 <span class="comment">// app messages</span>
- <a name="l00859"></a>00859 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo = check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>(msg->getControlInfo());
- <a name="l00860"></a>00860 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a129cf7292587fa2ee6e4e6238c5e4d33">setTransportType</a>(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a03dcc78e081682d383ff0baec54dcf8c">ROUTE_TRANSPORT</a>);
- <a name="l00861"></a>00861
- <a name="l00862"></a>00862 <a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>* baseAppDataMsg =
- <a name="l00863"></a>00863 check_and_cast<<a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>*>(msg);
- <a name="l00864"></a>00864 <a class="code" href="classBaseOverlay.html#a432f79071b87baece93311300cfda0c3" title="Calls deliver function in application.">callDeliver</a>(baseAppDataMsg, destKey);
- <a name="l00865"></a>00865 <span class="keywordflow">return</span>;
- <a name="l00866"></a>00866 }
- <a name="l00867"></a>00867
- <a name="l00868"></a>00868 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17ea9fb39f8e1c5f2ff00e45bb7294e5524f">OVERLAYROUTE</a>: {
- <a name="l00869"></a>00869 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* baseRouteMsg =
- <a name="l00870"></a>00870 check_and_cast<<a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>*>(msg);
- <a name="l00871"></a>00871
- <a name="l00872"></a>00872 <span class="comment">// collect delay-value of completed hop</span>
- <a name="l00873"></a>00873 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a2694627a0082c456367bfa472fff56b9" title="collect delay for single hops">collectPerHopDelay</a>) {
- <a name="l00874"></a>00874 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#adae1180a932d161a07885217adcf2213">setHopDelayArraySize</a>(baseRouteMsg->
- <a name="l00875"></a>00875 getHopDelayArraySize() + 1);
- <a name="l00876"></a>00876 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a860b477246d3e6ca1b3cf9ab50949f9c">setHopDelay</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ae75d0790b13698bfa9d31e2e2e04983b">getHopDelayArraySize</a>() - 1,
- <a name="l00877"></a>00877 simTime() - baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a31086f2b50373a749bf986c8ee1bab0f">getHopStamp</a>());
- <a name="l00878"></a>00878 }
- <a name="l00879"></a>00879
- <a name="l00880"></a>00880 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo
- <a name="l00881"></a>00881 = check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>(baseRouteMsg
- <a name="l00882"></a>00882 ->removeControlInfo());
- <a name="l00883"></a>00883 <span class="comment">// set transport type</span>
- <a name="l00884"></a>00884 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a129cf7292587fa2ee6e4e6238c5e4d33">setTransportType</a>(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a03dcc78e081682d383ff0baec54dcf8c">ROUTE_TRANSPORT</a>);
- <a name="l00885"></a>00885
- <a name="l00886"></a>00886 <span class="comment">// source routing: save visited nodes, copy next hops</span>
- <a name="l00887"></a>00887 std::vector<TransportAddress> sourceRoute;
- <a name="l00888"></a>00888 <span class="keywordflow">if</span> ((baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>() > 0) ||
- <a name="l00889"></a>00889 (baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>() == RECURSIVE_SOURCE_ROUTING) ||
- <a name="l00890"></a>00890 <a class="code" href="classBaseOverlay.html#a61186fd8bd7368c8a91a63ecc9c62a89" title="record visited hops on route">recordRoute</a>) {
- <a name="l00891"></a>00891 <span class="comment">// store the TransportAddress of the sender in the visited list</span>
- <a name="l00892"></a>00892 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a152289adca72ada1c7a8823d08e2164c">setVisitedHopsArraySize</a>(baseRouteMsg
- <a name="l00893"></a>00893 ->getVisitedHopsArraySize() + 1);
- <a name="l00894"></a>00894 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ade0721c1aa6e69d1f3ea712c8374f249">setVisitedHops</a>(baseRouteMsg
- <a name="l00895"></a>00895 ->getVisitedHopsArraySize() - 1,
- <a name="l00896"></a>00896 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad12b7ac74244fb7ab79ebf41e05fe79c">getLastHop</a>());
- <a name="l00897"></a>00897
- <a name="l00898"></a>00898 <span class="comment">// remove nodes from next hops and copy them to sourceRoute</span>
- <a name="l00899"></a>00899 <span class="keywordflow">if</span> (baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>() > 0) {
- <a name="l00900"></a>00900 sourceRoute.resize(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>()- 1);
- <a name="l00901"></a>00901 <span class="keywordflow">for</span> (uint32_t i = 1; i < baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>();
- <a name="l00902"></a>00902 ++i) {
- <a name="l00903"></a>00903 sourceRoute[i - 1] = baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a23f57254381410520aaa67dd52b0bc6c">getNextHops</a>(i);
- <a name="l00904"></a>00904 }
- <a name="l00905"></a>00905 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a3cb14c09b287d613f26d58ad39fec4d0">setNextHopsArraySize</a>(0);
- <a name="l00906"></a>00906 }
- <a name="l00907"></a>00907 }
- <a name="l00908"></a>00908
- <a name="l00909"></a>00909 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a57150c423c6413ed906a81402e8df0f5">setSrcNode</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>());
- <a name="l00910"></a>00910
- <a name="l00911"></a>00911 <span class="comment">// decapsulate msg if node is sibling for destKey</span>
- <a name="l00912"></a>00912 <span class="comment">// or message is at its destination node</span>
- <a name="l00913"></a>00913 <span class="keywordtype">bool</span> err;
- <a name="l00914"></a>00914 <span class="keywordflow">if</span> ((sourceRoute.size() == 0) &&
- <a name="l00915"></a>00915 (baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>().<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>() ||
- <a name="l00916"></a>00916 <a class="code" href="classBaseOverlay.html#ab5887b89ba9da5973068e834feb69ce7" title="Query if a node is among the siblings for a given key.">isSiblingFor</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>, baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>(), 1, &err)
- <a name="l00917"></a>00917 <span class="comment">/*&& !err*/</span>)) {
- <a name="l00918"></a>00918 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a790ec1f663fccc40033e6a8e714adbff">setHopCount</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>());
- <a name="l00919"></a>00919 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a2e3bd66c1e71acd70a6d87817efe15db">setRoutingType</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>());
- <a name="l00920"></a>00920
- <a name="l00921"></a>00921 <span class="keywordflow">if</span> (baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4d937e983eb4887400e41749b55ebecb">getVisitedHopsArraySize</a>() > 0) {
- <a name="l00922"></a>00922 <span class="comment">// recorded route available => add to srcNode</span>
- <a name="l00923"></a>00923 <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a> srcRoute(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>().<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>(),
- <a name="l00924"></a>00924 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a5e4624df761b01f0df433ef0ace1c597">getVisitedHops</a>(0));
- <a name="l00925"></a>00925
- <a name="l00926"></a>00926 <span class="keywordflow">for</span> (uint32_t i = 0; i < baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4d937e983eb4887400e41749b55ebecb">getVisitedHopsArraySize</a>(); ++i) {
- <a name="l00927"></a>00927 srcRoute.appendSourceRoute(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a5e4624df761b01f0df433ef0ace1c597">getVisitedHops</a>(i));
- <a name="l00928"></a>00928 }
- <a name="l00929"></a>00929
- <a name="l00930"></a>00930 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a32d9cea3544768278f7b283b753b018e">setSrcRoute</a>(srcRoute);
- <a name="l00931"></a>00931 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>().<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>()) {
- <a name="l00932"></a>00932 <span class="comment">// directly received (neither key routed nor source routed)</span>
- <a name="l00933"></a>00933 <span class="comment">// TODO: does this happen for a BaseRouteMessage?</span>
- <a name="l00934"></a>00934 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a32d9cea3544768278f7b283b753b018e">setSrcRoute</a>(
- <a name="l00935"></a>00935 <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>().<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>(),
- <a name="l00936"></a>00936 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad12b7ac74244fb7ab79ebf41e05fe79c">getLastHop</a>()));
- <a name="l00937"></a>00937 } <span class="keywordflow">else</span> {
- <a name="l00938"></a>00938 <span class="comment">// route to key and no recorded route available</span>
- <a name="l00939"></a>00939 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a32d9cea3544768278f7b283b753b018e">setSrcRoute</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>());
- <a name="l00940"></a>00940 }
- <a name="l00941"></a>00941
- <a name="l00942"></a>00942 <span class="comment">// copy visited nodes to control info</span>
- <a name="l00943"></a>00943 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#abc4f5e4539b4858443cf29523727a995">setVisitedHopsArraySize</a>(
- <a name="l00944"></a>00944 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4d937e983eb4887400e41749b55ebecb">getVisitedHopsArraySize</a>());
- <a name="l00945"></a>00945
- <a name="l00946"></a>00946 <span class="keywordflow">for</span> (uint32_t i = 0; i < baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a4d937e983eb4887400e41749b55ebecb">getVisitedHopsArraySize</a>();
- <a name="l00947"></a>00947 ++i) {
- <a name="l00948"></a>00948 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a307f80ca3aeec50add6dee234b9d51f0">setVisitedHops</a>(i,
- <a name="l00949"></a>00949 baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a5e4624df761b01f0df433ef0ace1c597">getVisitedHops</a>(i));
- <a name="l00950"></a>00950 }
- <a name="l00951"></a>00951
- <a name="l00952"></a>00952 <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* tmpMsg
- <a name="l00953"></a>00953 = check_and_cast<<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>*>(baseRouteMsg
- <a name="l00954"></a>00954 ->decapsulate());
- <a name="l00955"></a>00955 tmpMsg->setControlInfo(overlayCtrlInfo);
- <a name="l00956"></a>00956
- <a name="l00957"></a>00957 <span class="comment">// delay between hops</span>
- <a name="l00958"></a>00958 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a2694627a0082c456367bfa472fff56b9" title="collect delay for single hops">collectPerHopDelay</a>) {
- <a name="l00959"></a>00959 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(
- <a name="l00960"></a>00960 <span class="keywordtype">size_t</span> i;
- <a name="l00961"></a>00961 <span class="keywordflow">for</span> (i = <a class="code" href="classBaseOverlay.html#a93d899c36b4b7b7b012413924c9fb4b5">singleHopDelays</a>.size();
- <a name="l00962"></a>00962 i < baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ae75d0790b13698bfa9d31e2e2e04983b">getHopDelayArraySize</a>();) {
- <a name="l00963"></a>00963 <a class="code" href="classBaseOverlay.html#a93d899c36b4b7b7b012413924c9fb4b5">singleHopDelays</a>.push_back(<span class="keyword">new</span> <a class="code" href="structBaseOverlay_1_1HopDelayRecord.html" title="Structure for computing the average delay in one specific hop.">HopDelayRecord</a>[++i]);
- <a name="l00964"></a>00964 }
- <a name="l00965"></a>00965
- <a name="l00966"></a>00966 i = baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ae75d0790b13698bfa9d31e2e2e04983b">getHopDelayArraySize</a>() - 1;
- <a name="l00967"></a>00967 <a class="code" href="structBaseOverlay_1_1HopDelayRecord.html" title="Structure for computing the average delay in one specific hop.">HopDelayRecord</a>* hdr = <a class="code" href="classBaseOverlay.html#a93d899c36b4b7b7b012413924c9fb4b5">singleHopDelays</a>[i];
- <a name="l00968"></a>00968
- <a name="l00969"></a>00969 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j <= i; ++j) {
- <a name="l00970"></a>00970 hdr[j].<a class="code" href="structBaseOverlay_1_1HopDelayRecord.html#a83f056780cd6b9b68f8eb999d5b45482">count</a>++;
- <a name="l00971"></a>00971 hdr[j].<a class="code" href="structBaseOverlay_1_1HopDelayRecord.html#abcc398fdefba9230fcafb94e701f3071">val</a> += baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#aadbcf2336edf7d773dfbd6aec4da7b80">getHopDelay</a>(j);
- <a name="l00972"></a>00972 }
- <a name="l00973"></a>00973 );
- <a name="l00974"></a>00974 }
- <a name="l00975"></a>00975
- <a name="l00976"></a>00976 <span class="comment">// handle encapsulated message at destination node</span>
- <a name="l00977"></a>00977 <span class="keywordflow">if</span> (((baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>() == ITERATIVE_ROUTING)
- <a name="l00978"></a>00978 || (baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>() == EXHAUSTIVE_ITERATIVE_ROUTING)
- <a name="l00979"></a>00979 )
- <a name="l00980"></a>00980 || <a class="code" href="classBaseOverlay.html#a42f4c08f6408d155a9907957ecf12d79" title="Hook for forwarded message in recursive lookup mode.">recursiveRoutingHook</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>, baseRouteMsg)) {
- <a name="l00981"></a>00981 <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">handleBaseOverlayMessage</a>(tmpMsg, baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>());
- <a name="l00982"></a>00982 <span class="keyword">delete</span> baseRouteMsg;
- <a name="l00983"></a>00983 }
- <a name="l00984"></a>00984 <span class="keywordflow">return</span>;
- <a name="l00985"></a>00985 } <span class="keywordflow">else</span> {
- <a name="l00986"></a>00986 <span class="comment">// forward msg if this node is not responsible for the key</span>
- <a name="l00987"></a>00987 baseRouteMsg->setControlInfo(overlayCtrlInfo);
- <a name="l00988"></a>00988
- <a name="l00989"></a>00989 <span class="comment">// if this node is malicious drop the message</span>
- <a name="l00990"></a>00990 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">isMalicious</a>() && <a class="code" href="classBaseOverlay.html#a3bcd2bdd704803d7ec8ae77633cf03fa" title="if node is malicious, it drops all received BaseRouteMessages">dropRouteMessageAttack</a>) {
- <a name="l00991"></a>00991 EV << <span class="stringliteral">"[BaseOverlay::handleBaseOverlayMessage() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l00992"></a>00992 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l00993"></a>00993 << <span class="stringliteral">" BaseRouteMessage gets dropped because this node is malicious"</span>
- <a name="l00994"></a>00994 << endl;
- <a name="l00995"></a>00995 <span class="comment">//std::cout << "malicious!" << std::endl;</span>
- <a name="l00996"></a>00996 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l00997"></a>00997 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += baseRouteMsg->getByteLength());
- <a name="l00998"></a>00998 <span class="keyword">delete</span> baseRouteMsg;
- <a name="l00999"></a>00999 <span class="keywordflow">return</span>;
- <a name="l01000"></a>01000 }
- <a name="l01001"></a>01001
- <a name="l01002"></a>01002 <a class="code" href="classBaseOverlay.html#a6f2c598f5d3989a63a8cc7220f1aaf76" title="Sends a message to an overlay node, with the generic routing algorithm.">sendToKey</a>(baseRouteMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>(), baseRouteMsg, 1, sourceRoute);
- <a name="l01003"></a>01003 <span class="keywordflow">return</span>;
- <a name="l01004"></a>01004 }
- <a name="l01005"></a>01005 <span class="keywordflow">break</span>;
- <a name="l01006"></a>01006 }
- <a name="l01007"></a>01007
- <a name="l01008"></a>01008 <span class="keywordflow">default</span>:
- <a name="l01009"></a>01009 EV << <span class="stringliteral">"[BaseOverlay::handleBaseOverlayMessage() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01010"></a>01010 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01011"></a>01011 << <span class="stringliteral">" Received unknown message from UDP of type "</span> << msg->getName()
- <a name="l01012"></a>01012 << endl;
- <a name="l01013"></a>01013 <span class="keywordflow">break</span>;
- <a name="l01014"></a>01014 }
- <a name="l01015"></a>01015 }
- <a name="l01016"></a>01016
- <a name="l01017"></a><a class="code" href="classBaseOverlay.html#ac1cf471c2918271ed0244e4a9579c878">01017</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#ac1cf471c2918271ed0244e4a9579c878" title="callback-method for events at the NotificationBoard">BaseOverlay::receiveChangeNotification</a>(<span class="keywordtype">int</span> category, <span class="keyword">const</span> cPolymorphic * details)
- <a name="l01018"></a>01018 {
- <a name="l01019"></a>01019 Enter_Method_Silent();
- <a name="l01020"></a>01020 <span class="keywordflow">if</span> (category == NF_OVERLAY_TRANSPORTADDRESS_CHANGED) {
- <a name="l01021"></a>01021 <a class="code" href="classBaseOverlay.html#a2a53481e2aaf78e6826ab72378bebf48" title="This method gets call if the node has a new TransportAddress (IP address) because he changed his acce...">handleTransportAddressChangedNotification</a>();
- <a name="l01022"></a>01022 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (category == NF_OVERLAY_NODE_LEAVE) {
- <a name="l01023"></a>01023 <a class="code" href="classBaseOverlay.html#af9ea0a59c26b70c50c63c2c1dc4c2ec3" title="This method gets call **.gracefulLeaveDelay seconds before it is killed.">handleNodeLeaveNotification</a>();
- <a name="l01024"></a>01024 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (category == NF_OVERLAY_NODE_GRACEFUL_LEAVE) {
- <a name="l01025"></a>01025 <a class="code" href="classBaseOverlay.html#aa2d70984acd164839ca92694a02e7a91" title="This method gets call **.gracefulLeaveDelay seconds before it is killed if this node is among the gra...">handleNodeGracefulLeaveNotification</a>();
- <a name="l01026"></a>01026 }
- <a name="l01027"></a>01027 }
- <a name="l01028"></a>01028
- <a name="l01029"></a><a class="code" href="classBaseOverlay.html#a2a53481e2aaf78e6826ab72378bebf48">01029</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a2a53481e2aaf78e6826ab72378bebf48" title="This method gets call if the node has a new TransportAddress (IP address) because he changed his acce...">BaseOverlay::handleTransportAddressChangedNotification</a>()
- <a name="l01030"></a>01030 {
- <a name="l01031"></a>01031 <span class="comment">// get new ip address</span>
- <a name="l01032"></a>01032 <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a1c7b834dc2e6e738f1f4db8711a12814" title="Sets the ip address, port and NAT type.">setIp</a>(IPAddressResolver().addressOf(
- <a name="l01033"></a>01033 getParentModule()->getParentModule()));
- <a name="l01034"></a>01034
- <a name="l01035"></a>01035 <a class="code" href="classBaseOverlay.html#a3eefb56c2396601373c89d21b5b58110" title="Join the overlay with a given nodeID in thisNode.key.">joinOverlay</a>();
- <a name="l01036"></a>01036 }
- <a name="l01037"></a>01037
- <a name="l01038"></a><a class="code" href="classBaseOverlay.html#af9ea0a59c26b70c50c63c2c1dc4c2ec3">01038</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#af9ea0a59c26b70c50c63c2c1dc4c2ec3" title="This method gets call **.gracefulLeaveDelay seconds before it is killed.">BaseOverlay::handleNodeLeaveNotification</a>()
- <a name="l01039"></a>01039 {
- <a name="l01040"></a>01040 <span class="comment">// ...</span>
- <a name="l01041"></a>01041 }
- <a name="l01042"></a>01042
- <a name="l01043"></a><a class="code" href="classBaseOverlay.html#aa2d70984acd164839ca92694a02e7a91">01043</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#aa2d70984acd164839ca92694a02e7a91" title="This method gets call **.gracefulLeaveDelay seconds before it is killed if this node is among the gra...">BaseOverlay::handleNodeGracefulLeaveNotification</a>()
- <a name="l01044"></a>01044 {
- <a name="l01045"></a>01045 <span class="comment">// ...</span>
- <a name="l01046"></a>01046 }
- <a name="l01047"></a>01047
- <a name="l01048"></a>01048 <span class="comment">//virtual protected</span>
- <a name="l01049"></a><a class="code" href="classBaseOverlay.html#aef92d042c22b47c123e59a831acb7033">01049</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#aef92d042c22b47c123e59a831acb7033" title="Processes &quot;timer&quot; self-messages.">BaseOverlay::handleAppMessage</a>(cMessage* msg)
- <a name="l01050"></a>01050 {
- <a name="l01051"></a>01051 <span class="keyword">delete</span> msg;
- <a name="l01052"></a>01052 }
- <a name="l01053"></a>01053
- <a name="l01054"></a><a class="code" href="classBaseOverlay.html#a31d7dd39ddc9e62ad92f69f6d7210344">01054</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a31d7dd39ddc9e62ad92f69f6d7210344" title="Processes messages from underlay.">BaseOverlay::handleUDPMessage</a>(<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg)
- <a name="l01055"></a>01055 {
- <a name="l01056"></a>01056 <span class="keyword">delete</span> msg;
- <a name="l01057"></a>01057 }
- <a name="l01058"></a>01058
- <a name="l01059"></a>01059 <span class="comment">//virtual protected</span>
- <a name="l01060"></a><a class="code" href="classBaseOverlay.html#a921ac1fec5765f4099276800a82953ab">01060</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a921ac1fec5765f4099276800a82953ab" title="Collect overlay specific sent messages statistics.">BaseOverlay::recordOverlaySentStats</a>(<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg)
- <a name="l01061"></a>01061 {
- <a name="l01062"></a>01062 <span class="comment">// collect statistics ...</span>
- <a name="l01063"></a>01063 }
- <a name="l01064"></a>01064
- <a name="l01065"></a><a class="code" href="classBaseOverlay.html#a9da615809e832cbc4645cc732d510277">01065</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a9da615809e832cbc4645cc732d510277" title="Sets the overlay ready icon and register/deregisters the node at the GlobalNodeList.">BaseOverlay::setOverlayReady</a>(<span class="keywordtype">bool</span> ready)
- <a name="l01066"></a>01066 {
- <a name="l01067"></a>01067 <span class="comment">//TODO new setOverlayState(State state) function</span>
- <a name="l01068"></a>01068 <span class="keywordflow">if</span> ((ready && <a class="code" href="classBaseOverlay.html#aa484556ed4ff9e4e97394106d0c1d323" title="internal overlay state used for setOverlayReady()">internalReadyState</a>) || (!ready && !<a class="code" href="classBaseOverlay.html#aa484556ed4ff9e4e97394106d0c1d323" title="internal overlay state used for setOverlayReady()">internalReadyState</a>)) {
- <a name="l01069"></a>01069 <span class="keywordflow">return</span>;
- <a name="l01070"></a>01070 }
- <a name="l01071"></a>01071
- <a name="l01072"></a>01072 <a class="code" href="classBaseOverlay.html#aa484556ed4ff9e4e97394106d0c1d323" title="internal overlay state used for setOverlayReady()">internalReadyState</a> = ready;
- <a name="l01073"></a>01073
- <a name="l01074"></a>01074 getDisplayString().setTagArg(<span class="stringliteral">"i"</span>, 1, ready ? <span class="stringliteral">""</span> : <span class="stringliteral">"red"</span>);
- <a name="l01075"></a>01075 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">isMalicious</a>()) {
- <a name="l01076"></a>01076 getDisplayString().setTagArg(<span class="stringliteral">"i"</span>, 1, ready ? <span class="stringliteral">"green"</span> : <span class="stringliteral">"yellow"</span>);
- <a name="l01077"></a>01077 }
- <a name="l01078"></a>01078
- <a name="l01079"></a>01079 <a class="code" href="classBaseOverlay.html#a933e505ea77cae4ab0c8edcb77ade2c7" title="pointer to GlobalNodeList in this node">globalNodeList</a>-><a class="code" href="classGlobalNodeList.html#a94604495a81e687f7492564d788c7c36" title="Colors module-icon blue (ready), green (ready, malicious) or red (not ready).">setOverlayReadyIcon</a>(<a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>(), ready);
- <a name="l01080"></a>01080
- <a name="l01081"></a>01081 <span class="keywordflow">if</span> (ready) {
- <a name="l01082"></a>01082 <a class="code" href="classBaseOverlay.html#abe4dea93564123116c97d5c4721f0504" title="pointer to the BootstrapList module">bootstrapList</a>-><a class="code" href="classBootstrapList.html#a2b29d94b378a75148b777f560adcef13">registerBootstrapNode</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l01083"></a>01083 } <span class="keywordflow">else</span> {
- <a name="l01084"></a>01084 <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="l01085"></a>01085 }
- <a name="l01086"></a>01086
- <a name="l01087"></a>01087 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a59bde2858b8537864fbad3eb487dbc55" title="pointer to the GlobalParameters module">globalParameters</a>-><a class="code" href="classGlobalParameters.html#a8d700111d72e65cdefdf87e8f1b3b9b6">getPrintStateToStdOut</a>()) {
- <a name="l01088"></a>01088 std::cout << <span class="stringliteral">"OVERLAY STATE: "</span> << (ready ? <span class="stringliteral">"READY ("</span> : <span class="stringliteral">"OFFLINE ("</span>)
- <a name="l01089"></a>01089 << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a> << <span class="stringliteral">")"</span> << std::endl;
- <a name="l01090"></a>01090 }
- <a name="l01091"></a>01091
- <a name="l01092"></a>01092 <a class="code" href="classCompReadyMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">CompReadyMessage</a>* msg = <span class="keyword">new</span> <a class="code" href="classCompReadyMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">CompReadyMessage</a>;
- <a name="l01093"></a>01093 msg-><a class="code" href="classCompReadyMessage.html#ac5158504d6b97a32974f14c9b1a7a662">setReady</a>(ready);
- <a name="l01094"></a>01094 msg-><a class="code" href="classCompReadyMessage.html#ad9a52c5f788e0c11a75bbb5df3855ac0">setComp</a>(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5ead1b904580b02f8adaa1ab2de239c4c79">OVERLAY_COMP</a>);
- <a name="l01095"></a>01095
- <a name="l01096"></a>01096 <span class="comment">// notify all registered components about new overlay state</span>
- <a name="l01097"></a>01097 <a class="code" href="classBaseOverlay.html#a19c2c01f99a19bb7de0b30cdd866a2e0">sendMessageToAllComp</a>(msg, <a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5ead1b904580b02f8adaa1ab2de239c4c79">OVERLAY_COMP</a>);
- <a name="l01098"></a>01098 }
- <a name="l01099"></a>01099
- <a name="l01100"></a>01100
- <a name="l01101"></a>01101
- <a name="l01102"></a>01102 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l01103"></a>01103 <span class="comment">//--- Messages -----------------------------------------------------------</span>
- <a name="l01104"></a>01104 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l01105"></a>01105
- <a name="l01106"></a><a class="code" href="classBaseOverlay.html#ac93829bc8095a76e6208cf0ec12188b0">01106</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#ac93829bc8095a76e6208cf0ec12188b0">BaseOverlay::sendRouteMessage</a>(<span class="keyword">const</span> <a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>& dest,
- <a name="l01107"></a>01107 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* msg,
- <a name="l01108"></a>01108 <span class="keywordtype">bool</span> ack)
- <a name="l01109"></a>01109 {
- <a name="l01110"></a>01110 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* ctrlInfo =
- <a name="l01111"></a>01111 <span class="keyword">dynamic_cast<</span><a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*<span class="keyword">></span>(msg->removeControlInfo());
- <a name="l01112"></a>01112
- <a name="l01113"></a>01113 <span class="comment">// records statistics, if we forward this message</span>
- <a name="l01114"></a>01114 <span class="keywordflow">if</span> (ctrlInfo && ctrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad12b7ac74244fb7ab79ebf41e05fe79c">getLastHop</a>().<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>() != <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()) {
- <a name="l01115"></a>01115 <span class="keywordflow">if</span> (msg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_DATA_STAT) {
- <a name="l01116"></a>01116 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a341a65ab7c50dfbc8222c1adf4f08a99" title="number of forwarded app data packets">numAppDataForwarded</a>++;
- <a name="l01117"></a>01117 <a class="code" href="classBaseOverlay.html#a1c90204205e7e5b8f0f12fe4056914e6" title="number of forwarded app data bytes at out-gate">bytesAppDataForwarded</a> += msg->getByteLength());
- <a name="l01118"></a>01118 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (msg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_LOOKUP_STAT){
- <a name="l01119"></a>01119 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a8f5ff290e99ab78f3e0bd4a489bfcadd" title="number of forwarded app lookup packets">numAppLookupForwarded</a>++;
- <a name="l01120"></a>01120 <a class="code" href="classBaseOverlay.html#adeff8c454760c6eb4ca847e8dda252a7" title="number of forwarded app lookup bytes at out-gate">bytesAppLookupForwarded</a> += msg->getByteLength());
- <a name="l01121"></a>01121 } <span class="keywordflow">else</span> {
- <a name="l01122"></a>01122 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a05fa895acb368180bbca74d92152d2f7" title="number of forwarded maintenance packets">numMaintenanceForwarded</a>++;
- <a name="l01123"></a>01123 <a class="code" href="classBaseOverlay.html#a8dbb1ce4eee057f23bea55e5e4a7d13b" title="number of forwarded maintenance bytes at out-gate">bytesMaintenanceForwarded</a> += msg->getByteLength());
- <a name="l01124"></a>01124 }
- <a name="l01125"></a>01125 }
- <a name="l01126"></a>01126
- <a name="l01127"></a>01127 <span class="keyword">delete</span> ctrlInfo;
- <a name="l01128"></a>01128
- <a name="l01129"></a>01129 <span class="keywordflow">if</span> (msg && (dest != <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>)) {
- <a name="l01130"></a>01130 msg-><a class="code" href="classBaseRouteMessage.html#a1c843714ac5feca3c13f1e39b77e9b5c">setHopCount</a>(msg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>() + 1);
- <a name="l01131"></a>01131 }
- <a name="l01132"></a>01132 <span class="keywordflow">if</span> (!ack)
- <a name="l01133"></a>01133 <a class="code" href="classBaseOverlay.html#a124850e5bc8d81b3eb4f3aec75868449" title="Sends message to underlay.">sendMessageToUDP</a>(dest, msg);
- <a name="l01134"></a>01134 <span class="keywordflow">else</span> {
- <a name="l01135"></a>01135 <a class="code" href="classNextHopCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">NextHopCall</a>* nextHopCall = <span class="keyword">new</span> <a class="code" href="classNextHopCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">NextHopCall</a>(msg->getName());
- <a name="l01136"></a>01136 nextHopCall->setBitLength(<a class="code" href="CommonMessages__m_8h.html#ad34959682756fd7714484c7326ae823b">NEXTHOPCALL_L</a>(nextHopCall));
- <a name="l01137"></a>01137 nextHopCall->encapsulate(msg);
- <a name="l01138"></a>01138 nextHopCall-><a class="code" href="classBaseOverlayMessage.html#a46fd21016c6fad4f167d5510f0481f49">setStatType</a>(msg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>());
- <a name="l01139"></a>01139
- <a name="l01140"></a>01140 <span class="comment">// TODO parameter, in recursive mode routeRetries should be 0,</span>
- <a name="l01141"></a>01141 <span class="comment">// in iterative mode routeRetries could be more than 0</span>
- <a name="l01142"></a>01142 uint8_t routeRetries = 0;
- <a name="l01143"></a>01143 <a class="code" href="classBaseRpc.html#ac128e0ff0d09f81b652f7d3e00ce9441" title="Sends a Remote-Procedure-Call message to the underlay ">sendUdpRpcCall</a>(dest, nextHopCall, NULL, -1, routeRetries);
- <a name="l01144"></a>01144 }
- <a name="l01145"></a>01145 }
- <a name="l01146"></a><a class="code" href="classBaseOverlay.html#a124850e5bc8d81b3eb4f3aec75868449">01146</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a124850e5bc8d81b3eb4f3aec75868449" title="Sends message to underlay.">BaseOverlay::sendMessageToUDP</a>(<span class="keyword">const</span> <a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>& dest,
- <a name="l01147"></a>01147 cPacket* msg)
- <a name="l01148"></a>01148 {
- <a name="l01149"></a>01149 <span class="comment">// if there's still a control info attached to the message, remove it</span>
- <a name="l01150"></a>01150 cPolymorphic* ctrlInfo = msg->removeControlInfo();
- <a name="l01151"></a>01151 <span class="keywordflow">if</span> (ctrlInfo != NULL)
- <a name="l01152"></a>01152 <span class="keyword">delete</span> ctrlInfo;
- <a name="l01153"></a>01153
- <a name="l01154"></a>01154 <span class="comment">// debug message</span>
- <a name="l01155"></a>01155 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a49ff0fb8c25792a1339d54a60c36f2cd" title="debug output ?">debugOutput</a>) {
- <a name="l01156"></a>01156 EV << <span class="stringliteral">"[BaseOverlay::sendMessageToUDP() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01157"></a>01157 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01158"></a>01158 << <span class="stringliteral">" Sending "</span> << *msg << <span class="stringliteral">" to "</span> << dest.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01159"></a>01159 << endl;
- <a name="l01160"></a>01160 }
- <a name="l01161"></a>01161
- <a name="l01162"></a>01162 msg->setKind(UDP_C_DATA);
- <a name="l01163"></a>01163 UDPControlInfo* udpControlInfo = <span class="keyword">new</span> UDPControlInfo();
- <a name="l01164"></a>01164 udpControlInfo->setSrcAddr(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>());
- <a name="l01165"></a>01165 udpControlInfo->setSrcPort(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a4cf99c434c5110935683624dc3702e0f" title="returns port">getPort</a>());
- <a name="l01166"></a>01166 udpControlInfo->setDestAddr(dest.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>());
- <a name="l01167"></a>01167 udpControlInfo->setDestPort(dest.<a class="code" href="classTransportAddress.html#a4cf99c434c5110935683624dc3702e0f" title="returns port">getPort</a>());
- <a name="l01168"></a>01168 msg->setControlInfo(udpControlInfo);
- <a name="l01169"></a>01169
- <a name="l01170"></a>01170 <span class="keywordflow">if</span> (dest != <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>) {
- <a name="l01171"></a>01171 <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* baseOverlayMsg
- <a name="l01172"></a>01172 = check_and_cast<<a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>*>(msg);
- <a name="l01173"></a>01173 <span class="comment">// record statistics, if message is not local</span>
- <a name="l01174"></a>01174 <span class="keywordflow">if</span> (baseOverlayMsg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_DATA_STAT) {
- <a name="l01175"></a>01175 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#aa8c1469e21c59a08a84dec36218582b4" title="number of sent app data packets (incl. forwarded packets)">numAppDataSent</a>++;
- <a name="l01176"></a>01176 <a class="code" href="classBaseOverlay.html#ae6453766e7a58060722a6323ee3923e4" title="number of sent app data bytes (incl. forwarded bytes)">bytesAppDataSent</a> += msg->getByteLength());
- <a name="l01177"></a>01177 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (baseOverlayMsg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_LOOKUP_STAT){
- <a name="l01178"></a>01178 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a5b42fe053fd79b9b62680cbfc740ec4f" title="number of sent app loookup packets (incl. forwarded packets)">numAppLookupSent</a>++; <a class="code" href="classBaseOverlay.html#a118e46bc3e194c63a70e28846480ffe4" title="number of sent app lookup bytes (incl. forwarded bytes)">bytesAppLookupSent</a> +=
- <a name="l01179"></a>01179 msg->getByteLength());
- <a name="l01180"></a>01180 } <span class="keywordflow">else</span> { <span class="comment">// MAINTENANCE_STAT</span>
- <a name="l01181"></a>01181 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#af1077d5c646390fb11d4f646fc22eaaa" title="number of sent maintenance packets (incl. forwarded packets)">numMaintenanceSent</a>++; <a class="code" href="classBaseOverlay.html#a27259327737ad8092c612756c0fe6fb4" title="number of sent maintenance bytes (incl. forwarded bytes)">bytesMaintenanceSent</a> +=
- <a name="l01182"></a>01182 msg->getByteLength());
- <a name="l01183"></a>01183 }
- <a name="l01184"></a>01184 <a class="code" href="classBaseOverlay.html#a921ac1fec5765f4099276800a82953ab" title="Collect overlay specific sent messages statistics.">recordOverlaySentStats</a>(baseOverlayMsg);
- <a name="l01185"></a>01185
- <a name="l01186"></a>01186 <span class="keywordflow">if</span> (dynamic_cast<BaseResponseMessage*>(msg) && <a class="code" href="classBaseOverlay.html#a077a698fb5f760290bc67e4a50dfed9e">getMeasureAuthBlock</a>()) {
- <a name="l01187"></a>01187 <span class="comment">// TODO: Also consider signed DhtPutMessages</span>
- <a name="l01188"></a>01188 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a30e11530c77c2164f0a5c98a489a9fab" title="number of bytes sent for rpc message signatures">bytesAuthBlockSent</a> += ceil(<a class="code" href="CommonMessages__m_8h.html#a06bed1f18c78d612efe98781ddd5f56f">AUTHBLOCK_L</a>/8.0));
- <a name="l01189"></a>01189 }
- <a name="l01190"></a>01190 } <span class="keywordflow">else</span> {
- <a name="l01191"></a>01191 <span class="keywordflow">if</span> (dest.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>() == <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()) { <span class="comment">// to same node, but different port</span>
- <a name="l01192"></a>01192 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#ae34cc8a058a4dae47a3815cba64ceba2" title="number of packets sent to same host but different port (SimpleMultiOverlayHost)">numInternalSent</a>++; <a class="code" href="classBaseOverlay.html#ad0af3d066a89ced910b082a980f68f25" title="number of bytes sent to same host but different port (SimpleMultiOverlayHost)">bytesInternalSent</a> += msg->getByteLength());
- <a name="l01193"></a>01193 }
- <a name="l01194"></a>01194 }
- <a name="l01195"></a>01195 send(msg, <span class="stringliteral">"udpOut"</span>);
- <a name="l01196"></a>01196 }
- <a name="l01197"></a>01197
- <a name="l01198"></a>01198 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l01199"></a>01199 <span class="comment">//--- Basic Routing ------------------------------------------------------</span>
- <a name="l01200"></a>01200 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l01201"></a>01201
- <a name="l01202"></a><a class="code" href="BaseOverlay_8cc.html#a400caf95d25f6d8cedf0f008f9a697ec">01202</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="BaseOverlay_8cc.html#a400caf95d25f6d8cedf0f008f9a697ec">pendingLookups</a> = 0;
- <a name="l01203"></a>01203
- <a name="l01204"></a><a class="code" href="classBaseOverlay.html#af2c8b2108703c4df49217a719f280bb8">01204</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#af2c8b2108703c4df49217a719f280bb8" title="creates a LookupSet">BaseOverlay::initLookups</a>()
- <a name="l01205"></a>01205 {
- <a name="l01206"></a>01206 <a class="code" href="classBaseOverlay.html#ad25b51c2d6c06dbe12c534307f43822e">lookups</a> = <a class="code" href="classBaseOverlay.html#a65cc359d4db3de08cde7ff0b3794f0c8">LookupSet</a>();
- <a name="l01207"></a>01207 }
- <a name="l01208"></a>01208
- <a name="l01209"></a><a class="code" href="classBaseOverlay.html#abaaca6fe44d8e317d56c90a14e0fcada">01209</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#abaaca6fe44d8e317d56c90a14e0fcada" title="deletes entries in lookups">BaseOverlay::finishLookups</a>()
- <a name="l01210"></a>01210 {
- <a name="l01211"></a>01211 <span class="keywordflow">while</span> (<a class="code" href="classBaseOverlay.html#ad25b51c2d6c06dbe12c534307f43822e">lookups</a>.size() > 0) {
- <a name="l01212"></a>01212 (*<a class="code" href="classBaseOverlay.html#ad25b51c2d6c06dbe12c534307f43822e">lookups</a>.begin())->abortLookup();
- <a name="l01213"></a>01213 }
- <a name="l01214"></a>01214 <a class="code" href="classBaseOverlay.html#ad25b51c2d6c06dbe12c534307f43822e">lookups</a>.clear();
- <a name="l01215"></a>01215 }
- <a name="l01216"></a>01216
- <a name="l01217"></a><a class="code" href="classSendToKeyListener.html">01217</a> <span class="keyword">class </span><a class="code" href="classSendToKeyListener.html">SendToKeyListener</a> : <span class="keyword">public</span> <a class="code" href="classLookupListener.html" title="This class declares an abstract lookup listener.">LookupListener</a>
- <a name="l01218"></a>01218 {
- <a name="l01219"></a>01219 <span class="keyword">private</span>:
- <a name="l01220"></a><a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">01220</a> <a class="code" href="classBaseOverlay.html" title="Base class for overlays.">BaseOverlay</a>* <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>;
- <a name="l01221"></a><a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">01221</a> <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* <a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a>;
- <a name="l01222"></a><a class="code" href="classSendToKeyListener.html#ad65c944612ead39d93ddb9cf69bfbb7a">01222</a> <a class="code" href="classGlobalStatistics.html" title="Module to record global statistics.">GlobalStatistics</a>* <a class="code" href="classSendToKeyListener.html#ad65c944612ead39d93ddb9cf69bfbb7a">globalStatistics</a>;
- <a name="l01223"></a>01223 <span class="keyword">public</span>:
- <a name="l01224"></a><a class="code" href="classSendToKeyListener.html#a27b16a40cfd5c515f94c9fad087d299f">01224</a> <a class="code" href="classSendToKeyListener.html#a27b16a40cfd5c515f94c9fad087d299f">SendToKeyListener</a>( <a class="code" href="classBaseOverlay.html" title="Base class for overlays.">BaseOverlay</a>* <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>, <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* <a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a> ) {
- <a name="l01225"></a>01225 this->overlay = overlay;
- <a name="l01226"></a>01226 this->msg = msg;
- <a name="l01227"></a>01227 <a class="code" href="classSendToKeyListener.html#ad65c944612ead39d93ddb9cf69bfbb7a">globalStatistics</a> = overlay-><a class="code" href="classBaseRpc.html#a9552ba3a2b09c83b3c561e65dab9f23d" title="pointer to GlobalStatistics module in this node">globalStatistics</a>;
- <a name="l01228"></a>01228 <a class="code" href="BaseOverlay_8cc.html#a400caf95d25f6d8cedf0f008f9a697ec">pendingLookups</a>++;
- <a name="l01229"></a>01229 }
- <a name="l01230"></a>01230
- <a name="l01231"></a><a class="code" href="classSendToKeyListener.html#a008de600db3cf76f5aaec9ba8dd7fb77">01231</a> <a class="code" href="classSendToKeyListener.html#a008de600db3cf76f5aaec9ba8dd7fb77">~SendToKeyListener</a>() {
- <a name="l01232"></a>01232 <a class="code" href="BaseOverlay_8cc.html#a400caf95d25f6d8cedf0f008f9a697ec">pendingLookups</a>--;
- <a name="l01233"></a>01233 <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a> = NULL;
- <a name="l01234"></a>01234 <span class="keywordflow">if</span> (<a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a> != NULL) {
- <a name="l01235"></a>01235 <span class="keyword">delete</span> <a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a>;
- <a name="l01236"></a>01236 <a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a> = NULL;
- <a name="l01237"></a>01237 }
- <a name="l01238"></a>01238 }
- <a name="l01239"></a>01239
- <a name="l01240"></a><a class="code" href="classSendToKeyListener.html#ae21d1e104bd5a9d0bda09e659a2938db">01240</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classSendToKeyListener.html#ae21d1e104bd5a9d0bda09e659a2938db">lookupFinished</a>(<a class="code" href="classAbstractLookup.html" title="This class declares an abstract iterative lookup.">AbstractLookup</a> *lookup) {
- <a name="l01241"></a>01241 <span class="keywordflow">if</span> (dynamic_cast<BaseRouteMessage*>(<a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a>)) {
- <a name="l01242"></a>01242 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* routeMsg = <span class="keyword">static_cast<</span><a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>*<span class="keyword">></span>(<a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a>);
- <a name="l01243"></a>01243 <span class="keywordflow">if</span> (lookup-><a class="code" href="classAbstractLookup.html#a698d5d467c714e4d114359d1078b505d" title="Returns true, if the lookup was successful.">isValid</a>()) {
- <a name="l01244"></a>01244 <span class="keywordflow">if</span> (lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>().size()==0) {
- <a name="l01245"></a>01245 EV << <span class="stringliteral">"[SendToKeyListener::lookupFinished()]\n"</span>
- <a name="l01246"></a>01246 <span class="stringliteral">" [ERROR] SendToKeyListener: Valid result, "</span>
- <a name="l01247"></a>01247 <span class="stringliteral">"but empty array."</span> << endl;
- <a name="l01248"></a>01248 } <span class="keywordflow">else</span> {
- <a name="l01249"></a>01249 routeMsg-><a class="code" href="classBaseRouteMessage.html#a1c843714ac5feca3c13f1e39b77e9b5c">setHopCount</a>(routeMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>()
- <a name="l01250"></a>01250 + lookup-><a class="code" href="classAbstractLookup.html#adf3affffd7d97d965f984f54eb3de415" title="Returns the total number of hops for all lookup paths.">getAccumulatedHops</a>());
- <a name="l01251"></a>01251
- <a name="l01252"></a>01252 <span class="keywordflow">for</span> (uint32_t i=0; i<lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>().size(); i++) {
- <a name="l01253"></a>01253 <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseOverlay.html#ac93829bc8095a76e6208cf0ec12188b0">sendRouteMessage</a>(lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>()[i],
- <a name="l01254"></a>01254 <span class="keyword">static_cast<</span><a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>*<span class="keyword">></span>
- <a name="l01255"></a>01255 (routeMsg-><a class="code" href="classBaseRouteMessage.html#ad63dbffa8c4c6d79c6781ed06c691a49">dup</a>()),
- <a name="l01256"></a>01256 <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseOverlay.html#a6e9090bf68f45a31d727a6c7f0501d43" title="send ACK when receiving route message">routeMsgAcks</a>);
- <a name="l01257"></a>01257 }
- <a name="l01258"></a>01258 }
- <a name="l01259"></a>01259 } <span class="keywordflow">else</span> {
- <a name="l01260"></a>01260 EV << <span class="stringliteral">"[SendToKeyListener::lookupFinished()]\n"</span>
- <a name="l01261"></a>01261 << <span class="stringliteral">" Lookup failed - dropping message"</span>
- <a name="l01262"></a>01262 << endl;
- <a name="l01263"></a>01263 <span class="comment">//std::cout << simTime() << " "</span>
- <a name="l01264"></a>01264 <span class="comment">// << routeMsg->getSrcNode()</span>
- <a name="l01265"></a>01265 <span class="comment">// << " [SendToKeyListener::lookupFinished()]\n"</span>
- <a name="l01266"></a>01266 <span class="comment">// << " Lookup failed - dropping message"</span>
- <a name="l01267"></a>01267 <span class="comment">// << std::endl;</span>
- <a name="l01268"></a>01268 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l01269"></a>01269 <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += routeMsg->getByteLength());
- <a name="l01270"></a>01270 }
- <a name="l01271"></a>01271 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast<LookupCall*>(<a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a>)) {
- <a name="l01272"></a>01272 <a class="code" href="classLookupCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupCall</a>* call = <span class="keyword">static_cast<</span><a class="code" href="classLookupCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupCall</a>*<span class="keyword">></span>(<a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a>);
- <a name="l01273"></a>01273 <a class="code" href="classLookupResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupResponse</a>* response = <span class="keyword">new</span> <a class="code" href="classLookupResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupResponse</a>();
- <a name="l01274"></a>01274 response-><a class="code" href="classLookupResponse.html#a1caf06537b25c06685f0d24be5cd74fe">setKey</a>(call-><a class="code" href="classLookupCall.html#ac899d550007c1e632e299e917d38b705">getKey</a>());
- <a name="l01275"></a>01275 response-><a class="code" href="classLookupResponse.html#a06ef22a95a92f70807bc68b86ddd2047">setHopCount</a>(lookup-><a class="code" href="classAbstractLookup.html#adf3affffd7d97d965f984f54eb3de415" title="Returns the total number of hops for all lookup paths.">getAccumulatedHops</a>());
- <a name="l01276"></a>01276 <span class="keywordflow">if</span> (lookup-><a class="code" href="classAbstractLookup.html#a698d5d467c714e4d114359d1078b505d" title="Returns true, if the lookup was successful.">isValid</a>()) {
- <a name="l01277"></a>01277 response-><a class="code" href="classLookupResponse.html#a6d307ceeb8f4325c3373c3464cff45be">setIsValid</a>(<span class="keyword">true</span>);
- <a name="l01278"></a>01278 response-><a class="code" href="classLookupResponse.html#ab82d47b328532843aa1f5352be560578">setSiblingsArraySize</a>(lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>().size());
- <a name="l01279"></a>01279 <span class="keywordflow">for</span> (uint32_t i=0; i<lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>().size(); i++) {
- <a name="l01280"></a>01280 response-><a class="code" href="classLookupResponse.html#af95b0fd01f50e42c30dfce876648f480">setSiblings</a>(i, lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>()[i]);
- <a name="l01281"></a>01281 }
- <a name="l01282"></a>01282 <span class="keywordflow">if</span> (lookup-><a class="code" href="classAbstractLookup.html#a0ad852a71fdafed808e0ebb8dcd3723e" title="Returns the result of the lookup.">getResult</a>().size() == 0) {
- <a name="l01283"></a>01283 EV << <span class="stringliteral">"[SendToKeyListener::lookupFinished() @ "</span>
- <a name="l01284"></a>01284 << <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01285"></a>01285 << <span class="stringliteral">" ("</span> << <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01286"></a>01286 << <span class="stringliteral">" LookupCall "</span>
- <a name="l01287"></a>01287 << call-><a class="code" href="classBaseRpcMessage.html#a79f78c32aa4461025a89e8de3bc35702">getNonce</a>()
- <a name="l01288"></a>01288 << <span class="stringliteral">" failed! (size=0)"</span> << endl;
- <a name="l01289"></a>01289 }
- <a name="l01290"></a>01290 } <span class="keywordflow">else</span> {
- <a name="l01291"></a>01291 response-><a class="code" href="classLookupResponse.html#a6d307ceeb8f4325c3373c3464cff45be">setIsValid</a>(<span class="keyword">false</span>);
- <a name="l01292"></a>01292 EV << <span class="stringliteral">"[SendToKeyListener::lookupFinished() @ "</span>
- <a name="l01293"></a>01293 << <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01294"></a>01294 << <span class="stringliteral">" ("</span> << <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01295"></a>01295 << <span class="stringliteral">" LookupCall "</span>
- <a name="l01296"></a>01296 << call-><a class="code" href="classBaseRpcMessage.html#a79f78c32aa4461025a89e8de3bc35702">getNonce</a>()
- <a name="l01297"></a>01297 << <span class="stringliteral">" failed!"</span> << endl;
- <a name="l01298"></a>01298 }
- <a name="l01299"></a>01299 <a class="code" href="classSendToKeyListener.html#ac6a8b10c63a4595450377b9beaa00490">overlay</a>-><a class="code" href="classBaseRpc.html#adc06091d348c98a5efbf54fe0afe8747" title="Send Remote-Procedure response message and deletes call message.">sendRpcResponse</a>(call, response);
- <a name="l01300"></a>01300 <a class="code" href="classSendToKeyListener.html#a76dd14829ae2b15ccd4a710ab6329ff4">msg</a> = NULL;
- <a name="l01301"></a>01301 } <span class="keywordflow">else</span> {
- <a name="l01302"></a>01302 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"SendToKeyListener::lookupFinished(): "</span>
- <a name="l01303"></a>01303 <span class="stringliteral">"Unknown message type!"</span>);
- <a name="l01304"></a>01304 }
- <a name="l01305"></a>01305 <span class="keyword">delete</span> <span class="keyword">this</span>;
- <a name="l01306"></a>01306 }
- <a name="l01307"></a>01307 };
- <a name="l01308"></a>01308
- <a name="l01309"></a><a class="code" href="classBaseOverlay.html#ad62efdef2b674f46e5368354efb6104f">01309</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#ad62efdef2b674f46e5368354efb6104f" title="Routes message through overlay.">BaseOverlay::route</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& key, <a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> destComp,
- <a name="l01310"></a>01310 <a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> srcComp, cPacket* msg,
- <a name="l01311"></a>01311 <span class="keyword">const</span> std::vector<TransportAddress>& sourceRoute,
- <a name="l01312"></a>01312 <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a> routingType)
- <a name="l01313"></a>01313 {
- <a name="l01314"></a>01314 <span class="keywordflow">if</span> (key.<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>() &&
- <a name="l01315"></a>01315 (!sourceRoute.size() || sourceRoute[0].isUnspecified()))
- <a name="l01316"></a>01316 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"route(): Key and hint unspecified!"</span>);
- <a name="l01317"></a>01317
- <a name="l01318"></a>01318 <span class="comment">// encapsulate in a app data message for multiplexing</span>
- <a name="l01319"></a>01319 <span class="comment">// to destination component</span>
- <a name="l01320"></a>01320 <a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>* baseAppDataMsg =
- <a name="l01321"></a>01321 <span class="keyword">new</span> <a class="code" href="classBaseAppDataMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseAppDataMessage</a>(<span class="stringliteral">"BaseAppDataMessage"</span>);
- <a name="l01322"></a>01322 baseAppDataMsg-><a class="code" href="classBaseOverlayMessage.html#a1441ce272062923bae9d821ac35ed7cf">setType</a>(<a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17eab0641a3f5bcb1e08ee72afe9583ff5e6">APPDATA</a>);
- <a name="l01323"></a>01323 baseAppDataMsg-><a class="code" href="classBaseAppDataMessage.html#aaac3c10c2cdef1373c06dc16a28cbcda">setDestComp</a>(destComp);
- <a name="l01324"></a>01324 baseAppDataMsg-><a class="code" href="classBaseAppDataMessage.html#a39b6e418a8897f4c1ec6adb756deea5f">setSrcComp</a>(srcComp);
- <a name="l01325"></a>01325 baseAppDataMsg->setBitLength(<a class="code" href="CommonMessages__m_8h.html#aebae47ba62d6bd9fe00ca6d779bf0e81">BASEAPPDATA_L</a>(baseAppDataMsg));
- <a name="l01326"></a>01326 baseAppDataMsg->setName(msg->getName());
- <a name="l01327"></a>01327
- <a name="l01328"></a>01328 baseAppDataMsg-><a class="code" href="classBaseOverlayMessage.html#a46fd21016c6fad4f167d5510f0481f49">setStatType</a>(<a class="code" href="CommonMessages__m_8h.html#a25418fa818fbb01cd8c0b2c4b0732cdfad8d082af8526e80f7de088c52ad1b7c0">APP_DATA_STAT</a>);
- <a name="l01329"></a>01329 baseAppDataMsg->encapsulate(msg);
- <a name="l01330"></a>01330
- <a name="l01331"></a>01331 <span class="comment">// debug output</span>
- <a name="l01332"></a>01332 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a49ff0fb8c25792a1339d54a60c36f2cd" title="debug output ?">debugOutput</a>) {
- <a name="l01333"></a>01333 EV << <span class="stringliteral">"[BaseOverlay::route() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01334"></a>01334 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01335"></a>01335 << <span class="stringliteral">" Received message from application"</span>
- <a name="l01336"></a>01336 << endl;
- <a name="l01337"></a>01337 }
- <a name="l01338"></a>01338
- <a name="l01339"></a>01339 <span class="keywordflow">if</span> (key.<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>() && sourceRoute.size() <= 1) {
- <a name="l01340"></a>01340 <a class="code" href="classBaseOverlay.html#a124850e5bc8d81b3eb4f3aec75868449" title="Sends message to underlay.">sendMessageToUDP</a>(sourceRoute[0], baseAppDataMsg);
- <a name="l01341"></a>01341 } <span class="keywordflow">else</span> {
- <a name="l01342"></a>01342 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#aa484556ed4ff9e4e97394106d0c1d323" title="internal overlay state used for setOverlayReady()">internalReadyState</a> == <span class="keyword">false</span>) {
- <a name="l01343"></a>01343 <span class="comment">// overlay not ready => sendToKey doesn't work yet</span>
- <a name="l01344"></a>01344 EV << <span class="stringliteral">"[BaseOverlay::route() @ "</span>
- <a name="l01345"></a>01345 << <a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>().<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01346"></a>01346 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>().<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01347"></a>01347 << <span class="stringliteral">" Couldn't route application message to key "</span>
- <a name="l01348"></a>01348 << key.<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16)
- <a name="l01349"></a>01349 << <span class="stringliteral">" because the overlay module is not ready!"</span> << endl;
- <a name="l01350"></a>01350 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l01351"></a>01351 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += baseAppDataMsg->getByteLength());
- <a name="l01352"></a>01352 <span class="keyword">delete</span> baseAppDataMsg;
- <a name="l01353"></a>01353 <span class="keywordflow">return</span>;
- <a name="l01354"></a>01354 }
- <a name="l01355"></a>01355
- <a name="l01356"></a>01356 <a class="code" href="classBaseOverlay.html#a6f2c598f5d3989a63a8cc7220f1aaf76" title="Sends a message to an overlay node, with the generic routing algorithm.">sendToKey</a>(key, baseAppDataMsg, 1, sourceRoute, routingType);
- <a name="l01357"></a>01357 }
- <a name="l01358"></a>01358 }
- <a name="l01359"></a>01359
- <a name="l01360"></a><a class="code" href="classBaseOverlay.html#a42f4c08f6408d155a9907957ecf12d79">01360</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#a42f4c08f6408d155a9907957ecf12d79" title="Hook for forwarded message in recursive lookup mode.">BaseOverlay::recursiveRoutingHook</a>(<span class="keyword">const</span> <a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>& dest,
- <a name="l01361"></a>01361 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* msg)
- <a name="l01362"></a>01362 {
- <a name="l01363"></a>01363 <span class="keywordflow">return</span> <span class="keyword">true</span>;
- <a name="l01364"></a>01364 }
- <a name="l01365"></a>01365
- <a name="l01366"></a><a class="code" href="classBaseOverlay.html#a6f2c598f5d3989a63a8cc7220f1aaf76">01366</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a6f2c598f5d3989a63a8cc7220f1aaf76" title="Sends a message to an overlay node, with the generic routing algorithm.">BaseOverlay::sendToKey</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& key, <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg,
- <a name="l01367"></a>01367 <span class="keywordtype">int</span> numSiblings,
- <a name="l01368"></a>01368 <span class="keyword">const</span> std::vector<TransportAddress>& sourceRoute,
- <a name="l01369"></a>01369 <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a> routingType)
- <a name="l01370"></a>01370 {
- <a name="l01371"></a>01371 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* routeMsg = NULL;
- <a name="l01372"></a>01372
- <a name="l01373"></a>01373 <span class="keywordflow">if</span> (routingType == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551a931137cd67090e50ef2ea3ccfb9e8d90">DEFAULT_ROUTING</a>) routingType = <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a>;
- <a name="l01374"></a>01374
- <a name="l01375"></a>01375 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a49ff0fb8c25792a1339d54a60c36f2cd" title="debug output ?">debugOutput</a>) {
- <a name="l01376"></a>01376 EV << <span class="stringliteral">"[BaseOverlay::sendToKey() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01377"></a>01377 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01378"></a>01378 << <span class="stringliteral">" Sending "</span> << msg << <span class="stringliteral">" to "</span> << key
- <a name="l01379"></a>01379 << endl;
- <a name="l01380"></a>01380 }
- <a name="l01381"></a>01381
- <a name="l01382"></a>01382 <span class="keywordflow">if</span> (key.<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>() &&
- <a name="l01383"></a>01383 !(sourceRoute.size() && !sourceRoute[0].isUnspecified()))
- <a name="l01384"></a>01384 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::sendToKey(): "</span>
- <a name="l01385"></a>01385 <span class="stringliteral">"unspecified destination address and key!"</span>);
- <a name="l01386"></a>01386
- <a name="l01387"></a>01387 <span class="keywordflow">if</span> (msg-><a class="code" href="classBaseOverlayMessage.html#a406e342c0841abe2d82b9bb5c1e2aabd">getType</a>() != OVERLAYROUTE) {
- <a name="l01388"></a>01388 assert(!msg->getControlInfo());
- <a name="l01389"></a>01389 routeMsg = <span class="keyword">new</span> <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>(<span class="stringliteral">"BaseRouteMessage"</span>);
- <a name="l01390"></a>01390 routeMsg->setType(<a class="code" href="CommonMessages__m_8h.html#a6af1a552a7a6bce33c291758c369b17ea9fb39f8e1c5f2ff00e45bb7294e5524f">OVERLAYROUTE</a>);
- <a name="l01391"></a>01391 routeMsg->setRoutingType(routingType);
- <a name="l01392"></a>01392 routeMsg->setDestKey(key);
- <a name="l01393"></a>01393 routeMsg->setSrcNode(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l01394"></a>01394 routeMsg->setStatType(msg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>());
- <a name="l01395"></a>01395 <span class="comment">// copy the name of the inner message</span>
- <a name="l01396"></a>01396 routeMsg->setName(msg->getName());
- <a name="l01397"></a>01397 routeMsg->setBitLength(<a class="code" href="CommonMessages__m_8h.html#aa51e9b4f9362c33b9a432fd496bc31d0">BASEROUTE_L</a>(routeMsg));
- <a name="l01398"></a>01398 routeMsg->encapsulate(msg);
- <a name="l01399"></a>01399
- <a name="l01400"></a>01400 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* routeCtrlInfo = <span class="keyword">new</span> <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>;
- <a name="l01401"></a>01401 routeCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a6c2c1955d30ba60f696247685dc3d6ae">setLastHop</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l01402"></a>01402 routeCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a129cf7292587fa2ee6e4e6238c5e4d33">setTransportType</a>(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a03dcc78e081682d383ff0baec54dcf8c">ROUTE_TRANSPORT</a>);
- <a name="l01403"></a>01403 routeCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a2e3bd66c1e71acd70a6d87817efe15db">setRoutingType</a>(routingType);
- <a name="l01404"></a>01404 routeMsg->setControlInfo(routeCtrlInfo);
- <a name="l01405"></a>01405
- <a name="l01406"></a>01406 <span class="comment">//message marked as not already forwarded to tier1</span>
- <a name="l01407"></a>01407 routeMsg->setContextPointer(NULL);
- <a name="l01408"></a>01408 } <span class="keywordflow">else</span> {
- <a name="l01409"></a>01409 routeMsg = check_and_cast<<a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>*>(msg);
- <a name="l01410"></a>01410 routingType = <span class="keyword">static_cast<</span><a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a><span class="keyword">></span>(routeMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>());
- <a name="l01411"></a>01411 }
- <a name="l01412"></a>01412
- <a name="l01413"></a>01413 <span class="comment">// set timestamp for next hop</span>
- <a name="l01414"></a>01414 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a2694627a0082c456367bfa472fff56b9" title="collect delay for single hops">collectPerHopDelay</a>) {
- <a name="l01415"></a>01415 routeMsg-><a class="code" href="classBaseRouteMessage.html#a585ddc2330c8ef88a104c527f7929684">setHopStamp</a>(simTime());
- <a name="l01416"></a>01416 }
- <a name="l01417"></a>01417
- <a name="l01418"></a>01418 <span class="keywordflow">if</span> (sourceRoute.size() && !sourceRoute[0].isUnspecified()) {
- <a name="l01419"></a>01419 <span class="comment">// send msg to nextHop if specified (used for e.g. join rpcs)</span>
- <a name="l01420"></a>01420 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* ctrlInfo = check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>
- <a name="l01421"></a>01421 (routeMsg->getControlInfo());
- <a name="l01422"></a>01422 ctrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a129cf7292587fa2ee6e4e6238c5e4d33">setTransportType</a>(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a01580b2e886cd821bd7f3f2bcd7c690c">UDP_TRANSPORT</a>);
- <a name="l01423"></a>01423 assert(routeMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>() == 0);
- <a name="l01424"></a>01424 routeMsg-><a class="code" href="classBaseRouteMessage.html#a3cb14c09b287d613f26d58ad39fec4d0">setNextHopsArraySize</a>(sourceRoute.size());
- <a name="l01425"></a>01425 <span class="keywordflow">for</span> (uint32_t i = 0; i < sourceRoute.size(); ++i)
- <a name="l01426"></a>01426 routeMsg-><a class="code" href="classBaseRouteMessage.html#a85bb1a80fafad5e8a84b1bf96eb8befc">setNextHops</a>(i, sourceRoute[i]);
- <a name="l01427"></a>01427 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a42f4c08f6408d155a9907957ecf12d79" title="Hook for forwarded message in recursive lookup mode.">recursiveRoutingHook</a>(sourceRoute[0], routeMsg)) { <span class="comment">//test</span>
- <a name="l01428"></a>01428 <a class="code" href="classBaseOverlay.html#ac93829bc8095a76e6208cf0ec12188b0">sendRouteMessage</a>(sourceRoute[0], routeMsg, <a class="code" href="classBaseOverlay.html#a6e9090bf68f45a31d727a6c7f0501d43" title="send ACK when receiving route message">routeMsgAcks</a>);
- <a name="l01429"></a>01429 }
- <a name="l01430"></a>01430 <span class="keywordflow">return</span>;
- <a name="l01431"></a>01431 }
- <a name="l01432"></a>01432
- <a name="l01433"></a>01433 <span class="keywordflow">if</span> ((routingType == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551ae4bd936cbb47803986c83242cbb51867">ITERATIVE_ROUTING</a>)
- <a name="l01434"></a>01434 || (routingType == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551ad60cf756d6bb24af372d7fe7c279f44d">EXHAUSTIVE_ITERATIVE_ROUTING</a>)
- <a name="l01435"></a>01435 ) {
- <a name="l01436"></a>01436
- <a name="l01437"></a>01437 <span class="comment">// create lookup and sent to key</span>
- <a name="l01438"></a>01438 <a class="code" href="classAbstractLookup.html" title="This class declares an abstract iterative lookup.">AbstractLookup</a>* lookup = <a class="code" href="classBaseOverlay.html#a205a7d44401fb3d77b146e23b2904b6f" title="Creates an abstract iterative lookup instance.">createLookup</a>(routingType, routeMsg, NULL,
- <a name="l01439"></a>01439 (routeMsg-><a class="code" href="classBaseOverlayMessage.html#af0a4bf31778e05a809f8d55dff5bfcc1">getStatType</a>() == APP_DATA_STAT));
- <a name="l01440"></a>01440 lookup-><a class="code" href="classAbstractLookup.html#aa1bda70950cbd160ea78d1fcbd8c7767" title="Lookup siblings for a key.">lookup</a>(routeMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>(), numSiblings, <a class="code" href="classBaseOverlay.html#abffe6fbd25963bc2b7542f22ba6455b9" title="maximum hop count">hopCountMax</a>,
- <a name="l01441"></a>01441 0, <span class="keyword">new</span> <a class="code" href="classBaseOverlay.html#a4083c91b7d09ceaa7fd2768570814d77">SendToKeyListener</a>(<span class="keyword">this</span>, routeMsg));
- <a name="l01442"></a>01442 } <span class="keywordflow">else</span> {
- <a name="l01443"></a>01443 <span class="comment">// recursive routing</span>
- <a name="l01444"></a>01444 <a class="code" href="classBaseKeySortedVector.html">NodeVector</a>* nextHops = <a class="code" href="classBaseOverlay.html#a7cbdce336237331b67a3c69c4e43d489" title="Implements the find node call.">findNode</a>(routeMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>(),
- <a name="l01445"></a>01445 <a class="code" href="classBaseOverlay.html#ad0094285f9af244aec5e5fe600126243" title="numRedundantNodes for recursive routing">recNumRedundantNodes</a>,
- <a name="l01446"></a>01446 numSiblings, routeMsg);
- <a name="l01447"></a>01447
- <a name="l01448"></a>01448 <span class="keywordflow">if</span> (nextHops->size() == 0) {
- <a name="l01449"></a>01449 EV << <span class="stringliteral">"[BaseOverlay::sendToKey() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01450"></a>01450 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01451"></a>01451 << <span class="stringliteral">" FindNode() returned NULL - dropping message"</span>
- <a name="l01452"></a>01452 << endl;
- <a name="l01453"></a>01453 <span class="comment">//std::cout << simTime() << " " << thisNode.getIp() << " " << state</span>
- <a name="l01454"></a>01454 <span class="comment">// << " FindNode() returned NULL - dropping message "</span>
- <a name="l01455"></a>01455 <span class="comment">// << routeMsg->getName() << " from "</span>
- <a name="l01456"></a>01456 <span class="comment">// << routeMsg->getSrcNode() << std::endl;</span>
- <a name="l01457"></a>01457
- <a name="l01458"></a>01458 <span class="comment">// statistics</span>
- <a name="l01459"></a>01459 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++; <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += routeMsg->getByteLength());
- <a name="l01460"></a>01460 <span class="keyword">delete</span> routeMsg;
- <a name="l01461"></a>01461 } <span class="keywordflow">else</span> {
- <a name="l01462"></a>01462 <span class="comment">// delete message if the hop count maximum is exceeded</span>
- <a name="l01463"></a>01463 <span class="keywordflow">if</span> (routeMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>() >= <a class="code" href="classBaseOverlay.html#abffe6fbd25963bc2b7542f22ba6455b9" title="maximum hop count">hopCountMax</a>) {
- <a name="l01464"></a>01464
- <a name="l01465"></a>01465 EV << <span class="stringliteral">"[BaseOverlay::sendToKey() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01466"></a>01466 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01467"></a>01467 << <span class="stringliteral">" Discards "</span> << routeMsg->getName() << <span class="stringliteral">" from "</span>
- <a name="l01468"></a>01468 << routeMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>().<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>() << <span class="stringliteral">"\n"</span>
- <a name="l01469"></a>01469 << <span class="stringliteral">" The hop count maximum has been exceeded ("</span>
- <a name="l01470"></a>01470 << routeMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>() << <span class="stringliteral">">="</span>
- <a name="l01471"></a>01471 << <a class="code" href="classBaseOverlay.html#abffe6fbd25963bc2b7542f22ba6455b9" title="maximum hop count">hopCountMax</a> << <span class="stringliteral">")"</span>
- <a name="l01472"></a>01472 << endl;
- <a name="l01473"></a>01473 <span class="comment">//std::cout << "[BaseOverlay::sendToKey() @ " << thisNode.getIp()</span>
- <a name="l01474"></a>01474 <span class="comment">// << " (" << thisNode.getKey().toString(16) << ")]\n"</span>
- <a name="l01475"></a>01475 <span class="comment">// << " Discards " << routeMsg->getName() << " from "</span>
- <a name="l01476"></a>01476 <span class="comment">// << routeMsg->getSrcNode().getIp() << "\n"</span>
- <a name="l01477"></a>01477 <span class="comment">// << " The hop count maximum has been exceeded ("</span>
- <a name="l01478"></a>01478 <span class="comment">// << routeMsg->getHopCount() << ">="</span>
- <a name="l01479"></a>01479 <span class="comment">// << hopCountMax << ")"</span>
- <a name="l01480"></a>01480 <span class="comment">// << std::endl;</span>
- <a name="l01481"></a>01481
- <a name="l01482"></a>01482 <span class="comment">// statistics</span>
- <a name="l01483"></a>01483 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l01484"></a>01484 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += routeMsg->getByteLength());
- <a name="l01485"></a>01485 <span class="keyword">delete</span> routeMsg;
- <a name="l01486"></a>01486 <span class="keyword">delete</span> nextHops;
- <a name="l01487"></a>01487 <span class="keywordflow">return</span>;
- <a name="l01488"></a>01488 }
- <a name="l01489"></a>01489
- <a name="l01490"></a>01490 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo =
- <a name="l01491"></a>01491 <span class="keyword">dynamic_cast<</span><a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*<span class="keyword">></span>(routeMsg->getControlInfo());
- <a name="l01492"></a>01492 assert(overlayCtrlInfo);
- <a name="l01493"></a>01493
- <a name="l01494"></a>01494 <span class="comment">// check and choose nextHop candidate</span>
- <a name="l01495"></a>01495 <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>* nextHop = NULL;
- <a name="l01496"></a>01496 <span class="keywordtype">bool</span> err, isSibling;
- <a name="l01497"></a>01497 isSibling = <a class="code" href="classBaseOverlay.html#ab5887b89ba9da5973068e834feb69ce7" title="Query if a node is among the siblings for a given key.">isSiblingFor</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>, routeMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>(),
- <a name="l01498"></a>01498 numSiblings, &err);
- <a name="l01499"></a>01499
- <a name="l01500"></a>01500 <span class="comment">// if route is recorded we can do a real loop detection</span>
- <a name="l01501"></a>01501 std::set<TransportAddress> visitedHops;
- <a name="l01502"></a>01502 <span class="keywordflow">for</span> (uint32_t i = 0; i < routeMsg-><a class="code" href="classBaseRouteMessage.html#a4d937e983eb4887400e41749b55ebecb">getVisitedHopsArraySize</a>(); ++i) {
- <a name="l01503"></a>01503 visitedHops.insert(routeMsg-><a class="code" href="classBaseRouteMessage.html#a5e4624df761b01f0df433ef0ace1c597">getVisitedHops</a>(i));
- <a name="l01504"></a>01504 }
- <a name="l01505"></a>01505
- <a name="l01506"></a>01506 <span class="keywordflow">for</span> (uint32_t index = 0; nextHop == NULL && nextHops->size() > index;
- <a name="l01507"></a>01507 ++index) {
- <a name="l01508"></a>01508 nextHop = &((*nextHops)[index]);
- <a name="l01509"></a>01509 <span class="comment">// loop detection</span>
- <a name="l01510"></a>01510 <span class="keywordflow">if</span> (((overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad12b7ac74244fb7ab79ebf41e05fe79c">getLastHop</a>() == *nextHop) &&
- <a name="l01511"></a>01511 (*nextHop != <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>)) ||
- <a name="l01512"></a>01512 (visitedHops.find(*nextHop) != visitedHops.end()) ||
- <a name="l01513"></a>01513 <span class="comment">// do not forward msg to source node</span>
- <a name="l01514"></a>01514 ((*nextHop == routeMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>()) &&
- <a name="l01515"></a>01515 (<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a> != routeMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>())) ||
- <a name="l01516"></a>01516 <span class="comment">// nextHop is thisNode, but isSiblingFor() is false</span>
- <a name="l01517"></a>01517 ((*nextHop == <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>) && (!isSibling))) {
- <a name="l01518"></a>01518 nextHop = NULL;
- <a name="l01519"></a>01519 }
- <a name="l01520"></a>01520 }
- <a name="l01521"></a>01521
- <a name="l01522"></a>01522 <span class="keywordflow">if</span> (nextHop == NULL) {
- <a name="l01523"></a>01523 <span class="keywordflow">if</span> (!<a class="code" href="classBaseOverlay.html#a53ded56af8bba8e4caa9a9b29e01ab87">checkFindNode</a>(routeMsg)) {
- <a name="l01524"></a>01524 EV << <span class="stringliteral">"[BaseOverlay::sendToKey() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01525"></a>01525 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01526"></a>01526 << <span class="stringliteral">" Discards "</span> << routeMsg->getName() << <span class="stringliteral">" from "</span>
- <a name="l01527"></a>01527 << routeMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>().<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>() << <span class="stringliteral">"\n"</span>
- <a name="l01528"></a>01528 << <span class="stringliteral">" No useful nextHop found!"</span>
- <a name="l01529"></a>01529 << endl;
- <a name="l01530"></a>01530 <span class="comment">//std::cout << thisNode.getIp() << " packet from "</span>
- <a name="l01531"></a>01531 <span class="comment">// << routeMsg->getSrcNode().getIp()</span>
- <a name="l01532"></a>01532 <span class="comment">// << " dropped: " << routeMsg</span>
- <a name="l01533"></a>01533 <span class="comment">// << " " << state << std::endl;</span>
- <a name="l01534"></a>01534 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l01535"></a>01535 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += routeMsg->getByteLength());
- <a name="l01536"></a>01536 }
- <a name="l01537"></a>01537 <span class="keyword">delete</span> routeMsg;
- <a name="l01538"></a>01538 <span class="keyword">delete</span> nextHops;
- <a name="l01539"></a>01539 <span class="keywordflow">return</span>;
- <a name="l01540"></a>01540 }
- <a name="l01541"></a>01541
- <a name="l01542"></a>01542 assert(!nextHop-><a class="code" href="classNodeHandle.html#ab5136375a4548ced7c2014a73c8743c9" title="indicates if this NodeHandle is specified">isUnspecified</a>());
- <a name="l01543"></a>01543
- <a name="l01544"></a>01544 <span class="comment">// callForward to app</span>
- <a name="l01545"></a>01545 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#ac9acbeb30646d54f620d87641d91b113" title="forward messages to applications?">useCommonAPIforward</a> &&
- <a name="l01546"></a>01546 dynamic_cast<BaseAppDataMessage*>(
- <a name="l01547"></a>01547 routeMsg->getEncapsulatedPacket()) &&
- <a name="l01548"></a>01548 routeMsg->getContextPointer() == NULL) {
- <a name="l01549"></a>01549 <a class="code" href="classBaseOverlay.html#a71bcb54aa4fc66bdf97cc9c87fffc318" title="Calls forward function in application.">callForward</a>(routeMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>(), routeMsg, *nextHop);
- <a name="l01550"></a>01550 <span class="keyword">delete</span> nextHops;
- <a name="l01551"></a>01551 <span class="keywordflow">return</span>;
- <a name="l01552"></a>01552 }
- <a name="l01553"></a>01553 <span class="comment">//message marked as not already forwarded</span>
- <a name="l01554"></a>01554 routeMsg->setContextPointer(NULL);
- <a name="l01555"></a>01555
- <a name="l01556"></a>01556 <span class="comment">// is this node responsible?</span>
- <a name="l01557"></a>01557 <span class="keywordflow">if</span> (*nextHop == <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>) {
- <a name="l01558"></a>01558 <span class="keywordflow">if</span> (isSibling && !err) {
- <a name="l01559"></a>01559 <span class="comment">//EV << "[BaseOverlay::sendToKey() @ " << thisNode.getIp()</span>
- <a name="l01560"></a>01560 <span class="comment">// << " (" << thisNode.getKey().toString(16) << ")]\n"</span>
- <a name="l01561"></a>01561 <span class="comment">// << " Forwards msg for key " << routeMsg->getDestKey() "\n"</span>
- <a name="l01562"></a>01562 <span class="comment">// << " to node " << (*nextHops)[0]</span>
- <a name="l01563"></a>01563 <span class="comment">// << endl;</span>
- <a name="l01564"></a>01564 <span class="keyword">delete</span> nextHops;
- <a name="l01565"></a>01565 assert(routeMsg->getControlInfo());
- <a name="l01566"></a>01566 <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">handleBaseOverlayMessage</a>(routeMsg, key);
- <a name="l01567"></a>01567 <span class="keywordflow">return</span>;
- <a name="l01568"></a>01568 } <span class="keywordflow">else</span> {
- <a name="l01569"></a>01569 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"isSiblingsFor() is true with an "</span>
- <a name="l01570"></a>01570 <span class="stringliteral">"error: Erroneous method "</span>
- <a name="l01571"></a>01571 <span class="stringliteral">"isSiblingFor()!"</span>);
- <a name="l01572"></a>01572 }
- <a name="l01573"></a>01573 }
- <a name="l01574"></a>01574 <span class="comment">// else forward msg if this node is not responsible for the key</span>
- <a name="l01575"></a>01575 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a790ec1f663fccc40033e6a8e714adbff">setHopCount</a>(routeMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>());
- <a name="l01576"></a>01576 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a42f4c08f6408d155a9907957ecf12d79" title="Hook for forwarded message in recursive lookup mode.">recursiveRoutingHook</a>(*nextHop, routeMsg)) {
- <a name="l01577"></a>01577 <a class="code" href="classBaseOverlay.html#ac93829bc8095a76e6208cf0ec12188b0">sendRouteMessage</a>(*nextHop, routeMsg, <a class="code" href="classBaseOverlay.html#a6e9090bf68f45a31d727a6c7f0501d43" title="send ACK when receiving route message">routeMsgAcks</a>);
- <a name="l01578"></a>01578 }
- <a name="l01579"></a>01579 }
- <a name="l01580"></a>01580 <span class="keyword">delete</span> nextHops;
- <a name="l01581"></a>01581 }
- <a name="l01582"></a>01582 }
- <a name="l01583"></a>01583
- <a name="l01584"></a><a class="code" href="classBaseOverlay.html#a53ded56af8bba8e4caa9a9b29e01ab87">01584</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#a53ded56af8bba8e4caa9a9b29e01ab87">BaseOverlay::checkFindNode</a>(<a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* routeMsg)
- <a name="l01585"></a>01585 {
- <a name="l01586"></a>01586 <span class="keywordflow">if</span> (dynamic_cast<FindNodeCall*>(routeMsg->getEncapsulatedPacket())) {
- <a name="l01587"></a>01587 <a class="code" href="classFindNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeCall</a>* findNodeCall =
- <a name="l01588"></a>01588 <span class="keyword">static_cast<</span><a class="code" href="classFindNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeCall</a>*<span class="keyword">></span>(routeMsg->decapsulate());
- <a name="l01589"></a>01589 findNodeCall
- <a name="l01590"></a>01590 ->setControlInfo(check_and_cast<OverlayCtrlInfo*>
- <a name="l01591"></a>01591 (routeMsg->removeControlInfo()));
- <a name="l01592"></a>01592 <a class="code" href="classBaseOverlay.html#a50680d9b44a779f314baeab200da61dc">findNodeRpc</a>(findNodeCall);
- <a name="l01593"></a>01593 <span class="keywordflow">return</span> <span class="keyword">true</span>;
- <a name="l01594"></a>01594 }
- <a name="l01595"></a>01595 <span class="keywordflow">return</span> <span class="keyword">false</span>;
- <a name="l01596"></a>01596 }
- <a name="l01597"></a>01597
- <a name="l01598"></a>01598 <span class="comment">//protected: create a lookup class</span>
- <a name="l01599"></a><a class="code" href="classBaseOverlay.html#a205a7d44401fb3d77b146e23b2904b6f">01599</a> <a class="code" href="classAbstractLookup.html" title="This class declares an abstract iterative lookup.">AbstractLookup</a>* <a class="code" href="classBaseOverlay.html#a205a7d44401fb3d77b146e23b2904b6f" title="Creates an abstract iterative lookup instance.">BaseOverlay::createLookup</a>(<a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a> routingType,
- <a name="l01600"></a>01600 <span class="keyword">const</span> <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg,
- <a name="l01601"></a>01601 <span class="keyword">const</span> cPacket* findNodeExt,
- <a name="l01602"></a>01602 <span class="keywordtype">bool</span> appLookup)
- <a name="l01603"></a>01603 {
- <a name="l01604"></a>01604 <a class="code" href="classAbstractLookup.html" title="This class declares an abstract iterative lookup.">AbstractLookup</a>* newLookup;
- <a name="l01605"></a>01605
- <a name="l01606"></a>01606 <span class="keywordflow">if</span> (routingType == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551a931137cd67090e50ef2ea3ccfb9e8d90">DEFAULT_ROUTING</a>) {
- <a name="l01607"></a>01607 routingType = <a class="code" href="classBaseOverlay.html#a9e13844ea8090b84a90286f048cdcbf9">defaultRoutingType</a>;
- <a name="l01608"></a>01608 }
- <a name="l01609"></a>01609
- <a name="l01610"></a>01610 <span class="keywordflow">switch</span> (routingType) {
- <a name="l01611"></a>01611 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551ae4bd936cbb47803986c83242cbb51867">ITERATIVE_ROUTING</a>:
- <a name="l01612"></a>01612 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551ad60cf756d6bb24af372d7fe7c279f44d">EXHAUSTIVE_ITERATIVE_ROUTING</a>:
- <a name="l01613"></a>01613 newLookup = <span class="keyword">new</span> <a class="code" href="classBaseOverlay.html#af4b6fb17cb1da8f210d175cdba0c2c5a">IterativeLookup</a>(<span class="keyword">this</span>, routingType,
- <a name="l01614"></a>01614 <a class="code" href="classBaseOverlay.html#a32b8cfb47f3ef824dcf6ad882e6a6a9f">iterativeLookupConfig</a>, findNodeExt,
- <a name="l01615"></a>01615 appLookup);
- <a name="l01616"></a>01616 <span class="keywordflow">break</span>;
- <a name="l01617"></a>01617 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551ad8c4eefed3d826e5da402fe582cad2c1">RECURSIVE_SOURCE_ROUTING</a>:
- <a name="l01618"></a>01618 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551a18b63fe85aa5e81cd3fca5e3c7c9df82">SEMI_RECURSIVE_ROUTING</a>:
- <a name="l01619"></a>01619 <span class="keywordflow">case</span> <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551aeec4ce5cac6dae9d3d59b1347a9df957">FULL_RECURSIVE_ROUTING</a>:
- <a name="l01620"></a>01620 newLookup = <span class="keyword">new</span> <a class="code" href="classBaseOverlay.html#a9d94a8362059c5c49b2cfffeb628f7cb">RecursiveLookup</a>(<span class="keyword">this</span>, routingType,
- <a name="l01621"></a>01621 <a class="code" href="classBaseOverlay.html#af6573aac3c99626958737209309d7e99">recursiveLookupConfig</a>,
- <a name="l01622"></a>01622 appLookup);
- <a name="l01623"></a>01623 <span class="keywordflow">break</span>;
- <a name="l01624"></a>01624 <span class="keywordflow">default</span>:
- <a name="l01625"></a>01625 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::createLookup():"</span>
- <a name="l01626"></a>01626 <span class="stringliteral">" Unknown routingType!"</span>);
- <a name="l01627"></a>01627 <span class="keywordflow">break</span>;
- <a name="l01628"></a>01628 }
- <a name="l01629"></a>01629
- <a name="l01630"></a>01630 <a class="code" href="classBaseOverlay.html#ad25b51c2d6c06dbe12c534307f43822e">lookups</a>.insert(newLookup);
- <a name="l01631"></a>01631 <span class="keywordflow">return</span> newLookup;
- <a name="l01632"></a>01632 }
- <a name="l01633"></a>01633
- <a name="l01634"></a><a class="code" href="classBaseOverlay.html#a0bfca744a28f47cae8c99243de04b005">01634</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a0bfca744a28f47cae8c99243de04b005" title="Removes the abstract lookup instance.">BaseOverlay::removeLookup</a>(<a class="code" href="classAbstractLookup.html" title="This class declares an abstract iterative lookup.">AbstractLookup</a>* lookup)
- <a name="l01635"></a>01635 {
- <a name="l01636"></a>01636 <a class="code" href="classBaseOverlay.html#ad25b51c2d6c06dbe12c534307f43822e">lookups</a>.erase(lookup);
- <a name="l01637"></a>01637 }
- <a name="l01638"></a>01638
- <a name="l01639"></a>01639 <span class="comment">//virtual public</span>
- <a name="l01640"></a><a class="code" href="classBaseOverlay.html#aa12314947ef42726ec6c7066dde8d0f9">01640</a> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a> <a class="code" href="classBaseOverlay.html#aa12314947ef42726ec6c7066dde8d0f9" title="This method should implement the distance between two keys.">BaseOverlay::distance</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& x,
- <a name="l01641"></a>01641 <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& y,
- <a name="l01642"></a>01642 <span class="keywordtype">bool</span> useAlternative)<span class="keyword"> const</span>
- <a name="l01643"></a>01643 <span class="keyword"></span>{
- <a name="l01644"></a>01644 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::distance(): Not implemented!"</span>);
- <a name="l01645"></a>01645 <span class="keywordflow">return</span> <a class="code" href="classOverlayKey.html#ac0d4135dff2985e3582fdbed2a37eb75" title="OverlayKey without defined key.">OverlayKey::UNSPECIFIED_KEY</a>;
- <a name="l01646"></a>01646 }
- <a name="l01647"></a>01647
- <a name="l01648"></a>01648 <span class="comment">//protected: find closest nodes</span>
- <a name="l01649"></a><a class="code" href="classBaseOverlay.html#a7cbdce336237331b67a3c69c4e43d489">01649</a> <a class="code" href="classBaseKeySortedVector.html">NodeVector</a>* <a class="code" href="classBaseOverlay.html#a7cbdce336237331b67a3c69c4e43d489" title="Implements the find node call.">BaseOverlay::findNode</a>(<span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& key,
- <a name="l01650"></a>01650 <span class="keywordtype">int</span> numRedundantNodes,
- <a name="l01651"></a>01651 <span class="keywordtype">int</span> numSiblings,
- <a name="l01652"></a>01652 <a class="code" href="classBaseOverlayMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseOverlayMessage</a>* msg)
- <a name="l01653"></a>01653 {
- <a name="l01654"></a>01654 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"findNode: Not implemented!"</span>);
- <a name="l01655"></a>01655 <span class="keywordflow">return</span> NULL;
- <a name="l01656"></a>01656 }
- <a name="l01657"></a>01657
- <a name="l01658"></a>01658 <span class="comment">//protected: join the overlay with a given nodeID</span>
- <a name="l01659"></a><a class="code" href="classBaseOverlay.html#a3eefb56c2396601373c89d21b5b58110">01659</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a3eefb56c2396601373c89d21b5b58110" title="Join the overlay with a given nodeID in thisNode.key.">BaseOverlay::joinOverlay</a>()
- <a name="l01660"></a>01660 {
- <a name="l01661"></a>01661 <span class="comment">// std::cout << "BaseOverlay::joinOverlay(): Not implemented!" << endl;</span>
- <a name="l01662"></a>01662 <span class="keywordflow">return</span>;
- <a name="l01663"></a>01663 }
- <a name="l01664"></a>01664
- <a name="l01665"></a><a class="code" href="classBaseOverlay.html#aa53ca4e1b4720ba0d2874afe29eacbf7">01665</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#aa53ca4e1b4720ba0d2874afe29eacbf7" title="Handles a failed node.">BaseOverlay::handleFailedNode</a>(<span class="keyword">const</span> <a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>& failed)
- <a name="l01666"></a>01666 {
- <a name="l01667"></a>01667 <span class="keywordflow">return</span> <span class="keyword">true</span>;
- <a name="l01668"></a>01668 }
- <a name="l01669"></a>01669
- <a name="l01670"></a>01670 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l01671"></a>01671 <span class="comment">//--- RPCs ---------------------------------------------------------------</span>
- <a name="l01672"></a>01672 <span class="comment">//------------------------------------------------------------------------</span>
- <a name="l01673"></a>01673
- <a name="l01674"></a>01674 <span class="comment">//private</span>
- <a name="l01675"></a><a class="code" href="classBaseOverlay.html#a03a24a5876504b36177a0ee041d5822e">01675</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#a03a24a5876504b36177a0ee041d5822e">BaseOverlay::internalHandleRpcCall</a>(<a class="code" href="classBaseCallMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseCallMessage</a>* msg)
- <a name="l01676"></a>01676 {
- <a name="l01677"></a>01677 <span class="comment">// call rpc stubs</span>
- <a name="l01678"></a>01678 <a class="code" href="RpcMacros_8h.html#aa75b135e279b574267e1a7dc4ab79da4" title="Marks the beginning of a Remote-Procedure-Call Switch block.">RPC_SWITCH_START</a>( msg );
- <a name="l01679"></a>01679 <a class="code" href="RpcMacros_8h.html#ad81d44e9bc59d2fb2cfcacc4d5ecda35" title="Declares a RPC method delegation.">RPC_DELEGATE</a>( FindNode, <a class="code" href="classBaseOverlay.html#a50680d9b44a779f314baeab200da61dc">findNodeRpc</a> );
- <a name="l01680"></a>01680 <a class="code" href="RpcMacros_8h.html#ad81d44e9bc59d2fb2cfcacc4d5ecda35" title="Declares a RPC method delegation.">RPC_DELEGATE</a>( FailedNode, <a class="code" href="classBaseOverlay.html#a1655dc0cb4ebb2f22de1d1ee29030433">failedNodeRpc</a> );
- <a name="l01681"></a>01681 <a class="code" href="RpcMacros_8h.html#ad81d44e9bc59d2fb2cfcacc4d5ecda35" title="Declares a RPC method delegation.">RPC_DELEGATE</a>( <a class="code" href="classLookup.html">Lookup</a>, <a class="code" href="classBaseOverlay.html#aa9d874edfd1b52822e1693695420d5a7">lookupRpc</a> );
- <a name="l01682"></a>01682 <a class="code" href="RpcMacros_8h.html#ad81d44e9bc59d2fb2cfcacc4d5ecda35" title="Declares a RPC method delegation.">RPC_DELEGATE</a>( NextHop, <a class="code" href="classBaseOverlay.html#a3eef9db326747d930a455db3b884dac4">nextHopRpc</a> );
- <a name="l01683"></a>01683 <a class="code" href="RpcMacros_8h.html#a29a8a3f21e67ecb25f58608a54df5191" title="Marks the end of a Remote-Procedure-Call Switch block.">RPC_SWITCH_END</a>( );
- <a name="l01684"></a>01684
- <a name="l01685"></a>01685 <span class="comment">// if RPC was handled return true, else tell the parent class to handle it</span>
- <a name="l01686"></a>01686 <span class="keywordflow">return</span> <a class="code" href="RpcMacros_8h.html#aa5e964b7c7129c0943237a786e455e9a">RPC_HANDLED</a> || <a class="code" href="classBaseOverlay.html#a03a24a5876504b36177a0ee041d5822e">BaseRpc::internalHandleRpcCall</a>(msg);
- <a name="l01687"></a>01687 }
- <a name="l01688"></a>01688
- <a name="l01689"></a><a class="code" href="classBaseOverlay.html#adc50f1e153d88a20ca921e84a0dbf3b2">01689</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#adc50f1e153d88a20ca921e84a0dbf3b2">BaseOverlay::internalHandleRpcResponse</a>(<a class="code" href="classBaseResponseMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseResponseMessage</a>* msg,
- <a name="l01690"></a>01690 cPolymorphic* context,
- <a name="l01691"></a>01691 <span class="keywordtype">int</span> rpcId, simtime_t rtt)
- <a name="l01692"></a>01692 {
- <a name="l01693"></a>01693 <a class="code" href="classBaseOverlay.html#adc50f1e153d88a20ca921e84a0dbf3b2">BaseRpc::internalHandleRpcResponse</a>(msg, context, rpcId, rtt);
- <a name="l01694"></a>01694 }
- <a name="l01695"></a>01695
- <a name="l01696"></a><a class="code" href="classBaseOverlay.html#ac89854c2f011597f3421d414851f4407">01696</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#ac89854c2f011597f3421d414851f4407">BaseOverlay::internalHandleRpcTimeout</a>(<a class="code" href="classBaseCallMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseCallMessage</a>* msg,
- <a name="l01697"></a>01697 <span class="keyword">const</span> <a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>& dest,
- <a name="l01698"></a>01698 cPolymorphic* context, <span class="keywordtype">int</span> rpcId,
- <a name="l01699"></a>01699 <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& destKey)
- <a name="l01700"></a>01700 {
- <a name="l01701"></a>01701 <a class="code" href="RpcMacros_8h.html#aa75b135e279b574267e1a7dc4ab79da4" title="Marks the beginning of a Remote-Procedure-Call Switch block.">RPC_SWITCH_START</a>( msg )
- <a name="l01702"></a>01702 <a class="code" href="RpcMacros_8h.html#ae07fad586ce7b9e82ad12848767a32e5">RPC_ON_CALL</a>( NextHop )
- <a name="l01703"></a>01703 {
- <a name="l01704"></a>01704 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* tempMsg
- <a name="l01705"></a>01705 = check_and_cast<<a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>*>(msg->decapsulate());
- <a name="l01706"></a>01706
- <a name="l01707"></a>01707 assert(!tempMsg->getControlInfo());
- <a name="l01708"></a>01708 <span class="keywordflow">if</span> (!tempMsg->getControlInfo()) {
- <a name="l01709"></a>01709 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo = <span class="keyword">new</span> <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>;
- <a name="l01710"></a>01710 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a6c2c1955d30ba60f696247685dc3d6ae">setLastHop</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l01711"></a>01711 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a790ec1f663fccc40033e6a8e714adbff">setHopCount</a>(tempMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>());
- <a name="l01712"></a>01712 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a57150c423c6413ed906a81402e8df0f5">setSrcNode</a>(tempMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>());
- <a name="l01713"></a>01713 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a2e3bd66c1e71acd70a6d87817efe15db">setRoutingType</a>(tempMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>());
- <a name="l01714"></a>01714 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a129cf7292587fa2ee6e4e6238c5e4d33">setTransportType</a>(<a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9a01580b2e886cd821bd7f3f2bcd7c690c">UDP_TRANSPORT</a>);
- <a name="l01715"></a>01715 tempMsg->setControlInfo(overlayCtrlInfo);
- <a name="l01716"></a>01716 }
- <a name="l01717"></a>01717 <span class="comment">// remove node from local routing tables</span>
- <a name="l01718"></a>01718 <span class="comment">// + route message again if possible</span>
- <a name="l01719"></a>01719 assert(!dest.<a class="code" href="classTransportAddress.html#a026e777c423ff2a0280edd2fa5472e74" title="indicates if TransportAddress is specified">isUnspecified</a>() && destKey.<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>());
- <a name="l01720"></a>01720 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#aa53ca4e1b4720ba0d2874afe29eacbf7" title="Handles a failed node.">handleFailedNode</a>(dest)) {
- <a name="l01721"></a>01721 <span class="keywordflow">if</span> (!tempMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>().<a class="code" href="classOverlayKey.html#abe357a4d1babcf7d30598a61cbc0f5c2" title="Returns true, if the key is unspecified.">isUnspecified</a>()) {
- <a name="l01722"></a>01722 <span class="comment">// TODO: msg is resent only in recursive mode</span>
- <a name="l01723"></a>01723 EV << <span class="stringliteral">"[BaseOverlay::internalHandleRpcTimeout() @ "</span>
- <a name="l01724"></a>01724 << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01725"></a>01725 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01726"></a>01726 << <span class="stringliteral">" Resend msg for key "</span> << destKey
- <a name="l01727"></a>01727 << endl;
- <a name="l01728"></a>01728 <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">handleBaseOverlayMessage</a>(tempMsg, destKey);
- <a name="l01729"></a>01729 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(tempMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>() > 1) {
- <a name="l01730"></a>01730 <span class="keywordflow">for</span> (uint8_t i = 0; i < tempMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>() - 1; ++i) {
- <a name="l01731"></a>01731 tempMsg-><a class="code" href="classBaseRouteMessage.html#a85bb1a80fafad5e8a84b1bf96eb8befc">setNextHops</a>(i, tempMsg-><a class="code" href="classBaseRouteMessage.html#a23f57254381410520aaa67dd52b0bc6c">getNextHops</a>(i + 1));
- <a name="l01732"></a>01732 }
- <a name="l01733"></a>01733 tempMsg-><a class="code" href="classBaseRouteMessage.html#a3cb14c09b287d613f26d58ad39fec4d0">setNextHopsArraySize</a>(tempMsg-><a class="code" href="classBaseRouteMessage.html#a4037dda18976c8d98ef3f9ed663f8dc7">getNextHopsArraySize</a>() - 1);
- <a name="l01734"></a>01734 EV << <span class="stringliteral">"[BaseOverlay::internalHandleRpcTimeout() @ "</span>
- <a name="l01735"></a>01735 << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01736"></a>01736 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01737"></a>01737 << <span class="stringliteral">" Resend msg to next available node in nextHops[]: "</span>
- <a name="l01738"></a>01738 << tempMsg-><a class="code" href="classBaseRouteMessage.html#a23f57254381410520aaa67dd52b0bc6c">getNextHops</a>(0).<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01739"></a>01739 << std::endl;
- <a name="l01740"></a>01740 <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">handleBaseOverlayMessage</a>(tempMsg);
- <a name="l01741"></a>01741 } <span class="keywordflow">else</span> {
- <a name="l01742"></a>01742 EV << <span class="stringliteral">"[BaseOverlay::internalHandleRpcTimeout() @ "</span>
- <a name="l01743"></a>01743 << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01744"></a>01744 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01745"></a>01745 << <span class="stringliteral">" dropping msg for "</span> << dest
- <a name="l01746"></a>01746 << endl;
- <a name="l01747"></a>01747 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l01748"></a>01748 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += tempMsg->getByteLength());
- <a name="l01749"></a>01749 <span class="keyword">delete</span> tempMsg;
- <a name="l01750"></a>01750 }
- <a name="l01751"></a>01751 } <span class="keywordflow">else</span> {
- <a name="l01752"></a>01752 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a4a82bd4b76a8d06a1d63bba98f1a34d7" title="number of dropped packets">numDropped</a>++;
- <a name="l01753"></a>01753 <a class="code" href="classBaseOverlay.html#a9e09857b97f52d340e4710580f25f7a6" title="number of dropped bytes">bytesDropped</a> += tempMsg->getByteLength());
- <a name="l01754"></a>01754 <span class="keyword">delete</span> tempMsg;
- <a name="l01755"></a>01755 <a class="code" href="classBaseOverlay.html#acb8855faa86247ae37ab894891d9f4dd" title="Join the overlay with a given nodeID.">join</a>();
- <a name="l01756"></a>01756 }
- <a name="l01757"></a>01757 <span class="keywordflow">break</span>;
- <a name="l01758"></a>01758 }
- <a name="l01759"></a>01759 <a class="code" href="RpcMacros_8h.html#a29a8a3f21e67ecb25f58608a54df5191" title="Marks the end of a Remote-Procedure-Call Switch block.">RPC_SWITCH_END</a>( )
- <a name="l01760"></a>01760
- <a name="l01761"></a>01761 <a class="code" href="classBaseOverlay.html#ac89854c2f011597f3421d414851f4407">BaseRpc::internalHandleRpcTimeout</a>(msg, dest, context, rpcId, destKey);
- <a name="l01762"></a>01762 }
- <a name="l01763"></a>01763
- <a name="l01764"></a><a class="code" href="classBaseOverlay.html#afe4a27831cec5ad68f1ddca071461808">01764</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#afe4a27831cec5ad68f1ddca071461808">BaseOverlay::internalSendRouteRpc</a>(<a class="code" href="classBaseRpcMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRpcMessage</a>* message,
- <a name="l01765"></a>01765 <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>& destKey,
- <a name="l01766"></a>01766 <span class="keyword">const</span> std::vector<TransportAddress>&
- <a name="l01767"></a>01767 sourceRoute,
- <a name="l01768"></a>01768 <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a> routingType) {
- <a name="l01769"></a>01769 <a class="code" href="classFindNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeCall</a>* findNodeCall;
- <a name="l01770"></a>01770 uint32_t numSiblings = 1;
- <a name="l01771"></a>01771 <span class="keywordflow">if</span> ((findNodeCall = dynamic_cast<FindNodeCall*>(message)))
- <a name="l01772"></a>01772 numSiblings = findNodeCall-><a class="code" href="classFindNodeCall.html#ac5a68f5e9f62d37613c5ce47a9348a92">getNumSiblings</a>();
- <a name="l01773"></a>01773
- <a name="l01774"></a>01774 <a class="code" href="classBaseOverlay.html#a6f2c598f5d3989a63a8cc7220f1aaf76" title="Sends a message to an overlay node, with the generic routing algorithm.">sendToKey</a>(destKey, message, numSiblings, sourceRoute, routingType);
- <a name="l01775"></a>01775 }
- <a name="l01776"></a>01776
- <a name="l01777"></a><a class="code" href="classBaseOverlay.html#a3b7e4eeca10c3052e0bb51762fe1ce71">01777</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a3b7e4eeca10c3052e0bb51762fe1ce71">BaseOverlay::internalSendRpcResponse</a>(<a class="code" href="classBaseCallMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseCallMessage</a>* call,
- <a name="l01778"></a>01778 <a class="code" href="classBaseResponseMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseResponseMessage</a>* response)
- <a name="l01779"></a>01779 {
- <a name="l01780"></a>01780 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo =
- <a name="l01781"></a>01781 check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>(call->getControlInfo());
- <a name="l01782"></a>01782
- <a name="l01783"></a>01783 <a class="code" href="CommonMessages__m_8h.html#aca1e72535e7f260e54ed8bbf984dade9" title="Enum generated from common/CommonMessages.msg by opp_msgc.">TransportType</a> transportType = ROUTE_TRANSPORT;
- <a name="l01784"></a>01784 <span class="keyword">const</span> <a class="code" href="classTransportAddress.html" title="This class implements a common transport address.">TransportAddress</a>* destNode;
- <a name="l01785"></a>01785 <span class="keywordflow">if</span> (overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#af6e31869ed325ba04288a69346988343">getSrcNode</a>().<a class="code" href="classNodeHandle.html#ab5136375a4548ced7c2014a73c8743c9" title="indicates if this NodeHandle is specified">isUnspecified</a>()) {
- <a name="l01786"></a>01786 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a84fe39074cd9dc69acf188abf3e2ea12" title="needed by KBR protocols for NAT support">sendRpcResponseToLastHop</a>) {
- <a name="l01787"></a>01787 <span class="comment">// used for KBR protocols to deal with NATs</span>
- <a name="l01788"></a>01788 <span class="comment">// (srcNode in call message may contain private IP address)</span>
- <a name="l01789"></a>01789 destNode = &(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad12b7ac74244fb7ab79ebf41e05fe79c">getLastHop</a>());
- <a name="l01790"></a>01790 } <span class="keywordflow">else</span> {
- <a name="l01791"></a>01791 <span class="comment">// used for non-KBR protocols which have to route RPC calls</span>
- <a name="l01792"></a>01792 <span class="comment">// but can't use BaseRouteMessage (this doesn't work with NATs)</span>
- <a name="l01793"></a>01793 destNode = &(call-><a class="code" href="classBaseRpcMessage.html#ada3e122125cfb5acc7350277ca69c45a">getSrcNode</a>());
- <a name="l01794"></a>01794 }
- <a name="l01795"></a>01795 } <span class="keywordflow">else</span> {
- <a name="l01796"></a>01796 destNode = &(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#af6e31869ed325ba04288a69346988343">getSrcNode</a>());
- <a name="l01797"></a>01797 }
- <a name="l01798"></a>01798 <span class="keyword">const</span> <a class="code" href="classOverlayKey.html" title="A common overlay key class.">OverlayKey</a>* destKey = &<a class="code" href="classOverlayKey.html#ac0d4135dff2985e3582fdbed2a37eb75" title="OverlayKey without defined key.">OverlayKey::UNSPECIFIED_KEY</a>;
- <a name="l01799"></a>01799
- <a name="l01800"></a>01800 <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a> routingType
- <a name="l01801"></a>01801 = <span class="keyword">static_cast<</span><a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551" title="Enum generated from common/CommonMessages.msg by opp_msgc.">RoutingType</a><span class="keyword">></span>(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a4b81411df66c4c813b664665731ee38c">getRoutingType</a>());
- <a name="l01802"></a>01802
- <a name="l01803"></a>01803 assert(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad80a56dfc9e2b8c5bc12994fee6adda2">getTransportType</a>() != INTERNAL_TRANSPORT);
- <a name="l01804"></a>01804
- <a name="l01805"></a>01805 <span class="keywordflow">if</span> ((overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#ad80a56dfc9e2b8c5bc12994fee6adda2">getTransportType</a>() == UDP_TRANSPORT) ||
- <a name="l01806"></a>01806 (routingType == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551a18b63fe85aa5e81cd3fca5e3c7c9df82">SEMI_RECURSIVE_ROUTING</a>) ||
- <a name="l01807"></a>01807 (routingType == ITERATIVE_ROUTING) ||
- <a name="l01808"></a>01808 (routingType == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551ad60cf756d6bb24af372d7fe7c279f44d">EXHAUSTIVE_ITERATIVE_ROUTING</a>)
- <a name="l01809"></a>01809 ) {
- <a name="l01810"></a>01810 <span class="comment">// received by UDP or direct response (IR, EIR or SRR routing)</span>
- <a name="l01811"></a>01811 transportType = UDP_TRANSPORT;
- <a name="l01812"></a>01812 overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#abc4f5e4539b4858443cf29523727a995">setVisitedHopsArraySize</a>(0); <span class="comment">//???</span>
- <a name="l01813"></a>01813 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((static_cast<RoutingType> (overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a4b81411df66c4c813b664665731ee38c">getRoutingType</a>())
- <a name="l01814"></a>01814 == <a class="code" href="CommonMessages__m_8h.html#a5bbe67ba1134d38bbb89c7c242ba6551aeec4ce5cac6dae9d3d59b1347a9df957">FULL_RECURSIVE_ROUTING</a>)) {
- <a name="l01815"></a>01815 <span class="comment">// full recursive routing</span>
- <a name="l01816"></a>01816 destKey = &(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#af6e31869ed325ba04288a69346988343">getSrcNode</a>().<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>());
- <a name="l01817"></a>01817 destNode = &<a class="code" href="classNodeHandle.html#a79bf2c5e29c969cbd0b2581cb188d8a6" title="the unspecified NodeHandle">NodeHandle::UNSPECIFIED_NODE</a>;
- <a name="l01818"></a>01818 }
- <a name="l01819"></a>01819 <span class="comment">// else: source routing -> route back over visited hops</span>
- <a name="l01820"></a>01820
- <a name="l01821"></a>01821 <a class="code" href="classBaseRpc.html#adc06091d348c98a5efbf54fe0afe8747" title="Send Remote-Procedure response message and deletes call message.">sendRpcResponse</a>(transportType,
- <a name="l01822"></a>01822 static_cast<CompType>(overlayCtrlInfo-><a class="code" href="classOverlayCtrlInfo.html#a79a35b8f98c2fecef8d6bc566c4a7437">getSrcComp</a>()),
- <a name="l01823"></a>01823 *destNode, *destKey, call, response);
- <a name="l01824"></a>01824 }
- <a name="l01825"></a>01825
- <a name="l01826"></a>01826 <span class="comment">//protected: statistic helpers for IterativeLookup</span>
- <a name="l01827"></a><a class="code" href="classBaseOverlay.html#aee7b3e4129a3a624b9112c3b7ae2b6a3">01827</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#aee7b3e4129a3a624b9112c3b7ae2b6a3">BaseOverlay::countFindNodeCall</a>( <span class="keyword">const</span> <a class="code" href="classFindNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeCall</a>* call )
- <a name="l01828"></a>01828 {
- <a name="l01829"></a>01829 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a210e4277548e47f2ec8e772ae5b6eb7f">numFindNodeSent</a>++;
- <a name="l01830"></a>01830 <a class="code" href="classBaseOverlay.html#a99971f360cdde2d41d239418dfad7281">bytesFindNodeSent</a> += call->getByteLength());
- <a name="l01831"></a>01831 }
- <a name="l01832"></a>01832
- <a name="l01833"></a><a class="code" href="classBaseOverlay.html#a189d4d1410399ecd264b5bfe6fc85e0f">01833</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a189d4d1410399ecd264b5bfe6fc85e0f">BaseOverlay::countFailedNodeCall</a>( <span class="keyword">const</span> <a class="code" href="classFailedNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FailedNodeCall</a>* call )
- <a name="l01834"></a>01834 {
- <a name="l01835"></a>01835 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a2fef63e0e6d6d7c991c9cb2c95db5733">numFailedNodeSent</a>++;
- <a name="l01836"></a>01836 <a class="code" href="classBaseOverlay.html#aca6ed5880fa17a3bfe432deff8d10e7c">bytesFailedNodeSent</a> += call->getByteLength());
- <a name="l01837"></a>01837 }
- <a name="l01838"></a>01838
- <a name="l01839"></a>01839 <span class="comment">//private: rpc stub</span>
- <a name="l01840"></a><a class="code" href="classBaseOverlay.html#a50680d9b44a779f314baeab200da61dc">01840</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a50680d9b44a779f314baeab200da61dc">BaseOverlay::findNodeRpc</a>( <a class="code" href="classFindNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeCall</a>* call )
- <a name="l01841"></a>01841 {
- <a name="l01842"></a>01842 <span class="comment">// if this node is malicious don't answer a findNodeCall</span>
- <a name="l01843"></a>01843 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">isMalicious</a>() && <a class="code" href="classBaseOverlay.html#ab53aaadb5dfe6fea1ac6b90db356cc52" title="if node is malicious, it tries a findNode attack">dropFindNodeAttack</a>) {
- <a name="l01844"></a>01844 EV << <span class="stringliteral">"[BaseOverlay::findNodeRpc() @ "</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01845"></a>01845 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>.<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01846"></a>01846 << <span class="stringliteral">" Node ignores findNodeCall because this node is malicious"</span>
- <a name="l01847"></a>01847 << endl;
- <a name="l01848"></a>01848 <span class="keyword">delete</span> call;
- <a name="l01849"></a>01849 <span class="keywordflow">return</span>;
- <a name="l01850"></a>01850 }
- <a name="l01851"></a>01851
- <a name="l01852"></a>01852 <a class="code" href="classFindNodeResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeResponse</a>* findNodeResponse =
- <a name="l01853"></a>01853 <span class="keyword">new</span> <a class="code" href="classFindNodeResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FindNodeResponse</a>(<span class="stringliteral">"FindNodeResponse"</span>);
- <a name="l01854"></a>01854
- <a name="l01855"></a>01855 findNodeResponse->setBitLength(<a class="code" href="CommonMessages__m_8h.html#adf1e0e3719d7a62675c9c873cee6155e">FINDNODERESPONSE_L</a>(findNodeResponse));
- <a name="l01856"></a>01856 <a class="code" href="classBaseKeySortedVector.html">NodeVector</a>* nextHops = <a class="code" href="classBaseOverlay.html#a7cbdce336237331b67a3c69c4e43d489" title="Implements the find node call.">findNode</a>(call-><a class="code" href="classFindNodeCall.html#a1be5a1314a95df730b18ac73b08d07e8">getLookupKey</a>(),
- <a name="l01857"></a>01857 call-><a class="code" href="classFindNodeCall.html#ad145ac485f8da308c4b976802cfa48ae">getNumRedundantNodes</a>(),
- <a name="l01858"></a>01858 call-><a class="code" href="classFindNodeCall.html#ad9bb40597926cfc521e7eb8e10b5f14d">getExhaustiveIterative</a>() ? -1 : call-><a class="code" href="classFindNodeCall.html#ac5a68f5e9f62d37613c5ce47a9348a92">getNumSiblings</a>(), call);
- <a name="l01859"></a>01859
- <a name="l01860"></a>01860 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aafe7a51c910c28bec242629aef2146df">setClosestNodesArraySize</a>(nextHops->size());
- <a name="l01861"></a>01861 <span class="keywordflow">for</span> (uint32_t i=0; i < nextHops->size(); i++) {
- <a name="l01862"></a>01862 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aff387edca2f0bdcad9a4c55bbbcd0cbf">setClosestNodes</a>(i, (*nextHops)[i]);
- <a name="l01863"></a>01863 }
- <a name="l01864"></a>01864
- <a name="l01865"></a>01865 <span class="keywordtype">bool</span> err;
- <a name="l01866"></a>01866 <span class="keywordflow">if</span> (!call-><a class="code" href="classFindNodeCall.html#ad9bb40597926cfc521e7eb8e10b5f14d">getExhaustiveIterative</a>() &&
- <a name="l01867"></a>01867 <a class="code" href="classBaseOverlay.html#ab5887b89ba9da5973068e834feb69ce7" title="Query if a node is among the siblings for a given key.">isSiblingFor</a>(<a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>, call-><a class="code" href="classFindNodeCall.html#a1be5a1314a95df730b18ac73b08d07e8">getLookupKey</a>(), call-><a class="code" href="classFindNodeCall.html#ac5a68f5e9f62d37613c5ce47a9348a92">getNumSiblings</a>(),
- <a name="l01868"></a>01868 &err)) {
- <a name="l01869"></a>01869 findNodeResponse-><a class="code" href="classFindNodeResponse.html#ae936984960adf1bc123afd2c23448df6">setSiblings</a>(<span class="keyword">true</span>);
- <a name="l01870"></a>01870 }
- <a name="l01871"></a>01871
- <a name="l01872"></a>01872 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">isMalicious</a>() && <a class="code" href="classBaseOverlay.html#a319a6b16e55af5e67fbbf65f6d07d5d9" title="if node is malicious, it tries a invalidNode attack">invalidNodesAttack</a>) {
- <a name="l01873"></a>01873 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#ae70528858c70e2404e0d83824d6f5bbc" title="if node is malicious, it tries a isSibling attack">isSiblingAttack</a>) {
- <a name="l01874"></a>01874 findNodeResponse-><a class="code" href="classFindNodeResponse.html#ae936984960adf1bc123afd2c23448df6">setSiblings</a>(<span class="keyword">true</span>);
- <a name="l01875"></a>01875 } <span class="keywordflow">else</span> {
- <a name="l01876"></a>01876 findNodeResponse-><a class="code" href="classFindNodeResponse.html#ae936984960adf1bc123afd2c23448df6">setSiblings</a>(<span class="keyword">false</span>);
- <a name="l01877"></a>01877 }
- <a name="l01878"></a>01878
- <a name="l01879"></a>01879 <span class="keywordtype">int</span> resultSize = <a class="code" href="classBaseOverlay.html#ae70528858c70e2404e0d83824d6f5bbc" title="if node is malicious, it tries a isSibling attack">isSiblingAttack</a> ? call-><a class="code" href="classFindNodeCall.html#ac5a68f5e9f62d37613c5ce47a9348a92">getNumSiblings</a>() :
- <a name="l01880"></a>01880 call-><a class="code" href="classFindNodeCall.html#ad145ac485f8da308c4b976802cfa48ae">getNumRedundantNodes</a>();
- <a name="l01881"></a>01881
- <a name="l01882"></a>01882 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aafe7a51c910c28bec242629aef2146df">setClosestNodesArraySize</a>(resultSize);
- <a name="l01883"></a>01883 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < resultSize; i++) {
- <a name="l01884"></a>01884 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aff387edca2f0bdcad9a4c55bbbcd0cbf">setClosestNodes</a>(i,
- <a name="l01885"></a>01885 <a class="code" href="classNodeHandle.html" title="This class implements a node handle.">NodeHandle</a>(call-><a class="code" href="classFindNodeCall.html#a1be5a1314a95df730b18ac73b08d07e8">getLookupKey</a>() + i, IPvXAddress(IPAddress(
- <a name="l01886"></a>01886 <a class="code" href="classBaseOverlay.html#ae70528858c70e2404e0d83824d6f5bbc" title="if node is malicious, it tries a isSibling attack">isSiblingAttack</a> ? (424242+i) : intuniform(42,123123))), 42));
- <a name="l01887"></a>01887 <span class="preprocessor">#if 0</span>
- <a name="l01888"></a>01888 <span class="preprocessor"></span> <span class="comment">// was not used for evaluation</span>
- <a name="l01889"></a>01889 <span class="keywordflow">if</span> ((i == 0) && <a class="code" href="classBaseOverlay.html#ae70528858c70e2404e0d83824d6f5bbc" title="if node is malicious, it tries a isSibling attack">isSiblingAttack</a>) {
- <a name="l01890"></a>01890 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aff387edca2f0bdcad9a4c55bbbcd0cbf">setClosestNodes</a>(0, <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l01891"></a>01891 }
- <a name="l01892"></a>01892 <span class="preprocessor">#endif</span>
- <a name="l01893"></a>01893 <span class="preprocessor"></span> }
- <a name="l01894"></a>01894 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#a234b046348574d37d811638f0b27a89e" title="Returns true, if node is malicious.">isMalicious</a>() && <a class="code" href="classBaseOverlay.html#ae70528858c70e2404e0d83824d6f5bbc" title="if node is malicious, it tries a isSibling attack">isSiblingAttack</a>) {
- <a name="l01895"></a>01895 findNodeResponse-><a class="code" href="classFindNodeResponse.html#ae936984960adf1bc123afd2c23448df6">setSiblings</a>(<span class="keyword">true</span>);
- <a name="l01896"></a>01896 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aafe7a51c910c28bec242629aef2146df">setClosestNodesArraySize</a>(1);
- <a name="l01897"></a>01897 findNodeResponse-><a class="code" href="classFindNodeResponse.html#aff387edca2f0bdcad9a4c55bbbcd0cbf">setClosestNodes</a>(0, <a class="code" href="classBaseRpc.html#a88eb68c06450fd12ea072f471bf1c1b8" title="NodeHandle to this node.">thisNode</a>);
- <a name="l01898"></a>01898 }
- <a name="l01899"></a>01899
- <a name="l01900"></a>01900 findNodeResponse->setBitLength(<a class="code" href="CommonMessages__m_8h.html#adf1e0e3719d7a62675c9c873cee6155e">FINDNODERESPONSE_L</a>(findNodeResponse));
- <a name="l01901"></a>01901
- <a name="l01902"></a>01902 <span class="keywordflow">if</span> (call->hasObject(<span class="stringliteral">"findNodeExt"</span>)) {
- <a name="l01903"></a>01903 cPacket* findNodeExt = check_and_cast<cPacket*>(call->removeObject(<span class="stringliteral">"findNodeExt"</span>));
- <a name="l01904"></a>01904 findNodeResponse->addObject(findNodeExt);
- <a name="l01905"></a>01905 findNodeResponse->addBitLength(findNodeExt->getBitLength());
- <a name="l01906"></a>01906 }
- <a name="l01907"></a>01907
- <a name="l01908"></a>01908 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#a248581eed6fedf10b2c350cbedd69773">numFindNodeResponseSent</a>++; <a class="code" href="classBaseOverlay.html#a4b2293e58a3bf5a7ddc0d28cb0669f2f">bytesFindNodeResponseSent</a> +=
- <a name="l01909"></a>01909 findNodeResponse->getByteLength());
- <a name="l01910"></a>01910
- <a name="l01911"></a>01911 <span class="keyword">delete</span> nextHops;
- <a name="l01912"></a>01912
- <a name="l01913"></a>01913 <a class="code" href="classBaseRpc.html#adc06091d348c98a5efbf54fe0afe8747" title="Send Remote-Procedure response message and deletes call message.">sendRpcResponse</a>(call, findNodeResponse);
- <a name="l01914"></a>01914 }
- <a name="l01915"></a>01915
- <a name="l01916"></a>01916
- <a name="l01917"></a><a class="code" href="classBaseOverlay.html#a1655dc0cb4ebb2f22de1d1ee29030433">01917</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a1655dc0cb4ebb2f22de1d1ee29030433">BaseOverlay::failedNodeRpc</a>( <a class="code" href="classFailedNodeCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FailedNodeCall</a>* call )
- <a name="l01918"></a>01918 {
- <a name="l01919"></a>01919 <a class="code" href="classFailedNodeResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FailedNodeResponse</a>* failedNodeResponse =
- <a name="l01920"></a>01920 <span class="keyword">new</span> <a class="code" href="classFailedNodeResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">FailedNodeResponse</a>(<span class="stringliteral">"FailedNodeResponse"</span>);
- <a name="l01921"></a>01921 failedNodeResponse-><a class="code" href="classFailedNodeResponse.html#ac8a44e9e9cdc649d6ee7ab893a97e17f">setTryAgain</a>(<a class="code" href="classBaseOverlay.html#aa53ca4e1b4720ba0d2874afe29eacbf7" title="Handles a failed node.">handleFailedNode</a>(call-><a class="code" href="classFailedNodeCall.html#a5a47646a10bc9e34503a4635121ef85c">getFailedNode</a>()));
- <a name="l01922"></a>01922 failedNodeResponse->setBitLength(<a class="code" href="CommonMessages__m_8h.html#ae470e5deb63f7debd17b8666514dae46">FAILEDNODERESPONSE_L</a>(failedNodeResponse));
- <a name="l01923"></a>01923
- <a name="l01924"></a>01924 <span class="keywordflow">if</span> (call->hasObject(<span class="stringliteral">"findNodeExt"</span>)) {
- <a name="l01925"></a>01925 cPacket* findNodeExt = check_and_cast<cPacket*>(
- <a name="l01926"></a>01926 call->removeObject(<span class="stringliteral">"findNodeExt"</span>));
- <a name="l01927"></a>01927 failedNodeResponse->addObject(findNodeExt);
- <a name="l01928"></a>01928 failedNodeResponse->addBitLength(findNodeExt->getBitLength());
- <a name="l01929"></a>01929 }
- <a name="l01930"></a>01930
- <a name="l01931"></a>01931 <a class="code" href="GlobalStatistics_8h.html#af29140ebe8e0a93406a58441f7c5fec8" title="Macro used for recording statistics considering measureNetwIn parameter.">RECORD_STATS</a>(<a class="code" href="classBaseOverlay.html#acf40707599a177a1dd5cd9ec4e854dc8">numFailedNodeResponseSent</a>++; <a class="code" href="classBaseOverlay.html#aa62ca9476d42c748e40dd0f287823445">bytesFailedNodeResponseSent</a> +=
- <a name="l01932"></a>01932 failedNodeResponse->getByteLength());
- <a name="l01933"></a>01933
- <a name="l01934"></a>01934 <a class="code" href="classBaseRpc.html#adc06091d348c98a5efbf54fe0afe8747" title="Send Remote-Procedure response message and deletes call message.">sendRpcResponse</a>(call, failedNodeResponse);
- <a name="l01935"></a>01935 }
- <a name="l01936"></a>01936
- <a name="l01937"></a><a class="code" href="classBaseOverlay.html#aa9d874edfd1b52822e1693695420d5a7">01937</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#aa9d874edfd1b52822e1693695420d5a7">BaseOverlay::lookupRpc</a>(<a class="code" href="classLookupCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupCall</a>* call)
- <a name="l01938"></a>01938 {
- <a name="l01939"></a>01939 <span class="keywordtype">int</span> numSiblings = call-><a class="code" href="classLookupCall.html#a5be7c8b099438db99f2fb0c129ff1edb">getNumSiblings</a>();
- <a name="l01940"></a>01940
- <a name="l01941"></a>01941 <span class="keywordflow">if</span> (numSiblings < 0) {
- <a name="l01942"></a>01942 numSiblings = <a class="code" href="classBaseOverlay.html#acd3058ad15b470e024500dd4872e2f09" title="Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay proto...">getMaxNumSiblings</a>();
- <a name="l01943"></a>01943 }
- <a name="l01944"></a>01944
- <a name="l01945"></a>01945 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#aa484556ed4ff9e4e97394106d0c1d323" title="internal overlay state used for setOverlayReady()">internalReadyState</a> == <span class="keyword">false</span>) {
- <a name="l01946"></a>01946 <span class="comment">// overlay not ready => lookup failed</span>
- <a name="l01947"></a>01947 EV << <span class="stringliteral">"[BaseOverlay::lookupRpc() @ "</span>
- <a name="l01948"></a>01948 << <a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>().<a class="code" href="classTransportAddress.html#a00e613d98d3412e2b92897c25aa0eb4c" title="returns ip address">getIp</a>()
- <a name="l01949"></a>01949 << <span class="stringliteral">" ("</span> << <a class="code" href="classBaseRpc.html#ac3f420630d5618e81709c078b06fd9da" title="Returns the NodeHandle of this node.">getThisNode</a>().<a class="code" href="classNodeHandle.html#aef531103cdf07c8353267f4d30a80112" title="returns key of this NodeHandle">getKey</a>().<a class="code" href="classOverlayKey.html#aabeb4fd284a630a82e982ba34ece4fd9" title="Returns a string representation of this key.">toString</a>(16) << <span class="stringliteral">")]\n"</span>
- <a name="l01950"></a>01950 << <span class="stringliteral">" LookupCall "</span>
- <a name="l01951"></a>01951 << call-><a class="code" href="classBaseRpcMessage.html#a79f78c32aa4461025a89e8de3bc35702">getNonce</a>()
- <a name="l01952"></a>01952 << <span class="stringliteral">" failed, because overlay module is not ready!"</span> << endl;
- <a name="l01953"></a>01953
- <a name="l01954"></a>01954 <a class="code" href="classLookupResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupResponse</a>* response = <span class="keyword">new</span> <a class="code" href="classLookupResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">LookupResponse</a>();
- <a name="l01955"></a>01955 response-><a class="code" href="classLookupResponse.html#a1caf06537b25c06685f0d24be5cd74fe">setKey</a>(call-><a class="code" href="classLookupCall.html#ac899d550007c1e632e299e917d38b705">getKey</a>());
- <a name="l01956"></a>01956 response-><a class="code" href="classLookupResponse.html#a6d307ceeb8f4325c3373c3464cff45be">setIsValid</a>(<span class="keyword">false</span>);
- <a name="l01957"></a>01957
- <a name="l01958"></a>01958 <a class="code" href="classBaseRpc.html#adc06091d348c98a5efbf54fe0afe8747" title="Send Remote-Procedure response message and deletes call message.">sendRpcResponse</a>(call, response);
- <a name="l01959"></a>01959
- <a name="l01960"></a>01960 <span class="keywordflow">return</span>;
- <a name="l01961"></a>01961 }
- <a name="l01962"></a>01962
- <a name="l01963"></a>01963 <span class="comment">// create lookup and sent to key</span>
- <a name="l01964"></a>01964 <a class="code" href="classAbstractLookup.html" title="This class declares an abstract iterative lookup.">AbstractLookup</a>* lookup = <a class="code" href="classBaseOverlay.html#a205a7d44401fb3d77b146e23b2904b6f" title="Creates an abstract iterative lookup instance.">createLookup</a>(static_cast<RoutingType>(
- <a name="l01965"></a>01965 call-><a class="code" href="classLookupCall.html#ad0d7ad53c1de441b8567c8c3ecf17753">getRoutingType</a>()), call, NULL, <span class="keyword">true</span>);
- <a name="l01966"></a>01966 lookup-><a class="code" href="classAbstractLookup.html#aa1bda70950cbd160ea78d1fcbd8c7767" title="Lookup siblings for a key.">lookup</a>(call-><a class="code" href="classLookupCall.html#ac899d550007c1e632e299e917d38b705">getKey</a>(), numSiblings, <a class="code" href="classBaseOverlay.html#abffe6fbd25963bc2b7542f22ba6455b9" title="maximum hop count">hopCountMax</a>,
- <a name="l01967"></a>01967 1, <span class="keyword">new</span> <a class="code" href="classBaseOverlay.html#a4083c91b7d09ceaa7fd2768570814d77">SendToKeyListener</a>( <span class="keyword">this</span>, call ));
- <a name="l01968"></a>01968 }
- <a name="l01969"></a>01969
- <a name="l01970"></a><a class="code" href="classBaseOverlay.html#a3eef9db326747d930a455db3b884dac4">01970</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a3eef9db326747d930a455db3b884dac4">BaseOverlay::nextHopRpc</a>(<a class="code" href="classNextHopCall.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">NextHopCall</a>* call)
- <a name="l01971"></a>01971 {
- <a name="l01972"></a>01972 <span class="keywordflow">if</span> (<a class="code" href="classBaseOverlay.html#ab4be6d88417117fbf33a445d56af2655">state</a> != <a class="code" href="classBaseOverlay.html#a0ad4b12b0c9949661f66db7fbbf7d40fab3a263fb274a58d63b15cd61ba910335">READY</a>) {
- <a name="l01973"></a>01973 <span class="comment">//TODO EV...</span>
- <a name="l01974"></a>01974 <span class="keyword">delete</span> call;
- <a name="l01975"></a>01975 <span class="keywordflow">return</span>;
- <a name="l01976"></a>01976 }
- <a name="l01977"></a>01977
- <a name="l01978"></a>01978 <a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>* routeMsg
- <a name="l01979"></a>01979 = check_and_cast<<a class="code" href="classBaseRouteMessage.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">BaseRouteMessage</a>*>(call->decapsulate());
- <a name="l01980"></a>01980
- <a name="l01981"></a>01981 <a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>* overlayCtrlInfo =
- <a name="l01982"></a>01982 check_and_cast<<a class="code" href="classOverlayCtrlInfo.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">OverlayCtrlInfo</a>*>(call->getControlInfo()-><a class="code" href="classNextHopCall.html#a9ba4dbf11d99bbff0399ae3e0b43ab6a">dup</a>());
- <a name="l01983"></a>01983 overlayCtrlInfo->setHopCount(routeMsg-><a class="code" href="classBaseRouteMessage.html#ab59d2969c812aa35d132a68fc2baf819">getHopCount</a>());
- <a name="l01984"></a>01984 overlayCtrlInfo-><a class="code" href="classBaseRpcMessage.html#a02c1e30ce0998325630ef1abdcac1354">setSrcNode</a>(routeMsg-><a class="code" href="classBaseRouteMessage.html#af9787d89915f01a2055e920148015e17">getSrcNode</a>());
- <a name="l01985"></a>01985 overlayCtrlInfo->setRoutingType(routeMsg-><a class="code" href="classBaseRouteMessage.html#a834dd9c8f0b2b776ed5f5b1fa285149a">getRoutingType</a>());
- <a name="l01986"></a>01986
- <a name="l01987"></a>01987 routeMsg->setControlInfo(overlayCtrlInfo);
- <a name="l01988"></a>01988 assert(routeMsg->getControlInfo());
- <a name="l01989"></a>01989
- <a name="l01990"></a>01990 std::string temp(<span class="stringliteral">"ACK: ["</span>);
- <a name="l01991"></a>01991 (temp += routeMsg->getName()) += <span class="stringliteral">"]"</span>;
- <a name="l01992"></a>01992
- <a name="l01993"></a>01993 <a class="code" href="classNextHopResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">NextHopResponse</a>* response
- <a name="l01994"></a>01994 = <span class="keyword">new</span> <a class="code" href="classNextHopResponse.html" title="Class generated from common/CommonMessages.msg by opp_msgc.">NextHopResponse</a>(temp.c_str());
- <a name="l01995"></a>01995 response->setBitLength(<a class="code" href="CommonMessages__m_8h.html#adc9bda6bf3f1e194f083e32df15f237d">NEXTHOPRESPONSE_L</a>(response));
- <a name="l01996"></a>01996 <a class="code" href="classBaseRpc.html#adc06091d348c98a5efbf54fe0afe8747" title="Send Remote-Procedure response message and deletes call message.">sendRpcResponse</a>(call, response);
- <a name="l01997"></a>01997
- <a name="l01998"></a>01998 <a class="code" href="classBaseOverlay.html#ac647b32e360b4db1f0eb53b096437fd8" title="Handles a BaseOverlayMessage ">handleBaseOverlayMessage</a>(routeMsg, routeMsg-><a class="code" href="classBaseRouteMessage.html#ad983641a05758bc9d25070f1659b2f34">getDestKey</a>());
- <a name="l01999"></a>01999 }
- <a name="l02000"></a>02000
- <a name="l02001"></a><a class="code" href="classBaseOverlay.html#a2096f89814b5740257cee106b60dda15">02001</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a2096f89814b5740257cee106b60dda15">BaseOverlay::registerComp</a>(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> compType, cModule *module)
- <a name="l02002"></a>02002 {
- <a name="l02003"></a>02003 cGate *gate = NULL;
- <a name="l02004"></a>02004
- <a name="l02005"></a>02005 <span class="keywordflow">if</span> (module != NULL) {
- <a name="l02006"></a>02006 gate = module->gate(<span class="stringliteral">"direct_in"</span>);
- <a name="l02007"></a>02007 <span class="keywordflow">if</span> (gate == NULL) {
- <a name="l02008"></a>02008 <span class="keywordflow">throw</span> cRuntimeError(<span class="stringliteral">"BaseOverlay::registerComp(): The module "</span>
- <a name="l02009"></a>02009 <span class="stringliteral">"which tried to register has "</span>
- <a name="l02010"></a>02010 <span class="stringliteral">"no direct_in gate!"</span>);
- <a name="l02011"></a>02011 }
- <a name="l02012"></a>02012 }
- <a name="l02013"></a>02013
- <a name="l02014"></a>02014 <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>[compType] = make_pair<cModule*, cGate*>(module, gate);
- <a name="l02015"></a>02015 }
- <a name="l02016"></a>02016
- <a name="l02017"></a><a class="code" href="classBaseOverlay.html#a3aba2b6e93094d3cc8107d33db4b5244">02017</a> cModule* <a class="code" href="classBaseOverlay.html#a3aba2b6e93094d3cc8107d33db4b5244">BaseOverlay::getCompModule</a>(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> compType)
- <a name="l02018"></a>02018 {
- <a name="l02019"></a>02019 CompModuleList::iterator it = <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.find(compType);
- <a name="l02020"></a>02020
- <a name="l02021"></a>02021 <span class="keywordflow">if</span> (it != <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.end())
- <a name="l02022"></a>02022 <span class="keywordflow">return</span> it->second.first;
- <a name="l02023"></a>02023 <span class="keywordflow">else</span>
- <a name="l02024"></a>02024 <span class="keywordflow">return</span> NULL;
- <a name="l02025"></a>02025 }
- <a name="l02026"></a>02026
- <a name="l02027"></a><a class="code" href="classBaseOverlay.html#a5fc03fda227c0cca828109842af1b320">02027</a> cGate* <a class="code" href="classBaseOverlay.html#a5fc03fda227c0cca828109842af1b320">BaseOverlay::getCompRpcGate</a>(<a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> compType)
- <a name="l02028"></a>02028 {
- <a name="l02029"></a>02029 CompModuleList::iterator it = <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.find(compType);
- <a name="l02030"></a>02030
- <a name="l02031"></a>02031 <span class="keywordflow">if</span> (it != <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.end())
- <a name="l02032"></a>02032 <span class="keywordflow">return</span> it->second.second;
- <a name="l02033"></a>02033 <span class="keywordflow">else</span>
- <a name="l02034"></a>02034 <span class="keywordflow">return</span> NULL;
- <a name="l02035"></a>02035 }
- <a name="l02036"></a>02036
- <a name="l02037"></a><a class="code" href="classBaseOverlay.html#a19c2c01f99a19bb7de0b30cdd866a2e0">02037</a> <span class="keywordtype">void</span> <a class="code" href="classBaseOverlay.html#a19c2c01f99a19bb7de0b30cdd866a2e0">BaseOverlay::sendMessageToAllComp</a>(cMessage* msg, <a class="code" href="CommonMessages__m_8h.html#aad57ef0110fe8675eb299d467148bc5e" title="Enum generated from common/CommonMessages.msg by opp_msgc.">CompType</a> srcComp)
- <a name="l02038"></a>02038 {
- <a name="l02039"></a>02039 Enter_Method_Silent();
- <a name="l02040"></a>02040 take(msg);
- <a name="l02041"></a>02041
- <a name="l02042"></a>02042 <span class="keywordflow">for</span> (CompModuleList::iterator it = <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.begin();
- <a name="l02043"></a>02043 it != <a class="code" href="classBaseOverlay.html#a572cbbdedbbc386f1d9c3851e9250be7">compModuleList</a>.end(); it++) {
- <a name="l02044"></a>02044
- <a name="l02045"></a>02045 <span class="comment">// don't send message to the origination component</span>
- <a name="l02046"></a>02046 <span class="keywordflow">if</span> (it->first != srcComp)
- <a name="l02047"></a>02047 sendDirect((cMessage*)msg->dup(), it->second.second);
- <a name="l02048"></a>02048 }
- <a name="l02049"></a>02049
- <a name="l02050"></a>02050 <span class="keyword">delete</span> msg;
- <a name="l02051"></a>02051 }
- <a name="l02052"></a>02052
- <a name="l02053"></a><a class="code" href="classBaseOverlay.html#abef37828b7f070044154f53bcd2a765b">02053</a> <span class="keywordtype">bool</span> <a class="code" href="classBaseOverlay.html#abef37828b7f070044154f53bcd2a765b" title="Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost.">BaseOverlay::isInSimpleMultiOverlayHost</a>()
- <a name="l02054"></a>02054 {
- <a name="l02055"></a>02055 <span class="keywordflow">return</span> isVector() || getParentModule()->isVector();
- <a name="l02056"></a>02056 }
- <a name="l02057"></a>02057
- </pre></div></div>
- </div>
- <hr class="footer"/><address class="footer"><small>Generated on Wed Nov 3 2010 14:40:43 for OverSim by
- <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
- </body>
- </html>