Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > d9faa203c2b0b6fbb179d93daaea81b7 > files > 136

libdtn-devel-2.6.0-1mdv2009.0.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: BundleStatusReport.cc Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<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>
<h1>BundleStatusReport.cc</h1><a href="BundleStatusReport_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 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">#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="BundleStatusReport_8h.html">BundleStatusReport.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="SDNV_8h.html">SDNV.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;netinet/in.h&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;oasys/util/ScratchBuffer.h&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="keyword">namespace </span>dtn {
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00029"></a>00029 <span class="keywordtype">void</span>
<a name="l00030"></a><a class="code" href="classdtn_1_1BundleStatusReport.html#d3369fc659fbc354c26ddb769917ace8">00030</a> <a class="code" href="classdtn_1_1BundleStatusReport.html#d3369fc659fbc354c26ddb769917ace8" title="Constructor-like function that fills in the bundle payload buffer with the appropriate...">BundleStatusReport::create_status_report</a>(<a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>*           bundle,
<a name="l00031"></a>00031                                          <span class="keyword">const</span> <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>*     orig_bundle,
<a name="l00032"></a>00032                                          <span class="keyword">const</span> <a class="code" href="classdtn_1_1EndpointID.html">EndpointID</a>&amp; source,
<a name="l00033"></a>00033                                          <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de1499">flag_t</a>            status_flags,
<a name="l00034"></a>00034                                          <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917" title="Bundle Status Report &amp;quot;Reason Code&amp;quot; flags.">reason_t</a>          reason)
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036     bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#69c35928ca050eb4bb2ec67641f1b6bb" title="Setters and mutable accessors.">mutable_source</a>()-&gt;<a class="code" href="classdtn_1_1EndpointID.html#ec39752e4da3107b16ff5da58d2aa5ab" title="Assign this endpoint ID as a copy of the other.">assign</a>(source);
<a name="l00037"></a>00037     <span class="keywordflow">if</span> (orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#a2ffacc40d2afe751142e9fd64ab5fdf" title="Accessors.">replyto</a>().<a class="code" href="classdtn_1_1EndpointID.html#80721c0832c08c5066e6d6276d62d70b" title="Simple equality test function.">equals</a>(<a class="code" href="classdtn_1_1EndpointID.html#31bd1844cae5e71cc2393a139c9bec4c" title="Return the special endpoint id used for the null endpoint, namely &amp;quot;dtn:none&amp;quot;...">EndpointID::NULL_EID</a>())){
<a name="l00038"></a>00038         bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#fedf6ad0537f7e3a3f958162d1fc935e" title="Setters and mutable accessors.">mutable_dest</a>()-&gt;<a class="code" href="classdtn_1_1EndpointID.html#ec39752e4da3107b16ff5da58d2aa5ab" title="Assign this endpoint ID as a copy of the other.">assign</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#2dae8a97270a95799acf45d859eaf866" title="Accessors.">source</a>());
<a name="l00039"></a>00039     } <span class="keywordflow">else</span> {
<a name="l00040"></a>00040         bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#fedf6ad0537f7e3a3f958162d1fc935e" title="Setters and mutable accessors.">mutable_dest</a>()-&gt;<a class="code" href="classdtn_1_1EndpointID.html#ec39752e4da3107b16ff5da58d2aa5ab" title="Assign this endpoint ID as a copy of the other.">assign</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#a2ffacc40d2afe751142e9fd64ab5fdf" title="Accessors.">replyto</a>());
<a name="l00041"></a>00041     }
<a name="l00042"></a>00042     bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#7c2091e44637889b9ad6f94a82ae7f83" title="Setters and mutable accessors.">mutable_replyto</a>()-&gt;<a class="code" href="classdtn_1_1EndpointID.html#ec39752e4da3107b16ff5da58d2aa5ab" title="Assign this endpoint ID as a copy of the other.">assign</a>(<a class="code" href="classdtn_1_1EndpointID.html#31bd1844cae5e71cc2393a139c9bec4c" title="Return the special endpoint id used for the null endpoint, namely &amp;quot;dtn:none&amp;quot;...">EndpointID::NULL_EID</a>());
<a name="l00043"></a>00043     bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#96698085719d88c0b5c86d4cb388324c" title="Setters and mutable accessors.">mutable_custodian</a>()-&gt;<a class="code" href="classdtn_1_1EndpointID.html#ec39752e4da3107b16ff5da58d2aa5ab" title="Assign this endpoint ID as a copy of the other.">assign</a>(<a class="code" href="classdtn_1_1EndpointID.html#31bd1844cae5e71cc2393a139c9bec4c" title="Return the special endpoint id used for the null endpoint, namely &amp;quot;dtn:none&amp;quot;...">EndpointID::NULL_EID</a>());
<a name="l00044"></a>00044     
<a name="l00045"></a>00045     bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#1cb30932516cd93a9d1127fb3f3352d1" title="Setters and mutable accessors.">set_is_admin</a>(<span class="keyword">true</span>);
<a name="l00046"></a>00046 
<a name="l00047"></a>00047     <span class="comment">// use the expiration time from the original bundle</span>
<a name="l00048"></a>00048     <span class="comment">// XXX/demmer maybe something more clever??</span>
<a name="l00049"></a>00049     bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#7623ecfe9e47e5dc075ebd872fb9a237" title="Setters and mutable accessors.">set_expiration</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#21879e67b7f065975cbd942807500746" title="Accessors.">expiration</a>());
<a name="l00050"></a>00050 
<a name="l00051"></a>00051     <span class="comment">// store the original bundle's source eid</span>
<a name="l00052"></a>00052     <a class="code" href="classdtn_1_1EndpointID.html">EndpointID</a> orig_source(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#2dae8a97270a95799acf45d859eaf866" title="Accessors.">source</a>());
<a name="l00053"></a>00053 
<a name="l00054"></a>00054     <span class="keywordtype">int</span> <a class="code" href="sdnv-c_8h.html#61025d18c2abbee27eba89034e1fb025" title="Return the number of bytes needed to encode the given value.">sdnv_encoding_len</a> = 0;  <span class="comment">// use an int to handle -1 return values</span>
<a name="l00055"></a>00055     <span class="keywordtype">int</span> report_length = 0;
<a name="l00056"></a>00056     
<a name="l00057"></a>00057     <span class="comment">// we generally don't expect the Status Peport length to be &gt; 256 bytes</span>
<a name="l00058"></a>00058     oasys::ScratchBuffer&lt;u_char*, 256&gt; scratch;
<a name="l00059"></a>00059 
<a name="l00060"></a>00060     <span class="comment">//</span>
<a name="l00061"></a>00061     <span class="comment">// Structure of bundle status reports:</span>
<a name="l00062"></a>00062     <span class="comment">//</span>
<a name="l00063"></a>00063     <span class="comment">// 1 byte Admin Payload type and flags</span>
<a name="l00064"></a>00064     <span class="comment">// 1 byte Status Flags</span>
<a name="l00065"></a>00065     <span class="comment">// 1 byte Reason Code</span>
<a name="l00066"></a>00066     <span class="comment">// SDNV   [Fragment Offset (if present)]</span>
<a name="l00067"></a>00067     <span class="comment">// SDNV   [Fragment Length (if present)]</span>
<a name="l00068"></a>00068     <span class="comment">// SDNVx2 Time of {receipt/forwarding/delivery/deletion/custody/app-ack}</span>
<a name="l00069"></a>00069     <span class="comment">//        of bundle X</span>
<a name="l00070"></a>00070     <span class="comment">// SDNVx2 Copy of bundle X's Creation Timestamp</span>
<a name="l00071"></a>00071     <span class="comment">// SDNV   Length of X's source endpoint ID</span>
<a name="l00072"></a>00072     <span class="comment">// vari   Source endpoint ID of bundle X</span>
<a name="l00073"></a>00073 
<a name="l00074"></a>00074     <span class="comment">// note that the spec allows for all 6 of the "Time of..." fields</span>
<a name="l00075"></a>00075     <span class="comment">// to be present in a single Status Report, but for this</span>
<a name="l00076"></a>00076     <span class="comment">// implementation we will always have one and only one of the 6</span>
<a name="l00077"></a>00077     <span class="comment">// timestamp fields</span>
<a name="l00078"></a>00078     <span class="comment">// XXX/matt we may want to change to allow multiple-timestamps per SR</span>
<a name="l00079"></a>00079 
<a name="l00080"></a>00080     <span class="comment">// the non-optional, fixed-length fields above:</span>
<a name="l00081"></a>00081     report_length = 1 + 1 + 1;
<a name="l00082"></a>00082 
<a name="l00083"></a>00083     <span class="comment">// the 2 SDNV fragment fields:</span>
<a name="l00084"></a>00084     <span class="keywordflow">if</span> (orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#d6c74eba219bfe55854cf7a90e210cca" title="Accessors.">is_fragment</a>()) {
<a name="l00085"></a>00085         report_length += <a class="code" href="SDNV_8cc.html#46f4c114c92230c80f6714318251b542">SDNV::encoding_len</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#76cf6a44f566aa22e2a98007bf233ee2" title="Accessors.">frag_offset</a>());
<a name="l00086"></a>00086         report_length += <a class="code" href="SDNV_8cc.html#46f4c114c92230c80f6714318251b542">SDNV::encoding_len</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#e32f3c57057214a1763dfe7709160cf8" title="Accessors.">orig_length</a>());
<a name="l00087"></a>00087     }
<a name="l00088"></a>00088 
<a name="l00089"></a>00089     <span class="comment">// Time field, set to the current time (with no sub-second</span>
<a name="l00090"></a>00090     <span class="comment">// accuracy defined at all)</span>
<a name="l00091"></a>00091     <a class="code" href="structdtn_1_1BundleTimestamp.html" title="Simple struct definition for bundle creation timestamps.">BundleTimestamp</a> now;
<a name="l00092"></a>00092     now.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = <a class="code" href="structdtn_1_1BundleTimestamp.html#27af1dd8ce1c3d9f361a0149aba6cb0c" title="Return the current time in the correct format for the bundle protocol, i.e.">BundleTimestamp::get_current_time</a>();
<a name="l00093"></a>00093     now.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00094"></a>00094     report_length += <a class="code" href="classdtn_1_1BundleProtocol.html#efd5468219b7a40e33d4d6eaa7fa610e" title="Return the length required to encode the timestamp as two SDNVs.">BundleProtocol::ts_encoding_len</a>(now);
<a name="l00095"></a>00095     
<a name="l00096"></a>00096     <span class="comment">// The bundle's creation timestamp:</span>
<a name="l00097"></a>00097     report_length += <a class="code" href="classdtn_1_1BundleProtocol.html#efd5468219b7a40e33d4d6eaa7fa610e" title="Return the length required to encode the timestamp as two SDNVs.">BundleProtocol::ts_encoding_len</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#13cd9ab7b010f09562170e2a57242209" title="Accessors.">creation_ts</a>());
<a name="l00098"></a>00098 
<a name="l00099"></a>00099     <span class="comment">// the Source Endpoint ID:</span>
<a name="l00100"></a>00100     report_length += <a class="code" href="SDNV_8cc.html#46f4c114c92230c80f6714318251b542">SDNV::encoding_len</a>(orig_source.length()) +
<a name="l00101"></a>00101                      orig_source.length();
<a name="l00102"></a>00102 
<a name="l00103"></a>00103     <span class="comment">//</span>
<a name="l00104"></a>00104     <span class="comment">// Done calculating length, now create the report payload</span>
<a name="l00105"></a>00105     <span class="comment">//</span>
<a name="l00106"></a>00106     u_char* bp = scratch.buf(report_length);
<a name="l00107"></a>00107     <span class="keywordtype">int</span> <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a> = report_length;
<a name="l00108"></a>00108     
<a name="l00109"></a>00109     <span class="comment">// Admin Payload Type and flags</span>
<a name="l00110"></a>00110     *bp = <a class="code" href="classdtn_1_1BundleProtocol.html#35e3c05cad3ebc9ec0f4d9b0f88ece20e4dc69cfbb7fd68487cffea427db7f7f">BundleProtocol::ADMIN_STATUS_REPORT</a> &lt;&lt; 4;
<a name="l00111"></a>00111     <span class="keywordflow">if</span> (orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#d6c74eba219bfe55854cf7a90e210cca" title="Accessors.">is_fragment</a>()) {
<a name="l00112"></a>00112         *bp |= <a class="code" href="classdtn_1_1BundleProtocol.html#f827c0a9dff8115434bc273dc53b7df1951511bc017d452550ea77dd9a15306b">BundleProtocol::ADMIN_IS_FRAGMENT</a>;
<a name="l00113"></a>00113     }
<a name="l00114"></a>00114     bp++;
<a name="l00115"></a>00115     len--;
<a name="l00116"></a>00116     
<a name="l00117"></a>00117     <span class="comment">// Status Flags</span>
<a name="l00118"></a>00118     *bp++ = status_flags;
<a name="l00119"></a>00119     len--;
<a name="l00120"></a>00120 
<a name="l00121"></a>00121     <span class="comment">// Reason Code</span>
<a name="l00122"></a>00122     *bp++ = reason;
<a name="l00123"></a>00123     len--;
<a name="l00124"></a>00124     
<a name="l00125"></a>00125     <span class="comment">// The 2 Fragment Fields</span>
<a name="l00126"></a>00126     <span class="keywordflow">if</span> (orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#d6c74eba219bfe55854cf7a90e210cca" title="Accessors.">is_fragment</a>()) {
<a name="l00127"></a>00127         sdnv_encoding_len = <a class="code" href="SDNV_8cc.html#21c54ef3a5345647ad1cada265a03eb4">SDNV::encode</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#76cf6a44f566aa22e2a98007bf233ee2" title="Accessors.">frag_offset</a>(), bp, len);
<a name="l00128"></a>00128         <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(sdnv_encoding_len &gt; 0);
<a name="l00129"></a>00129         bp  += sdnv_encoding_len;
<a name="l00130"></a>00130         len -= sdnv_encoding_len;
<a name="l00131"></a>00131         
<a name="l00132"></a>00132         sdnv_encoding_len = <a class="code" href="SDNV_8cc.html#21c54ef3a5345647ad1cada265a03eb4">SDNV::encode</a>(orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#e32f3c57057214a1763dfe7709160cf8" title="Accessors.">orig_length</a>(), bp, len);
<a name="l00133"></a>00133         <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(sdnv_encoding_len &gt; 0);
<a name="l00134"></a>00134         bp  += sdnv_encoding_len;
<a name="l00135"></a>00135         len -= sdnv_encoding_len;
<a name="l00136"></a>00136     }   
<a name="l00137"></a>00137 
<a name="l00138"></a>00138     sdnv_encoding_len = <a class="code" href="classdtn_1_1BundleProtocol.html#c590d33b1e828121f9d096860d4cad9a" title="Store a DTN timestamp into a 64-bit value suitable for transmission over the network...">BundleProtocol::set_timestamp</a>(bp, len, now);
<a name="l00139"></a>00139     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(sdnv_encoding_len &gt; 0);
<a name="l00140"></a>00140     bp  += sdnv_encoding_len;
<a name="l00141"></a>00141     len -= sdnv_encoding_len;
<a name="l00142"></a>00142 
<a name="l00143"></a>00143     <span class="comment">// Copy of bundle X's Creation Timestamp</span>
<a name="l00144"></a>00144     sdnv_encoding_len = 
<a name="l00145"></a>00145         <a class="code" href="classdtn_1_1BundleProtocol.html#c590d33b1e828121f9d096860d4cad9a" title="Store a DTN timestamp into a 64-bit value suitable for transmission over the network...">BundleProtocol::set_timestamp</a>(bp, len, orig_bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#13cd9ab7b010f09562170e2a57242209" title="Accessors.">creation_ts</a>());
<a name="l00146"></a>00146     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(sdnv_encoding_len &gt; 0);
<a name="l00147"></a>00147     bp  += sdnv_encoding_len;
<a name="l00148"></a>00148     len -= sdnv_encoding_len;
<a name="l00149"></a>00149     
<a name="l00150"></a>00150     <span class="comment">// The 2 Endpoint ID fields:</span>
<a name="l00151"></a>00151     sdnv_encoding_len = <a class="code" href="SDNV_8cc.html#21c54ef3a5345647ad1cada265a03eb4">SDNV::encode</a>(orig_source.length(), bp, len);
<a name="l00152"></a>00152     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>(sdnv_encoding_len &gt; 0);
<a name="l00153"></a>00153     len -= sdnv_encoding_len;
<a name="l00154"></a>00154     bp  += sdnv_encoding_len;
<a name="l00155"></a>00155     
<a name="l00156"></a>00156     <a class="code" href="SDNV_8cc.html#ca68c0d4ac8df0838e209fb5300f7be3">ASSERT</a>((u_int)len == orig_source.length());
<a name="l00157"></a>00157     memcpy(bp, orig_source.c_str(), orig_source.length());
<a name="l00158"></a>00158     
<a name="l00159"></a>00159     <span class="comment">// </span>
<a name="l00160"></a>00160     <span class="comment">// Finished generating the payload</span>
<a name="l00161"></a>00161     <span class="comment">//</span>
<a name="l00162"></a>00162     bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#857079bad68497626f75c2985b69052f" title="Setters and mutable accessors.">mutable_payload</a>()-&gt;<a class="code" href="classdtn_1_1BundlePayload.html#8abce553a70ab4bff48443d3faf49b2e" title="Set the payload data and length.">set_data</a>(scratch.buf(), report_length);
<a name="l00163"></a>00163 }
<a name="l00164"></a>00164 
<a name="l00165"></a>00165 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00166"></a><a class="code" href="classdtn_1_1BundleStatusReport.html#a9e6e466cf356e0550bd1f36def1f4dc">00166</a> <span class="keywordtype">bool</span> BundleStatusReport::parse_status_report(<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html" title="Specification of the contents of a Bundle Status Report.">data_t</a>* data,
<a name="l00167"></a>00167                                              <span class="keyword">const</span> u_char* bp, u_int <a class="code" href="num2sdnv_8c.html#fed088663f8704004425cdae2120b9b3">len</a>)
<a name="l00168"></a>00168 {
<a name="l00169"></a>00169     <span class="comment">// 1 byte Admin Payload Type + Flags:</span>
<a name="l00170"></a>00170     <span class="keywordflow">if</span> (len &lt; 1) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00171"></a>00171     data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#e333f73e3e8e5f9006d976f9c38cab67">admin_type_</a>  = (*bp &gt;&gt; 4);
<a name="l00172"></a>00172     data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#6c1b239cbfe40a46de7795d6aa6d4ecf">admin_flags_</a> = *bp &amp; 0xf;
<a name="l00173"></a>00173     bp++;
<a name="l00174"></a>00174     len--;
<a name="l00175"></a>00175 
<a name="l00176"></a>00176     <span class="comment">// validate the admin type</span>
<a name="l00177"></a>00177     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#e333f73e3e8e5f9006d976f9c38cab67">admin_type_</a> != <a class="code" href="classdtn_1_1BundleProtocol.html#35e3c05cad3ebc9ec0f4d9b0f88ece20e4dc69cfbb7fd68487cffea427db7f7f">BundleProtocol::ADMIN_STATUS_REPORT</a>) {
<a name="l00178"></a>00178         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00179"></a>00179     }
<a name="l00180"></a>00180 
<a name="l00181"></a>00181     <span class="comment">// 1 byte Status Flags:</span>
<a name="l00182"></a>00182     <span class="keywordflow">if</span> (len &lt; 1) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00183"></a>00183     data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> = *bp++;
<a name="l00184"></a>00184     len--;
<a name="l00185"></a>00185     
<a name="l00186"></a>00186     <span class="comment">// 1 byte Reason Code:</span>
<a name="l00187"></a>00187     <span class="keywordflow">if</span> (len &lt; 1) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00188"></a>00188     data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#12fab47b69881fcc1ca2cb75c6941746">reason_code_</a> = *bp++;
<a name="l00189"></a>00189     len--;
<a name="l00190"></a>00190     
<a name="l00191"></a>00191     <span class="comment">// Fragment SDNV Fields (offset &amp; length), if present:</span>
<a name="l00192"></a>00192     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#6c1b239cbfe40a46de7795d6aa6d4ecf">admin_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleProtocol.html#f827c0a9dff8115434bc273dc53b7df1951511bc017d452550ea77dd9a15306b">BundleProtocol::ADMIN_IS_FRAGMENT</a>) {
<a name="l00193"></a>00193         <span class="keywordtype">int</span> sdnv_bytes = <a class="code" href="SDNV_8cc.html#151d178617a7c2f598cfd7630ebeb7b4">SDNV::decode</a>(bp, len, &amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#dc07b750280a3ffb45b922f6dd64bda2">orig_frag_offset_</a>);
<a name="l00194"></a>00194         <span class="keywordflow">if</span> (sdnv_bytes == -1) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00195"></a>00195         bp  += sdnv_bytes;
<a name="l00196"></a>00196         len -= sdnv_bytes;
<a name="l00197"></a>00197         sdnv_bytes = <a class="code" href="SDNV_8cc.html#151d178617a7c2f598cfd7630ebeb7b4">SDNV::decode</a>(bp, len, &amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#aa5e604aa7f1e5309f33b3eaec40aaa5">orig_frag_length_</a>);
<a name="l00198"></a>00198         <span class="keywordflow">if</span> (sdnv_bytes == -1) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00199"></a>00199         bp  += sdnv_bytes;
<a name="l00200"></a>00200         len -= sdnv_bytes;
<a name="l00201"></a>00201     }
<a name="l00202"></a>00202 
<a name="l00203"></a>00203     <span class="comment">// The 6 Optional ACK Timestamps:</span>
<a name="l00204"></a>00204     
<a name="l00205"></a>00205     <span class="keywordtype">int</span> ts_len;
<a name="l00206"></a>00206     
<a name="l00207"></a>00207     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de149923a02b797429c4a3cf6c5e89f65ee036">BundleStatusReport::STATUS_RECEIVED</a>) {
<a name="l00208"></a>00208         ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#304997abfd815cb4570ba38d5dc5a0f9">receipt_tv_</a>, bp, len);
<a name="l00209"></a>00209         <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00210"></a>00210         bp  += ts_len;
<a name="l00211"></a>00211         len -= ts_len;
<a name="l00212"></a>00212     } <span class="keywordflow">else</span> {
<a name="l00213"></a>00213         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#304997abfd815cb4570ba38d5dc5a0f9">receipt_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = 0;
<a name="l00214"></a>00214         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#304997abfd815cb4570ba38d5dc5a0f9">receipt_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00215"></a>00215     }
<a name="l00216"></a>00216 
<a name="l00217"></a>00217     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de1499064bcecfb056e6fb69163c02c178e16d">BundleStatusReport::STATUS_CUSTODY_ACCEPTED</a>) {
<a name="l00218"></a>00218         ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#a12c42c06734a0f27e09240cdcf40d5f">custody_tv_</a>, bp, len);
<a name="l00219"></a>00219         <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00220"></a>00220         bp  += ts_len;
<a name="l00221"></a>00221         len -= ts_len;
<a name="l00222"></a>00222     } <span class="keywordflow">else</span> {
<a name="l00223"></a>00223         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#a12c42c06734a0f27e09240cdcf40d5f">custody_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = 0;
<a name="l00224"></a>00224         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#a12c42c06734a0f27e09240cdcf40d5f">custody_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00225"></a>00225     }
<a name="l00226"></a>00226 
<a name="l00227"></a>00227     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de14990bf1d45c8cccd8402bde14ee94f6547f">BundleStatusReport::STATUS_FORWARDED</a>) {
<a name="l00228"></a>00228         ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#8eb774a8ad59cdd6a3a91a87392b30da">forwarding_tv_</a>, bp, len);
<a name="l00229"></a>00229         <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00230"></a>00230         bp  += ts_len;
<a name="l00231"></a>00231         len -= ts_len;
<a name="l00232"></a>00232     } <span class="keywordflow">else</span> {
<a name="l00233"></a>00233         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#8eb774a8ad59cdd6a3a91a87392b30da">forwarding_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = 0;
<a name="l00234"></a>00234         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#8eb774a8ad59cdd6a3a91a87392b30da">forwarding_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00235"></a>00235     }
<a name="l00236"></a>00236 
<a name="l00237"></a>00237     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de1499c3d5b382fe3e58a9ef8a7ad98203e9f0">BundleStatusReport::STATUS_DELIVERED</a>) {
<a name="l00238"></a>00238         ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#972b1e9695dd6d0ed5802170e22ff489">delivery_tv_</a>, bp, len);
<a name="l00239"></a>00239         <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00240"></a>00240         bp  += ts_len;
<a name="l00241"></a>00241         len -= ts_len;
<a name="l00242"></a>00242     } <span class="keywordflow">else</span> {
<a name="l00243"></a>00243         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#972b1e9695dd6d0ed5802170e22ff489">delivery_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = 0;
<a name="l00244"></a>00244         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#972b1e9695dd6d0ed5802170e22ff489">delivery_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00245"></a>00245     }
<a name="l00246"></a>00246 
<a name="l00247"></a>00247     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de14990b94e9bc2f3ff0bb55a9920a9a5058f2">BundleStatusReport::STATUS_DELETED</a>) {
<a name="l00248"></a>00248         ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#54689605e52b7c87e60f2ff0ab8fb413">deletion_tv_</a>, bp, len);
<a name="l00249"></a>00249         <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00250"></a>00250         bp  += ts_len;
<a name="l00251"></a>00251         len -= ts_len;
<a name="l00252"></a>00252     } <span class="keywordflow">else</span> {
<a name="l00253"></a>00253         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#54689605e52b7c87e60f2ff0ab8fb413">deletion_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = 0;
<a name="l00254"></a>00254         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#54689605e52b7c87e60f2ff0ab8fb413">deletion_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00255"></a>00255     }
<a name="l00256"></a>00256 
<a name="l00257"></a>00257     <span class="keywordflow">if</span> (data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#3f1f30037f28bb8ad3de467df41d8a8d">status_flags_</a> &amp; <a class="code" href="classdtn_1_1BundleStatusReport.html#b2546897ef428634d8385363b6de1499c3f0fc79cd0c05849272121d95eb3b4a">BundleStatusReport::STATUS_ACKED_BY_APP</a>) {
<a name="l00258"></a>00258         ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#d83b26f19b8246119e870453922ba151">ack_by_app_tv_</a>, bp, len);
<a name="l00259"></a>00259         <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00260"></a>00260         bp  += ts_len;
<a name="l00261"></a>00261         len -= ts_len;
<a name="l00262"></a>00262     } <span class="keywordflow">else</span> {
<a name="l00263"></a>00263         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#d83b26f19b8246119e870453922ba151">ack_by_app_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#02c8a347150620243240655bdcd2f42d" title="Seconds since 1/1/2000.">seconds_</a> = 0;
<a name="l00264"></a>00264         data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#d83b26f19b8246119e870453922ba151">ack_by_app_tv_</a>.<a class="code" href="structdtn_1_1BundleTimestamp.html#ebc8cea66862d7f6056da450db410347" title="Sub-second sequence number.">seqno_</a>   = 0;
<a name="l00265"></a>00265     }
<a name="l00266"></a>00266     
<a name="l00267"></a>00267     <span class="comment">// Bundle Creation Timestamp</span>
<a name="l00268"></a>00268     ts_len = <a class="code" href="classdtn_1_1BundleProtocol.html#09d040740695f886e1e09bd9065767ab" title="Retrieve a DTN timestamp from a 64-bit value that was transmitted over the network...">BundleProtocol::get_timestamp</a>(&amp;data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#24a8b16df7b3050f6ca8fb2479c6d574">orig_creation_tv_</a>, bp, len);
<a name="l00269"></a>00269     <span class="keywordflow">if</span> (ts_len &lt; 0) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00270"></a>00270     bp  += ts_len;
<a name="l00271"></a>00271     len -= ts_len;
<a name="l00272"></a>00272     
<a name="l00273"></a>00273     <span class="comment">// EID of Bundle</span>
<a name="l00274"></a>00274     u_int64_t EID_len;
<a name="l00275"></a>00275     <span class="keywordtype">int</span> num_bytes = <a class="code" href="SDNV_8cc.html#151d178617a7c2f598cfd7630ebeb7b4">SDNV::decode</a>(bp, len, &amp;EID_len);
<a name="l00276"></a>00276     <span class="keywordflow">if</span> (num_bytes == -1) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00277"></a>00277     bp  += num_bytes;
<a name="l00278"></a>00278     len -= num_bytes;
<a name="l00279"></a>00279 
<a name="l00280"></a>00280     <span class="keywordflow">if</span> (len != EID_len) { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
<a name="l00281"></a>00281     <span class="keywordtype">bool</span> ok = data-&gt;<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html#a0e5648f21a9d7ded26521289c2e4aeb">orig_source_eid_</a>.<a class="code" href="classdtn_1_1EndpointID.html#ec39752e4da3107b16ff5da58d2aa5ab" title="Assign this endpoint ID as a copy of the other.">assign</a>(std::string((<span class="keyword">const</span> <span class="keywordtype">char</span>*)bp, len));
<a name="l00282"></a>00282     <span class="keywordflow">if</span> (!ok) {
<a name="l00283"></a>00283         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00284"></a>00284     }
<a name="l00285"></a>00285     
<a name="l00286"></a>00286     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00287"></a>00287 }
<a name="l00288"></a>00288 
<a name="l00289"></a>00289 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00290"></a>00290 <span class="keywordtype">bool</span>
<a name="l00291"></a><a class="code" href="classdtn_1_1BundleStatusReport.html#4ecd1fbeed4960b87f389d888d9a46d8">00291</a> <a class="code" href="classdtn_1_1BundleStatusReport.html#a9e6e466cf356e0550bd1f36def1f4dc" title="Parse a byte stream containing a Status Report Payload and store the fields in the...">BundleStatusReport::parse_status_report</a>(<a class="code" href="structdtn_1_1BundleStatusReport_1_1data__t.html" title="Specification of the contents of a Bundle Status Report.">data_t</a>* data,
<a name="l00292"></a>00292                                         <span class="keyword">const</span> <a class="code" href="classdtn_1_1Bundle.html" title="The internal representation of a bundle.">Bundle</a>* bundle)
<a name="l00293"></a>00293 {
<a name="l00294"></a>00294     <a class="code" href="classdtn_1_1BundleProtocol.html#35e3c05cad3ebc9ec0f4d9b0f88ece20" title="Administrative Record Type Codes.">BundleProtocol::admin_record_type_t</a> admin_type;
<a name="l00295"></a>00295     <span class="keywordflow">if</span> (! <a class="code" href="classdtn_1_1BundleProtocol.html#0100870ed71be16830543b822cfffd2c" title="Assuming the given bundle is an administrative bundle, extract the admin bundle type...">BundleProtocol::get_admin_type</a>(bundle, &amp;admin_type)) {
<a name="l00296"></a>00296         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00297"></a>00297     }
<a name="l00298"></a>00298 
<a name="l00299"></a>00299     <span class="keywordflow">if</span> (admin_type != <a class="code" href="classdtn_1_1BundleProtocol.html#35e3c05cad3ebc9ec0f4d9b0f88ece20e4dc69cfbb7fd68487cffea427db7f7f">BundleProtocol::ADMIN_STATUS_REPORT</a>) {
<a name="l00300"></a>00300         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00301"></a>00301     }
<a name="l00302"></a>00302 
<a name="l00303"></a>00303     <span class="keywordtype">size_t</span> payload_len = bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#3bc0b88b547620b4029eba4809a73447" title="Accessors.">payload</a>().<a class="code" href="classdtn_1_1BundlePayload.html#56b3851ad789c4dbf019a32d557b7453" title="The payload length.">length</a>();
<a name="l00304"></a>00304     <span class="keywordflow">if</span> (payload_len &gt; 16384) {
<a name="l00305"></a>00305         <a class="code" href="SDNV_8cc.html#3f24cadc9f28aba33472df0500092dcb">log_err_p</a>(<span class="stringliteral">"/dtn/bundle/protocol"</span>,
<a name="l00306"></a>00306                   <span class="stringliteral">"status report length %zu too big to be parsed!!"</span>,
<a name="l00307"></a>00307                   payload_len);
<a name="l00308"></a>00308         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00309"></a>00309     }
<a name="l00310"></a>00310 
<a name="l00311"></a>00311     oasys::ScratchBuffer&lt;u_char*, 256&gt; <a class="code" href="num2sdnv_8c.html#a81cdcc7ff6987bc85c073253e32715f">buf</a>;
<a name="l00312"></a>00312     buf.reserve(payload_len);
<a name="l00313"></a>00313     <span class="keyword">const</span> u_char* bp = bundle-&gt;<a class="code" href="classdtn_1_1Bundle.html#3bc0b88b547620b4029eba4809a73447" title="Accessors.">payload</a>().<a class="code" href="classdtn_1_1BundlePayload.html#c4ce25f2d2d7ad54a9306ea2599731b4" title="Copy out a chunk of payload data into the supplied buffer.">read_data</a>(0, payload_len, buf.buf());
<a name="l00314"></a>00314     <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1BundleStatusReport.html#a9e6e466cf356e0550bd1f36def1f4dc" title="Parse a byte stream containing a Status Report Payload and store the fields in the...">parse_status_report</a>(data, bp, payload_len);
<a name="l00315"></a>00315 }
<a name="l00316"></a>00316 
<a name="l00317"></a>00317 <span class="comment">//----------------------------------------------------------------------</span>
<a name="l00318"></a>00318 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00319"></a><a class="code" href="classdtn_1_1BundleStatusReport.html#c01eebd70430ee5eaf44240097a765cf">00319</a> <a class="code" href="classdtn_1_1BundleStatusReport.html#c01eebd70430ee5eaf44240097a765cf" title="Return a string version of the reason code.">BundleStatusReport::reason_to_str</a>(u_int8_t reason)
<a name="l00320"></a>00320 {
<a name="l00321"></a>00321     <span class="keywordflow">switch</span> (reason) {
<a name="l00322"></a>00322     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917eac137290a0338e66ed4a0c1cc09c2f2">BundleProtocol::REASON_NO_ADDTL_INFO</a>:
<a name="l00323"></a>00323         <span class="keywordflow">return</span> <span class="stringliteral">"no additional information"</span>;
<a name="l00324"></a>00324 
<a name="l00325"></a>00325     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f91773f35a814d405ad151db78f95422a394">BundleProtocol::REASON_LIFETIME_EXPIRED</a>:
<a name="l00326"></a>00326         <span class="keywordflow">return</span> <span class="stringliteral">"lifetime expired"</span>;
<a name="l00327"></a>00327 
<a name="l00328"></a>00328     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917e2b2502001dc9ec3108744dc835b6511">BundleProtocol::REASON_FORWARDED_UNIDIR_LINK</a>:
<a name="l00329"></a>00329         <span class="keywordflow">return</span> <span class="stringliteral">"forwarded over unidirectional link"</span>;
<a name="l00330"></a>00330 
<a name="l00331"></a>00331     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917fcf8e25210f4249990dad68547f7b993">BundleProtocol::REASON_TRANSMISSION_CANCELLED</a>:
<a name="l00332"></a>00332         <span class="keywordflow">return</span> <span class="stringliteral">"transmission cancelled"</span>;
<a name="l00333"></a>00333 
<a name="l00334"></a>00334     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f9176e886c084e3e545573e435ef04760c1a">BundleProtocol::REASON_DEPLETED_STORAGE</a>:
<a name="l00335"></a>00335         <span class="keywordflow">return</span> <span class="stringliteral">"depleted storage"</span>;
<a name="l00336"></a>00336 
<a name="l00337"></a>00337     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917261a9bdbc6f572b8cff433355d191e43">BundleProtocol::REASON_ENDPOINT_ID_UNINTELLIGIBLE</a>:
<a name="l00338"></a>00338         <span class="keywordflow">return</span> <span class="stringliteral">"endpoint id unintelligible"</span>;
<a name="l00339"></a>00339 
<a name="l00340"></a>00340     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917e692ecf914f35ccd754a12534793b7d1">BundleProtocol::REASON_NO_ROUTE_TO_DEST</a>:
<a name="l00341"></a>00341         <span class="keywordflow">return</span> <span class="stringliteral">"no known route to destination"</span>;
<a name="l00342"></a>00342 
<a name="l00343"></a>00343     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917635c372cffcc51473ade75ebfa02c1f0">BundleProtocol::REASON_NO_TIMELY_CONTACT</a>:
<a name="l00344"></a>00344         <span class="keywordflow">return</span> <span class="stringliteral">"no timely contact"</span>;
<a name="l00345"></a>00345 
<a name="l00346"></a>00346     <span class="keywordflow">case</span> <a class="code" href="classdtn_1_1BundleProtocol.html#37b000d94172c06970bb8af32889f917a86c9900fe5641754acdcdb326b79b2c">BundleProtocol::REASON_BLOCK_UNINTELLIGIBLE</a>:
<a name="l00347"></a>00347         <span class="keywordflow">return</span> <span class="stringliteral">"block unintelligible"</span>;
<a name="l00348"></a>00348 
<a name="l00349"></a>00349     <span class="keywordflow">default</span>:
<a name="l00350"></a>00350         <span class="keywordflow">return</span> <span class="stringliteral">"(unknown reason)"</span>;
<a name="l00351"></a>00351     }
<a name="l00352"></a>00352 }
<a name="l00353"></a>00353 
<a name="l00354"></a>00354 } <span class="comment">// namespace dtn</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:38 2008 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.6 </small></address>
</body>
</html>