Changeset 5151 for source/ariba/overlay/messages
- Timestamp:
- Jul 21, 2009, 1:54:55 PM (15 years ago)
- Location:
- source/ariba/overlay/messages
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/messages/JoinReply.h
r3690 r5151 85 85 86 86 sznBeginDefault( ariba::overlay::JoinReply, X ) { 87 X && &spovnetid && param && bootstrapEp && joinAllowed && cI(0,7); 87 uint8_t ja = joinAllowed; 88 X && &spovnetid && param && &bootstrapEp && ja; 89 if (X.isDeserializer()) joinAllowed = ja; 88 90 } sznEnd(); 89 91 -
source/ariba/overlay/messages/LinkRequest.cpp
r3690 r5151 7 7 vsznDefault(LinkRequest); 8 8 9 LinkRequest::LinkRequest() {10 11 }12 13 LinkRequest::LinkRequest( uint32_t nonce, const EndpointDescriptor* endpoint, bool reply ) :14 flags(reply&1), nonce(nonce), endpoint(endpoint) {15 }16 17 9 LinkRequest::~LinkRequest() { 18 10 } -
source/ariba/overlay/messages/LinkRequest.h
r4625 r5151 27 27 uint32_t nonce; 28 28 const EndpointDescriptor* endpoint; 29 LinkID remoteLinkId; 30 NodeID relay; 29 31 30 32 public: 31 LinkRequest(); 33 LinkRequest() { 34 35 } 32 36 33 37 LinkRequest( uint32_t nonce, const EndpointDescriptor* endpoint, 34 bool reply = false ); 38 bool reply = false, const LinkID& remoteLinkId = LinkID::UNSPECIFIED, 39 const NodeID& relay = NodeID::UNSPECIFIED ) : 40 flags(reply&1), nonce(nonce), endpoint(endpoint), remoteLinkId(remoteLinkId), relay(relay) { 41 } 35 42 36 43 virtual ~LinkRequest(); … … 38 45 const EndpointDescriptor* getEndpoint() const { 39 46 return endpoint; 47 } 48 49 const LinkID& getRemoteLinkId() const { 50 return remoteLinkId; 51 } 52 53 const NodeID& getRelay() const { 54 return relay; 40 55 } 41 56 … … 53 68 sznBeginDefault( ariba::overlay::LinkRequest, X ) { 54 69 if (X.isDeserializer()) endpoint = new EndpointDescriptor(); 55 X && flags && nonce && reinterpret_cast<VSerializeable*>(const_cast<EndpointDescriptor*>(endpoint)); 70 X && flags && nonce; 71 X && const_cast<EndpointDescriptor*>(endpoint); 72 X && &relay && &remoteLinkId; 56 73 } sznEnd(); 57 74 -
source/ariba/overlay/messages/OverlayMsg.cpp
r3690 r5151 44 44 vsznDefault(OverlayMsg); 45 45 46 OverlayMsg::OverlayMsg(OverlayMessageType _type, const ServiceID _service, const NodeID _sourceNode)47 : type( (uint8_t)_type), service( _service ), sourceNode( _sourceNode ) {48 }49 50 OverlayMsg::OverlayMsg(OverlayMessageType _type, const NodeID _sourceNode)51 : type( (uint8_t)_type), service( ServiceID::UNSPECIFIED ), sourceNode( _sourceNode ){52 }53 54 46 OverlayMsg::~OverlayMsg(){ 55 47 } 56 48 57 OverlayMsg::OverlayMessageType OverlayMsg::getType(){58 return (OverlayMessageType)type;59 }60 61 const ServiceID& OverlayMsg::getService(){62 return service;63 }64 65 bool OverlayMsg::isType(OverlayMessageType _type){66 return (OverlayMessageType)type == _type;67 }68 69 const NodeID& OverlayMsg::getSourceNode(){70 return sourceNode;71 }72 73 49 }} // ariba::overlay -
source/ariba/overlay/messages/OverlayMsg.h
r4625 r5151 55 55 namespace overlay { 56 56 57 using_serialization; 57 using_serialization 58 ; 58 59 59 class OverlayMsg : public Message { 60 VSERIALIZEABLE; 60 class OverlayMsg: public Message { 61 VSERIALIZEABLE 62 ; 61 63 public: 62 64 63 typedef enum _OverlayMessageType { 64 OverlayMessageTypeInvalid = 0, // invalid type (no encapsulated messages) 65 OverlayMessageTypeData = 1, // message contains data for higher layers 66 OverlayMessageTypeJoinRequest = 2, // spovnet join request 67 OverlayMessageTypeJoinReply = 3, // spovnet join reply 68 OverlayMessageTypeUpdate = 4, // update message for link association 69 OverlayMessageTypeBye = 5, // spovnet leave (no encapsulated messages) 70 OverlayMessageTypeLinkRequest = 6, // link request (sent over the overlay) 71 } OverlayMessageType; 65 /// (payload-) message types 66 enum type_ { 67 typeInvalid = 0, ///< invalid type (no encapsulated messages) 68 typeData = 1, ///< message contains data for higher layers 69 typeJoinRequest = 2, ///< join request 70 typeJoinReply = 3, ///< join reply 71 typeUpdate = 4, ///< update message for link association 72 typeBye = 5, ///< leave (no encapsulated messages) 73 typeLinkRequest = 6, ///< link request (sent over the overlay) 74 typeRelay = 7, ///< relay message 75 typeKeepAlive = 8, ///< a keep-alive message 76 typeDirectLink = 9, 77 ///< a direct connection has been established 78 }; 72 79 73 OverlayMsg( 74 OverlayMessageType _type = OverlayMessageTypeInvalid, 75 const ServiceID _service = ServiceID::UNSPECIFIED, 76 const NodeID _sourceNode = NodeID::UNSPECIFIED 77 ); 80 /// default constructor 81 OverlayMsg(type_ type = typeInvalid, const ServiceID _service = 82 ServiceID::UNSPECIFIED, const NodeID _sourceNode = 83 NodeID::UNSPECIFIED) : 84 type((uint8_t) type), service(_service), sourceNode(_sourceNode), 85 relayLink(LinkID::UNSPECIFIED), autoLink(false) { 86 } 78 87 79 OverlayMsg( 80 OverlayMessageType _type,81 const NodeID _sourceNode82 );88 OverlayMsg(const OverlayMsg& rhs) : 89 type(rhs.type), service(rhs.service), sourceNode(rhs.sourceNode), 90 relayLink(rhs.relayLink), autoLink(rhs.autoLink) { 91 } 83 92 84 virtual ~OverlayMsg(); 93 /// type and source node constructor 94 OverlayMsg(type_ type, const NodeID _sourceNode) : 95 type((uint8_t) type), service(ServiceID::UNSPECIFIED), sourceNode( 96 _sourceNode), relayLink(LinkID::UNSPECIFIED), autoLink(false) { 97 } 85 98 86 bool isType(OverlayMessageType _type); 87 OverlayMessageType getType(); 88 const ServiceID& getService(); 89 const NodeID& getSourceNode(); 99 /// destructor 100 ~OverlayMsg(); 90 101 102 type_ getType() const { 103 return (type_) type; 104 } 105 106 const ServiceID& getService() const { 107 return service; 108 } 109 110 const NodeID& getSourceNode() const { 111 return sourceNode; 112 } 113 114 const LinkID& getRelayLink() const { 115 return relayLink; 116 } 117 118 void setRelayLink(const LinkID& relayLink) { 119 this->relayLink = relayLink; 120 } 121 122 const bool isAutoLink() const { 123 return autoLink; 124 } 125 126 void setAutoLink(bool autoLink) { 127 this->autoLink = autoLink; 128 } 91 129 private: 92 130 uint8_t type; 93 131 ServiceID service; 94 132 NodeID sourceNode; 133 LinkID relayLink; 134 uint8_t autoLink; 95 135 }; 96 136 97 }} // ariba::overlay 137 } 138 } // ariba::overlay 98 139 99 sznBeginDefault( ariba::overlay::OverlayMsg, X ) { 100 X && type && &service && &sourceNode && Payload(); 101 } sznEnd(); 140 sznBeginDefault( ariba::overlay::OverlayMsg, X ){ 141 X && type && &service && &sourceNode; 142 if (type == typeDirectLink) X && &relayLink; 143 if (type == typeUpdate) X && autoLink; 144 X && Payload(); 145 }sznEnd(); 102 146 103 147 #endif // OVERLAY_MSG_H__
Note:
See TracChangeset
for help on using the changeset viewer.