Sophie

Sophie

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

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: ProphetRouter.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>ProphetRouter.cc</h1><a href="ProphetRouter_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 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">#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 "<a class="code" href="BundleProtocol_8h.html">bundling/BundleProtocol.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="BundleDaemon_8h.html">bundling/BundleDaemon.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;oasys/thread/Lock.h&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="QueuePolicy_8h.html">prophet/QueuePolicy.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="ProphetRouter_8h.html">ProphetRouter.h</a>"</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="keyword">namespace </span>dtn
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 
<a name="l00031"></a><a class="code" href="namespacedtn.html#69742eb2b516bc1564d1f36c7abe163f">00031</a> <span class="keywordtype">void</span> <a class="code" href="namespacedtn.html#69742eb2b516bc1564d1f36c7abe163f">prophet_router_shutdown</a>(<span class="keywordtype">void</span>*)
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033     BundleDaemon::instance()-&gt;router()-&gt;shutdown();
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <a class="code" href="classprophet_1_1ProphetParams.html" title="Tunable parameter struct for setting global default values for various Prophet algorithms...">prophet::ProphetParams</a> <a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">ProphetRouter::params_</a>;
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1ProphetRouter.html#fb4e243340f3878127e6c07c6b5d3ee5" title="flag to indicate whether initialization has run">ProphetRouter::is_init_</a> = <span class="keyword">false</span>;
<a name="l00039"></a>00039 
<a name="l00040"></a><a class="code" href="classdtn_1_1ProphetRouter.html#4709c6ecd0eedea8f3bbe2dd66b3f79c">00040</a> <a class="code" href="classdtn_1_1ProphetRouter.html#4709c6ecd0eedea8f3bbe2dd66b3f79c" title="Constructor.">ProphetRouter::ProphetRouter</a>()
<a name="l00041"></a>00041     : <a class="code" href="classdtn_1_1BundleRouter.html" title="The BundleRouter is the main decision maker for all routing decisions related to...">BundleRouter</a>(<span class="stringliteral">"ProphetRouter"</span>,<span class="stringliteral">"prophet"</span>),
<a name="l00042"></a>00042       core_(NULL), oracle_(NULL),
<a name="l00043"></a>00043       lock_(new oasys::SpinLock(<span class="stringliteral">"ProphetRouter"</span>))
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045 }
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="classdtn_1_1ProphetRouter.html#a6fd06e4f14f7e58e93582b73f99c540">00047</a> <a class="code" href="classdtn_1_1ProphetRouter.html#a6fd06e4f14f7e58e93582b73f99c540" title="Destructor.">ProphetRouter::~ProphetRouter</a>()
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049     <span class="keyword">delete</span> <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>;
<a name="l00050"></a>00050     <span class="keyword">delete</span> <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>;
<a name="l00051"></a>00051     <span class="keyword">delete</span> <a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>;
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="keywordtype">void</span>
<a name="l00055"></a><a class="code" href="classdtn_1_1ProphetRouter.html#304a0bf554ed47ef4859269a85282e07">00055</a> <a class="code" href="classdtn_1_1ProphetRouter.html#304a0bf554ed47ef4859269a85282e07" title="Post-constructor initialization routine.">ProphetRouter::initialize</a>()
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>( <a class="code" href="classdtn_1_1ProphetRouter.html#fb4e243340f3878127e6c07c6b5d3ee5" title="flag to indicate whether initialization has run">is_init_</a> == <span class="keyword">false</span> );
<a name="l00058"></a>00058 
<a name="l00059"></a>00059     <span class="comment">// create local instance of ProphetBundleCore,</span>
<a name="l00060"></a>00060     <span class="comment">// prophet::Repository, and prophet::Controller</span>
<a name="l00061"></a>00061     std::string local_eid(BundleDaemon::instance()-&gt;local_eid().str());
<a name="l00062"></a>00062 
<a name="l00063"></a>00063     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a> = <span class="keyword">new</span> <a class="code" href="classdtn_1_1ProphetBundleCore.html" title="Implements the prophet::BundleCore API by integrating DTN&amp;#39;s system services.">ProphetBundleCore</a>(local_eid,<a class="code" href="classdtn_1_1BundleRouter.html#cf71e3f1982b36bafa7ac5cd45d38675" title="The actions interface, set by the BundleDaemon when the router is initialized.">actions_</a>,<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>);
<a name="l00064"></a>00064     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a> = <span class="keyword">new</span> prophet::Controller(<a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>,<a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#8977fbd7babe7accd434e8fa8426ce90" title="Virtual from prophet::BundleCore.">bundles</a>(),&amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">params_</a>);
<a name="l00065"></a>00065 
<a name="l00066"></a>00066     <span class="comment">// register the global shutdown function</span>
<a name="l00067"></a>00067     BundleDaemon::instance()-&gt;set_rtr_shutdown(
<a name="l00068"></a>00068             <a class="code" href="namespacedtn.html#69742eb2b516bc1564d1f36c7abe163f">prophet_router_shutdown</a>, (<span class="keywordtype">void</span> *) 0);
<a name="l00069"></a>00069 
<a name="l00070"></a>00070     <span class="comment">// deserialize any routes from permanent storage </span>
<a name="l00071"></a>00071     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#2f380429a5d36969d4522d02e4aa6e51" title="Initialization routine for deserializing routes from permanent storage.">load_prophet_nodes</a>(<a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;nodes(),&amp;<a class="code" href="classdtn_1_1ProphetRouter.html#eb1d9d265f364705570696cb39c9df78" title="Prophet&amp;#39;s configuration and default values.">params_</a>);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073     <a class="code" href="classdtn_1_1ProphetRouter.html#fb4e243340f3878127e6c07c6b5d3ee5" title="flag to indicate whether initialization has run">is_init_</a> = <span class="keyword">true</span>;
<a name="l00074"></a>00074     log_info(<span class="stringliteral">"ProphetRouter initialization complete"</span>);
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 <span class="keywordtype">void</span>
<a name="l00078"></a><a class="code" href="classdtn_1_1ProphetRouter.html#a920b30dda10ae715f859d808a7d32d1">00078</a> <a class="code" href="classdtn_1_1ProphetRouter.html#a920b30dda10ae715f859d808a7d32d1" title="Virtual from BundleRouter.">ProphetRouter::shutdown</a>()
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080     log_info(<span class="stringliteral">"ProphetRouter shutdown"</span>);
<a name="l00081"></a>00081     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"shutdown"</span>);
<a name="l00082"></a>00082     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;shutdown();
<a name="l00083"></a>00083     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#727fe40847cd264cec424bb5ef6d3161" title="Callback for host system&amp;#39;s shutdown routine.">shutdown</a>();
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 <span class="keywordtype">void</span>
<a name="l00087"></a><a class="code" href="classdtn_1_1ProphetRouter.html#d8879a4475b92ace92406c197705e052">00087</a> <a class="code" href="classdtn_1_1ProphetRouter.html#d8879a4475b92ace92406c197705e052" title="Virtual from BundleRouter.">ProphetRouter::handle_event</a>(<a class="code" href="classdtn_1_1BundleEvent.html" title="Event base class.">BundleEvent</a>* e)
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089     <a class="code" href="classdtn_1_1BundleEventHandler.html#ff1afd1aab4f62d6dfccfc855968206d" title="Dispatch the event by type code to one of the event-specific handler functions below...">dispatch_event</a>(e);
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091 
<a name="l00092"></a>00092 <span class="keywordtype">void</span>
<a name="l00093"></a><a class="code" href="classdtn_1_1ProphetRouter.html#490806ff616e7d4695f14ada5ec17f2e">00093</a> <a class="code" href="classdtn_1_1ProphetRouter.html#490806ff616e7d4695f14ada5ec17f2e" title="Write out routing state to StringBuffer.">ProphetRouter::get_routing_state</a>(oasys::StringBuffer* <a class="code" href="num2sdnv_8c.html#a81cdcc7ff6987bc85c073253e32715f">buf</a>)
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095     log_info(<span class="stringliteral">"ProphetRouter get_routing_state"</span>);
<a name="l00096"></a>00096     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"get_routing_state"</span>);
<a name="l00097"></a>00097 
<a name="l00098"></a>00098     <span class="comment">// summarize current number of routes, misc. statistics</span>
<a name="l00099"></a>00099     buf-&gt;appendf(<span class="stringliteral">"ProphetRouter:\n"</span>
<a name="l00100"></a>00100             <span class="stringliteral">"  %zu routes, %zu queued bundles, %zu ACKs, %zu active sessions\n"</span>,
<a name="l00101"></a>00101             <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;nodes()-&gt;size(),
<a name="l00102"></a>00102             <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#8977fbd7babe7accd434e8fa8426ce90" title="Virtual from prophet::BundleCore.">bundles</a>()-&gt;size(),
<a name="l00103"></a>00103             <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;acks()-&gt;size(),
<a name="l00104"></a>00104             <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;size());
<a name="l00105"></a>00105     <span class="comment">// iterate over Encounters and query their status</span>
<a name="l00106"></a>00106     buf-&gt;appendf(<span class="stringliteral">"Active Sessions\n"</span>);
<a name="l00107"></a>00107     <span class="keywordflow">for</span> (prophet::Controller::List::const_iterator i = <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;begin();
<a name="l00108"></a>00108             i != <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;end(); i++)
<a name="l00109"></a>00109     {
<a name="l00110"></a>00110         buf-&gt;appendf(<span class="stringliteral">" %4d: %-30s %s timeout %u\n"</span>,
<a name="l00111"></a>00111                 (*i)-&gt;local_instance(),
<a name="l00112"></a>00112                 (*i)-&gt;nexthop()-&gt;remote_eid(),
<a name="l00113"></a>00113                 (*i)-&gt;state_str(),
<a name="l00114"></a>00114                 (*i)-&gt;time_remaining());
<a name="l00115"></a>00115     }
<a name="l00116"></a>00116     buf-&gt;appendf(<span class="stringliteral">"Routes\n"</span>);
<a name="l00117"></a>00117     <span class="keywordflow">for</span> (<a class="code" href="classprophet_1_1Table.html#a2f4bc33f615e318215dc60b48447a5d">prophet::Table::const_iterator</a> i = <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;nodes()-&gt;begin();
<a name="l00118"></a>00118             i != <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;nodes()-&gt;end(); i++)
<a name="l00119"></a>00119     {
<a name="l00120"></a>00120         buf-&gt;appendf(<span class="stringliteral">"       %-30s: %.2f %s%s%s %lu s old\n"</span>,
<a name="l00121"></a>00121                 i-&gt;second-&gt;dest_id(), i-&gt;second-&gt;p_value(),
<a name="l00122"></a>00122                 i-&gt;second-&gt;relay() ? <span class="stringliteral">"R"</span> : <span class="stringliteral">" "</span>,
<a name="l00123"></a>00123                 i-&gt;second-&gt;custody() ? <span class="stringliteral">"C"</span> : <span class="stringliteral">" "</span>,
<a name="l00124"></a>00124                 i-&gt;second-&gt;internet_gw() ? <span class="stringliteral">"I"</span> : <span class="stringliteral">" "</span>,
<a name="l00125"></a>00125                 (time(0) - i-&gt;second-&gt;age()));
<a name="l00126"></a>00126     }
<a name="l00127"></a>00127     buf-&gt;appendf(<span class="stringliteral">"\n R - relay   C - custody   I - internet gateway \n\n"</span>);
<a name="l00128"></a>00128 
<a name="l00129"></a>00129     <span class="comment">//XXX/wilson debug</span>
<a name="l00130"></a>00130     buf-&gt;appendf(<span class="stringliteral">"Bundles:\n"</span>);
<a name="l00131"></a>00131     <a class="code" href="classprophet_1_1BundleList.html" title="List of Prophet&amp;#39;s Bundle facade objects.">prophet::BundleList</a> bundles = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#8977fbd7babe7accd434e8fa8426ce90" title="Virtual from prophet::BundleCore.">bundles</a>()-&gt;get_bundles();
<a name="l00132"></a>00132     <span class="keywordflow">for</span> (prophet::BundleList::iterator i = bundles.begin();
<a name="l00133"></a>00133             i != bundles.end(); i++)
<a name="l00134"></a>00134     {
<a name="l00135"></a>00135         buf-&gt;appendf(<span class="stringliteral">"%s -&gt; %s (%u:%u)\n"</span>,
<a name="l00136"></a>00136                 (*i)-&gt;source_id().c_str(),
<a name="l00137"></a>00137                 (*i)-&gt;destination_id().c_str(),
<a name="l00138"></a>00138                 (*i)-&gt;creation_ts(),
<a name="l00139"></a>00139                 (*i)-&gt;sequence_num());
<a name="l00140"></a>00140     }
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="keywordtype">bool</span>
<a name="l00144"></a><a class="code" href="classdtn_1_1ProphetRouter.html#fdbd79c1f2d0d746ab05de40af7c6a7b">00144</a> <a class="code" href="classdtn_1_1ProphetRouter.html#fdbd79c1f2d0d746ab05de40af7c6a7b" title="Virtual from BundleRouter.">ProphetRouter::accept_bundle</a>(<a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle, <span class="keywordtype">int</span>* errp)
<a name="l00145"></a>00145 {
<a name="l00146"></a>00146     log_info(<span class="stringliteral">"ProphetRouter accept_bundle"</span>);
<a name="l00147"></a>00147 
<a name="l00148"></a>00148     <span class="comment">// first ask base class</span>
<a name="l00149"></a>00149     <span class="keywordflow">if</span> (!<a class="code" href="classdtn_1_1BundleRouter.html#47afbf9e1c42ae2cfb396c3895ddca45" title="Synchronous probe indicating whether or not this bundle should be accepted by the...">BundleRouter::accept_bundle</a>(bundle,errp))
<a name="l00150"></a>00150     {
<a name="l00151"></a>00151         log_debug(<span class="stringliteral">"BundleRouter rejects *%p"</span>,bundle);
<a name="l00152"></a>00152         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00153"></a>00153     }
<a name="l00154"></a>00154 
<a name="l00155"></a>00155     <a class="code" href="namespacedtn.html#87094f3b26b9f1d469e616d311ae57b1" title="Class definition for a Bundle reference.">BundleRef</a> tmp(<span class="stringliteral">"accept_bundle"</span>);
<a name="l00156"></a>00156     tmp = bundle;
<a name="l00157"></a>00157 
<a name="l00158"></a>00158     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"accept_bundle"</span>);
<a name="l00159"></a>00159     <span class="comment">// retrieve temp prophet handle to Bundle metadata</span>
<a name="l00160"></a>00160     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Bundle.html" title="Facade interface between Prophet router and host implmentation&amp;#39;s Bundle representation...">prophet::Bundle</a>* b = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#df384080fdfc9cc99c8ed066f503fb5d" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_temp_bundle</a>(tmp);
<a name="l00161"></a>00161     <span class="keywordflow">if</span> (errp != NULL) errp = (int) <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917eac137290a0338e66ed4a0c1cc09c2f2">BundleProtocol::REASON_NO_ADDTL_INFO</a>;
<a name="l00162"></a>00162     <span class="comment">// ask controller's opinion on this bundle</span>
<a name="l00163"></a>00163     <span class="keywordtype">bool</span> ok = <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;accept_bundle(b);
<a name="l00164"></a>00164     <span class="comment">// clean up memory used by temporary wrapper</span>
<a name="l00165"></a>00165     <span class="keyword">delete</span> b;
<a name="l00166"></a>00166     log_debug(<span class="stringliteral">"do%saccept bundle *%p"</span>, ok ? <span class="stringliteral">" "</span> : <span class="stringliteral">" not "</span>, bundle);
<a name="l00167"></a>00167     <span class="keywordflow">return</span> ok;
<a name="l00168"></a>00168 }
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 <span class="keywordtype">void</span>
<a name="l00171"></a><a class="code" href="classdtn_1_1ProphetRouter.html#d13ac67e947b37e95947f82661433a2a">00171</a> <a class="code" href="classdtn_1_1ProphetRouter.html#d13ac67e947b37e95947f82661433a2a" title="Virtual from BundleRouter.">ProphetRouter::handle_bundle_received</a>(<a class="code" href="classdtn_1_1BundleReceivedEvent.html" title="Event class for new bundle arrivals.">BundleReceivedEvent</a>* e)
<a name="l00172"></a>00172 {
<a name="l00173"></a>00173     log_info(<span class="stringliteral">"ProphetRouter handle_bundle_received"</span>);
<a name="l00174"></a>00174 
<a name="l00175"></a>00175     <span class="comment">// should not be reached, but somehow still is</span>
<a name="l00176"></a>00176     <span class="keywordflow">if</span> (e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#c65ff559e593a79e83d71978265a0407" title="The source of the bundle.">source_</a> == <a class="code" href="namespacedtn.html#60ee39c9672604f59fe1b12d4e1d142b8fb8e6004d0ab350daca47bdcc106866" title="the data store">EVENTSRC_STORE</a>)
<a name="l00177"></a>00177         <span class="keywordflow">return</span>;
<a name="l00178"></a>00178 
<a name="l00179"></a>00179     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Link.html">prophet::Link</a>* l = NULL;
<a name="l00180"></a>00180 
<a name="l00181"></a>00181     oasys::ScopeLock sl(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"handle_bundle_received"</span>);
<a name="l00182"></a>00182     <span class="keywordflow">if</span> (e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#c65ff559e593a79e83d71978265a0407" title="The source of the bundle.">source_</a> != <a class="code" href="namespacedtn.html#60ee39c9672604f59fe1b12d4e1d142bf3e56dfb4e624d4f62d7099b60472072" title="a local application">EVENTSRC_APP</a>)
<a name="l00183"></a>00183     {
<a name="l00184"></a>00184         <span class="comment">// The external CL does not set this field, which the Prophet</span>
<a name="l00185"></a>00185         <span class="comment">// implementation needs. We want to fail quickly if we're</span>
<a name="l00186"></a>00186         <span class="comment">// running with the ECL.</span>
<a name="l00187"></a>00187         <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#b851addef235e605411198e7bb3d9677" title="Link from which bundle was received, if applicable.">link_</a> != NULL);
<a name="l00188"></a>00188 
<a name="l00189"></a>00189         <span class="comment">// add DTN's Link to BundleCore facade</span>
<a name="l00190"></a>00190         <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#0dcc65afc988880e4b15557aa771a9c1">add</a>(e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#b851addef235e605411198e7bb3d9677" title="Link from which bundle was received, if applicable.">link_</a>);
<a name="l00191"></a>00191         
<a name="l00192"></a>00192         <span class="comment">// retrieve prophet's handle to Link metadata</span>
<a name="l00193"></a>00193         l = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#d66e16db42a6bbe21ec71964ec73223e" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_link</a>(e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#b851addef235e605411198e7bb3d9677" title="Link from which bundle was received, if applicable.">link_</a>.object());
<a name="l00194"></a>00194 
<a name="l00195"></a>00195         <span class="keywordflow">if</span> (l == NULL) <span class="keywordflow">return</span>;
<a name="l00196"></a>00196     }
<a name="l00197"></a>00197 
<a name="l00198"></a>00198     <span class="comment">// create temporary prophet handle to Bundle metadata</span>
<a name="l00199"></a>00199     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Bundle.html" title="Facade interface between Prophet router and host implmentation&amp;#39;s Bundle representation...">prophet::Bundle</a>* b = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#df384080fdfc9cc99c8ed066f503fb5d" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_temp_bundle</a>(e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#2e1b84458a749cb26467f9053677874c" title="The newly arrived bundle.">bundleref_</a>);
<a name="l00200"></a>00200 
<a name="l00201"></a>00201     <span class="keywordflow">if</span> (b == NULL)
<a name="l00202"></a>00202     {
<a name="l00203"></a>00203         log_err(<span class="stringliteral">"failed to retrieve prophet handle for *%p"</span>,
<a name="l00204"></a>00204                 e-&gt;<a class="code" href="classdtn_1_1BundleReceivedEvent.html#2e1b84458a749cb26467f9053677874c" title="The newly arrived bundle.">bundleref_</a>.object());
<a name="l00205"></a>00205         <span class="keywordflow">return</span>;
<a name="l00206"></a>00206     }
<a name="l00207"></a>00207 
<a name="l00208"></a>00208     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#523fafcbef972e062ebe3c411dd7dc2f" title="objects that link DTN to Prophet bundles">bundles_</a>.<a class="code" href="classdtn_1_1ProphetBundleList.html#726b948b41a5e24b7f2f18689dd1b107" title="Add mapping for dtn::BundleRef to list.">add</a>(b);
<a name="l00209"></a>00209 
<a name="l00210"></a>00210     <span class="comment">// inform Controller that a new bundle has arrived on this link</span>
<a name="l00211"></a>00211     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;handle_bundle_received(b,l);
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 <span class="keywordtype">void</span>
<a name="l00215"></a><a class="code" href="classdtn_1_1ProphetRouter.html#9d46ae8ac401fb55fd21b858fe09b325">00215</a> <a class="code" href="classdtn_1_1ProphetRouter.html#9d46ae8ac401fb55fd21b858fe09b325" title="Virtual from BundleRouter.">ProphetRouter::handle_bundle_delivered</a>(<a class="code" href="classdtn_1_1BundleDeliveredEvent.html" title="Event class for local bundle delivery.">BundleDeliveredEvent</a>* e)
<a name="l00216"></a>00216 {
<a name="l00217"></a>00217     log_info(<span class="stringliteral">"ProphetRouter handle_bundle_delivered"</span>);
<a name="l00218"></a>00218     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"handle_bundle_delivered"</span>);
<a name="l00219"></a>00219 
<a name="l00220"></a>00220     <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle = e-&gt;<a class="code" href="classdtn_1_1BundleDeliveredEvent.html#da93626e6dcfca7b887be2d7a17fa8ac" title="The delivered bundle.">bundleref_</a>.object();
<a name="l00221"></a>00221     <span class="keywordflow">if</span> (bundle == NULL) <span class="keywordflow">return</span>;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223     <span class="comment">// retrieve prophet's handle to Bundle metadata</span>
<a name="l00224"></a>00224     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Bundle.html" title="Facade interface between Prophet router and host implmentation&amp;#39;s Bundle representation...">prophet::Bundle</a>* b = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#996e6a15afca44ed35cb91bf1cab3c25" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_bundle</a>(bundle);
<a name="l00225"></a>00225     <span class="keywordflow">if</span> (b == NULL) 
<a name="l00226"></a>00226     {
<a name="l00227"></a>00227         log_err(<span class="stringliteral">"Failed to convert *%p to prophet object"</span>,bundle);
<a name="l00228"></a>00228         <span class="keywordflow">return</span>;
<a name="l00229"></a>00229     }
<a name="l00230"></a>00230     <span class="comment">// BundleDeliveredEvent means prophet::Ack, which kicks Bundle out of Prophet</span>
<a name="l00231"></a>00231     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;ack(b);
<a name="l00232"></a>00232 }
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 <span class="keywordtype">void</span>
<a name="l00235"></a><a class="code" href="classdtn_1_1ProphetRouter.html#2ed59b661dc9a313d166f45c1e3bee69">00235</a> <a class="code" href="classdtn_1_1ProphetRouter.html#2ed59b661dc9a313d166f45c1e3bee69" title="Virtual from BundleRouter.">ProphetRouter::handle_bundle_expired</a>(<a class="code" href="classdtn_1_1BundleExpiredEvent.html" title="Event class for bundle expiration.">BundleExpiredEvent</a>* e)
<a name="l00236"></a>00236 {
<a name="l00237"></a>00237     log_info(<span class="stringliteral">"ProphetRouter handle_bundle_expired"</span>);
<a name="l00238"></a>00238     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"handle_bundle_expired"</span>);
<a name="l00239"></a>00239 
<a name="l00240"></a>00240     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Bundle.html" title="Facade interface between Prophet router and host implmentation&amp;#39;s Bundle representation...">prophet::Bundle</a>* b = NULL;
<a name="l00241"></a>00241     <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle = e-&gt;<a class="code" href="classdtn_1_1BundleExpiredEvent.html#ff03d709b5e05b88f372b75d8644c7eb" title="The expired bundle.">bundleref_</a>.object();
<a name="l00242"></a>00242     <span class="keywordflow">if</span> (bundle != NULL &amp;&amp; ((b = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#996e6a15afca44ed35cb91bf1cab3c25" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_bundle</a>(bundle)) != NULL))
<a name="l00243"></a>00243     {
<a name="l00244"></a>00244         <span class="comment">// drop Prophet stats on this bundle</span>
<a name="l00245"></a>00245         <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;stats()-&gt;drop_bundle(b);
<a name="l00246"></a>00246     }
<a name="l00247"></a>00247 
<a name="l00248"></a>00248     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#12409f4d4d0b3d4be1c756129f133379">del</a>(e-&gt;<a class="code" href="classdtn_1_1BundleExpiredEvent.html#ff03d709b5e05b88f372b75d8644c7eb" title="The expired bundle.">bundleref_</a>);
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250 
<a name="l00251"></a>00251 <span class="keywordtype">void</span> 
<a name="l00252"></a><a class="code" href="classdtn_1_1ProphetRouter.html#72e71b3a6e8d45ef6a9b8920aac53dae">00252</a> <a class="code" href="classdtn_1_1ProphetRouter.html#72e71b3a6e8d45ef6a9b8920aac53dae" title="Virtual from BundleRouter.">ProphetRouter::handle_bundle_transmitted</a>(<a class="code" href="classdtn_1_1BundleTransmittedEvent.html" title="Event class for bundle or fragment transmission.">BundleTransmittedEvent</a>* e)
<a name="l00253"></a>00253 {
<a name="l00254"></a>00254     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Bundle.html" title="Facade interface between Prophet router and host implmentation&amp;#39;s Bundle representation...">prophet::Bundle</a>* bundle = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#996e6a15afca44ed35cb91bf1cab3c25" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_bundle</a>(e-&gt;<a class="code" href="classdtn_1_1BundleTransmittedEvent.html#1d7eb733d3768632525dc99663473b2c" title="The transmitted bundle.">bundleref_</a>.object());
<a name="l00255"></a>00255     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Link.html">prophet::Link</a>* link = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#d66e16db42a6bbe21ec71964ec73223e" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_link</a>(e-&gt;<a class="code" href="classdtn_1_1BundleTransmittedEvent.html#12bfb1b3d1aaf619c9ac7d646a362455" title="The link over which the bundle was sent (may not have a contact when the transmission...">link_</a>.object());
<a name="l00256"></a>00256     <span class="keywordflow">if</span> (bundle != NULL &amp;&amp; link != NULL)
<a name="l00257"></a>00257         <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;handle_bundle_transmitted(bundle,link);
<a name="l00258"></a>00258 }
<a name="l00259"></a>00259 
<a name="l00260"></a>00260 <span class="keywordtype">void</span>
<a name="l00261"></a><a class="code" href="classdtn_1_1ProphetRouter.html#90bccc3b9c6c4aef912f79a905bee708">00261</a> <a class="code" href="classdtn_1_1ProphetRouter.html#90bccc3b9c6c4aef912f79a905bee708" title="Virtual from BundleRouter.">ProphetRouter::handle_contact_up</a>(<a class="code" href="classdtn_1_1ContactUpEvent.html" title="Event class for contact up events.">ContactUpEvent</a>* e)
<a name="l00262"></a>00262 {
<a name="l00263"></a>00263     log_info(<span class="stringliteral">"ProphetRouter handle_contact_up"</span>);
<a name="l00264"></a>00264     oasys::ScopeLock lk(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"handle_contact_up"</span>);
<a name="l00265"></a>00265 
<a name="l00266"></a>00266     <a class="code" href="classdtn_1_1Link.html" title="Abstraction for a DTN link, i.e.">Link</a>* link = e-&gt;<a class="code" href="classdtn_1_1ContactUpEvent.html#10e9dd243dd15f8e5974a02df3ab8e6e" title="The contact that is up.">contact_</a>-&gt;link().object();
<a name="l00267"></a>00267     <span class="keywordflow">if</span> (link == NULL) <span class="keywordflow">return</span>;
<a name="l00268"></a>00268 
<a name="l00269"></a>00269     <span class="comment">// add DTN's Link to BundleCore facade</span>
<a name="l00270"></a>00270     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#0dcc65afc988880e4b15557aa771a9c1">add</a>(e-&gt;<a class="code" href="classdtn_1_1ContactUpEvent.html#10e9dd243dd15f8e5974a02df3ab8e6e" title="The contact that is up.">contact_</a>-&gt;link());
<a name="l00271"></a>00271     <span class="comment">// retrieve prophet's handle to Link metadata</span>
<a name="l00272"></a>00272     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Link.html">prophet::Link</a>* l = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#d66e16db42a6bbe21ec71964ec73223e" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_link</a>(link);
<a name="l00273"></a>00273     <span class="keywordflow">if</span> (l == NULL) <span class="keywordflow">return</span>;
<a name="l00274"></a>00274     <span class="comment">// tell Controller about our new friend</span>
<a name="l00275"></a>00275     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;new_neighbor(l);
<a name="l00276"></a>00276 }
<a name="l00277"></a>00277 
<a name="l00278"></a>00278 <span class="keywordtype">void</span>
<a name="l00279"></a><a class="code" href="classdtn_1_1ProphetRouter.html#f264be330910c84da2092cb4f60d34db">00279</a> <a class="code" href="classdtn_1_1ProphetRouter.html#f264be330910c84da2092cb4f60d34db" title="Virtual from BundleRouter.">ProphetRouter::handle_contact_down</a>(<a class="code" href="classdtn_1_1ContactDownEvent.html" title="Event class for contact down events.">ContactDownEvent</a>* e)
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281     log_info(<span class="stringliteral">"ProphetRouter handle_contact_down"</span>);
<a name="l00282"></a>00282     oasys::ScopeLock lk(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"handle_contact_down"</span>);
<a name="l00283"></a>00283 
<a name="l00284"></a>00284     <a class="code" href="classdtn_1_1Link.html" title="Abstraction for a DTN link, i.e.">Link</a>* link = e-&gt;<a class="code" href="classdtn_1_1ContactDownEvent.html#cc4067480bd6af7023cb6d4c99122a7e" title="The contact that is now down.">contact_</a>-&gt;link().object();
<a name="l00285"></a>00285 
<a name="l00286"></a>00286     <span class="comment">// retrieve prophet's handle to Link metadata</span>
<a name="l00287"></a>00287     <span class="keyword">const</span> <a class="code" href="classprophet_1_1Link.html">prophet::Link</a>* l = NULL;
<a name="l00288"></a>00288     <span class="keywordflow">if</span> (link != NULL &amp;&amp;
<a name="l00289"></a>00289             (l = <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#d66e16db42a6bbe21ec71964ec73223e" title="Conversion between Prophet&amp;#39;s Facade type and DTN native type.">get_link</a>(e-&gt;<a class="code" href="classdtn_1_1ContactDownEvent.html#cc4067480bd6af7023cb6d4c99122a7e" title="The contact that is now down.">contact_</a>-&gt;link().object())) != NULL)
<a name="l00290"></a>00290         <span class="comment">// inform Controller about the loss</span>
<a name="l00291"></a>00291         <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;neighbor_gone(l);
<a name="l00292"></a>00292     <span class="comment">// drop BundleCore's knowledge about this Link</span>
<a name="l00293"></a>00293     <a class="code" href="classdtn_1_1ProphetRouter.html#6aec00931a6a5a164ee5096347b990bb" title="facade interface into BundleDaemon, etc">core_</a>-&gt;<a class="code" href="classdtn_1_1ProphetBundleCore.html#12409f4d4d0b3d4be1c756129f133379">del</a>(e-&gt;<a class="code" href="classdtn_1_1ContactDownEvent.html#cc4067480bd6af7023cb6d4c99122a7e" title="The contact that is now down.">contact_</a>-&gt;link());
<a name="l00294"></a>00294 }
<a name="l00295"></a>00295 
<a name="l00296"></a>00296 <span class="keywordtype">void</span>
<a name="l00297"></a><a class="code" href="classdtn_1_1ProphetRouter.html#c630a26aa48086bb969899f47e77d486">00297</a> <a class="code" href="classdtn_1_1ProphetRouter.html#c630a26aa48086bb969899f47e77d486" title="Virtual from BundleRouter.">ProphetRouter::handle_link_available</a>(<a class="code" href="classdtn_1_1LinkAvailableEvent.html" title="Event class for link available events.">LinkAvailableEvent</a>* e)
<a name="l00298"></a>00298 {
<a name="l00299"></a>00299     <a class="code" href="namespacedtn.html#6efb37e503f8062c537b022eb755b94e" title="Typedef for a reference on a link.">LinkRef</a> next_hop = e-&gt;<a class="code" href="classdtn_1_1LinkAvailableEvent.html#1c03fd085ae843493cc1318828e4e4c9" title="The link that is available.">link_</a>;
<a name="l00300"></a>00300     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(next_hop != NULL);
<a name="l00301"></a>00301     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(!next_hop-&gt;isdeleted());
<a name="l00302"></a>00302 
<a name="l00303"></a>00303     <span class="comment">// Prophet initiates its protocol based on handle_contact_up,</span>
<a name="l00304"></a>00304     <span class="comment">// which fires upon success link open ... so poke it and see </span>
<a name="l00305"></a>00305     <span class="comment">// what happens</span>
<a name="l00306"></a>00306     <span class="keywordflow">if</span> (!next_hop-&gt;isopen())
<a name="l00307"></a>00307     {
<a name="l00308"></a>00308         <span class="comment">// request to open link</span>
<a name="l00309"></a>00309         <a class="code" href="classdtn_1_1BundleRouter.html#cf71e3f1982b36bafa7ac5cd45d38675" title="The actions interface, set by the BundleDaemon when the router is initialized.">actions_</a>-&gt;<a class="code" href="classdtn_1_1BundleActions.html#0cb4ef96c172a1943d32d19747a00438" title="Open a link for bundle transmission.">open_link</a>(next_hop);
<a name="l00310"></a>00310     }
<a name="l00311"></a>00311 }
<a name="l00312"></a>00312 
<a name="l00313"></a>00313 <span class="keywordtype">void</span>
<a name="l00314"></a><a class="code" href="classdtn_1_1ProphetRouter.html#c0b21659eeb7bf95aa5475394f576a82">00314</a> <a class="code" href="classdtn_1_1ProphetRouter.html#c0b21659eeb7bf95aa5475394f576a82" title="Callback methods for handling runtime configuration changes.">ProphetRouter::set_queue_policy</a>()
<a name="l00315"></a>00315 {
<a name="l00316"></a>00316     log_info(<span class="stringliteral">"ProphetRouter set_queue_policy"</span>);
<a name="l00317"></a>00317     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"set_queue_policy"</span>);
<a name="l00318"></a>00318     <span class="comment">// tell Controller to reorganize internal bundle policy based on new </span>
<a name="l00319"></a>00319     <span class="comment">// parameters written to params_ by ProphetCommand</span>
<a name="l00320"></a>00320     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;set_queue_policy();
<a name="l00321"></a>00321 }
<a name="l00322"></a>00322 
<a name="l00323"></a>00323 <span class="keywordtype">void</span>
<a name="l00324"></a><a class="code" href="classdtn_1_1ProphetRouter.html#d6c24ab26ece29f3d84130576525a283">00324</a> <a class="code" href="classdtn_1_1ProphetRouter.html#d6c24ab26ece29f3d84130576525a283" title="Callback methods for handling runtime configuration changes.">ProphetRouter::set_hello_interval</a>()
<a name="l00325"></a>00325 {
<a name="l00326"></a>00326     log_info(<span class="stringliteral">"ProphetRouter set_hello_interval"</span>);
<a name="l00327"></a>00327     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"set_hello_interval"</span>);
<a name="l00328"></a>00328     <span class="comment">// tell Controller to change internal protocol timeouts based on new</span>
<a name="l00329"></a>00329     <span class="comment">// parameters written to params_ by ProphetCommand</span>
<a name="l00330"></a>00330     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;set_hello_interval();
<a name="l00331"></a>00331 }
<a name="l00332"></a>00332 
<a name="l00333"></a>00333 <span class="keywordtype">void</span>
<a name="l00334"></a><a class="code" href="classdtn_1_1ProphetRouter.html#9325f2d59c2779bff283caf7c5666745">00334</a> <a class="code" href="classdtn_1_1ProphetRouter.html#9325f2d59c2779bff283caf7c5666745" title="Callback methods for handling runtime configuration changes.">ProphetRouter::set_max_route</a>()
<a name="l00335"></a>00335 {
<a name="l00336"></a>00336     log_info(<span class="stringliteral">"ProphetRouter set_max_route"</span>);
<a name="l00337"></a>00337     oasys::ScopeLock l(<a class="code" href="classdtn_1_1ProphetRouter.html#ca736983d08f4629321b3fd0091dafb2" title="control concurrent access to core_ and oracle_">lock_</a>, <span class="stringliteral">"set_max_route"</span>);
<a name="l00338"></a>00338     <span class="comment">// tell Controller to change internal limit on number of routes</span>
<a name="l00339"></a>00339     <span class="comment">// to retain, based on changes made to params_ by ProphetCommand</span>
<a name="l00340"></a>00340     <a class="code" href="classdtn_1_1ProphetRouter.html#ba534cca1eb7b84064ba0e318cb49ac3" title="list of active Prophet peering sessions">oracle_</a>-&gt;set_max_route();
<a name="l00341"></a>00341 }
<a name="l00342"></a>00342 
<a name="l00343"></a>00343 }; <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>