Changeset 9684 for source/ariba/communication
- Timestamp:
- Mar 22, 2011, 4:05:57 PM (14 years ago)
- Location:
- source/ariba/communication
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/communication/BaseCommunication.h
r6941 r9684 131 131 132 132 /// Establishes a link to another end-point. 133 const LinkID establishLink(const EndpointDescriptor& descriptor, 134 const LinkID& linkid = LinkID::UNSPECIFIED, const QoSParameterSet& qos = 135 QoSParameterSet::DEFAULT, const SecurityParameterSet& sec = 136 SecurityParameterSet::DEFAULT); 133 const LinkID establishLink(const EndpointDescriptor& descriptor ); 137 134 138 135 /// Drops a link 139 void dropLink( const LinkID link);136 void dropLink( LinkID link ); 140 137 141 138 /** … … 146 143 * @return A sequence number for this message 147 144 */ 148 seqnum_t sendMessage( const LinkID lid, const Message* message);145 seqnum_t sendMessage( LinkID lid, const Message* message ); 149 146 150 147 /** … … 154 151 * @return The end-point descriptor of the link's end-point 155 152 */ 156 const EndpointDescriptor& getEndpointDescriptor( const LinkID link =157 LinkID ::UNSPECIFIED) const;153 const EndpointDescriptor& getEndpointDescriptor( 154 LinkID link = LinkID::UNSPECIFIED) const; 158 155 159 156 /** … … 212 209 class LinkDescriptor { 213 210 public: 214 215 211 /// default constructor 216 LinkDescriptor() : 217 localLink(LinkID::UNSPECIFIED), localLocator(NULL), 218 remoteLink(LinkID::UNSPECIFIED), remoteLocator(NULL), 219 up(false) { 220 } 212 LinkDescriptor() : up(false), id(), localLocator(NULL), remoteLocator(NULL) {} 221 213 222 214 ~LinkDescriptor() { … … 226 218 227 219 bool isUnspecified() const { 228 return (this == &UNSPECIFIED());220 return id.isUnspecified(); 229 221 } 230 222 231 static LinkDescriptor& UNSPECIFIED(){ 232 static LinkDescriptor* unspec = NULL; 233 if(unspec == NULL) unspec = new LinkDescriptor(); 234 return *unspec; 235 } 236 237 bool unspecified; 238 239 /// link identifiers 240 LinkID localLink; 223 /// flag, whether this link is up 224 bool up; 225 226 /// link identifier 227 LinkID id; 228 229 /// locators 241 230 const address_v* localLocator; 242 243 /// used underlay addresses for the link244 LinkID remoteLink;245 231 const address_v* remoteLocator; 246 232 247 233 /// the remote end-point descriptor 248 234 EndpointDescriptor remoteEndpoint; 249 250 /// flag, whether this link is up251 bool up;252 235 }; 253 236 … … 259 242 260 243 /// Link management: add a link 261 void addLink( LinkDescriptor*link );244 LinkDescriptor& addLink( LinkID link ); 262 245 263 246 /// Link management: remove a link 264 void removeLink( const LinkID& localLink);247 void removeLink( LinkID link); 265 248 266 249 /// Link management: get link information using the local link 267 LinkDescriptor& queryLocalLink(const LinkID& localLink) const; 268 269 /// Link management: get link information using the remote link 270 LinkDescriptor& queryRemoteLink(const LinkID& remoteLink) const; 250 LinkDescriptor& queryLink( LinkID link) const; 271 251 272 252 /// The local end-point descriptor … … 307 287 /// convenience: send message to peer 308 288 void send( Message* message, const EndpointDescriptor& endpoint ); 289 309 290 void send( Message* message, const LinkDescriptor& descriptor ); 310 291 311 292 /// state of the base communication 312 293 bool started; 313 314 294 }; 315 295 -
source/ariba/communication/messages/AribaBaseMsg.cpp
r6919 r9684 44 44 vsznDefault(AribaBaseMsg); 45 45 46 AribaBaseMsg::AribaBaseMsg( type_ _type, 47 const LinkID& localLink, const LinkID& remoteLink ) : 48 type((uint8_t)_type), 49 localLink(localLink),remoteLink(remoteLink) { 46 AribaBaseMsg::AribaBaseMsg( type_ _type, LinkID link ) : 47 type((uint8_t)_type), link(link){ 50 48 } 51 49 -
source/ariba/communication/messages/AribaBaseMsg.h
r5284 r9684 41 41 42 42 #include <string> 43 #include <boost/cstdint.hpp> 43 #include <stdint.h> 44 44 45 #include "ariba/utility/messages.h" 45 46 #include "ariba/utility/serialization.h" 47 46 48 #include "ariba/utility/types/LinkID.h" 47 49 #include "ariba/utility/types/Address.h" … … 72 74 }; 73 75 74 AribaBaseMsg( type_ type = typeData, 75 const LinkID& localLink = LinkID::UNSPECIFIED, 76 const LinkID& remoteLink = LinkID::UNSPECIFIED ); 77 76 AribaBaseMsg( type_ type = typeData, LinkID link = LinkID::UNSPECIFIED ); 78 77 virtual ~AribaBaseMsg(); 79 78 … … 84 83 } 85 84 86 const LinkID& getLocalLink() const { 87 return localLink; 88 } 89 90 const LinkID& getRemoteLink() const { 91 return remoteLink; 85 const LinkID& getLink() const { 86 return link; 92 87 } 93 88 … … 101 96 102 97 private: 103 uint8_t type; // the link message type 98 // link message type 99 uint8_t type; 104 100 105 // remote and local link ids 106 LinkID localLink; // the local link id 107 LinkID remoteLink; // the remote link id 101 // link identifier 102 LinkID link; 108 103 109 // remote and local endpoint descriptors 104 // remote and local endpoint descriptors (link reply/request only) 110 105 EndpointDescriptor localDescriptor; 111 106 EndpointDescriptor remoteDescriptor; … … 115 110 116 111 sznBeginDefault( ariba::communication::AribaBaseMsg, X ) { 117 X && type && &localLink && &remoteLink;118 if (type == typeLinkReply || type == typeLinkRequest) 112 X && type && link; 113 if (type == typeLinkReply || type == typeLinkRequest) { 119 114 X && localDescriptor && remoteDescriptor; 115 } 120 116 X && Payload(); 121 117 } sznEnd();
Note:
See TracChangeset
for help on using the changeset viewer.