00001
00002
00003
00004
00005 #ifndef _BROOSEMESSAGE_M_H_
00006 #define _BROOSEMESSAGE_M_H_
00007
00008 #include <omnetpp.h>
00009
00010
00011 #define MSGC_VERSION 0x0400
00012 #if (MSGC_VERSION!=OMNETPP_VERSION)
00013 # error Version mismatch! Probably this file was generated by an earlier version of opp_msgc: 'make clean' should help.
00014 #endif
00015
00016
00017
00018 #include <IPvXAddress.h>
00019 #include <NodeHandle.h>
00020 #include <CommonMessages_m.h>
00021 #include <OverlayKey.h>
00022
00023
00024 static const int FAILEDREPONSES_L = 8;
00025 static const int RTT_L = 8;
00026 static const int LASTSEEN_L = 8;
00027 static const int INDEX_L = 8;
00028 static const int BUCKETTYPE_L = 2;
00029 static const int PROTOSTATE_L = 2;
00030 static const int STEP_L = 8;
00031 static const int RIGHTSHIFTING_L = 1;
00032 static const int NODENUM_L = 8;
00033
00034
00035 #define BROOSEHANDLE_L (NODEHANDLE_L + FAILEDRESPONSES_L + RTT_L + LASTSEEN_L)
00036
00037 #define BUCKETCALL_L(msg) (BASECALL_L(msg) + INDEX_L + BUCKETTYPE_L + PROTOSTATE_L)
00038 #define BUCKETRESPONSE_L(msg) (BASERESPONSE_L(msg) + INDEX_L + BUCKETTYPE_L + PROTOSTATE_L \
00039 + NODENUM_L + msg->getNodesArraySize() * NODEHANDLE_L)
00040
00041 #define BROOSEPINGCALL_L(msg) PINGCALL_L(msg)
00042 #define BROOSEPINGRESPONSE_L(msg) PINGRESPONSE_L(msg)
00043
00044 #define BROOSEFINDNODEEXTMESSAGE_L (KEY_L + STEP_L + RIGHTSHIFTING_L + NODEHANDLE_L)
00045
00046
00047
00048
00049
00061 enum ServiceType {
00062 REQUEST = 0,
00063 RESPONSE = 1
00064 };
00065
00078 enum BucketType {
00079 RIGHT = 0,
00080 LEFT = 1,
00081 BROTHER = 2
00082 };
00083
00097 enum ProState {
00098 PINIT = 0,
00099 PRSET = 1,
00100 PBSET = 2,
00101 PREADY = 3
00102 };
00103
00115 class BucketCall : public BaseCallMessage
00116 {
00117 protected:
00118 int bucketType_var;
00119 int bucketIndex_var;
00120 int proState_var;
00121
00122
00123 bool operator==(const BucketCall&);
00124
00125 public:
00126 BucketCall(const char *name=NULL, int kind=0);
00127 BucketCall(const BucketCall& other);
00128 virtual ~BucketCall();
00129 BucketCall& operator=(const BucketCall& other);
00130 virtual BucketCall *dup() const {return new BucketCall(*this);}
00131 virtual void parsimPack(cCommBuffer *b);
00132 virtual void parsimUnpack(cCommBuffer *b);
00133
00134
00135 virtual int getBucketType() const;
00136 virtual void setBucketType(int bucketType_var);
00137 virtual int getBucketIndex() const;
00138 virtual void setBucketIndex(int bucketIndex_var);
00139 virtual int getProState() const;
00140 virtual void setProState(int proState_var);
00141 };
00142
00143 inline void doPacking(cCommBuffer *b, BucketCall& obj) {obj.parsimPack(b);}
00144 inline void doUnpacking(cCommBuffer *b, BucketCall& obj) {obj.parsimUnpack(b);}
00145
00160 class BucketResponse : public BaseResponseMessage
00161 {
00162 protected:
00163 int bucketType_var;
00164 int bucketIndex_var;
00165 int nodeNum_var;
00166 NodeHandle *nodes_var;
00167 unsigned int nodes_arraysize;
00168 int proState_var;
00169
00170
00171 bool operator==(const BucketResponse&);
00172
00173 public:
00174 BucketResponse(const char *name=NULL, int kind=0);
00175 BucketResponse(const BucketResponse& other);
00176 virtual ~BucketResponse();
00177 BucketResponse& operator=(const BucketResponse& other);
00178 virtual BucketResponse *dup() const {return new BucketResponse(*this);}
00179 virtual void parsimPack(cCommBuffer *b);
00180 virtual void parsimUnpack(cCommBuffer *b);
00181
00182
00183 virtual int getBucketType() const;
00184 virtual void setBucketType(int bucketType_var);
00185 virtual int getBucketIndex() const;
00186 virtual void setBucketIndex(int bucketIndex_var);
00187 virtual int getNodeNum() const;
00188 virtual void setNodeNum(int nodeNum_var);
00189 virtual void setNodesArraySize(unsigned int size);
00190 virtual unsigned int getNodesArraySize() const;
00191 virtual NodeHandle& getNodes(unsigned int k);
00192 virtual const NodeHandle& getNodes(unsigned int k) const {return const_cast<BucketResponse*>(this)->getNodes(k);}
00193 virtual void setNodes(unsigned int k, const NodeHandle& nodes_var);
00194 virtual int getProState() const;
00195 virtual void setProState(int proState_var);
00196 };
00197
00198 inline void doPacking(cCommBuffer *b, BucketResponse& obj) {obj.parsimPack(b);}
00199 inline void doUnpacking(cCommBuffer *b, BucketResponse& obj) {obj.parsimUnpack(b);}
00200
00209 class BroosePingCall : public BaseCallMessage
00210 {
00211 protected:
00212
00213
00214 bool operator==(const BroosePingCall&);
00215
00216 public:
00217 BroosePingCall(const char *name=NULL, int kind=0);
00218 BroosePingCall(const BroosePingCall& other);
00219 virtual ~BroosePingCall();
00220 BroosePingCall& operator=(const BroosePingCall& other);
00221 virtual BroosePingCall *dup() const {return new BroosePingCall(*this);}
00222 virtual void parsimPack(cCommBuffer *b);
00223 virtual void parsimUnpack(cCommBuffer *b);
00224
00225
00226 };
00227
00228 inline void doPacking(cCommBuffer *b, BroosePingCall& obj) {obj.parsimPack(b);}
00229 inline void doUnpacking(cCommBuffer *b, BroosePingCall& obj) {obj.parsimUnpack(b);}
00230
00239 class BroosePingResponse : public BaseResponseMessage
00240 {
00241 protected:
00242
00243
00244 bool operator==(const BroosePingResponse&);
00245
00246 public:
00247 BroosePingResponse(const char *name=NULL, int kind=0);
00248 BroosePingResponse(const BroosePingResponse& other);
00249 virtual ~BroosePingResponse();
00250 BroosePingResponse& operator=(const BroosePingResponse& other);
00251 virtual BroosePingResponse *dup() const {return new BroosePingResponse(*this);}
00252 virtual void parsimPack(cCommBuffer *b);
00253 virtual void parsimUnpack(cCommBuffer *b);
00254
00255
00256 };
00257
00258 inline void doPacking(cCommBuffer *b, BroosePingResponse& obj) {obj.parsimPack(b);}
00259 inline void doUnpacking(cCommBuffer *b, BroosePingResponse& obj) {obj.parsimUnpack(b);}
00260
00274 class BrooseFindNodeExtMessage : public cPacket
00275 {
00276 protected:
00277 OverlayKey routeKey_var;
00278 int step_var;
00279 bool rightShifting_var;
00280 NodeHandle lastNode_var;
00281 int length_var;
00282
00283
00284 bool operator==(const BrooseFindNodeExtMessage&);
00285
00286 public:
00287 BrooseFindNodeExtMessage(const char *name=NULL, int kind=0);
00288 BrooseFindNodeExtMessage(const BrooseFindNodeExtMessage& other);
00289 virtual ~BrooseFindNodeExtMessage();
00290 BrooseFindNodeExtMessage& operator=(const BrooseFindNodeExtMessage& other);
00291 virtual BrooseFindNodeExtMessage *dup() const {return new BrooseFindNodeExtMessage(*this);}
00292 virtual void parsimPack(cCommBuffer *b);
00293 virtual void parsimUnpack(cCommBuffer *b);
00294
00295
00296 virtual OverlayKey& getRouteKey();
00297 virtual const OverlayKey& getRouteKey() const {return const_cast<BrooseFindNodeExtMessage*>(this)->getRouteKey();}
00298 virtual void setRouteKey(const OverlayKey& routeKey_var);
00299 virtual int getStep() const;
00300 virtual void setStep(int step_var);
00301 virtual bool getRightShifting() const;
00302 virtual void setRightShifting(bool rightShifting_var);
00303 virtual NodeHandle& getLastNode();
00304 virtual const NodeHandle& getLastNode() const {return const_cast<BrooseFindNodeExtMessage*>(this)->getLastNode();}
00305 virtual void setLastNode(const NodeHandle& lastNode_var);
00306 virtual int getLength() const;
00307 virtual void setLength(int length_var);
00308 };
00309
00310 inline void doPacking(cCommBuffer *b, BrooseFindNodeExtMessage& obj) {obj.parsimPack(b);}
00311 inline void doUnpacking(cCommBuffer *b, BrooseFindNodeExtMessage& obj) {obj.parsimUnpack(b);}
00312
00313
00314 #endif // _BROOSEMESSAGE_M_H_