Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 29c369053a983cc5d8c880dc6e0a2237 > files > 488

libdtn-devel-2.6.0-2mdv2009.1.i586.rpm

<!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: ProphetCommand.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.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>ProphetCommand.cc</h1><a href="ProphetCommand_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 2006 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">#ifdef HAVE_CONFIG_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#  include &lt;<a class="code" href="dtn-config_8h.html">dtn-config.h</a>&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#endif</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;oasys/util/StringBuffer.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;oasys/util/OptParser.h&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="BundleDaemon_8h.html">bundling/BundleDaemon.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="BundleRouter_8h.html">routing/BundleRouter.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="QueuePolicy_8h.html">prophet/QueuePolicy.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="FwdStrategy_8h.html">prophet/FwdStrategy.h</a>"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="Params_8h.html">prophet/Params.h</a>"</span>
<a name="l00029"></a>00029 <span class="comment">// default settings for ProphetRouter::params_ are set in prophet/Params.h</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="ProphetRouter_8h.html">routing/ProphetRouter.h</a>"</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="ProphetCommand_8h.html">ProphetCommand.h</a>"</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="keyword">namespace </span>dtn {
<a name="l00035"></a>00035 
<a name="l00036"></a><a class="code" href="classdtn_1_1ProphetCommand.html#55a27ba9d0f0f5cd1b2c0db63e3a9d08">00036</a> <a class="code" href="classdtn_1_1ProphetCommand.html#55a27ba9d0f0f5cd1b2c0db63e3a9d08">ProphetCommand::ProphetCommand</a>()
<a name="l00037"></a>00037     : TclCommand(<span class="stringliteral">"prophet"</span>)
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039     bind_var(<span class="keyword">new</span> oasys::DoubleOpt(<span class="stringliteral">"encounter"</span>,
<a name="l00040"></a>00040                                   &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.encounter_,
<a name="l00041"></a>00041                                   <span class="stringliteral">"val"</span>,
<a name="l00042"></a>00042                                   <span class="stringliteral">"predictability initialization constant "</span>
<a name="l00043"></a>00043                                   <span class="stringliteral">"(between 0 and 1)"</span>));
<a name="l00044"></a>00044 
<a name="l00045"></a>00045     bind_var(<span class="keyword">new</span> oasys::DoubleOpt(<span class="stringliteral">"beta"</span>, &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.beta_, 
<a name="l00046"></a>00046                                   <span class="stringliteral">"val"</span>,
<a name="l00047"></a>00047                                   <span class="stringliteral">"weight factor for transitive predictability "</span>
<a name="l00048"></a>00048                                   <span class="stringliteral">"(between 0 and 1)"</span>));
<a name="l00049"></a>00049 
<a name="l00050"></a>00050     bind_var(<span class="keyword">new</span> oasys::DoubleOpt(<span class="stringliteral">"gamma"</span>, &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.gamma_, 
<a name="l00051"></a>00051                                   <span class="stringliteral">"val"</span>,
<a name="l00052"></a>00052                                   <span class="stringliteral">"weight factor for predictability aging "</span>
<a name="l00053"></a>00053                                   <span class="stringliteral">"(between 0 and 1)"</span>));
<a name="l00054"></a>00054 
<a name="l00055"></a>00055     bind_var(<span class="keyword">new</span> oasys::UIntOpt(<span class="stringliteral">"kappa"</span>, &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.kappa_, 
<a name="l00056"></a>00056                                 <span class="stringliteral">"val"</span>,
<a name="l00057"></a>00057                                 <span class="stringliteral">"scaling factor for aging equation"</span>));
<a name="l00058"></a>00058 
<a name="l00059"></a>00059     bind_var(<span class="keyword">new</span> oasys::UIntOpt(<span class="stringliteral">"hello_dead"</span>, &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.hello_dead_,
<a name="l00060"></a>00060                                 <span class="stringliteral">"num"</span>,
<a name="l00061"></a>00061                                 <span class="stringliteral">"number of HELLO intervals before "</span>
<a name="l00062"></a>00062                                 <span class="stringliteral">"peer considered unreachable"</span>));
<a name="l00063"></a>00063 
<a name="l00064"></a>00064     bind_var(<span class="keyword">new</span> oasys::UIntOpt(<span class="stringliteral">"max_forward"</span>,
<a name="l00065"></a>00065                                 &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.max_forward_,
<a name="l00066"></a>00066                                 <span class="stringliteral">"num"</span>,
<a name="l00067"></a>00067                                 <span class="stringliteral">"max times to forward bundle using GTMX"</span>));
<a name="l00068"></a>00068 
<a name="l00069"></a>00069     bind_var(<span class="keyword">new</span> oasys::UIntOpt(<span class="stringliteral">"min_forward"</span>,
<a name="l00070"></a>00070                                 &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.min_forward_,
<a name="l00071"></a>00071                                 <span class="stringliteral">"num"</span>,
<a name="l00072"></a>00072                                 <span class="stringliteral">"min times to forward bundle using LEPR"</span>));
<a name="l00073"></a>00073 
<a name="l00074"></a>00074     bind_var(<span class="keyword">new</span> oasys::UIntOpt(<span class="stringliteral">"age_period"</span>, &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.age_period_,
<a name="l00075"></a>00075                                 <span class="stringliteral">"val"</span>,
<a name="l00076"></a>00076                                 <span class="stringliteral">"timer setting for aging algorithm and "</span>
<a name="l00077"></a>00077                                 <span class="stringliteral">"Prophet ACK expiry"</span>));
<a name="l00078"></a>00078 
<a name="l00079"></a>00079     bind_var(<span class="keyword">new</span> oasys::BoolOpt(<span class="stringliteral">"relay_node"</span>,
<a name="l00080"></a>00080                                 &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.relay_node_,
<a name="l00081"></a>00081                                 <span class="stringliteral">"whether this node forwards bundles "</span>
<a name="l00082"></a>00082                                 <span class="stringliteral">"to other Prophet nodes"</span>));
<a name="l00083"></a>00083 
<a name="l00084"></a>00084     bind_var(<span class="keyword">new</span> oasys::BoolOpt(<span class="stringliteral">"internet_gw"</span>,
<a name="l00085"></a>00085                                 &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.internet_gw_,
<a name="l00086"></a>00086                                 <span class="stringliteral">"whether this node forwards bundles to "</span>
<a name="l00087"></a>00087                                 <span class="stringliteral">"Internet domain"</span>));
<a name="l00088"></a>00088 
<a name="l00089"></a>00089     <span class="comment">// smallest double that can fit into 8 bits:  0.0039 (1/255)</span>
<a name="l00090"></a>00090     bind_var(<span class="keyword">new</span> oasys::DoubleOpt(<span class="stringliteral">"epsilon"</span>, &amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.epsilon_,
<a name="l00091"></a>00091                                   <span class="stringliteral">"val"</span>,
<a name="l00092"></a>00092                                   <span class="stringliteral">"lower limit on predictability before "</span>
<a name="l00093"></a>00093                                   <span class="stringliteral">"dropping route"</span>));
<a name="l00094"></a>00094 
<a name="l00095"></a>00095     add_to_help(<span class="stringliteral">"queue_policy=&lt;policy&gt;"</span>,
<a name="l00096"></a>00096                 <span class="stringliteral">"set queue policy to one of the following:\n"</span>
<a name="l00097"></a>00097                 <span class="stringliteral">"\tfifo\tfirst in first out\n"</span>
<a name="l00098"></a>00098                 <span class="stringliteral">"\tmofo\tevict most forwarded first\n"</span>
<a name="l00099"></a>00099                 <span class="stringliteral">"\tmopr\tevict most favorably forwarded first\n"</span>
<a name="l00100"></a>00100                 <span class="stringliteral">"\tlmopr\tevict most favorably forwarded first (linear increase)\n"</span>
<a name="l00101"></a>00101                 <span class="stringliteral">"\tshli\tevict shortest lifetime first\n"</span>
<a name="l00102"></a>00102                 <span class="stringliteral">"\tlepr\tevice least probable first\n"</span>);
<a name="l00103"></a>00103 
<a name="l00104"></a>00104     add_to_help(<span class="stringliteral">"fwd_strategy=&lt;strategy&gt;"</span>,
<a name="l00105"></a>00105                 <span class="stringliteral">"set forwarding strategy to one of the following:\n"</span>
<a name="l00106"></a>00106                 <span class="stringliteral">"\tgrtr\tforward if remote's P is greater\n"</span>
<a name="l00107"></a>00107                 <span class="stringliteral">"\tgtmx\tforward if \"grtr\" and NF &lt; NF_Max\n"</span>
<a name="l00108"></a>00108                 <span class="stringliteral">"\tgrtr_plus\tforward if \"grtr\" and P &gt; P_Max\n"</span>
<a name="l00109"></a>00109                 <span class="stringliteral">"\tgtmx_plus\tforward if \"grtr_plus\" and NF &lt; NF_Max\n"</span>
<a name="l00110"></a>00110                 <span class="stringliteral">"\tgrtr_sort\tforward if \"grtr\" and sort desc by P_remote - P_local\n"</span>
<a name="l00111"></a>00111                 <span class="stringliteral">"\tgrtr_max\tforward if \"grtr\" and sort desc by P_remote\n"</span>);
<a name="l00112"></a>00112 
<a name="l00113"></a>00113     add_to_help(<span class="stringliteral">"hello_interval=&lt;interval&gt;"</span>,
<a name="l00114"></a>00114                 <span class="stringliteral">"maximum delay between protocol messages, in 100ms units,"</span>
<a name="l00115"></a>00115                 <span class="stringliteral">" ranging from 1 to 255 (100 ms to 25.5s)"</span>);
<a name="l00116"></a>00116 
<a name="l00117"></a>00117     add_to_help(<span class="stringliteral">"max_route=&lt;number&gt;"</span>,
<a name="l00118"></a>00118                 <span class="stringliteral">"maximum number of routes for Prophet to retain"</span>
<a name="l00119"></a>00119                 <span class="stringliteral">" (set to 0 to disable quota)"</span>);
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121 
<a name="l00122"></a>00122 <span class="keywordtype">int</span>
<a name="l00123"></a><a class="code" href="classdtn_1_1ProphetCommand.html#1de666dca4d385870ff55903423e2def">00123</a> <a class="code" href="classdtn_1_1ProphetCommand.html#1de666dca4d385870ff55903423e2def" title="Virtual from CommandModule.">ProphetCommand::exec</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span>** argv, Tcl_Interp* interp)
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125     (void)interp;
<a name="l00126"></a>00126     
<a name="l00127"></a>00127     <span class="keywordflow">if</span> (argc != 2)
<a name="l00128"></a>00128     {
<a name="l00129"></a>00129         resultf(<span class="stringliteral">"prophet: wrong number of arguments, got %d looking for 2"</span>,
<a name="l00130"></a>00130                 argc);
<a name="l00131"></a>00131         <span class="keywordflow">return</span> TCL_ERROR;
<a name="l00132"></a>00132     }
<a name="l00133"></a>00133 
<a name="l00134"></a>00134     <span class="keyword">const</span> <span class="keywordtype">char</span>* cmd = argv[1];
<a name="l00135"></a>00135 
<a name="l00136"></a>00136     <span class="comment">// scoot past "prophet foo" to the value</span>
<a name="l00137"></a>00137     argc -= 1;
<a name="l00138"></a>00138     argv += 1;
<a name="l00139"></a>00139 
<a name="l00140"></a>00140     oasys::OptParser p;
<a name="l00141"></a>00141     <span class="keyword">const</span> <span class="keywordtype">char</span>* invalid = NULL;
<a name="l00142"></a>00142 
<a name="l00143"></a>00143     <span class="keywordflow">if</span> (strncmp(cmd,<span class="stringliteral">"fwd_strategy"</span>,strlen(<span class="stringliteral">"fwd_strategy"</span>)) == 0)
<a name="l00144"></a>00144     {
<a name="l00145"></a>00145         oasys::EnumOpt::Case FwdStrategyCases[] =
<a name="l00146"></a>00146         {
<a name="l00147"></a>00147             {<span class="stringliteral">"grtr"</span>,      <a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff9d50665e088294ee93bfdab2b1887c683">prophet::FwdStrategy::GRTR</a>},
<a name="l00148"></a>00148             {<span class="stringliteral">"gtmx"</span>,      <a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff93556b70a32a018adc3efee4111f10580">prophet::FwdStrategy::GTMX</a>},
<a name="l00149"></a>00149             {<span class="stringliteral">"grtr_plus"</span>, <a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff92dc38cf4c7a05c138524ad3ed80a5699">prophet::FwdStrategy::GRTR_PLUS</a>},
<a name="l00150"></a>00150             {<span class="stringliteral">"gtmx_plus"</span>, <a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff982360112f9e1c1b7137f30156eb45520">prophet::FwdStrategy::GTMX_PLUS</a>},
<a name="l00151"></a>00151             {<span class="stringliteral">"grtr_sort"</span>, <a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff9b9c1ff494a55bdfb4d57eb8a43666466">prophet::FwdStrategy::GRTR_SORT</a>},
<a name="l00152"></a>00152             {<span class="stringliteral">"grtr_max"</span>,  <a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff9ecc35b1ddfc1e3bd218f938a99327472">prophet::FwdStrategy::GRTR_MAX</a>},
<a name="l00153"></a>00153             {0, 0}
<a name="l00154"></a>00154         };
<a name="l00155"></a>00155         <span class="keywordtype">int</span> fs_pass = <a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.<a class="code" href="classprophet_1_1ProphetParams.html#673fa444b729127a7b55082009adcdea" title="bundle forwarding strategy">fs_</a>;
<a name="l00156"></a>00156         p.addopt(<span class="keyword">new</span> oasys::EnumOpt(<span class="stringliteral">"fwd_strategy"</span>,
<a name="l00157"></a>00157                     FwdStrategyCases, &amp;fs_pass, <span class="stringliteral">""</span>,
<a name="l00158"></a>00158                     <span class="stringliteral">"forwarding strategies"</span>));
<a name="l00159"></a>00159         <span class="keywordflow">if</span> (! p.parse(argc,argv,&amp;invalid))
<a name="l00160"></a>00160         {
<a name="l00161"></a>00161             resultf(<span class="stringliteral">"bad parameter for fwd_strategy: %s"</span>,invalid);
<a name="l00162"></a>00162             <span class="keywordflow">return</span> TCL_ERROR;
<a name="l00163"></a>00163         }
<a name="l00164"></a>00164 
<a name="l00165"></a>00165         <a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.<a class="code" href="classprophet_1_1ProphetParams.html#673fa444b729127a7b55082009adcdea" title="bundle forwarding strategy">fs_</a> =
<a name="l00166"></a>00166             (<a class="code" href="structprophet_1_1FwdStrategy.html#50567dba6d835926a1532568f6a46ff9" title="Forwarding strategies p.">prophet::FwdStrategy::fwd_strategy_t</a>)fs_pass;
<a name="l00167"></a>00167 
<a name="l00168"></a>00168         resultf(<span class="stringliteral">"fwd_strategy set to %s"</span>,
<a name="l00169"></a>00169                 <a class="code" href="structprophet_1_1FwdStrategy.html#7f4f68ad00baaae6231d6b4162e92c1e" title="Utility function to convert type code to const char*.">prophet::FwdStrategy::fs_to_str</a>(<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.fs_));
<a name="l00170"></a>00170     }
<a name="l00171"></a>00171     <span class="keywordflow">else</span>
<a name="l00172"></a>00172     <span class="keywordflow">if</span> (strncmp(cmd,<span class="stringliteral">"queue_policy"</span>,strlen(<span class="stringliteral">"queue_policy"</span>)) == 0)
<a name="l00173"></a>00173     {
<a name="l00174"></a>00174         oasys::EnumOpt::Case QueuePolicyCases[] =
<a name="l00175"></a>00175         {
<a name="l00176"></a>00176             {<span class="stringliteral">"fifo"</span>,  <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed6800b0cb9c3951d7d6db33102917550f3f">prophet::QueuePolicy::FIFO</a>},
<a name="l00177"></a>00177             {<span class="stringliteral">"mofo"</span>,  <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed684382c43915c1d5108a7ef513a6455887">prophet::QueuePolicy::MOFO</a>},
<a name="l00178"></a>00178             {<span class="stringliteral">"mopr"</span>,  <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed687446684993b20f377a98a45245a14b79">prophet::QueuePolicy::MOPR</a>},
<a name="l00179"></a>00179             {<span class="stringliteral">"lmopr"</span>, <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed68728feb9621404217cc7dc2362c9d366b">prophet::QueuePolicy::LINEAR_MOPR</a>},
<a name="l00180"></a>00180             {<span class="stringliteral">"shli"</span>,  <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed68769c4df6689421bad5ba4fcad0dfaf82">prophet::QueuePolicy::SHLI</a>},
<a name="l00181"></a>00181             {<span class="stringliteral">"lepr"</span>,  <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed68a7cf7e5bdd10d1048fb623a737cfe6af">prophet::QueuePolicy::LEPR</a>},
<a name="l00182"></a>00182             {0, 0}
<a name="l00183"></a>00183         };
<a name="l00184"></a>00184         <span class="keywordtype">int</span> qp_pass;
<a name="l00185"></a>00185         p.addopt(<span class="keyword">new</span> oasys::EnumOpt(<span class="stringliteral">"queue_policy"</span>,
<a name="l00186"></a>00186                     QueuePolicyCases, &amp;qp_pass, <span class="stringliteral">""</span>,
<a name="l00187"></a>00187                     <span class="stringliteral">"queueing policies as put forth by Prophet, March 2006"</span>));
<a name="l00188"></a>00188         <span class="keywordflow">if</span> (! p.parse(argc,argv,&amp;invalid))
<a name="l00189"></a>00189         {
<a name="l00190"></a>00190             resultf(<span class="stringliteral">"bad parameter for queue_policy: %s"</span>,invalid);
<a name="l00191"></a>00191             <span class="keywordflow">return</span> TCL_ERROR;
<a name="l00192"></a>00192         }
<a name="l00193"></a>00193 
<a name="l00194"></a>00194         <a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed68" title="Queuing policies p.">prophet::QueuePolicy::q_policy_t</a> qp =
<a name="l00195"></a>00195             (<a class="code" href="structprophet_1_1QueuePolicy.html#41e2705af81c561ed69d802afa47ed68" title="Queuing policies p.">prophet::QueuePolicy::q_policy_t</a>)qp_pass;
<a name="l00196"></a>00196 
<a name="l00197"></a>00197         <a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.<a class="code" href="classprophet_1_1ProphetParams.html#baee73aa7287cc40ce5c4371c258d0ed" title="bundle queuing policy">qp_</a> = qp;
<a name="l00198"></a>00198         <span class="keywordflow">if</span> (<a class="code" href="classdtn_1_1ProphetRouter.html#3279ff240ebac50a0960147ba8272c1a" title="Query the router as to whether initialization is complete.">ProphetRouter::is_init</a>())
<a name="l00199"></a>00199         {
<a name="l00200"></a>00200             <a class="code" href="classdtn_1_1ProphetRouter.html">ProphetRouter</a>* r = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classdtn_1_1ProphetRouter.html">ProphetRouter</a>*<span class="keyword">&gt;</span>(
<a name="l00201"></a>00201                                     BundleDaemon::instance()-&gt;router());
<a name="l00202"></a>00202             <span class="keywordflow">if</span> (r != NULL)
<a name="l00203"></a>00203                 r-&gt;<a class="code" href="classdtn_1_1ProphetRouter.html#c0b21659eeb7bf95aa5475394f576a82" title="Callback methods for handling runtime configuration changes.">set_queue_policy</a>();
<a name="l00204"></a>00204         }
<a name="l00205"></a>00205         resultf(<span class="stringliteral">"queue_policy set to %s"</span>, <a class="code" href="structprophet_1_1QueuePolicy.html#10be033bf51963571262ddccc33508be" title="Utility function to convert type code to const char*.">prophet::QueuePolicy::qp_to_str</a>(qp));
<a name="l00206"></a>00206     }
<a name="l00207"></a>00207     <span class="keywordflow">else</span>
<a name="l00208"></a>00208     <span class="keywordflow">if</span> (strncmp(cmd,<span class="stringliteral">"hello_interval"</span>,strlen(<span class="stringliteral">"hello_interval"</span>)) == 0)
<a name="l00209"></a>00209     {
<a name="l00210"></a>00210         u_int8_t hello_interval;
<a name="l00211"></a>00211         p.addopt(<span class="keyword">new</span> oasys::UInt8Opt(<span class="stringliteral">"hello_interval"</span>,
<a name="l00212"></a>00212                  &amp;hello_interval,<span class="stringliteral">"seconds"</span>,
<a name="l00213"></a>00213                  <span class="stringliteral">"100s of milliseconds between HELLO beacons (between 1 "</span>
<a name="l00214"></a>00214                  <span class="stringliteral">"and 255)"</span>));
<a name="l00215"></a>00215 
<a name="l00216"></a>00216         <span class="keywordflow">if</span> (! p.parse(argc,argv,&amp;invalid))
<a name="l00217"></a>00217         {
<a name="l00218"></a>00218             resultf(<span class="stringliteral">"bad parameter for hello_interval: %s"</span>,invalid);
<a name="l00219"></a>00219             <span class="keywordflow">return</span> TCL_ERROR;
<a name="l00220"></a>00220         }
<a name="l00221"></a>00221 
<a name="l00222"></a>00222         <a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.<a class="code" href="classprophet_1_1ProphetParams.html#8e006d8ded69418e398b6072045e1d4f" title="delay between HELLO beacons (100ms units)">hello_interval_</a> = hello_interval;
<a name="l00223"></a>00223         <span class="keywordflow">if</span> (<a class="code" href="classdtn_1_1ProphetRouter.html#3279ff240ebac50a0960147ba8272c1a" title="Query the router as to whether initialization is complete.">ProphetRouter::is_init</a>())
<a name="l00224"></a>00224         {
<a name="l00225"></a>00225             <a class="code" href="classdtn_1_1ProphetRouter.html">ProphetRouter</a>* r = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classdtn_1_1ProphetRouter.html">ProphetRouter</a>*<span class="keyword">&gt;</span>(
<a name="l00226"></a>00226                     BundleDaemon::instance()-&gt;router());
<a name="l00227"></a>00227             <span class="keywordflow">if</span> (r != NULL)
<a name="l00228"></a>00228                 r-&gt;<a class="code" href="classdtn_1_1ProphetRouter.html#d6c24ab26ece29f3d84130576525a283" title="Callback methods for handling runtime configuration changes.">set_hello_interval</a>();
<a name="l00229"></a>00229         }
<a name="l00230"></a>00230         resultf(<span class="stringliteral">"hello_interval set to %d"</span>,hello_interval);
<a name="l00231"></a>00231     }
<a name="l00232"></a>00232     <span class="keywordflow">else</span>
<a name="l00233"></a>00233     <span class="keywordflow">if</span> (strncmp(cmd,<span class="stringliteral">"max_route"</span>,strlen(<span class="stringliteral">"max_route"</span>)) == 0)
<a name="l00234"></a>00234     {
<a name="l00235"></a>00235         u_int max_route;
<a name="l00236"></a>00236         p.addopt(<span class="keyword">new</span> oasys::UIntOpt(<span class="stringliteral">"max_route"</span>,
<a name="l00237"></a>00237                  &amp;max_route, <span class="stringliteral">"maximum number"</span>,
<a name="l00238"></a>00238                  <span class="stringliteral">"maximum number of routes for Prophet to retain"</span>));
<a name="l00239"></a>00239 
<a name="l00240"></a>00240         <span class="keywordflow">if</span> (! p.parse(argc,argv,&amp;invalid))
<a name="l00241"></a>00241         {
<a name="l00242"></a>00242             resultf(<span class="stringliteral">"bad parameter for hello_interval: %s"</span>,invalid);
<a name="l00243"></a>00243             <span class="keywordflow">return</span> TCL_ERROR;
<a name="l00244"></a>00244         }
<a name="l00245"></a>00245 
<a name="l00246"></a>00246         <a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>.<a class="code" href="classprophet_1_1ProphetParams.html#c4c67c6dd4e453f159ddd5a6afca8fb4" title="max number of routes to retain">max_table_size_</a> = max_route;
<a name="l00247"></a>00247         <span class="keywordflow">if</span> (<a class="code" href="classdtn_1_1ProphetRouter.html#3279ff240ebac50a0960147ba8272c1a" title="Query the router as to whether initialization is complete.">ProphetRouter::is_init</a>())
<a name="l00248"></a>00248         {
<a name="l00249"></a>00249             <a class="code" href="classdtn_1_1ProphetRouter.html">ProphetRouter</a>* r = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classdtn_1_1ProphetRouter.html">ProphetRouter</a>*<span class="keyword">&gt;</span>(
<a name="l00250"></a>00250                     BundleDaemon::instance()-&gt;router());
<a name="l00251"></a>00251             <span class="keywordflow">if</span> (r != NULL)
<a name="l00252"></a>00252                 r-&gt;<a class="code" href="classdtn_1_1ProphetRouter.html#9325f2d59c2779bff283caf7c5666745" title="Callback methods for handling runtime configuration changes.">set_max_route</a>();
<a name="l00253"></a>00253         }
<a name="l00254"></a>00254         resultf(<span class="stringliteral">"max_route set to %u"</span>,max_route);
<a name="l00255"></a>00255     }
<a name="l00256"></a>00256 
<a name="l00257"></a>00257     <span class="keywordflow">return</span> TCL_OK;
<a name="l00258"></a>00258 }
<a name="l00259"></a>00259 
<a name="l00260"></a>00260 } <span class="comment">// namespace dtn</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&nbsp;
<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>