Changeset 5870 for source/ariba/overlay/modules/chord/messages
- Timestamp:
- Aug 11, 2009, 4:11:02 PM (15 years ago)
- Location:
- source/ariba/overlay/modules/chord/messages
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/modules/chord/messages/Discovery.cpp
r5681 r5870 44 44 vsznDefault(Discovery); 45 45 46 Discovery::Discovery(){47 }48 49 46 Discovery::~Discovery(){ 50 47 } -
source/ariba/overlay/modules/chord/messages/Discovery.h
r5744 r5870 41 41 42 42 #include <vector> 43 43 44 #include "ariba/utility/messages.h" 44 45 #include "ariba/utility/serialization.h" … … 61 62 VSERIALIZEABLE; 62 63 public: 63 enum follow_type_ { 64 normal = 0, 65 successor = 1, 66 predecessor = 2 64 enum type_ { 65 invalid = 0, 66 normal = 1, 67 successor = 2, 68 predecessor = 3 67 69 }; 68 70 69 Discovery( const Discovery& msg ) { 70 this->follow_type = msg.follow_type; 71 this->ttl = msg.ttl; 72 this->source_relay = msg.source_relay; 73 this->source_endpoint = msg.source_endpoint; 71 Discovery( const Discovery& msg ) : type(msg.type), ttl(msg.ttl), 72 endpoint(msg.endpoint) { 74 73 } 75 explicit Discovery(); 74 Discovery( type_ type = invalid, uint8_t ttl = 4, 75 const EndpointDescriptor& endpoint = EndpointDescriptor::UNSPECIFIED() ) 76 : type(type), ttl(ttl), endpoint(endpoint) { 77 } 76 78 virtual ~Discovery(); 77 79 78 const EndpointDescriptor* getSourceEndpoint() const {79 return &source_endpoint;80 inline type_ getType() const { 81 return (type_)type; 80 82 } 81 83 82 void setSourceEndpoint( const EndpointDescriptor* endpoint) {83 source_endpoint = *endpoint;84 inline void setType( type_ type ) { 85 this->type = type; 84 86 } 85 87 … … 92 94 } 93 95 94 inline follow_type_ getFollowType() const {95 return (follow_type_)follow_type;96 inline const EndpointDescriptor& getEndpoint() const { 97 return endpoint; 96 98 } 97 99 98 inline void set FollowType( follow_type_ type) {99 follow_type = (uint8_t)type;100 inline void setEndpoint( const EndpointDescriptor& endpoint ) { 101 this->endpoint = endpoint; 100 102 } 101 103 102 inline void setSourceRelay( const NodeID& relay ) {103 source_relay = relay;104 }105 106 inline const NodeID& getSourceRelay() const {107 return source_relay;108 }109 104 private: 110 uint8_t follow_type;105 uint8_t type; 111 106 uint8_t ttl; 112 EndpointDescriptor source_endpoint; 113 NodeID source_relay; 107 EndpointDescriptor endpoint; 114 108 }; 115 109 … … 117 111 118 112 sznBeginDefault( ariba::overlay::Discovery, X ) { 119 /// serialize follow-type and time-to-live 120 X && follow_type && ttl; 121 122 // serialize end-point 123 X && &source_relay && source_endpoint; 113 X && type && ttl && endpoint; 124 114 } sznEnd(); 125 115
Note:
See TracChangeset
for help on using the changeset viewer.