Changeset 5870 for source/ariba/overlay/BaseOverlay.h
- Timestamp:
- Aug 11, 2009, 4:11:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/BaseOverlay.h
r5743 r5870 121 121 122 122 class LinkDescriptor; 123 class OverlayMsg; 123 124 124 125 class BaseOverlay: public MessageReceiver, … … 161 162 162 163 /// Tries to establish a direct or overlay link 163 const LinkID establishLink(const EndpointDescriptor& ep, 164 const NodeID& node, const ServiceID& service, 165 const NodeID& remoteRelay = NodeID::UNSPECIFIED, 166 const LinkID& linkid = LinkID::UNSPECIFIED); 164 const LinkID establishLink( const EndpointDescriptor& ep, 165 const NodeID& node, const ServiceID& service ); 167 166 168 167 /** … … 174 173 * @param linkid Link identifier to be used with this link 175 174 */ 176 const LinkID establishLink(const NodeID& node, const ServiceID& service, 177 const NodeID& remoteRelay = NodeID::UNSPECIFIED, 178 const LinkID& linkid = LinkID::UNSPECIFIED); 175 const LinkID establishLink( const NodeID& remote, 176 const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID ); 179 177 180 178 /** … … 182 180 * endpoint and to the specified service 183 181 */ 184 const LinkID establishDirectLink( const EndpointDescriptor& ep,185 const ServiceID& service , const LinkID& linkid = LinkID::UNSPECIFIED);182 const LinkID establishDirectLink( const EndpointDescriptor& endpoint, 183 const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID ); 186 184 187 185 /// drops a link 188 void dropLink( const LinkID& link);186 void dropLink( const LinkID& link ); 189 187 190 188 /// sends a message over an existing link 191 seqnum_t sendMessage(const Message* message, const LinkID& link );189 seqnum_t sendMessage(const Message* message, const LinkID& link ); 192 190 193 191 /// sends a message to a node and a specific service 194 seqnum_t sendMessage(const Message* message, const NodeID& node,195 const ServiceID& service );192 seqnum_t sendMessage(const Message* message, const NodeID& remote, 193 const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID); 196 194 197 195 /** … … 207 205 * @return The end-point descriptor of the link's end-point 208 206 */ 209 const EndpointDescriptor& getEndpointDescriptor( const LinkID& link =210 207 const EndpointDescriptor& getEndpointDescriptor( 208 const LinkID& link = LinkID::UNSPECIFIED) const; 211 209 212 210 /** … … 332 330 * the node the message came from! 333 331 */ 334 virtual bool receiveMessage(const Message* message, const LinkID& link, 335 const NodeID& source = NodeID::UNSPECIFIED); 332 virtual bool receiveMessage( const Message* message, const LinkID& link, 333 const NodeID& ); 334 335 /** 336 * This method is called, when a new node joined the network 337 * 338 * @see OverlayStructureEvents.h 339 */ 340 virtual void onNodeJoin(const NodeID& node); 341 342 /** 343 * Timer Event method 344 */ 345 virtual void eventFunction(); 336 346 337 347 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 348 339 /// handles an incoming message with link descriptor340 bool handleMessage(const Message* message,341 const LinkID& boLink, const LinkID& bcLink, const NodeID& remoteNode );342 343 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~344 /**345 * This method is called, when a routed message arrives from the346 * overlay.347 *348 * @see OverlayStructureEvents.h349 */350 virtual void incomingRouteMessage(Message* msg,351 const LinkID& link = LinkID::UNSPECIFIED,352 const NodeID& source = NodeID::UNSPECIFIED);353 354 /**355 * This method is called, when a new node joined the network356 *357 * @see OverlayStructureEvents.h358 */359 virtual void onNodeJoin(const NodeID& node);360 361 /**362 * Timer Event method363 */364 virtual void eventFunction();365 349 366 350 private: 351 /// is the base overlay started yet 352 bool started; 367 353 368 354 /// The state of the BaseOverlay … … 372 358 } BaseOverlayState; 373 359 374 BaseOverlayState state; 375 BaseCommunication* bc; 376 NodeID nodeId; 377 SpoVNetID spovnetId; 378 vector<LinkID> bootstrapLinks; 379 NodeID spovnetInitiator; 360 BaseOverlayState state; ///< Current Base-Overlay state 361 BaseCommunication* bc; ///< reference to the base communication 362 NodeID nodeId; ///< the node id of this node 363 SpoVNetID spovnetId; ///< the spovnet id of the currently joined overlay 364 vector<LinkID> bootstrapLinks; ///< the link id of the link to the initiator node 365 NodeID spovnetInitiator; ///< The initiator node 380 366 381 367 /// the service id communication listeners 382 368 Demultiplexer<CommunicationListener*, ServiceID> communicationListeners; 369 CommunicationListener* getListener( const ServiceID& id ); 383 370 384 371 /// the node listeners … … 392 379 OverlayInterface* overlayInterface; 393 380 381 /// Bootstrapper for our spovnet 382 OverlayBootstrap overlayBootstrap; 383 384 // message handlers -------------------------------------------------------- 385 386 /// demultiplexes a incoming message with link descriptor 387 bool handleMessage( const Message* message, LinkDescriptor* ld, 388 const LinkID bcLink = LinkID::UNSPECIFIED ); 389 390 // handle data and signalling messages 391 bool handleData( OverlayMsg* msg, LinkDescriptor* ld ); 392 bool handleSignaling( OverlayMsg* msg, LinkDescriptor* ld ); 393 394 // handle join request / reply messages 395 bool handleJoinRequest( OverlayMsg* msg, const LinkID& bcLink ); 396 bool handleJoinReply( OverlayMsg* msg, const LinkID& bcLink ); 397 398 // handle link messages 399 bool handleLinkRequest( OverlayMsg* msg, LinkDescriptor* ld ); 400 bool handleLinkReply( OverlayMsg* msg, LinkDescriptor* ld ); 401 bool handleLinkUpdate( OverlayMsg* msg, LinkDescriptor* ld ); 402 bool handleLinkDirect( OverlayMsg* msg, LinkDescriptor* ld ); 403 bool handleLinkAlive( OverlayMsg* msg, LinkDescriptor* ld ); 404 405 // link state handling ----------------------------------------------------- 406 407 /// link state information counter 408 int counter; 409 394 410 /// The link mapping of the node 395 411 vector<LinkDescriptor*> links; 412 413 /// erases a link descriptor 396 414 void eraseDescriptor(const LinkID& link, bool communication = false); 397 415 … … 410 428 LinkDescriptor* addDescriptor(const LinkID& link = LinkID::UNSPECIFIED); 411 429 412 /// returns a direct link relay descriptor to the given relay node 413 LinkDescriptor* getRelayDescriptor( const NodeID& remoteNode ); 414 415 /// returns the local relay node to a given remote node 416 NodeID getRelayNode( const NodeID& remoteNode ); 417 418 /// returns the direct link the message to a neighbor is send to 419 LinkDescriptor* getSendDescriptor( const NodeID& nodeid, bool follow = true ); 420 421 /// routes a message over the overlay or directly sends it when a link is open 422 seqnum_t sendOverlay( Message* message, const NodeID& nodeid, 423 const NodeID& remoteRelay = NodeID::UNSPECIFIED ); 424 425 /// forwards a message over relays/overlay/directly using link descriptor 426 seqnum_t sendMessage( Message* message, const LinkDescriptor* ld ); 427 428 /// creates a link descriptor, applys relay semantics if possible 429 LinkDescriptor* createLinkDescriptor( 430 const NodeID remoteNode, const ServiceID service, const LinkID link_id ); 431 432 // map of a link request map a nonce to a LinkID 433 typedef map<const uint32_t, LinkID> PendingLinkMap; 434 PendingLinkMap pendingLinks; 435 436 void showLinkState(); 430 /// stabilizes link information 431 void stabilizeLinks(); 432 433 /// print the currently known links 434 void showLinks(); 435 436 // relay route management -------------------------------------------------- 437 438 /// relay route definitions 439 class relay_route { 440 public: 441 NodeID node; 442 LinkID link; 443 uint8_t hops; 444 time_t used; 445 }; 446 vector<relay_route> relay_routes; 447 448 /// stabilize relay information 449 void stabilizeRelays(); 450 451 /// refreshes relay information 452 void refreshRelayInformation( const OverlayMsg* message, LinkDescriptor* ld ); 453 454 /// returns a known relay link 455 LinkDescriptor* getRelayLinkTo( const NodeID& remote ); 456 457 /// removes relay link information 458 void removeRelayLink( const LinkID& link ); 459 460 /// removes relay node information 461 void removeRelayNode( const NodeID& link ); 462 463 // internal message delivery ----------------------------------------------- 464 465 /// routes a message to its destination node 466 void route( OverlayMsg* message, LinkDescriptor* incomingLink ); 467 468 /// sends a raw message to another node, delivers it to the base overlay class 469 seqnum_t send( OverlayMsg* message, const NodeID& destination ); 470 471 /// send a raw message using a link descriptor, delivers it to the base overlay class 472 seqnum_t send( OverlayMsg* message, LinkDescriptor* ld, 473 bool ignore_down = false ); 474 475 /// send a message using a node id using overlay routing 476 /// sets necessary fields in the overlay message! 477 seqnum_t send_node( OverlayMsg* message, const NodeID& remote, 478 const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID); 479 480 /// send a message using a node id using overlay routing using a link 481 /// sets necessary fields in the overlay message! 482 seqnum_t send_link( OverlayMsg* message, const LinkID& link, 483 bool ignore_down = false ); 484 485 // misc -------------------------------------------------------------------- 437 486 438 487 /** … … 442 491 typedef vector<NodeID> JoiningNodes; 443 492 JoiningNodes joiningNodes; 444 445 int counter;446 447 /**448 * Bootstrapper for our spovnet449 */450 OverlayBootstrap overlayBootstrap;451 452 /// is the base overlay started yet453 bool started;454 493 }; 455 494
Note:
See TracChangeset
for help on using the changeset viewer.