Sophie

Sophie

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

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: FileConvergenceLayer.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>FileConvergenceLayer.h</h1><a href="FileConvergenceLayer_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 _FILE_CONVERGENCE_LAYER_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _FILE_CONVERGENCE_LAYER_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="ConvergenceLayer_8h.html">ConvergenceLayer.h</a>"</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;oasys/thread/Thread.h&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">namespace </span>dtn {
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="classdtn_1_1FileConvergenceLayer.html">00025</a> <span class="keyword">class </span><a class="code" href="classdtn_1_1FileConvergenceLayer.html">FileConvergenceLayer</a> : <span class="keyword">public</span> <a class="code" href="classdtn_1_1ConvergenceLayer.html" title="The abstract interface for a convergence layer.">ConvergenceLayer</a> {
<a name="l00026"></a>00026 <span class="keyword">public</span>:
<a name="l00030"></a>00030     <a class="code" href="classdtn_1_1FileConvergenceLayer.html#38bec4f813195bce0ad2b221c3f3bd26" title="Constructor.">FileConvergenceLayer</a>();
<a name="l00031"></a>00031 
<a name="l00033"></a>00033     
<a name="l00034"></a>00034     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#8d9881cfbe25bfb327e2367399f9d0d7" title="Bring up a new interface.">interface_up</a>(<a class="code" href="classdtn_1_1Interface.html" title="Abstraction of a local dtn interface.">Interface</a>* iface,
<a name="l00035"></a>00035                               <span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span>* argv[]);
<a name="l00036"></a>00036     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#b13b8ef7972ad45e7581299a57573189" title="Bring down the interface.">interface_down</a>(<a class="code" href="classdtn_1_1Interface.html" title="Abstraction of a local dtn interface.">Interface</a>* iface);
<a name="l00037"></a>00037     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#d0bf3977a6a40400d63c7a1c19805490" title="Validate that the contact eid specifies a legit directory.">open_contact</a>(<span class="keyword">const</span> <a class="code" href="namespacedtn.html#5f869544c85c75b5a85a14d6e90d7ff7" title="Typedef for a reference on a contact.">ContactRef</a>&amp; contact);
<a name="l00038"></a>00038     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#eb188fa883a317e65dec1037ea77e495" title="Close the connnection to the contact.">close_contact</a>(<span class="keyword">const</span> <a class="code" href="namespacedtn.html#5f869544c85c75b5a85a14d6e90d7ff7" title="Typedef for a reference on a contact.">ContactRef</a>&amp; contact);
<a name="l00039"></a>00039     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#16e756b8cc2394df24a67cff5c79c6af" title="Try to send the bundles queued up for the given contact.">send_bundle</a>(<span class="keyword">const</span> <a class="code" href="namespacedtn.html#5f869544c85c75b5a85a14d6e90d7ff7" title="Typedef for a reference on a contact.">ContactRef</a>&amp; contact, <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="keyword">protected</span>:
<a name="l00045"></a><a class="code" href="classdtn_1_1FileConvergenceLayer.html#fd5ae6a7a99000a59029a2a5b4f7da99">00045</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#fd5ae6a7a99000a59029a2a5b4f7da99" title="Current version of the file cl protocol.">CURRENT_VERSION</a> = 0x1;
<a name="l00046"></a>00046      
<a name="l00050"></a><a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html">00050</a>     <span class="keyword">struct </span><a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html" title="Framing header at the beginning of each bundle file.">FileHeader</a> {
<a name="l00051"></a><a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#a655d9424540f8165fe0c777c7dd3dd2">00051</a>         u_int8_t <a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#a655d9424540f8165fe0c777c7dd3dd2" title="framing protocol version">version</a>;               
<a name="l00052"></a><a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#b6592dfa1b5c98d401809823422df7cb">00052</a>         u_int8_t <a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#b6592dfa1b5c98d401809823422df7cb" title="unused">pad</a>;                   
<a name="l00053"></a><a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#7ea447d2a1db519047c591bcfb09475d">00053</a>         u_int16_t <a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#7ea447d2a1db519047c591bcfb09475d" title="length of the bundle header">header_length</a>;        
<a name="l00054"></a><a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#0bb2b0890592bfbc1880fefc9de7faea">00054</a>         u_int32_t <a class="code" href="structdtn_1_1FileConvergenceLayer_1_1FileHeader.html#0bb2b0890592bfbc1880fefc9de7faea" title="length of the bundle + headers">bundle_length</a>;        
<a name="l00055"></a>00055     } __attribute__((<a class="code" href="classdtn_1_1FileConvergenceLayer.html#67adbe5740c6c3027f0b4d3ababef243" title="Framing header at the beginning of each bundle file.">packed</a>));
<a name="l00056"></a>00056     
<a name="l00060"></a>00060     <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#aebe7c76dfff8e796631603aa1af2d1a" title="Pull a filesystem directory out of the next hop admin address.">extract_dir</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* nexthop, std::string* dirp);
<a name="l00061"></a>00061     
<a name="l00066"></a>00066     <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer.html#5abd1055ec64a0d16ad26554d138bb26" title="Validate that a given directory exists and that the permissions are correct.">validate_dir</a>(<span class="keyword">const</span> std::string&amp; dir);
<a name="l00067"></a>00067         
<a name="l00072"></a><a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html">00072</a>     <span class="keyword">class </span><a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html" title="Helper class (and thread) that periodically scans a directory for new bundle files...">Scanner</a> : <span class="keyword">public</span> <a class="code" href="classdtn_1_1CLInfo.html" title="Abstract base class for convergence layer specific state stored in an interface /...">CLInfo</a>, <span class="keyword">public</span> oasys::<a class="code" href="classoasys_1_1Logger.html">Logger</a>, <span class="keyword">public</span> oasys::Thread {
<a name="l00073"></a>00073     <span class="keyword">public</span>:
<a name="l00077"></a>00077         <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#b1f03477810cc672dcbf134210650a9b" title="Constructor.">Scanner</a>(<span class="keywordtype">int</span> secs_per_scan, <span class="keyword">const</span> std::string&amp; dir);
<a name="l00078"></a>00078 
<a name="l00082"></a>00082         <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#d9338020486ba3e94c52b920cad0d873" title="Set the flag to ask it to stop next loop.">stop</a>();
<a name="l00083"></a>00083 
<a name="l00087"></a><a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#0aba27b6194e966434fb72c8ac538cd2">00087</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#0aba27b6194e966434fb72c8ac538cd2" title="Virtual from SerializableObject.">serialize</a>( oasys::SerializableObject *) {}
<a name="l00088"></a>00088 
<a name="l00089"></a>00089     <span class="keyword">protected</span>:
<a name="l00093"></a>00093         <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#2e2106951825c94de9c7225413a98c9d" title="Main thread function.">run</a>();
<a name="l00094"></a>00094         
<a name="l00095"></a><a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#d9020658f8de3bc7a6b902fa7a01af52">00095</a>         <span class="keywordtype">int</span> <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#d9020658f8de3bc7a6b902fa7a01af52" title="scan interval">secs_per_scan_</a>;     
<a name="l00096"></a><a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#92513d7da6f585ce94e15651260c8dc7">00096</a>         std::string <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#92513d7da6f585ce94e15651260c8dc7" title="directory to scan for bundles.">dir_</a>;       
<a name="l00097"></a><a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#f10f457d9dc8d0cb257a6c70767bbf7a">00097</a>         <span class="keywordtype">bool</span> <a class="code" href="classdtn_1_1FileConvergenceLayer_1_1Scanner.html#f10f457d9dc8d0cb257a6c70767bbf7a" title="keep running?">run_</a>;              
<a name="l00098"></a>00098     };
<a name="l00099"></a>00099 };
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 } <span class="comment">// namespace dtn</span>
<a name="l00102"></a>00102 
<a name="l00103"></a>00103 <span class="preprocessor">#endif </span><span class="comment">/* _FILE_CONVERGENCE_LAYER_H_ */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Jan 30 09:26:56 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>