Changeset 3374 for source/ariba/overlay/BaseOverlay.cpp
- Timestamp:
- May 7, 2009, 4:51:31 PM (16 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.