IBR-DTNSuite  0.8
ibrdtn/ibrdtn/data/StatusReportBlock.h
Go to the documentation of this file.
00001 /*
00002  * StatusReportBlock.h
00003  *
00004  *  Created on: 05.06.2009
00005  *      Author: morgenro
00006  */
00007 
00008 
00009 
00010 #ifndef STATUSREPORTBLOCK_H_
00011 #define STATUSREPORTBLOCK_H_
00012 
00013 #include "ibrdtn/data/Block.h"
00014 #include "ibrdtn/data/EID.h"
00015 #include "ibrcommon/data/BLOB.h"
00016 #include "ibrdtn/data/DTNTime.h"
00017 
00018 namespace dtn
00019 {
00020         namespace data
00021         {
00022                 class StatusReportBlock : public Block
00023                 {
00024                 public:
00025                         enum TYPE
00026                         {
00027                                 RECEIPT_OF_BUNDLE = 1 << 0,
00028                                 CUSTODY_ACCEPTANCE_OF_BUNDLE = 1 << 1,
00029                                 FORWARDING_OF_BUNDLE = 1 << 2,
00030                                 DELIVERY_OF_BUNDLE = 1 << 3,
00031                                 DELETION_OF_BUNDLE = 1 << 4
00032                         };
00033 
00034                         enum REASON_CODE
00035                         {
00036                                 NO_ADDITIONAL_INFORMATION = 0x00,
00037                                 LIFETIME_EXPIRED = 0x01,
00038                                 FORWARDED_OVER_UNIDIRECTIONAL_LINK = 0x02,
00039                                 TRANSMISSION_CANCELED = 0x03,
00040                                 DEPLETED_STORAGE = 0x04,
00041                                 DESTINATION_ENDPOINT_ID_UNINTELLIGIBLE = 0x05,
00042                                 NO_KNOWN_ROUTE_TO_DESTINATION_FROM_HERE = 0x06,
00043                                 NO_TIMELY_CONTACT_WITH_NEXT_NODE_ON_ROUTE = 0x07,
00044                                 BLOCK_UNINTELLIGIBLE = 0x08
00045                         };
00046 
00047                         StatusReportBlock();
00048                         virtual ~StatusReportBlock();
00049 
00050                         virtual size_t getLength() const;
00051                         virtual std::ostream &serialize(std::ostream &stream, size_t &length) const;
00052                         virtual std::istream &deserialize(std::istream &stream, const size_t length);
00053 
00054                         char _admfield;
00055                         char _status;
00056                         char _reasoncode;
00057                         SDNV _fragment_offset;
00058                         SDNV _fragment_length;
00059                         DTNTime _timeof_receipt;
00060                         DTNTime _timeof_custodyaccept;
00061                         DTNTime _timeof_forwarding;
00062                         DTNTime _timeof_delivery;
00063                         DTNTime _timeof_deletion;
00064                         SDNV _bundle_timestamp;
00065                         SDNV _bundle_sequence;
00066                         EID _source;
00067                 };
00068         }
00069 }
00070 
00071 #endif /* STATUSREPORTBLOCK_H_ */