00001 #ifndef STATUSREPORTBLOCK_H_
00002 #define STATUSREPORTBLOCK_H_
00003
00004 #include "data/AdministrativeBlock.h"
00005 #include "data/ProcessingFlags.h"
00006 #include "data/Exceptions.h"
00007
00008 namespace dtn
00009 {
00010 namespace data
00011 {
00012 enum STATUSREPORT_FIELDS
00013 {
00014 STATUSREPORT_ADMFIELD = 0,
00015 STATUSREPORT_STATUS = 1,
00016 STATUSREPORT_REASON = 2,
00017 STATUSREPORT_FRAGMENT_OFFSET = 3,
00018 STATUSREPORT_FRAGMENT_LENGTH = 4,
00019 STATUSREPORT_TIMEOF_RECEIPT = 5,
00020 STATUSREPORT_TIMEOF_CUSTODYACCEPT = 6,
00021 STATUSREPORT_TIMEOF_FORWARDING = 7,
00022 STATUSREPORT_TIMEOF_DELIVERY = 8,
00023 STATUSREPORT_TIMEOF_DELETION = 9,
00024 STATUSREPORT_BUNDLE_TIMESTAMP = 10,
00025 STATUSREPORT_BUNDLE_SEQUENCE = 11,
00026 STATUSREPORT_BUNDLE_SOURCE_LENGTH = 12,
00027 STATUSREPORT_BUNDLE_SOURCE = 13
00028 };
00029
00030 enum StatusReportType
00031 {
00032 RECEIPT_OF_BUNDLE = 0,
00033 CUSTODY_ACCEPTANCE_OF_BUNDLE = 1,
00034 FORWARDING_OF_BUNDLE = 2,
00035 DELIVERY_OF_BUNDLE = 3,
00036 DELETION_OF_BUNDLE = 4
00037 };
00038
00039 enum StatusReportReasonCode
00040 {
00041 NO_ADDITIONAL_INFORMATION = 0x00,
00042 LIFETIME_EXPIRED = 0x01,
00043 FORWARDED_OVER_UNIDIRECTIONAL_LINK = 0x02,
00044 TRANSMISSION_CANCELED = 0x03,
00045 DEPLETED_STORAGE = 0x04,
00046 DESTINATION_ENDPOINT_ID_UNINTELLIGIBLE = 0x05,
00047 NO_KNOWN_ROUTE_TO_DESTINATION_FROM_HERE = 0x06,
00048 NO_TIMELY_CONTACT_WITH_NEXT_NODE_ON_ROUTE = 0x07,
00049 BLOCK_UNINTELLIGIBLE = 0x08
00050 };
00051
00052 class StatusReportBlock : public data::AdministrativeBlock
00053 {
00054 public:
00058 StatusReportBlock(Block *block);
00059 StatusReportBlock(NetworkFrame *frame);
00060
00064 virtual ~StatusReportBlock();
00065
00066 bool forFragment() const;
00067
00068 unsigned int getFragmentOffset() const;
00069 void setFragmentOffset(unsigned int value);
00070
00071 unsigned int getFragmentLength() const;
00072 void setFragmentLength(unsigned int value);
00073
00074
00075 ProcessingFlags getReasonCode() const;
00076 void setReasonCode(ProcessingFlags value);
00077
00078
00079 unsigned int getTimeOfReceipt() const;
00080 void setTimeOfReceipt(unsigned int value);
00081
00082
00083 unsigned int getTimeOfCustodyAcceptance() const;
00084 void setTimeOfCustodyAcceptance(unsigned int value);
00085
00086
00087 unsigned int getTimeOfForwarding() const;
00088 void setTimeOfForwarding(unsigned int value);
00089
00090
00091 unsigned int getTimeOfDelivery() const;
00092 void setTimeOfDelivery(unsigned int value);
00093
00094
00095 unsigned int getTimeOfDeletion() const;
00096 void setTimeOfDeletion(unsigned int value);
00097
00098
00099 unsigned int getCreationTimestamp() const;
00100 void setCreationTimestamp(unsigned int value);
00101
00102
00103 unsigned int getCreationTimestampSequence() const;
00104 void setCreationTimestampSequence(unsigned int value);
00105
00106 bool match(const Bundle &b) const;
00107 void setMatch(const Bundle &b);
00108
00109
00110 string getSource() const;
00111 void setSource(string value);
00112
00113 private:
00114 unsigned int getField(STATUSREPORT_FIELDS field) const;
00115 };
00116 }
00117 }
00118
00119 #endif