Changeset 3374
- Timestamp:
- May 7, 2009, 4:51:31 PM (16 years ago)
- Location:
- source/ariba
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/AribaModule.cpp
r3037 r3374 44 44 45 45 // ariba includes 46 #include "ariba/SideportListener.h" 46 47 #include "ariba/utility/misc/Helper.h" 47 48 #include "ariba/utility/misc/StringFormat.h" … … 56 57 namespace ariba { 57 58 58 AribaModule::AribaModule() { 59 AribaModule::AribaModule() 60 : base_comm(NULL), sideport_sniffer(NULL), 61 ip_addr(NULL), started(false) { 59 62 60 63 // init with default values 61 this->base_comm = NULL; 62 this->ip_addr = NULL; 64 63 65 this->tcp_port = 41402; 64 66 this->udp_port = 41402; 65 this->started = false;66 67 } 67 68 … … 145 146 } 146 147 148 void AribaModule::registerSideportListener(SideportListener* sideport){ 149 sideport_sniffer = sideport; 150 } 151 147 152 // @see Module.h 148 153 void AribaModule::initialize() { -
source/ariba/AribaModule.h
r3055 r3374 44 44 #include <boost/foreach.hpp> 45 45 46 // usings47 46 using std::vector; 48 47 using std::string; … … 50 49 // forward declaration 51 50 namespace ariba { 52 class AribaModule; 51 class AribaModule; 52 class SideportListener; 53 53 } 54 54 … … 59 59 namespace ariba { 60 60 61 // forward declarations of old interface62 61 namespace communication { 63 62 class EndpointDescriptor; … … 119 118 void addBootstrapHints(string bootinfo); 120 119 120 /** 121 * Register a sideport for sniffing on communication events 122 * and get advanced information. The sniffer is attached to 123 * every node that is created on the module. Only one such 124 * sniffer can be active system-wide, a new call to this 125 * register function will only attach the sniffer to nodes 126 * created after the registration call. 127 * 128 * @param sideport The SideportListener to integrate 129 */ 130 void registerSideportListener(SideportListener* sideport); 131 121 132 // --- module implementation --- 122 133 … … 185 196 186 197 communication::BaseCommunication* base_comm; 198 SideportListener* sideport_sniffer; 187 199 188 200 // TODO: use "abstract" representations here! -
source/ariba/CommunicationListener.cpp
r3071 r3374 41 41 namespace ariba { 42 42 43 CommunicationListener CommunicationListener::DEFAULT; 44 43 45 CommunicationListener::CommunicationListener() { 44 46 } … … 68 70 } 69 71 72 bool CommunicationListener::onEnableSideportListener() { 73 return true; 74 } 75 70 76 // --- extended message functionality --- 71 77 //void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r, -
source/ariba/CommunicationListener.h
r3071 r3374 56 56 */ 57 57 class CommunicationListener { 58 58 59 friend class ariba::overlay::BaseOverlay; 60 friend class Node; 61 62 static CommunicationListener DEFAULT; 63 59 64 protected: 65 60 66 CommunicationListener(); 61 67 virtual ~CommunicationListener(); … … 78 84 const LinkID& lnk = LinkID::UNSPECIFIED); 79 85 86 // --- sniffing related method --- 87 virtual bool onEnableSideportListener(); 88 80 89 // --- extended message functionality --- 81 90 // virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, -
source/ariba/Makefile.am
r3055 r3374 73 73 Node.cpp \ 74 74 NodeListener.cpp \ 75 SideportListener.cpp \ 75 76 SpoVNetProperties.cpp 76 77 … … 87 88 Node.h \ 88 89 NodeListener.h \ 90 SideportListener.h \ 89 91 SpoVNetProperties.h 90 92 -
source/ariba/Node.cpp
r3071 r3374 146 146 147 147 bool Node::bind(CommunicationListener* listener, const ServiceID& sid) { 148 return base_overlay->bind(listener, sid); 148 // bind the listener 149 bool ret = base_overlay->bind(listener, sid); 150 151 // now that we have a listener, we can ask if sniffing is ok 152 if( ariba_mod.sideport_sniffer != NULL ){ 153 bool allow = listener->onEnableSideportListener(); 154 base_overlay->registerSidePort(ariba_mod.sideport_sniffer); 155 } 156 157 return ret; 149 158 } 150 159 -
source/ariba/Node.h
r3071 r3374 57 57 #include "CommunicationListener.h" 58 58 #include "DataMessage.h" 59 #include "SideportListener.h" 59 60 60 61 using std::vector; -
source/ariba/ariba.h
r3055 r3374 54 54 #include "Node.h" 55 55 #include "NodeListener.h" 56 #include "SideportListener.h" 56 57 #include "SpoVNetProperties.h" 57 58 -
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.