EventMessage.h

00001 #ifndef EVENTMESSAGE_H
00002 #define EVENTMESSAGE_H
00003 
00004 #include "serializable.h"
00005 
00009 #define EVT_SUCCESS     0
00010 #define EVT_ERROR       -1
00011 #define EVT_SHUTDOWN    -2
00012 
00013 
00017 #define FILE_SEND_REQ           101
00018 #define FILE_RECV_REQ           102
00019 #define FILE_FIND_REQ           103
00020 #define FILE_PUBLISH_REQ        104
00021 #define FILE_GOSSIP_REQ         105
00022 #define FILE_BOOTSTRAP_SRV_REQ  106
00023 #define FILE_BOOTSTRAP_SRV_RES  107
00024 #define FILE_BOOTSTRAP_KAD_REQ  109
00025 //for validating publish cert.
00026 #define FILE_REPORT_CERT_REQ    110
00027 
00028 
00032 #define FILE_GOSSIP             0xB1
00033 #define FILE_OTHER              0xB2
00034 #define FILE_MULTICAST          0xB3
00035 #define FILE_BOOTSTRAP          0xB4
00036 #define FILE_UNKNOWN            0xB5
00037 
00041 #define USE_TCP         201
00042 #define USE_UDP         202
00043 
00047 #define MODULE_MULTICAST                        0xC1
00048 #define MODULE_GOSSIP                           0xC2
00049 #define MODULE_KAD                              0xC3
00050 #define MODULE_UNKNOWN                          0xC4
00051 #define MODULE_GOSSIP_AND_MULTICAST             0xC5
00052 
00053 
00054 #define SAFE_DELETE(X) {if (X) { delete (X); (X) = NULL; } }
00055 
00065 class EventMessage: public ISerializable{
00066 
00067 
00068 public:
00069         EventMessage();
00070         virtual ~EventMessage();
00071 
00072         /*EVT_SUCCESS or EVT_ERROR?*/
00076         void SetStatus(int i){m_iStatus = i;}
00077 
00081         void SetReasonCode(int i){m_iReasonCode = i;}
00082 
00086         void SetReasonString(const std::string& s){m_sReasonString = s; m_iReasonStringLen = s.size();}
00087 
00091         void SetFileType(uint8_t t){m_8FileType = t;}
00092 
00096         void SetFileSize(int t){m_iFileSize = t;}
00097 
00101         void SetFileName(const std::string& s){m_sFileName = s; m_iFileNameLen = s.size();}
00102 
00106         void SetFilePath(const std::string& s){m_sFilePath = s; m_iFilePathLen = s.size();}
00107 
00111         void SetSearchID(int i){m_iSearchID = i;}
00112 
00116         int GetStatus(){return m_iStatus;}
00117 
00121         int GetReasonCode(){return m_iReasonCode;}
00122 
00126         std::string GetReasonString(){return m_sReasonString ; }
00127 
00131         uint8_t GetFileType(){return m_8FileType;}
00132 
00136         int GetFileSize(){return m_iFileSize;}
00137 
00141         std::string GetFileName(){return m_sFileName;}
00142 
00146         std::string GetFilePath(){return m_sFilePath ;}
00147 
00151         int GetSearchID(){return m_iSearchID ;}
00152 
00156         void SetRelatedModule(uint8_t t){m_8RelatedModule = t;}
00157 
00161         uint8_t GetRelatedModule(){return m_8RelatedModule;}
00162 
00163 
00167         virtual void serialize(std::string& sBuf) const ;
00168 
00172         virtual int deserialize(const std::string& sBuf);
00173 
00174 private:
00175         /*Is this a success or a failure notification*/
00176         int m_iStatus;
00177 
00178         /*Reason Code*/
00179         int m_iReasonCode;
00180 
00181         int m_iReasonStringLen;
00182         /*Reason string for human readability*/
00183         std::string m_sReasonString;
00184 
00185         /*File Information*/
00186 
00187         /*Goosip file, or certificate?*/
00188         uint8_t m_8FileType;
00189 
00190         int m_iFileSize;
00191 
00192         int m_iFileNameLen;
00193         std::string m_sFileName;
00194 
00195         int m_iFilePathLen;
00196         std::string m_sFilePath;
00197 
00198         int m_iSearchID;
00199 
00200         /*Goosip file, or certificate?*/
00201         uint8_t m_8RelatedModule;
00202 
00203 
00204 
00205 };
00206 
00207 #endif // EVENTMESSAGE_H

Generated on Thu Sep 16 11:29:42 2010 for Policy Component by  doxygen 1.4.7