Sophie

Sophie

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

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: BundleTLV.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>BundleTLV.h</h1><a href="BundleTLV_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *    Copyright 2007 Baylor University</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *    Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00005"></a>00005 <span class="comment"> *    you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> *    You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> *        http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> *    Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> *    distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> *    See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> *    limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _PROPHET_BUNDLE_TLV_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _PROPHET_BUNDLE_TLV_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="BaseTLV_8h.html">BaseTLV.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="BundleTLVEntry_8h.html">BundleTLVEntry.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="BundleTLVEntryList_8h.html">BundleTLVEntryList.h</a>"</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="keyword">namespace </span>prophet
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="classprophet_1_1BundleTLV.html">00028</a> <span class="keyword">class </span><a class="code" href="classprophet_1_1BundleTLV.html">BundleTLV</a> : <span class="keyword">public</span> <a class="code" href="classprophet_1_1BaseTLV.html" title="The Prophet I-D (March 2006) dictates five bytecodes for router state exchange messages...">BaseTLV</a>
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 <span class="keyword">public</span>:
<a name="l00049"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html">00049</a>     <span class="keyword">struct </span><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html" title="Bundle Offer/Response Header  p.">BundleTLVHeader</a> {
<a name="l00050"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#83ceb3125a38cddbc859463ebd12cbe1">00050</a>         u_int8_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#83ceb3125a38cddbc859463ebd12cbe1" title="defined as 0xA2">type</a>; 
<a name="l00051"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#700b11136c08d66b3a4132fc7e22e6e6">00051</a>         u_int8_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#700b11136c08d66b3a4132fc7e22e6e6" title="TBD.">flags</a>; 
<a name="l00052"></a>00052 
<a name="l00056"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#eeff4bf7749c53b5210337567549c659">00056</a>         u_int16_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#eeff4bf7749c53b5210337567549c659" title="Length of the TLV in octets, including the TLV header and any nested TLVs.">length</a>;
<a name="l00060"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#3caebac83135faee423f6a09ade8c776">00060</a>         u_int16_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#3caebac83135faee423f6a09ade8c776" title="Number of bundle offer entries.">offer_count</a>;
<a name="l00061"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#955d4889176aa218ebf4fb2d9a96cb1c">00061</a>         u_int16_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html#955d4889176aa218ebf4fb2d9a96cb1c">unused__</a>;
<a name="l00062"></a>00062     } __attribute__((<a class="code" href="classprophet_1_1BundleTLV.html#449a2e1d110c4af9c4f6d1b3e996a252" title="Bundle Offer/Response Header  p.">packed</a>));
<a name="l00063"></a>00063 
<a name="l00068"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html">00068</a>     <span class="keyword">struct </span><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html" title="Bundle Offer/Response Entry p.">BundleEntry</a> {
<a name="l00073"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#60e01bbc5e6733f4ea1ac8a08be297de">00073</a>         u_int16_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#60e01bbc5e6733f4ea1ac8a08be297de" title="ID string of the destination of the bundle as predefined in the dictionary TLV.">dest_string_id</a>;
<a name="l00098"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#f14d0c0d2f48dc471e2f72afd94c92fc">00098</a>         u_int8_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#f14d0c0d2f48dc471e2f72afd94c92fc" title="The encoding of the B_Flags in the request are:     Flag 0: Custody Offered 0b1 ...">b_flags</a>;
<a name="l00099"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#f935a5e60b6454fd3727ed2f0130951d">00099</a>         u_int8_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#f935a5e60b6454fd3727ed2f0130951d">unused__</a>;
<a name="l00100"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#8cb032cd9f4197280edd3b6e3f51a793">00100</a>         u_int32_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#8cb032cd9f4197280edd3b6e3f51a793" title="This bundle&amp;#39;s creation timestamp.">creation_timestamp</a>; 
<a name="l00101"></a><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#faba22de4c51e2a9a4408fbc8b96b30c">00101</a>         u_int32_t <a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html#faba22de4c51e2a9a4408fbc8b96b30c" title="NOT IN SPEC.">seqno</a>; 
<a name="l00102"></a>00102     } __attribute__((<a class="code" href="classprophet_1_1BundleTLV.html#449a2e1d110c4af9c4f6d1b3e996a252" title="Bundle Offer/Response Header  p.">packed</a>));
<a name="l00103"></a>00103 
<a name="l00108"></a><a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2b">00108</a>     <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00109"></a><a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2b0e2665233fe415bb8a081d2e4aea1be9">00109</a>         <a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2b0e2665233fe415bb8a081d2e4aea1be9" title="custody offered or accepted on this bundle">CUSTODY</a>  = 1 &lt;&lt; 0, 
<a name="l00110"></a><a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2bb1f7b9b43eb9277a9e6e42a569736a6e">00110</a>         <a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2bb1f7b9b43eb9277a9e6e42a569736a6e" title="this bundle is accepted for relay">ACCEPTED</a> = 1 &lt;&lt; 1, 
<a name="l00111"></a><a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2b15802a3008fb408e9a7c395c05e12084">00111</a>         <a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2b15802a3008fb408e9a7c395c05e12084" title="Prophet ACK for this bundle.">ACK</a>      = 1 &lt;&lt; 7  
<a name="l00112"></a>00112     } <a class="code" href="classprophet_1_1BundleTLV.html#1d398f4325d6d724d3e807cc9dd25a2b" title="Flag values for Bundle Offer/Response Entry p.">bundletlv_flags_t</a>;
<a name="l00113"></a>00113 
<a name="l00114"></a><a class="code" href="classprophet_1_1BundleTLV.html#9f8735ed361f09d5bb05fc0975c6b191">00114</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1BundleTLV.html#9f8735ed361f09d5bb05fc0975c6b191">BundleTLVHeaderSize</a> = <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structprophet_1_1BundleTLV_1_1BundleTLVHeader.html" title="Bundle Offer/Response Header  p.">BundleTLVHeader</a>);
<a name="l00115"></a>00115 
<a name="l00116"></a><a class="code" href="classprophet_1_1BundleTLV.html#a7921e77cc4c5585d79932a24b8a7927">00116</a>     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1BundleTLV.html#a7921e77cc4c5585d79932a24b8a7927">BundleEntrySize</a> = <span class="keyword">sizeof</span>(<span class="keyword">struct </span><a class="code" href="structprophet_1_1BundleTLV_1_1BundleEntry.html" title="Bundle Offer/Response Entry p.">BundleEntry</a>);
<a name="l00117"></a>00117 
<a name="l00121"></a><a class="code" href="classprophet_1_1BundleTLV.html#2bded4142d846bf67b7a48384e426c3a">00121</a>     <span class="keyword">virtual</span> <a class="code" href="classprophet_1_1BundleTLV.html#2bded4142d846bf67b7a48384e426c3a" title="Destructor.">~BundleTLV</a>() {}
<a name="l00122"></a>00122 
<a name="l00123"></a>00123 <span class="keyword">protected</span>:
<a name="l00127"></a><a class="code" href="classprophet_1_1BundleTLV.html#f7b6d1c613fea745f051f861660373ad">00127</a>     <a class="code" href="classprophet_1_1BundleTLV.html#f7b6d1c613fea745f051f861660373ad" title="Constructor.">BundleTLV</a>(<a class="code" href="classprophet_1_1BaseTLV.html#37c3690d6040c870b40fa0436b67b09d" title="Byte codes for TLV types.">BaseTLV::prophet_tlv_t</a> type = <a class="code" href="classprophet_1_1BaseTLV.html#37c3690d6040c870b40fa0436b67b09d7058a0458dcadab12100c4813118e7db">BaseTLV::UNKNOWN_TLV</a>,
<a name="l00128"></a>00128               u_int8_t <a class="code" href="classprophet_1_1BaseTLV.html#85ccaab1420732e2f1e327798b8899ed" title="Accessors.">flags</a> = 0, u_int16_t <a class="code" href="classprophet_1_1BaseTLV.html#5d6ab71b768b416bc457090d1189b291" title="Accessors.">length</a> = 0)
<a name="l00129"></a>00129         : <a class="code" href="classprophet_1_1BaseTLV.html" title="The Prophet I-D (March 2006) dictates five bytecodes for router state exchange messages...">BaseTLV</a>(type,<a class="code" href="classprophet_1_1BaseTLV.html#85ccaab1420732e2f1e327798b8899ed" title="Accessors.">flags</a>,<a class="code" href="classprophet_1_1BaseTLV.html#5d6ab71b768b416bc457090d1189b291" title="Accessors.">length</a>) {}
<a name="l00130"></a>00130 
<a name="l00135"></a>00135     <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1BundleTLV.html#eeadbbb84b780c5d390a9f1e6318c850" title="Serialize BundleOfferTLVEntry out to no more than len bytes of buffer; return bytes...">write_bundle_entry</a>(u_int32_t cts, u_int32_t seq, u_int16_t sid,
<a name="l00136"></a>00136                              <span class="keywordtype">bool</span> <a class="code" href="dtncat_8c.html#160881851a33309c0106503ac4d14d96">custody</a>, <span class="keywordtype">bool</span> accept, <span class="keywordtype">bool</span> ack,
<a name="l00137"></a>00137                              <a class="code" href="classprophet_1_1BundleTLVEntry.html#ba508cc555c3c88394dc4659c7e0d321" title="A BundleTLVEntry can represent either an OFFER or a RESPONSE, depending on what is...">BundleTLVEntry::bundle_entry_t</a> type,
<a name="l00138"></a>00138                              u_char* bp, <span class="keywordtype">size_t</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>) <span class="keyword">const</span>;
<a name="l00139"></a>00139 
<a name="l00144"></a>00144     <span class="keywordtype">size_t</span> <a class="code" href="classprophet_1_1BundleTLV.html#4fe36522dccc0c81046b72e54d02d05c" title="Deserialize struct BundleOfferTLVEntry from transport into memory, reading no more...">read_bundle_entry</a>(u_int32_t *cts, u_int32_t *seq, u_int16_t *sid,
<a name="l00145"></a>00145                              <span class="keywordtype">bool</span> *<a class="code" href="dtncat_8c.html#160881851a33309c0106503ac4d14d96">custody</a>, <span class="keywordtype">bool</span> *accept, <span class="keywordtype">bool</span> *ack,
<a name="l00146"></a>00146                              <a class="code" href="classprophet_1_1BundleTLVEntry.html#ba508cc555c3c88394dc4659c7e0d321" title="A BundleTLVEntry can represent either an OFFER or a RESPONSE, depending on what is...">BundleTLVEntry::bundle_entry_t</a> *type,
<a name="l00147"></a>00147                              <span class="keyword">const</span> u_char* bp, <span class="keywordtype">size_t</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a> );
<a name="l00148"></a>00148 }; <span class="comment">// class BundleTLV</span>
<a name="l00149"></a>00149 
<a name="l00150"></a>00150 }; <span class="comment">// namespace prophet</span>
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 <span class="preprocessor">#endif // _PROPHET_BUNDLE_TLV_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>