00001 #ifndef TCPMESSAGEHEADER_H_ 00002 #define TCPMESSAGEHEADER_H_ 00003 00004 #include "data/Exceptions.h" 00005 #include "data/NetworkFrame.h" 00006 #include <bitset> 00007 00008 using namespace std; 00009 00010 namespace dtn 00011 { 00012 namespace exceptions 00013 { 00014 class IncompleteDataException : public Exception 00015 { 00016 public: 00017 IncompleteDataException() : Exception("Data incomplete") 00018 { 00019 }; 00020 00021 IncompleteDataException(string what) : Exception(what) 00022 { 00023 }; 00024 }; 00025 } 00026 } 00027 00028 namespace dtn 00029 { 00030 namespace core 00031 { 00032 enum TCPMessageType 00033 { 00034 MSG_DATA_SEGMENT = 0x01, 00035 MSG_ACK_SEGMENT = 0x02, 00036 MSG_REFUSE_BUNDLE = 0x03, 00037 MSG_KEEPALIVE = 0x04, 00038 MSG_SHUTDOWN = 0x05 00039 }; 00040 00041 enum TCPMessageShutdownReason 00042 { 00043 MSG_SHUTDOWN_NONE = 0x00, 00044 MSG_SHUTDOWN_IDLE_TIMEOUT = 0x01, 00045 MSG_SHUTDOWN_VERSION_MISSMATCH = 0x02, 00046 MSG_SHUTDOWN_BUSY = 0x03 00047 }; 00048 00049 class TCPMessage 00050 { 00051 public: 00052 TCPMessage(size_t chunksize, char *data); // creates a Data Message 00053 TCPMessage(size_t acksize); // creates a Ack Message 00054 TCPMessage(); // Creates a Keep-Alive Message 00055 TCPMessage(TCPMessageShutdownReason reason = MSG_SHUTDOWN_NONE, size_t reconnect = 0); // Creates a Shutdown Message 00056 00057 //TCPMessage(char *data) throw (dtn::exceptions::IncompleteDataException); 00058 ~TCPMessage(); 00059 00060 char* getData(); 00061 size_t getSize(); 00062 void setFirst(bool value); 00063 void setLast(bool value); 00064 private: 00065 dtn::data::NetworkFrame *m_frame; 00066 }; 00067 } 00068 } 00069 00070 #endif /*TCPMESSAGEHEADER_H_*/
1.5.6