Sophie

Sophie

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

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: BundleRouter.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&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>BundleRouter.h</h1><a href="BundleRouter_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 2004-2006 Intel Corporation</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 _BUNDLE_ROUTER_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _BUNDLE_ROUTER_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;oasys/debug/Logger.h&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;oasys/thread/Thread.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;oasys/util/StringUtils.h&gt;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="BundleEvent_8h.html">bundling/BundleEvent.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="BundleEventHandler_8h.html">bundling/BundleEventHandler.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="EndpointID_8h.html">naming/EndpointID.h</a>"</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="keyword">namespace </span>dtn {
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">class </span>BundleActions;
<a name="l00032"></a>00032 <span class="keyword">class </span>BundleRouter;
<a name="l00033"></a><a class="code" href="namespacedtn.html#6bd062dc9ee1754deb774971551bad21">00033</a> <span class="keyword">class </span>StringBuffer;
<a name="l00034"></a>00034 
<a name="l00038"></a>00038 <span class="keyword">typedef</span> std::vector&lt;BundleRouter*&gt; <a class="code" href="namespacedtn.html#6bd062dc9ee1754deb774971551bad21" title="Typedef for a list of bundle routers.">BundleRouterList</a>;
<a name="l00039"></a>00039 
<a name="l00060"></a><a class="code" href="classdtn_1_1BundleRouter.html">00060</a> <span class="keyword">class </span><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="keyword">public</span> <a class="code" href="classdtn_1_1BundleEventHandler.html" title="Both the BundleDaemon and all the BundleRouter classes need to process the various...">BundleEventHandler</a> {
<a name="l00061"></a>00061 <span class="keyword">public</span>:
<a name="l00066"></a>00066     <span class="keyword">static</span> <a class="code" href="classdtn_1_1BundleRouter.html" title="The BundleRouter is the main decision maker for all routing decisions related to...">BundleRouter</a>* <a class="code" href="classdtn_1_1BundleRouter.html#deb4dc788d0ca34bfb1e06eb49c42de4" title="Factory method to create the correct subclass of BundleRouter for the registered...">create_router</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* type);
<a name="l00067"></a>00067 
<a name="l00072"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html">00072</a>     <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html" title="Config variables.">Config</a> {
<a name="l00073"></a>00073         <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#41d19625934c6b5f96e132fd6568dcf8">Config</a>();
<a name="l00074"></a>00074         
<a name="l00076"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#9e9ba1240a34830c807326594288cc17">00076</a>         std::string <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#9e9ba1240a34830c807326594288cc17" title="The routing algorithm type.">type_</a>;
<a name="l00077"></a>00077         
<a name="l00080"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#790fe839395fd2d7e0a199958c6e923c">00080</a>         <span class="keywordtype">bool</span> <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#790fe839395fd2d7e0a199958c6e923c" title="Whether or not to add routes for nexthop links that know the remote endpoint id (default...">add_nexthop_routes_</a>;
<a name="l00081"></a>00081 
<a name="l00084"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#3ab2ead8dd452c2fc49fe14863e0f9a1">00084</a>         <span class="keywordtype">bool</span> <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#3ab2ead8dd452c2fc49fe14863e0f9a1" title="Whether or not to open discovered opportunistic links when they become available...">open_discovered_links_</a>;
<a name="l00085"></a>00085         
<a name="l00087"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#78120f8b15ddb79efd489d89e42b7ab2">00087</a>         <span class="keywordtype">int</span> <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#78120f8b15ddb79efd489d89e42b7ab2" title="Default priority for new routes.">default_priority_</a>;
<a name="l00088"></a>00088 
<a name="l00091"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#2181b81ab91ecd8656814af62795993f">00091</a>         <span class="keywordtype">int</span> <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#2181b81ab91ecd8656814af62795993f" title="Maximum number of route_to entries to follow for a lookup (default 10).">max_route_to_chain_</a>;
<a name="l00092"></a>00092 
<a name="l00094"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#9481bbe5640b14a0f148e75e9d92b7f1">00094</a>         u_int64_t <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#9481bbe5640b14a0f148e75e9d92b7f1" title="Storage quota for bundle payloads (default unlimited).">storage_quota_</a>;
<a name="l00095"></a>00095 
<a name="l00098"></a><a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#1c297a4f0b77bae69ad90757318a86d9">00098</a>         u_int <a class="code" href="structdtn_1_1BundleRouter_1_1Config.html#1c297a4f0b77bae69ad90757318a86d9" title="Timeout for upstream session subscriptions in seconds (default is ten minutes).">subscription_timeout_</a>;
<a name="l00099"></a>00099         
<a name="l00100"></a>00100     } <a class="code" href="classdtn_1_1BundleRouter.html#344d85ef64a884adf9fb173a82674cca" title="Config variables.">config_</a>;
<a name="l00101"></a>00101     
<a name="l00105"></a>00105     <span class="keyword">virtual</span> <a class="code" href="classdtn_1_1BundleRouter.html#ab8365216a5adc94dbdb8f5adc9c18f8" title="Destructor.">~BundleRouter</a>();
<a name="l00106"></a>00106 
<a name="l00107"></a>00107     <span class="comment">/*</span>
<a name="l00108"></a>00108 <span class="comment">     *  called after all the global data structures are set up</span>
<a name="l00109"></a>00109 <span class="comment">     */</span>
<a name="l00110"></a>00110     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#58bdadd6a5f618d44cd4c2084acc707c">initialize</a>();
<a name="l00111"></a>00111 
<a name="l00116"></a>00116     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#8c592e5d57adf8287f2b886ba39d5d93" title="Pure virtual event handler function (copied from BundleEventHandler for clarity)...">handle_event</a>(<a class="code" href="classdtn_1_1BundleEvent.html" title="Event base class.">BundleEvent</a>* event) = 0;
<a name="l00117"></a>00117 
<a name="l00128"></a>00128     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1BundleRouter.html#47afbf9e1c42ae2cfb396c3895ddca45" title="Synchronous probe indicating whether or not this bundle should be accepted by the...">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="l00129"></a>00129 
<a name="l00137"></a>00137     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1BundleRouter.html#50702bb5cf9c4e2b9be0a7b452c94629" title="Synchronous probe indicating whether or not this bundle can be deleted by the system...">can_delete_bundle</a>(<span class="keyword">const</span> <a class="code" href="namespacedtn.html#87094f3b26b9f1d469e616d311ae57b1" title="Class definition for a Bundle reference.">BundleRef</a>&amp; bundle);
<a name="l00138"></a>00138 
<a name="l00144"></a>00144     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#4e48a822cf5f7b143cf641d26a12091f" title="Synchronous call indicating that the bundle is being deleted from the system and...">delete_bundle</a>(<span class="keyword">const</span> <a class="code" href="namespacedtn.html#87094f3b26b9f1d469e616d311ae57b1" title="Class definition for a Bundle reference.">BundleRef</a>&amp; bundle);
<a name="l00145"></a>00145     
<a name="l00149"></a>00149     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#a0bfd372d2ae8e1c324e6beae5a31573" title="Format the given StringBuffer with current routing info.">get_routing_state</a>(oasys::StringBuffer* <a class="code" href="num2sdnv_8c.html#a81cdcc7ff6987bc85c073253e32715f">buf</a>) = 0;
<a name="l00150"></a>00150 
<a name="l00158"></a>00158     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1BundleRouter.html#b30e99f427cc0526fce08b77e0ae95c7" title="Check if the bundle should be forwarded to the given next hop.">should_fwd</a>(<span class="keyword">const</span> <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle, <span class="keyword">const</span> <a class="code" href="namespacedtn.html#6efb37e503f8062c537b022eb755b94e" title="Typedef for a reference on a link.">LinkRef</a>&amp; link,
<a name="l00159"></a>00159             <a class="code" href="classdtn_1_1ForwardingInfo.html#18ec95dc1b1b8a7e9df9873a0d9b5947" title="The forwarding action type codes.">ForwardingInfo::action_t</a> action = <a class="code" href="classdtn_1_1ForwardingInfo.html#18ec95dc1b1b8a7e9df9873a0d9b594777ba7ba2355d6b87536afc9ef78efeb8" title="Forward a copy of the bundle.">ForwardingInfo::COPY_ACTION</a>);
<a name="l00160"></a>00160 
<a name="l00174"></a>00174     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#2083fea1b1c69c671626c6e71ef78d5d" title="Format the given StringBuffer with a tcl-parsable version of the routing state.">tcl_dump_state</a>(oasys::StringBuffer* <a class="code" href="num2sdnv_8c.html#a81cdcc7ff6987bc85c073253e32715f">buf</a>);
<a name="l00175"></a>00175 
<a name="l00180"></a>00180     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#b679ffe5062b9bbc936b0e6dd7c6d834" title="Hook to force route recomputation from the command interpreter.">recompute_routes</a>();
<a name="l00181"></a>00181 
<a name="l00185"></a>00185     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1BundleRouter.html#0862b94502efe0e65fc1a7020532ba96" title="for registration with the BundleDaemon">shutdown</a>();
<a name="l00186"></a>00186     
<a name="l00187"></a>00187 <span class="keyword">protected</span>:
<a name="l00191"></a>00191     <a class="code" href="classdtn_1_1BundleRouter.html#372135e06860e84c440fd9ee02253ea8" title="Constructor.">BundleRouter</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* classname, <span class="keyword">const</span> std::string&amp; name);
<a name="l00192"></a>00192 
<a name="l00194"></a><a class="code" href="classdtn_1_1BundleRouter.html#6e25e98eb6d3a10c75aecd7b7d89e253">00194</a>     std::string <a class="code" href="classdtn_1_1BundleRouter.html#6e25e98eb6d3a10c75aecd7b7d89e253" title="Name of this particular router.">name_</a>;
<a name="l00195"></a>00195     
<a name="l00197"></a><a class="code" href="classdtn_1_1BundleRouter.html#06ef6e02e26e9a78a9d15619810d56dc">00197</a>     <a class="code" href="classdtn_1_1BundleList.html" title="List structure for handling bundles.">BundleList</a>* <a class="code" href="classdtn_1_1BundleRouter.html#06ef6e02e26e9a78a9d15619810d56dc" title="The list of all bundles still pending delivery.">pending_bundles_</a>;
<a name="l00198"></a>00198 
<a name="l00200"></a><a class="code" href="classdtn_1_1BundleRouter.html#c37671a1e74edfb709e0b0d3ca9ed2d9">00200</a>     <a class="code" href="classdtn_1_1BundleList.html" title="List structure for handling bundles.">BundleList</a>* <a class="code" href="classdtn_1_1BundleRouter.html#c37671a1e74edfb709e0b0d3ca9ed2d9" title="The list of all bundles that I have custody of.">custody_bundles_</a>;
<a name="l00201"></a>00201 
<a name="l00204"></a><a class="code" href="classdtn_1_1BundleRouter.html#cf71e3f1982b36bafa7ac5cd45d38675">00204</a>     <a class="code" href="classdtn_1_1BundleActions.html" title="Intermediary class that provides a utility interface to help routers more easily...">BundleActions</a>* <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 name="l00205"></a>00205     
<a name="l00206"></a>00206 };
<a name="l00207"></a>00207 
<a name="l00208"></a>00208 } <span class="comment">// namespace dtn</span>
<a name="l00209"></a>00209 
<a name="l00210"></a>00210 <span class="preprocessor">#endif </span><span class="comment">/* _BUNDLE_ROUTER_H_ */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Jan 30 09:26:53 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>