<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>DTN Reference Implementation: Node.h 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.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</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> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>Node.h</h1><a href="servlib_2prophet_2Node_8h.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 2007 Baylor University</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> <a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> <a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span> <a name="l00007"></a>00007 <span class="comment"> *</span> <a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> <a name="l00009"></a>00009 <span class="comment"> *</span> <a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> <a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> <a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> <a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span> <a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span> <a name="l00015"></a>00015 <span class="comment"> */</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="preprocessor">#ifndef _PROPHET_NODE_H_</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _PROPHET_NODE_H_</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <sys/types.h></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <string></span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="PointerList_8h.html">PointerList.h</a>"</span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="keyword">namespace </span>prophet <a name="l00025"></a>00025 { <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="comment">// forward declaration</span> <a name="l00028"></a>00028 <span class="keyword">class </span>Table; <a name="l00029"></a>00029 <span class="keyword">class </span>RIBTLV; <a name="l00030"></a>00030 <span class="keyword">class </span>NodeHeap; <a name="l00031"></a>00031 <a name="l00036"></a><a class="code" href="structprophet_1_1NodeParams.html">00036</a> <span class="keyword">struct </span><a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a> <a name="l00037"></a>00037 { <a name="l00041"></a><a class="code" href="structprophet_1_1NodeParams.html#ea9a3e2edf9e04edfd6282d27d621454">00041</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="structprophet_1_1NodeParams.html#ea9a3e2edf9e04edfd6282d27d621454" title="Default initialization values, p.">DEFAULT_P_ENCOUNTER</a>; <a name="l00042"></a>00042 <a name="l00046"></a><a class="code" href="structprophet_1_1NodeParams.html#1860ee3f76d4b409a53f15d39739d964">00046</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="structprophet_1_1NodeParams.html#1860ee3f76d4b409a53f15d39739d964" title="Default initialization values, p.">DEFAULT_BETA</a>; <a name="l00047"></a>00047 <a name="l00051"></a><a class="code" href="structprophet_1_1NodeParams.html#5a59c293aeb8704cb5abe2b003aa35de">00051</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="structprophet_1_1NodeParams.html#5a59c293aeb8704cb5abe2b003aa35de" title="Default initialization values, p.">DEFAULT_GAMMA</a>; <a name="l00052"></a>00052 <a name="l00057"></a><a class="code" href="structprophet_1_1NodeParams.html#24476b6c796c0cc96e4be37d3df301bd">00057</a> <span class="keyword">static</span> <span class="keyword">const</span> u_int <a class="code" href="structprophet_1_1NodeParams.html#24476b6c796c0cc96e4be37d3df301bd" title="The kappa variable describes how many milliseconds-per-timeunit (for equation 2,...">DEFAULT_KAPPA</a>; <a name="l00058"></a>00058 <a name="l00059"></a><a class="code" href="structprophet_1_1NodeParams.html#a9e78cb24c7584fb98956b03e5926a2b">00059</a> <a class="code" href="structprophet_1_1NodeParams.html#a9e78cb24c7584fb98956b03e5926a2b">NodeParams</a>() <a name="l00060"></a>00060 : <a class="code" href="structprophet_1_1NodeParams.html#934c0123add436e36e9e4f42d3d38ed6" title="initial value for p_value">encounter_</a>(<a class="code" href="structprophet_1_1NodeParams.html#ea9a3e2edf9e04edfd6282d27d621454" title="Default initialization values, p.">DEFAULT_P_ENCOUNTER</a>), <a name="l00061"></a>00061 <a class="code" href="structprophet_1_1NodeParams.html#c9635d2eb0bc4a2f2c3ef8f5241bc58e" title="weighting factor for transitive algorithm">beta_</a>(<a class="code" href="structprophet_1_1NodeParams.html#1860ee3f76d4b409a53f15d39739d964" title="Default initialization values, p.">DEFAULT_BETA</a>), <a name="l00062"></a>00062 <a class="code" href="structprophet_1_1NodeParams.html#62ffb277b60f7dd34dc67226b3fbf7ed" title="weighting factor for aging algorithm">gamma_</a>(<a class="code" href="structprophet_1_1NodeParams.html#5a59c293aeb8704cb5abe2b003aa35de" title="Default initialization values, p.">DEFAULT_GAMMA</a>), <a name="l00063"></a>00063 <a class="code" href="structprophet_1_1NodeParams.html#6420360f31061f42258f36e49b7e9922" title="milliseconds per unit time, aging algorithm">kappa_</a>(<a class="code" href="structprophet_1_1NodeParams.html#24476b6c796c0cc96e4be37d3df301bd" title="The kappa variable describes how many milliseconds-per-timeunit (for equation 2,...">DEFAULT_KAPPA</a>) {} <a name="l00064"></a>00064 <a name="l00065"></a><a class="code" href="structprophet_1_1NodeParams.html#47b6055488f4d18f45018b9fa1759922">00065</a> <span class="keyword">virtual</span> <a class="code" href="structprophet_1_1NodeParams.html#47b6055488f4d18f45018b9fa1759922">~NodeParams</a>() {} <a name="l00066"></a>00066 <a name="l00067"></a><a class="code" href="structprophet_1_1NodeParams.html#934c0123add436e36e9e4f42d3d38ed6">00067</a> <span class="keywordtype">double</span> <a class="code" href="structprophet_1_1NodeParams.html#934c0123add436e36e9e4f42d3d38ed6" title="initial value for p_value">encounter_</a>; <a name="l00068"></a><a class="code" href="structprophet_1_1NodeParams.html#c9635d2eb0bc4a2f2c3ef8f5241bc58e">00068</a> <span class="keywordtype">double</span> <a class="code" href="structprophet_1_1NodeParams.html#c9635d2eb0bc4a2f2c3ef8f5241bc58e" title="weighting factor for transitive algorithm">beta_</a>; <a name="l00069"></a><a class="code" href="structprophet_1_1NodeParams.html#62ffb277b60f7dd34dc67226b3fbf7ed">00069</a> <span class="keywordtype">double</span> <a class="code" href="structprophet_1_1NodeParams.html#62ffb277b60f7dd34dc67226b3fbf7ed" title="weighting factor for aging algorithm">gamma_</a>; <a name="l00070"></a><a class="code" href="structprophet_1_1NodeParams.html#6420360f31061f42258f36e49b7e9922">00070</a> u_int <a class="code" href="structprophet_1_1NodeParams.html#6420360f31061f42258f36e49b7e9922" title="milliseconds per unit time, aging algorithm">kappa_</a>; <a name="l00071"></a>00071 }; <span class="comment">// NodeParams</span> <a name="l00072"></a>00072 <a name="l00079"></a><a class="code" href="classprophet_1_1Node.html">00079</a> <span class="keyword">class </span><a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a> <a name="l00080"></a>00080 { <a name="l00081"></a>00081 <span class="keyword">public</span>: <a name="l00082"></a><a class="code" href="classprophet_1_1Node.html#001f6d13d658e508a4a065d689b74fe3">00082</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#001f6d13d658e508a4a065d689b74fe3">DEFAULT_RELAY</a> = <span class="keyword">true</span>; <a name="l00083"></a><a class="code" href="classprophet_1_1Node.html#8c16b001d6a0028ccec12540d4348203">00083</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#8c16b001d6a0028ccec12540d4348203">DEFAULT_CUSTODY</a> = <span class="keyword">true</span>; <a name="l00084"></a><a class="code" href="classprophet_1_1Node.html#9a789b306d56aa744100b7b7cbca2937">00084</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#9a789b306d56aa744100b7b7cbca2937">DEFAULT_INTERNET</a> = <span class="keyword">false</span>; <a name="l00088"></a>00088 <a class="code" href="classprophet_1_1Node.html#75459afed7dcff2374e6c31b05f08dc8" title="Default constructor.">Node</a>(<span class="keyword">const</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>* <a class="code" href="classprophet_1_1Node.html#3c184f84a2984f0bd2c0a3479b461f46" title="Accessors.">params</a> = NULL); <a name="l00089"></a>00089 <a name="l00093"></a>00093 <a class="code" href="classprophet_1_1Node.html#75459afed7dcff2374e6c31b05f08dc8" title="Default constructor.">Node</a>(<span class="keyword">const</span> <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>& node); <a name="l00094"></a>00094 <a name="l00098"></a>00098 <a class="code" href="classprophet_1_1Node.html#75459afed7dcff2374e6c31b05f08dc8" title="Default constructor.">Node</a>(<span class="keyword">const</span> std::string& <a class="code" href="classprophet_1_1Node.html#4c423ba83a417f43615a087bf52127e9" title="Accessors.">dest_id</a>, <a name="l00099"></a>00099 <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#0c4ef32bed5fa9595df25d24d4090ffc" title="Accessors.">relay</a> = <a class="code" href="classprophet_1_1Node.html#001f6d13d658e508a4a065d689b74fe3">DEFAULT_RELAY</a>, <a name="l00100"></a>00100 <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#30c2f606e0860b283bea16d79e1d5747" title="Accessors.">custody</a> = <a class="code" href="classprophet_1_1Node.html#8c16b001d6a0028ccec12540d4348203">DEFAULT_CUSTODY</a>, <a name="l00101"></a>00101 <span class="keywordtype">bool</span> internet = <a class="code" href="classprophet_1_1Node.html#9a789b306d56aa744100b7b7cbca2937">DEFAULT_INTERNET</a>, <a name="l00102"></a>00102 <span class="keyword">const</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>* <a class="code" href="classprophet_1_1Node.html#3c184f84a2984f0bd2c0a3479b461f46" title="Accessors.">params</a> = NULL); <a name="l00103"></a>00103 <a name="l00107"></a>00107 <span class="keyword">virtual</span> <a class="code" href="classprophet_1_1Node.html#f598e85c6a112c073971276f5ef6ffe7" title="Destructor.">~Node</a>(); <a name="l00108"></a>00108 <a name="l00110"></a><a class="code" href="classprophet_1_1Node.html#97b1dbf4d60d48b5ffc8d7022a3708b7">00110</a> <span class="keywordtype">double</span> <a class="code" href="classprophet_1_1Node.html#97b1dbf4d60d48b5ffc8d7022a3708b7" title="Accessors.">p_value</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#3c7049d0e318cb9ad1dbecb4aea32d13" title="predictability value for this node">p_value_</a>; } <a name="l00111"></a><a class="code" href="classprophet_1_1Node.html#0c4ef32bed5fa9595df25d24d4090ffc">00111</a> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#0c4ef32bed5fa9595df25d24d4090ffc" title="Accessors.">relay</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#a9c374bd403cce3a2f302fb85815225b" title="whether this node acts as relay">relay_</a>; } <a name="l00112"></a><a class="code" href="classprophet_1_1Node.html#30c2f606e0860b283bea16d79e1d5747">00112</a> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#30c2f606e0860b283bea16d79e1d5747" title="Accessors.">custody</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#aed787be763e9c079022852749599b7e" title="whether this node accepts custody txfr">custody_</a>; } <a name="l00113"></a><a class="code" href="classprophet_1_1Node.html#f960607d5799557a90155780683e5be3">00113</a> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#f960607d5799557a90155780683e5be3" title="Accessors.">internet_gw</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#df5e3e63e03991c7528c78aa0fa3cb85" title="whether bridge to Internet">internet_gateway_</a>; } <a name="l00114"></a><a class="code" href="classprophet_1_1Node.html#4c423ba83a417f43615a087bf52127e9">00114</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classprophet_1_1Node.html#4c423ba83a417f43615a087bf52127e9" title="Accessors.">dest_id</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#37978147b84bbb9bd2cb9b0135620fd9" title="string representation of route to node">dest_id_</a>.c_str(); } <a name="l00115"></a><a class="code" href="classprophet_1_1Node.html#203a4a3557ffec82595fe2ddce4fd9ab">00115</a> u_int32_t <a class="code" href="classprophet_1_1Node.html#203a4a3557ffec82595fe2ddce4fd9ab" title="Accessors.">age</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#78e6ca0a6340e2c8a624652c4885a596" title="age in seconds of last update to p_value">age_</a>; } <a name="l00116"></a><a class="code" href="classprophet_1_1Node.html#3c184f84a2984f0bd2c0a3479b461f46">00116</a> <span class="keyword">const</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>* <a class="code" href="classprophet_1_1Node.html#3c184f84a2984f0bd2c0a3479b461f46" title="Accessors.">params</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a>; } <a name="l00118"></a>00118 <a name="l00122"></a><a class="code" href="classprophet_1_1Node.html#f24a38e98a4660fbe6f059c9ded7e1e3">00122</a> <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>& <a class="code" href="classprophet_1_1Node.html#f24a38e98a4660fbe6f059c9ded7e1e3" title="Assignment operator.">operator= </a>(<span class="keyword">const</span> <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>& n) <a name="l00123"></a>00123 { <a name="l00124"></a>00124 <a class="code" href="classprophet_1_1Node.html#3c7049d0e318cb9ad1dbecb4aea32d13" title="predictability value for this node">p_value_</a> = n.<a class="code" href="classprophet_1_1Node.html#3c7049d0e318cb9ad1dbecb4aea32d13" title="predictability value for this node">p_value_</a>; <a name="l00125"></a>00125 <a class="code" href="classprophet_1_1Node.html#a9c374bd403cce3a2f302fb85815225b" title="whether this node acts as relay">relay_</a> = n.<a class="code" href="classprophet_1_1Node.html#a9c374bd403cce3a2f302fb85815225b" title="whether this node acts as relay">relay_</a>; <a name="l00126"></a>00126 <a class="code" href="classprophet_1_1Node.html#aed787be763e9c079022852749599b7e" title="whether this node accepts custody txfr">custody_</a> = n.<a class="code" href="classprophet_1_1Node.html#aed787be763e9c079022852749599b7e" title="whether this node accepts custody txfr">custody_</a>; <a name="l00127"></a>00127 <a class="code" href="classprophet_1_1Node.html#df5e3e63e03991c7528c78aa0fa3cb85" title="whether bridge to Internet">internet_gateway_</a> = n.<a class="code" href="classprophet_1_1Node.html#df5e3e63e03991c7528c78aa0fa3cb85" title="whether bridge to Internet">internet_gateway_</a>; <a name="l00128"></a>00128 <a class="code" href="classprophet_1_1Node.html#37978147b84bbb9bd2cb9b0135620fd9" title="string representation of route to node">dest_id_</a>.assign(n.<a class="code" href="classprophet_1_1Node.html#37978147b84bbb9bd2cb9b0135620fd9" title="string representation of route to node">dest_id_</a>); <a name="l00129"></a>00129 <a class="code" href="classprophet_1_1Node.html#78e6ca0a6340e2c8a624652c4885a596" title="age in seconds of last update to p_value">age_</a> = n.<a class="code" href="classprophet_1_1Node.html#78e6ca0a6340e2c8a624652c4885a596" title="age in seconds of last update to p_value">age_</a>; <a name="l00130"></a>00130 <span class="keyword">delete</span> <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a>; <a name="l00131"></a>00131 <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a> = <span class="keyword">new</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>(*n.<a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a>); <a name="l00132"></a>00132 <a class="code" href="classprophet_1_1Node.html#e53ea58de68128e0b384f24d19265525" title="heap index used by Table">heap_pos_</a> = n.<a class="code" href="classprophet_1_1Node.html#e53ea58de68128e0b384f24d19265525" title="heap index used by Table">heap_pos_</a>; <a name="l00133"></a>00133 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00134"></a>00134 } <a name="l00135"></a>00135 <a name="l00139"></a>00139 <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#9365eb7dd51b5d164e40beec48922e22" title="Apply the direct contact algorithm, p.">update_pvalue</a>(); <a name="l00140"></a>00140 <a name="l00145"></a>00145 <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#8c01707e283dc0c3b69bd4f6786a4cb6" title="Apply transitive algorithm, where ab is p_value from local to peer, bc is p_value...">update_transitive</a>(<span class="keywordtype">double</span> ab, <span class="keywordtype">double</span> bc); <a name="l00146"></a>00146 <a name="l00151"></a>00151 <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#71b04fb6a94d2ad69945624e80185684" title="Routes must decrease predictability with the passing of time, p.">update_age</a>(); <a name="l00152"></a>00152 <a name="l00154"></a><a class="code" href="classprophet_1_1Node.html#417321bce127dbf863a0c0b7a9afabdc">00154</a> <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1Node.html#417321bce127dbf863a0c0b7a9afabdc" title="Accessor and mutator for heap index used by Table and testing.">heap_pos</a>() { <span class="keywordflow">return</span> <a class="code" href="classprophet_1_1Node.html#e53ea58de68128e0b384f24d19265525" title="heap index used by Table">heap_pos_</a>; } <a name="l00155"></a><a class="code" href="classprophet_1_1Node.html#5b185a9167ef8b6e44ea608fd858dcbc">00155</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#5b185a9167ef8b6e44ea608fd858dcbc" title="}">set_heap_pos</a>(<span class="keywordtype">size_t</span> pos) { <a class="code" href="classprophet_1_1Node.html#e53ea58de68128e0b384f24d19265525" title="heap index used by Table">heap_pos_</a> = pos; } <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="keyword">protected</span>: <a name="l00159"></a><a class="code" href="classprophet_1_1Node.html#f888815e80064bc9fa1035c6265da86e">00159</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classprophet_1_1Table.html" title="Container for Prophet nodes (routes and predictability values).">Table</a>; <a name="l00160"></a><a class="code" href="classprophet_1_1Node.html#1ea496252513ca245fd09748f43f4e27">00160</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classprophet_1_1RIBTLV.html">RIBTLV</a>; <a name="l00161"></a>00161 <a name="l00163"></a><a class="code" href="classprophet_1_1Node.html#9782bc47ae71e19c461aeb8077d0bede">00163</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#9782bc47ae71e19c461aeb8077d0bede" title="Mutators, protected for use by friend classes only.">set_pvalue</a>( <span class="keywordtype">double</span> d ) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 <span class="keywordflow">if</span> ( d >= 0.0 && d <= 1.0 ) <a class="code" href="classprophet_1_1Node.html#3c7049d0e318cb9ad1dbecb4aea32d13" title="predictability value for this node">p_value_</a> = d; <a name="l00166"></a>00166 }; <a name="l00167"></a><a class="code" href="classprophet_1_1Node.html#3000d74e49497db616a5273a1a9c8b05">00167</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#3000d74e49497db616a5273a1a9c8b05" title="}">set_relay</a>( <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#0c4ef32bed5fa9595df25d24d4090ffc" title="Accessors.">relay</a> ) { <a class="code" href="classprophet_1_1Node.html#a9c374bd403cce3a2f302fb85815225b" title="whether this node acts as relay">relay_</a> = relay; } <a name="l00168"></a><a class="code" href="classprophet_1_1Node.html#8fe7de524be35146a9453473138b9c0f">00168</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#8fe7de524be35146a9453473138b9c0f" title="}">set_custody</a>( <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#30c2f606e0860b283bea16d79e1d5747" title="Accessors.">custody</a> ) { <a class="code" href="classprophet_1_1Node.html#aed787be763e9c079022852749599b7e" title="whether this node accepts custody txfr">custody_</a> = custody; } <a name="l00169"></a><a class="code" href="classprophet_1_1Node.html#aded851dec9a724734930e46589113a2">00169</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#aded851dec9a724734930e46589113a2" title="}">set_internet_gw</a>( <span class="keywordtype">bool</span> gw ) { <a class="code" href="classprophet_1_1Node.html#df5e3e63e03991c7528c78aa0fa3cb85" title="whether bridge to Internet">internet_gateway_</a> = gw; } <a name="l00170"></a><a class="code" href="classprophet_1_1Node.html#89f3c19b326af535d569e2f2659b599c">00170</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#89f3c19b326af535d569e2f2659b599c" title="}">set_dest_id</a>( <span class="keyword">const</span> std::string& eid ) <a name="l00171"></a>00171 { <a name="l00172"></a>00172 <a class="code" href="classprophet_1_1Node.html#37978147b84bbb9bd2cb9b0135620fd9" title="string representation of route to node">dest_id_</a>.assign(eid); <a name="l00173"></a>00173 } <a name="l00174"></a><a class="code" href="classprophet_1_1Node.html#03500725883d2184950f61c93bd4f751">00174</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#03500725883d2184950f61c93bd4f751" title="}">set_age</a>( u_int32_t <a class="code" href="classprophet_1_1Node.html#203a4a3557ffec82595fe2ddce4fd9ab" title="Accessors.">age</a> ) { <a class="code" href="classprophet_1_1Node.html#78e6ca0a6340e2c8a624652c4885a596" title="age in seconds of last update to p_value">age_</a> = age; } <a name="l00175"></a><a class="code" href="classprophet_1_1Node.html#81474d8376b1a420f9876cf15af603e6">00175</a> <span class="keywordtype">void</span> <a class="code" href="classprophet_1_1Node.html#81474d8376b1a420f9876cf15af603e6" title="}">set_params</a>( <span class="keyword">const</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>* <a class="code" href="classprophet_1_1Node.html#3c184f84a2984f0bd2c0a3479b461f46" title="Accessors.">params</a> ) <a name="l00176"></a>00176 { <a name="l00177"></a>00177 <span class="keyword">delete</span> <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a>; <a name="l00178"></a>00178 <span class="keywordflow">if</span> (params != NULL) <a name="l00179"></a>00179 <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a> = <span class="keyword">new</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>(*params); <a name="l00180"></a>00180 <span class="keywordflow">else</span> <a name="l00181"></a>00181 <span class="comment">// take the defaults</span> <a name="l00182"></a>00182 <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a> = <span class="keyword">new</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>(); <a name="l00183"></a>00183 } <a name="l00185"></a>00185 <a name="l00190"></a>00190 u_int <a class="code" href="classprophet_1_1Node.html#6bddbda80b7a4f77f1d7c29000818c08" title="Use NodeParams::kappa_ milliseconds per unit to convert diff to time units for use...">time_to_units</a>(u_int32_t diff) <span class="keyword">const</span>; <a name="l00191"></a>00191 <a name="l00192"></a><a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324">00192</a> <span class="keyword">const</span> <a class="code" href="structprophet_1_1NodeParams.html" title="Tunable parameter struct for setting global default values for Prophet node algorithms...">NodeParams</a>* <a class="code" href="classprophet_1_1Node.html#f83ac1e7a06422170af65f1e129a6324" title="global settings for all prophet nodes">params_</a>; <a name="l00193"></a><a class="code" href="classprophet_1_1Node.html#3c7049d0e318cb9ad1dbecb4aea32d13">00193</a> <span class="keywordtype">double</span> <a class="code" href="classprophet_1_1Node.html#3c7049d0e318cb9ad1dbecb4aea32d13" title="predictability value for this node">p_value_</a>; <a name="l00194"></a><a class="code" href="classprophet_1_1Node.html#a9c374bd403cce3a2f302fb85815225b">00194</a> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#a9c374bd403cce3a2f302fb85815225b" title="whether this node acts as relay">relay_</a>; <a name="l00195"></a><a class="code" href="classprophet_1_1Node.html#aed787be763e9c079022852749599b7e">00195</a> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#aed787be763e9c079022852749599b7e" title="whether this node accepts custody txfr">custody_</a>; <a name="l00196"></a><a class="code" href="classprophet_1_1Node.html#df5e3e63e03991c7528c78aa0fa3cb85">00196</a> <span class="keywordtype">bool</span> <a class="code" href="classprophet_1_1Node.html#df5e3e63e03991c7528c78aa0fa3cb85" title="whether bridge to Internet">internet_gateway_</a>; <a name="l00197"></a><a class="code" href="classprophet_1_1Node.html#37978147b84bbb9bd2cb9b0135620fd9">00197</a> std::string <a class="code" href="classprophet_1_1Node.html#37978147b84bbb9bd2cb9b0135620fd9" title="string representation of route to node">dest_id_</a>; <a name="l00198"></a><a class="code" href="classprophet_1_1Node.html#78e6ca0a6340e2c8a624652c4885a596">00198</a> u_int32_t <a class="code" href="classprophet_1_1Node.html#78e6ca0a6340e2c8a624652c4885a596" title="age in seconds of last update to p_value">age_</a>; <a name="l00199"></a><a class="code" href="classprophet_1_1Node.html#e53ea58de68128e0b384f24d19265525">00199</a> <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1Node.html#e53ea58de68128e0b384f24d19265525" title="heap index used by Table">heap_pos_</a>; <a name="l00200"></a>00200 }; <span class="comment">// Node</span> <a name="l00201"></a>00201 <a name="l00206"></a><a class="code" href="classprophet_1_1RIBNode.html">00206</a> <span class="keyword">class </span><a class="code" href="classprophet_1_1RIBNode.html" title="RIBNode provides a convenience wrapper around Node for tracking endpoint ID to string...">RIBNode</a> : <span class="keyword">public</span> <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a> <a name="l00207"></a>00207 { <a name="l00208"></a>00208 <span class="keyword">public</span>: <a name="l00212"></a><a class="code" href="classprophet_1_1RIBNode.html#480e10874fe5e0178a3c6bbdb8a473fa">00212</a> <a class="code" href="classprophet_1_1RIBNode.html#480e10874fe5e0178a3c6bbdb8a473fa" title="Constructor.">RIBNode</a>(<span class="keyword">const</span> <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>* node, u_int16_t sid) <a name="l00213"></a>00213 : <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>(*node), <a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a>(sid) {} <a name="l00214"></a>00214 <a name="l00218"></a><a class="code" href="classprophet_1_1RIBNode.html#49873cda7f792c9cca436de1b9473b88">00218</a> <a class="code" href="classprophet_1_1RIBNode.html#480e10874fe5e0178a3c6bbdb8a473fa" title="Constructor.">RIBNode</a>(u_int16_t sid = 0) <a name="l00219"></a>00219 : <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>(), <a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a>(sid) {} <a name="l00220"></a>00220 <a name="l00224"></a><a class="code" href="classprophet_1_1RIBNode.html#d8be614d85c8b7fe508d548f2c005b48">00224</a> <a class="code" href="classprophet_1_1RIBNode.html#480e10874fe5e0178a3c6bbdb8a473fa" title="Constructor.">RIBNode</a>(<span class="keyword">const</span> <a class="code" href="classprophet_1_1RIBNode.html" title="RIBNode provides a convenience wrapper around Node for tracking endpoint ID to string...">RIBNode</a>& a) <a name="l00225"></a>00225 : <a class="code" href="classprophet_1_1Node.html" title="Node represents a route to another Prophet node, and as such, tracks destination...">Node</a>(a), <a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a>(a.<a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a>) {} <a name="l00226"></a>00226 <a name="l00230"></a><a class="code" href="classprophet_1_1RIBNode.html#6d6f1cbad2a3386a883a7d58a15cb941">00230</a> <span class="keyword">virtual</span> <a class="code" href="classprophet_1_1RIBNode.html#6d6f1cbad2a3386a883a7d58a15cb941" title="Destructor.">~RIBNode</a>() {} <a name="l00231"></a>00231 <a name="l00235"></a><a class="code" href="classprophet_1_1RIBNode.html#3927e019dfa735fee90f4e6acb207abc">00235</a> <a class="code" href="classprophet_1_1RIBNode.html" title="RIBNode provides a convenience wrapper around Node for tracking endpoint ID to string...">RIBNode</a>& <a class="code" href="classprophet_1_1RIBNode.html#3927e019dfa735fee90f4e6acb207abc" title="Assignment operator.">operator= </a>(<span class="keyword">const</span> <a class="code" href="classprophet_1_1RIBNode.html" title="RIBNode provides a convenience wrapper around Node for tracking endpoint ID to string...">RIBNode</a>& a) <a name="l00236"></a>00236 { <a name="l00237"></a>00237 <a class="code" href="classprophet_1_1RIBNode.html#3927e019dfa735fee90f4e6acb207abc" title="Assignment operator.">Node::operator=</a>(a); <a name="l00238"></a>00238 <a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a> = a.<a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a>; <a name="l00239"></a>00239 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00240"></a>00240 } <a name="l00241"></a>00241 <a name="l00242"></a><a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d">00242</a> u_int16_t <a class="code" href="classprophet_1_1RIBNode.html#8cfc39e5a10c38c054d51c88fea5916d" title="String identifier used by RIB TLV.">sid_</a>; <a name="l00243"></a>00243 }; <span class="comment">// RIBNode</span> <a name="l00244"></a>00244 <a name="l00245"></a><a class="code" href="namespaceprophet.html#0a6dda9a26319dc79b4683fb2779eefc">00245</a> <span class="keyword">typedef</span> <a class="code" href="classprophet_1_1PointerList.html" title="Auto deletes pointers in list destructor This object assumes ownership for member...">PointerList<Node></a> <a class="code" href="classprophet_1_1PointerList.html" title="Auto deletes pointers in list destructor This object assumes ownership for member...">NodeList</a>; <a name="l00246"></a><a class="code" href="namespaceprophet.html#85efb86d8e405350d5ac3236c15e4be5">00246</a> <span class="keyword">typedef</span> <a class="code" href="classprophet_1_1PointerList.html">PointerList<RIBNode></a> <a class="code" href="classprophet_1_1PointerList.html">RIBNodeList</a>; <a name="l00247"></a>00247 <a name="l00248"></a>00248 }; <span class="comment">//namespace prophet</span> <a name="l00249"></a>00249 <a name="l00250"></a>00250 <span class="preprocessor">#endif // _PROPHET_NODE_H_</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Fri Jan 30 09:26:57 2009 for DTN Reference Implementation by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> </body> </html>