Changeset 3071


Ignore:
Timestamp:
Apr 24, 2009, 4:34:53 PM (16 years ago)
Author:
Christoph Mayer
Message:

-some further fixed in the protocols and cleaning the interfaces for stuff we have no functionality yet

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • sample/pingpong/PingPong.cpp

    r3056 r3071  
    8787        Timer::stop();
    8888
     89        // leave spovnet
     90        node->leave();
     91
    8992        // unbind communication and node listener
    9093        node->unbind( this );                               /*NodeListener*/
    9194        node->unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/
    92 
    93         // leave spovnet
    94         node->leave();
    9595
    9696        // stop the ariba module
     
    111111        // this can be all nodes (OneHop) overlay or just some neighbors
    112112        // in case of a Chord or Kademlia structure
     113
     114        // in this sample we use auto-links: we just send out our message
     115        // to the node and the link is established automatically. for more
     116        // control we would use the node->establishLink function to create
     117        // a link and start using the link in the CommunicationListener::onLinkUp
     118        // function that is implemented further down in PingPong::onLinkUp
    113119
    114120        logging_info( "pinging overlay neighbors with ping id " << ++pingId );
     
    139145
    140146void PingPong::onJoinFailed( const SpoVNetID& vid ) {
    141         logging_error("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX pingpong node join failed, spovnetid=" << vid.toString() );
     147        logging_error("pingpong node join failed, spovnetid=" << vid.toString() );
    142148}
    143149
     
    150156}
    151157
    152 // communication listener
    153 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) {
    154         logging_debug( "node " << remote.toString() << " wants to build up a link with us ... allowing" );
    155         return true;
    156 }
    157 
    158158void PingPong::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk) {
    159 
    160159        PingPongMessage* pingmsg = msg.getMessage()->convert<PingPongMessage> ();
    161160
     
    176175
    177176void PingPong::onLinkChanged(const LinkID& lnk, const NodeID& remote){
    178         logging_info( "received link-changed event for link " << lnk.toString()
     177        logging_info( "link-changed event for link " << lnk.toString()
    179178                        << " and node " << remote.toString() );
     179}
     180
     181bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) {
     182        logging_info( "node " << remote.toString() << " wants to build up a link with us ... allowing" );
     183        return true;
    180184}
    181185
     
    185189}
    186190
    187 void PingPong::onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop){
    188         logging_info( "received link-qos-changed event for link " << lnk.toString()
    189                                 << " and node " << remote.toString()
    190                                 << " with link properties " << prop.toString() );
    191 }
    192 
    193191}}} // namespace ariba, application, pingpong
  • sample/pingpong/PingPong.h

    r3056 r3071  
    3535protected:
    3636        // communication listener interface
    37         virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg);
     37        virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg = DataMessage::UNSPECIFIED);
    3838        virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk= LinkID::UNSPECIFIED);
    3939        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
     
    4141        virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
    4242        virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
    43         virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop);
    4443
    4544        // node listener interface
  • source/ariba/CommunicationListener.cpp

    r3056 r3071  
    5959}
    6060
    61 void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r,
    62                 const LinkProperties& p) {
    63 }
    64 
    6561bool CommunicationListener::onLinkRequest(const NodeID& remote,
    6662                const DataMessage& msg) {
     
    7369
    7470// --- extended message functionality ---
     71//void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r,
     72//              const LinkProperties& p) {
     73//}
     74
     75// --- extended message functionality ---
    7576// void CommunicationListener::onMessageSent(seqnum_t seq_num, bool failed,
    7677//              const DataMessage& msg) {
  • source/ariba/CommunicationListener.h

    r3056 r3071  
    7171        virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
    7272
    73         virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote,
    74                         const LinkProperties& prop);
    75 
    76         virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg);
     73        virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg = DataMessage::UNSPECIFIED);
    7774
    7875        // --- general receive method ---
     
    8077        virtual void onMessage(const DataMessage& msg, const NodeID& remote,
    8178                        const LinkID& lnk = LinkID::UNSPECIFIED);
     79
     80        // --- extended message functionality ---
     81        // virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote,
     82        //                      const LinkProperties& prop);
    8283
    8384        // --- extended message functionality ---
  • source/ariba/Node.cpp

    r3067 r3071  
    5757}
    5858
    59 //TODO: Implement error handling: no bootstrap node available
    6059void Node::join(const Name& vnetname) {
    6160        spovnetId = vnetname.toSpoVNetId();
  • source/ariba/Node.h

    r3067 r3071  
    5858#include "DataMessage.h"
    5959
     60using std::vector;
    6061using ariba::overlay::BaseOverlay;
    61 using std::vector;
    6262
    6363namespace ariba {
  • source/ariba/overlay/BaseOverlay.cpp

    r3067 r3071  
    9898
    9999        ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." );
    100         logging_info( "starting to join spovnet " << id.toString() << "...");
     100        logging_info( "starting to join spovnet " << id.toString() <<
     101                        " with nodeid " << nodeId.toString());
    101102
    102103        //
     
    145146        logging_debug( "leaving overlay" );
    146147        // first, leave the overlay interface
    147         overlayInterface->leaveOverlay();
     148        if( overlayInterface != NULL )
     149                overlayInterface->leaveOverlay();
    148150
    149151        // --> leave spovnet
     
    177179        //
    178180
    179         logging_info("creating spovnet " + id.toString());
     181        logging_info( "creating spovnet " + id.toString() << " with nodeid " << nodeId.toString() );
    180182
    181183        spovnetId = id;
     
    502504        if( i == linkMapping.end() ) return;
    503505
    504         if( i->second.interface != NULL )
     506        if( i->second.interface != NULL ){
    505507                i->second.interface->onLinkChanged( id, i->second.node );
     508                // call onLinkQoSChanged?
     509        }
    506510
    507511        i->second.markused();
     
    537541
    538542        // TODO: convert QoSParameterSet to the LinkProperties properties
    539         if( i->second.interface != NULL )
    540                 i->second.interface->onLinkQoSChanged( id, i->second.node, LinkProperties::DEFAULT );
     543        if( i->second.interface != NULL ){
     544                // TODO: currently not in the interface: i->second.interface->onLinkQoSChanged( id, i->second.node, LinkProperties::DEFAULT );
     545        }
    541546
    542547        i->second.markused();
     548}
     549
     550bool BaseOverlay::onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ){
     551
     552        // also see in the receiveMessage function. there the higher layer service
     553        // is asked whether to accept link requests, but there a basic link association is
     554        // already built up, so we know the node id
     555        logging_debug("received link request from " << remote->toString() << ", accepting");
     556        return true;
    543557}
    544558
     
    791805
    792806                i->second.interface = iface;
    793                 iface->onLinkUp( link, sourcenode );
    794807                i->second.markused();
    795808
    796                 return true ;
     809                //
     810                // ask the service whether it wants to accept this link
     811                //
     812
     813                if( iface->onLinkRequest(sourcenode) ){
     814                        iface->onLinkUp( link, sourcenode );
     815                } else {
     816                        // prevent onLinkDown calls to the service
     817                        i->second.interface = NULL;
     818                        // drop the link
     819                        dropLink( link );
     820                }
     821
     822                return true;
    797823
    798824        } // else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeUpdate) )
  • source/ariba/overlay/BaseOverlay.h

    r3067 r3071  
    250250
    251251        /**
    252          * TODO
     252         * @see ariba::communication::CommunicationEvents.h
    253253         */
    254254        virtual void onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
    255255
    256256        /**
    257          * TODO
     257         * @see ariba::communication::CommunicationEvents.h
    258258         */
    259259        virtual void onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
    260260
     261        /**
     262         * @see ariba::communication::CommunicationEvents.h
     263         */
    261264        virtual void onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote );
    262265
    263266        /**
    264          * TODO
     267         * @see ariba::communication::CommunicationEvents.h
    265268         */
    266269        virtual void onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
    267270
    268271        /**
    269          * TODO
     272         * @see ariba::communication::CommunicationEvents.h
    270273         */
    271274        virtual void onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos );
     275
     276        /**
     277         * @see ariba::communication::CommunicationEvents.h
     278         */
     279        virtual bool onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
    272280
    273281        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • source/ariba/utility/system/StartupWrapper.cpp

    r3067 r3071  
    103103        {
    104104                log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
    105                 logger->setLevel(log4cxx::Level::getInfo());
     105                logger->setLevel(log4cxx::Level::getDebug());
    106106        }
    107107
Note: See TracChangeset for help on using the changeset viewer.