IBR-DTNSuite
0.8
|
00001 /* 00002 * StreamDataSegment.h 00003 * 00004 * Created on: 30.06.2009 00005 * Author: morgenro 00006 */ 00007 00008 00009 #ifndef STREAMDATASEGMENT_H_ 00010 #define STREAMDATASEGMENT_H_ 00011 00012 #include <stdlib.h> 00013 #include <iostream> 00014 00015 namespace dtn 00016 { 00017 namespace streams 00018 { 00019 class StreamDataSegment 00020 { 00021 public: 00022 enum SegmentType 00023 { 00024 MSG_DATA_SEGMENT = 0x1, 00025 MSG_ACK_SEGMENT = 0x2, 00026 MSG_REFUSE_BUNDLE = 0x3, 00027 MSG_KEEPALIVE = 0x4, 00028 MSG_SHUTDOWN = 0x5 00029 }; 00030 00031 enum SegmentMark 00032 { 00033 MSG_MARK_BEGINN = 0x02, 00034 MSG_MARK_END = 0x01 00035 }; 00036 00037 enum ShutdownReason 00038 { 00039 MSG_SHUTDOWN_NONE = 0xff, 00040 MSG_SHUTDOWN_IDLE_TIMEOUT = 0x00, 00041 MSG_SHUTDOWN_VERSION_MISSMATCH = 0x01, 00042 MSG_SHUTDOWN_BUSY = 0x02 00043 }; 00044 00045 StreamDataSegment(SegmentType type, size_t size); // creates a ACK or DATA segment 00046 StreamDataSegment(SegmentType type = MSG_KEEPALIVE); // Creates a Keep-Alive Message 00047 StreamDataSegment(ShutdownReason reason, size_t reconnect = 0); // Creates a Shutdown Message 00048 00049 virtual ~StreamDataSegment(); 00050 00051 size_t _value; 00052 SegmentType _type; 00053 ShutdownReason _reason; 00054 u_int8_t _flags; 00055 00056 friend std::ostream &operator<<(std::ostream &stream, const StreamDataSegment &seg); 00057 friend std::istream &operator>>(std::istream &stream, StreamDataSegment &seg); 00058 }; 00059 } 00060 } 00061 00062 #endif /* STREAMDATASEGMENT_H_ */