00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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:
00031 typedef enum {
00032 STATUS_RECEIVED = 0x01,
00033 STATUS_CUSTODY_ACCEPTED = 0x02,
00034 STATUS_FORWARDED = 0x04,
00035 STATUS_DELIVERED = 0x08,
00036 STATUS_DELETED = 0x10,
00037 STATUS_ACKED_BY_APP = 0x20,
00038 STATUS_UNUSED = 0x40,
00039 STATUS_UNUSED2 = 0x80,
00040 } flag_t;
00041
00045 typedef BundleProtocol::status_report_reason_t reason_t;
00046
00050 struct data_t {
00051 u_int8_t admin_type_;
00052 u_int8_t admin_flags_;
00053 u_int8_t status_flags_;
00054 u_int8_t reason_code_;
00055 u_int64_t orig_frag_offset_;
00056 u_int64_t orig_frag_length_;
00057 BundleTimestamp receipt_tv_;
00058 BundleTimestamp custody_tv_;
00059 BundleTimestamp forwarding_tv_;
00060 BundleTimestamp delivery_tv_;
00061 BundleTimestamp deletion_tv_;
00062 BundleTimestamp ack_by_app_tv_;
00063 BundleTimestamp orig_creation_tv_;
00064 EndpointID orig_source_eid_;
00065 };
00066
00076 static void create_status_report(Bundle* bundle,
00077 const Bundle* orig_bundle,
00078 const EndpointID& source,
00079 flag_t status_flag,
00080 reason_t reason);
00081
00087 static bool parse_status_report(data_t* data,
00088 const u_char* bp, u_int len);
00089
00094 static bool parse_status_report(data_t* data,
00095 const Bundle* bundle);
00096
00100 static const char* reason_to_str(u_int8_t reason);
00101 };
00102
00103 }
00104
00105 #endif