00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef __CHORD_MESSAGE_H
00040 #define __CHORD_MESSAGE_H
00041
00042 #include "ariba/utility/messages.h"
00043 #include "ariba/utility/serialization.h"
00044 #include "ariba/Identifiers.h"
00045
00046 using ariba::utility::Message;
00047
00048 namespace ariba {
00049 namespace overlay {
00050
00051 using_serialization
00052 ;
00053
00054 class ChordMessage: public Message { VSERIALIZEABLE
00055 public:
00056 enum type_ {
00057 invalid = 0,
00058 route = 1,
00059 discovery = 2,
00060 leave = 3,
00061 };
00062
00063 inline ChordMessage( const ChordMessage& msg ) {
00064 this->type = msg.type;
00065 this->hop_count = msg.hop_count;
00066 this->source = msg.source;
00067 this->destination = msg.destination;
00068 }
00069
00070 inline explicit ChordMessage(type_ type = invalid,
00071 const NodeID& source = NodeID::UNSPECIFIED,
00072 const NodeID& destination = NodeID::UNSPECIFIED) :
00073 type((uint8_t) type), source(source), destination(destination) {
00074 }
00075
00076 virtual ~ChordMessage();
00077
00078 inline uint8_t getHopCount() const {
00079 return hop_count;
00080 }
00081
00082 inline void setHopCount( uint8_t hop_count ) {
00083 this->hop_count = hop_count;
00084 }
00085
00086 inline type_ getType() const {
00087 return (type_) this->type;
00088 }
00089
00090 const NodeID& getSource() const {
00091 return source;
00092 }
00093
00094 inline const NodeID& getDestination() const {
00095 return destination;
00096 }
00097
00098 private:
00099 uint8_t type;
00100 uint8_t hop_count;
00101 NodeID source, destination;
00102 };
00103
00104 }}
00105
00106 sznBeginDefault( ariba::overlay::ChordMessage, X ){
00107 X && type && hop_count && &source && &destination && Payload();
00108 }sznEnd();
00109
00110 #endif // __CHORD_MESSAGE_H