EventMessage.h

00001 #ifndef EVENTMESSAGE_H
00002 #define EVENTMESSAGE_H
00003 
00004 #include "serializable.h"
00005 
00006 //iStatus
00007 #define EVT_SUCCESS     0
00008 #define EVT_ERROR       -1
00009 #define EVT_SHUTDOWN    -2
00010 
00011 
00012 //iReasonCode
00013 #define FILE_SEND_REQ           101
00014 #define FILE_RECV_REQ           102
00015 #define FILE_FIND_REQ           103
00016 #define FILE_PUBLISH_REQ        104
00017 #define FILE_GOSSIP_REQ         105
00018 #define FILE_BOOTSTRAP_SRV_REQ  106
00019 #define FILE_BOOTSTRAP_SRV_RES  107
00020 #define FILE_BOOTSTRAP_KAD_REQ  109
00021 //for validating publish cert.
00022 #define FILE_REPORT_CERT_REQ    110
00023 
00024 //8FileType
00025 #define FILE_GOSSIP             0xB1
00026 #define FILE_OTHER              0xB2
00027 #define FILE_MULTICAST          0xB3
00028 #define FILE_BOOTSTRAP          0xB4
00029 #define FILE_UNKNOWN            0xB5
00030 
00031 #define USE_TCP         201
00032 #define USE_UDP         202
00033 
00034 //8RelatedModule
00035 #define MODULE_MULTICAST                        0xC1
00036 #define MODULE_GOSSIP                           0xC2
00037 #define MODULE_KAD                              0xC3
00038 #define MODULE_UNKNOWN                          0xC4
00039 #define MODULE_GOSSIP_AND_MULTICAST             0xC5
00040 
00041 
00042 #define SAFE_DELETE(X) {if (X) { delete (X); (X) = NULL; } }
00043 
00044 
00045 class EventMessage: public ISerializable{
00046 
00047 
00048 public:
00049         EventMessage();
00050         virtual ~EventMessage();
00051 
00052         /*EVT_SUCCESS or EVT_ERROR?*/
00053         void SetStatus(int i){m_iStatus = i;}
00054 
00055         /*Future use*/
00056         void SetReasonCode(int i){m_iReasonCode = i;}
00057         void SetReasonString(const std::string& s){m_sReasonString = s; m_iReasonStringLen = s.size();}
00058 
00059         void SetFileType(uint8_t t){m_8FileType = t;}
00060         void SetFileSize(int t){m_iFileSize = t;}
00061         void SetFileName(const std::string& s){m_sFileName = s; m_iFileNameLen = s.size();}
00062         void SetFilePath(const std::string& s){m_sFilePath = s; m_iFilePathLen = s.size();}
00063         void SetSearchID(int i){m_iSearchID = i;}
00064 
00065         int GetStatus(){return m_iStatus;}
00066         int GetReasonCode(){return m_iReasonCode;}
00067         std::string GetReasonString(){return m_sReasonString ; }
00068         uint8_t GetFileType(){return m_8FileType;}
00069         int GetFileSize(){return m_iFileSize;}
00070         std::string GetFileName(){return m_sFileName;}
00071         std::string GetFilePath(){return m_sFilePath ;}
00072         int GetSearchID(){return m_iSearchID ;}
00073         void SetRelatedModule(uint8_t t){m_8RelatedModule = t;}
00074         uint8_t GetRelatedModule(){return m_8RelatedModule;}
00075 
00076 
00077 
00078 
00079         virtual void serialize(std::string& sBuf) const ;
00080         virtual int deserialize(const std::string& sBuf);
00081 
00082 private:
00083         /*Is this a success or a failure notification*/
00084         int m_iStatus;
00085 
00086         /*Reason Code*/
00087         int m_iReasonCode;
00088 
00089         int m_iReasonStringLen;
00090         /*Reason string for human readability*/
00091         std::string m_sReasonString;
00092 
00093         /*File Information*/
00094 
00095         /*Goosip file, or certificate?*/
00096         uint8_t m_8FileType;
00097 
00098         int m_iFileSize;
00099 
00100         int m_iFileNameLen;
00101         std::string m_sFileName;
00102 
00103         int m_iFilePathLen;
00104         std::string m_sFilePath;
00105 
00106         int m_iSearchID;
00107 
00108         /*Goosip file, or certificate?*/
00109         uint8_t m_8RelatedModule;
00110 
00111 
00112 
00113 };
00114 
00115 #endif // EVENTMESSAGE_H

Generated on Thu Sep 16 11:51:44 2010 for Communication Component by  doxygen 1.4.7