Changeset 3057


Ignore:
Timestamp:
Apr 23, 2009, 7:18:10 PM (16 years ago)
Author:
Christoph Mayer
Message:

-fixes #4 (merge tidy interface with current implementation)

Location:
source/ariba/overlay/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/modules/OverlayInterface.cpp

    r3056 r3057  
    6060}
    6161
     62void OverlayInterface::onLinkUp(const LinkID& lnk, const NodeID& remote){
     63}
     64
     65void OverlayInterface::onLinkDown(const LinkID& lnk, const NodeID& remote){
     66}
     67
     68void OverlayInterface::onLinkChanged(const LinkID& lnk, const NodeID& remote){
     69}
     70
     71void OverlayInterface::onLinkFail(const LinkID& lnk, const NodeID& remote){
     72}
     73
     74void OverlayInterface::onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop){
     75}
     76
     77bool OverlayInterface::onLinkRequest(const NodeID& remote, const DataMessage& msg){
     78}
     79
     80void OverlayInterface::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk){
     81}
     82
    6283}} // namespace ariba, overlay
  • source/ariba/overlay/modules/OverlayInterface.h

    r3055 r3057  
    8080        virtual NodeList getKnownNodes() const = 0;
    8181
     82        // functions from CommunicationListener that we _can_ use as overlay
     83        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
     84        virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
     85        virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
     86        virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
     87        virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop);
     88        virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg);
     89        virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk = LinkID::UNSPECIFIED);
     90
    8291protected:
    8392        BaseOverlay& baseoverlay;
  • source/ariba/overlay/modules/onehop/OneHop.cpp

    r3056 r3057  
    5858
    5959OneHop::~OneHop(){
    60 
    6160        deleteOverlay();
    6261}
     
    163162}
    164163
    165 void OneHop::onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote ){
     164
     165void OneHop::onLinkDown(const LinkID& lnk, const NodeID& remote){
    166166
    167167        //
     
    175175
    176176        for( ; i != iend; i++ ){
    177                 if( i->second == link ){
     177                if( i->second == lnk ){
    178178                        overlayNodes.erase( i );
    179179                        break;
     
    182182}
    183183
    184 void OneHop::onLinkUp(const LinkID& link, const NodeID& local, const NodeID& remote) {
     184void OneHop::onLinkUp(const LinkID& lnk, const NodeID& remote){
    185185
    186186        //
     
    189189        //
    190190
    191         if( link != bootstrapLink ){
     191        if( lnk != bootstrapLink ){
    192192                if( pendingLinks > 0 )  pendingLinks--;
    193193                if( pendingLinks == 0 ) state = OneHopStateCompleted;
     
    201201
    202202        state = OneHopStateJoinListingRequested;
    203         baseoverlay.sendMessage( &onemsg, link );
    204 }
    205 
    206 bool OneHop::receiveMessage(const Message* message, const LinkID& link, const NodeID& node){
    207 
    208         OneHopMessage* onemsg = const_cast<Message*>(message)->decapsulate<OneHopMessage>();
    209         if( onemsg == NULL ) return false;
     203        baseoverlay.sendMessage( &onemsg, lnk );
     204}
     205
     206void OneHop::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk){
     207
     208        OneHopMessage* onemsg = msg.getMessage()->convert<OneHopMessage>();
     209        if( onemsg == NULL ) return;
    210210
    211211        //
     
    217217                NodeListingRequest* request = onemsg->decapsulate<NodeListingRequest>();
    218218
    219                 logging_info( "onehop received node listing request from node " << node.toString() );
     219                logging_info( "onehop received node listing request from node " << remote.toString() );
    220220
    221221                //
     
    223223                //
    224224
    225                 overlayNodes.insert( make_pair(node, link) );
     225                overlayNodes.insert( make_pair(remote, lnk) );
    226226
    227227                //
     
    249249
    250250                onehopReply.encapsulate( &listingReply );
    251                 baseoverlay.sendMessage( &onehopReply, link );
     251                baseoverlay.sendMessage( &onehopReply, lnk );
    252252
    253253                //
     
    256256                //
    257257
    258                 eventsReceiver->onNodeJoin( node );
     258                eventsReceiver->onNodeJoin( remote );
    259259
    260260        } // if( request != NULL )
     
    268268                NodeListingReply* reply = onemsg->decapsulate<NodeListingReply>();
    269269
    270                 logging_debug( "received node listing reply from node " << node.toString()
     270                logging_debug( "received node listing reply from node " << remote.toString()
    271271                                        << " with all overlay nodes. connecting to all of them" );
    272272
  • source/ariba/overlay/modules/onehop/OneHop.h

    r3055 r3057  
    8585
    8686        //
    87         // see CommunicationListener.h and OverlayInterface.h
     87        // see CommunicationListener.h or OverlayInterface.h
    8888        //
    8989
    90         virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
    91         virtual void onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote );
    92         virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
     90        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
     91        virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
     92        virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk = LinkID::UNSPECIFIED);
    9393
    9494private:
Note: See TracChangeset for help on using the changeset viewer.