Changeset 3374 for source/ariba/overlay
- Timestamp:
- May 7, 2009, 4:51:31 PM (16 years ago)
- Location:
- source/ariba/overlay
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/BaseOverlay.cpp
r3071 r3374 42 42 #include "ariba/NodeListener.h" 43 43 #include "ariba/CommunicationListener.h" 44 #include "ariba/SideportListener.h" 44 45 45 46 namespace ariba { … … 49 50 50 51 BaseOverlay::BaseOverlay() 51 : bc(NULL), overlayInterface(NULL), 52 nodeId(NodeID::UNSPECIFIED), spovnetId(SpoVNetID::UNSPECIFIED),53 initiatorLink(LinkID::UNSPECIFIED), state(BaseOverlayStateInvalid){52 : bc(NULL), overlayInterface(NULL), nodeId(NodeID::UNSPECIFIED), 53 spovnetId(SpoVNetID::UNSPECIFIED), initiatorLink(LinkID::UNSPECIFIED), 54 state(BaseOverlayStateInvalid), sideport(&SideportListener::DEFAULT){ 54 55 } 55 56 … … 230 231 231 232 CommunicationListener* receiver = communicationListeners.get( service ); 233 assert( receiver != NULL ); 234 232 235 LinkItem item (link, NodeID::UNSPECIFIED, service, receiver); 233 236 linkMapping.insert( make_pair(link, item) ); … … 251 254 bc->dropLink( link ); 252 255 253 i f( item.interface != NULL )254 item.interface->onLinkDown( link, item.node);256 item.interface->onLinkDown( link, item.node ); 257 sideport->onLinkDown(link, this->nodeId, item.node, this->spovnetId ); 255 258 } 256 259 … … 352 355 communicationListeners.registerItem( listener, sid ); 353 356 return true; 357 } 358 359 bool BaseOverlay::registerSidePort(SideportListener* _sideport){ 360 sideport = _sideport; 361 _sideport->configure( this ); 362 } 363 364 bool BaseOverlay::unregisterSidePort(SideportListener* _sideport){ 365 sideport = &SideportListener::DEFAULT; 354 366 } 355 367 … … 442 454 if( i == linkMapping.end() ){ 443 455 444 LinkItem item (id, NodeID::UNSPECIFIED, ServiceID::UNSPECIFIED, NULL);456 LinkItem item (id, NodeID::UNSPECIFIED, ServiceID::UNSPECIFIED, &CommunicationListener::DEFAULT ); 445 457 linkMapping.insert( make_pair(id, item) ); 446 458 … … 487 499 } 488 500 489 i f( i->second.interface != NULL )490 i->second.interface->onLinkDown( id, i->second.node);501 i->second.interface->onLinkDown( id, i->second.node ); 502 sideport->onLinkDown( id, this->nodeId, i->second.node, this->spovnetId ); 491 503 492 504 linkMapping.erase( i ); … … 504 516 if( i == linkMapping.end() ) return; 505 517 506 i f( i->second.interface != NULL ){507 i->second.interface->onLinkChanged( id, i->second.node);508 // call onLinkQoSChanged? 509 }518 i->second.interface->onLinkChanged( id, i->second.node ); 519 sideport->onLinkChanged( id, this->nodeId, i->second.node, this->spovnetId ); 520 521 // TODO call onLinkQoSChanged? 510 522 511 523 i->second.markused(); … … 523 535 if( i == linkMapping.end() ) return; 524 536 525 i f( i->second.interface != NULL )526 i->second.interface->onLinkFail( id, i->second.node);537 i->second.interface->onLinkFail( id, i->second.node ); 538 sideport->onLinkFail( id, this->nodeId, i->second.node, this->spovnetId ); 527 539 528 540 i->second.markused(); … … 541 553 542 554 // TODO: convert QoSParameterSet to the LinkProperties properties 543 if( i->second.interface != NULL ){ 544 // TODO: currently not in the interface: i->second.interface->onLinkQoSChanged( id, i->second.node, LinkProperties::DEFAULT ); 545 } 555 // TODO: currently not in the interface: i->second.interface->onLinkQoSChanged( id, i->second.node, LinkProperties::DEFAULT ); 546 556 547 557 i->second.markused(); … … 799 809 800 810 CommunicationListener* iface = communicationListeners.get( service ); 801 if( iface == NULL ){811 if( iface == NULL || iface == &CommunicationListener::DEFAULT ){ 802 812 logging_warn( "linkup event for service that has been registered with a NULL interface" ); 803 813 return true; … … 812 822 813 823 if( iface->onLinkRequest(sourcenode) ){ 824 825 // call the notification functions 814 826 iface->onLinkUp( link, sourcenode ); 827 sideport->onLinkUp( link, nodeId, sourcenode, this->spovnetId ); 828 815 829 } else { 816 830 // prevent onLinkDown calls to the service 817 i->second.interface = NULL;831 i->second.interface = &CommunicationListener::DEFAULT; 818 832 // drop the link 819 833 dropLink( link ); … … 950 964 } 951 965 966 vector<LinkID> BaseOverlay::getLinkIDs( const NodeID& nid ) const { 967 968 vector<LinkID> linkvector; 969 970 BOOST_FOREACH( LinkPair item, linkMapping ){ 971 if( item.second.node == nid || nid == NodeID::UNSPECIFIED ){ 972 linkvector.push_back( item.second.link ); 973 } 974 } 975 976 return linkvector; 977 } 978 952 979 void BaseOverlay::incomingRouteMessage(Message* msg){ 953 980 // gets handled as normal data message -
source/ariba/overlay/BaseOverlay.h
r3071 r3374 70 70 class NodeListener; 71 71 class CommunicationListener; 72 class SideportListener; 72 73 namespace utility { 73 74 class OvlVis; … … 220 221 221 222 /** 223 * TODO 224 */ 225 bool registerSidePort(SideportListener* _sideport); 226 227 /** 228 * TODO 229 */ 230 bool unregisterSidePort(SideportListener* _sideport); 231 232 /** 222 233 * Returns the own nodeID or the NodeID of the specified link 223 234 * … … 226 237 */ 227 238 const NodeID& getNodeID( const LinkID& lid = LinkID::UNSPECIFIED ) const ; 239 240 /** 241 * Return all Links for the specified remote nodeid, or all links when 242 * the node id given is set to unspecified 243 * 244 * @param nid The node id to request links for, or unspecified for all links 245 * @return a vector that contains all the link ids requested 246 */ 247 vector<LinkID> getLinkIDs( const NodeID& nid = NodeID::UNSPECIFIED ) const; 228 248 229 249 /** … … 342 362 343 363 /** 364 * TODO 365 */ 366 SideportListener* sideport; 367 368 /** 344 369 * The abstract overlay interface that implements 345 370 * the overlay specific functionality. … … 387 412 static const LinkItem UNSPECIFIED; 388 413 414 LinkItem() 415 : link(LinkID::UNSPECIFIED), node(NodeID::UNSPECIFIED), 416 service(ServiceID::UNSPECIFIED), interface(&CommunicationListener::DEFAULT), 417 autolink(false), lastuse(0){ 418 } 419 389 420 LinkItem( const LinkID& _link, const NodeID& _node, 390 421 const ServiceID& _service, CommunicationListener* _interface ) 391 422 : link( _link ), node( _node ), service( _service ), interface( _interface ), 392 423 autolink( false ), lastuse( time(NULL) ) { 424 425 assert( _interface != NULL ); 393 426 } 394 427
Note:
See TracChangeset
for help on using the changeset viewer.