BundleStatusReport.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 #ifndef _BUNDLE_STATUS_REPORT_H_
00018 #define _BUNDLE_STATUS_REPORT_H_
00019 
00020 #include "Bundle.h"
00021 #include "BundleProtocol.h"
00022 #include "BundleTimestamp.h"
00023 
00024 namespace dtn {
00025 
00029 class BundleStatusReport {
00030 public:
00034     typedef BundleProtocol::status_report_flag_t flag_t;
00035     
00039     typedef BundleProtocol::status_report_reason_t reason_t;
00040 
00044     struct data_t {
00045         u_int8_t        admin_type_;
00046         u_int8_t        admin_flags_;
00047         u_int8_t        status_flags_;
00048         u_int8_t        reason_code_;
00049         u_int64_t       orig_frag_offset_;
00050         u_int64_t       orig_frag_length_;
00051         BundleTimestamp receipt_tv_;
00052         BundleTimestamp custody_tv_;
00053         BundleTimestamp forwarding_tv_;
00054         BundleTimestamp delivery_tv_;
00055         BundleTimestamp deletion_tv_;
00056         BundleTimestamp acknowledgement_tv_;
00057         BundleTimestamp orig_creation_tv_;
00058         EndpointID      orig_source_eid_;
00059     };
00060 
00070     static void create_status_report(Bundle*           bundle,
00071                                      const Bundle*     orig_bundle,
00072                                      const EndpointID& source,
00073                                      flag_t            status_flag,
00074                                      reason_t          reason);
00075     
00081     static bool parse_status_report(data_t* data,
00082                                     const u_char* bp, u_int len);
00083 
00088     static bool parse_status_report(data_t* data,
00089                                     const Bundle* bundle);
00090 
00094     static const char* reason_to_str(u_int8_t reason);
00095 };
00096 
00097 } // namespace dtn
00098 
00099 #endif /* _BUNDLE_STATUS_REPORT_H_ */

Generated on Thu Jun 7 12:54:26 2007 for DTN Reference Implementation by  doxygen 1.5.1