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