Ignore:
Timestamp:
May 26, 2009, 1:40:23 AM (15 years ago)
Author:
mies
Message:

Merged 20090512-mies-connectors changes r3472:r3689 into trunk.

Location:
source/ariba/overlay/modules/onehop
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/modules/onehop/OneHop.cpp

    r3067 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#include "OneHop.h"
    4040#include "ariba/overlay/BaseOverlay.h"
     41
     42#include "ariba/overlay/modules/onehop/messages/OneHopMessage.h"
     43#include "ariba/overlay/modules/onehop/messages/NodeListingRequest.h"
     44#include "ariba/overlay/modules/onehop/messages/NodeListingReply.h"
    4145
    4246namespace ariba {
     
    8488                return;
    8589        }
    86 
    87         baseoverlay.sendMessage( msg, i->second );
    88 }
    89 
    90 void OneHop::createOverlay(){
    91 
     90        OneHopMessage onehopRoute( OneHopMessage::OneHopMessageTypeRoute );
     91        onehopRoute.encapsulate(msg);
     92
     93        baseoverlay.sendMessage( &onehopRoute, i->second );
     94}
     95
     96void OneHop::createOverlay() {
    9297        // don't need to bootstrap against ourselfs.
    9398        // the create and join process is completed now.
    94 
    9599        logging_info( "creating onehop overlay structure" );
    96100        state = OneHopStateCompleted;
     
    119123void OneHop::joinOverlay(const EndpointDescriptor& bootstrapEp){
    120124
    121         logging_info( "joining onehop overlay structure through endpoint " <<
     125        logging_info( "joining onehop overlay structure through end-point " <<
    122126                        (bootstrapEp == EndpointDescriptor::UNSPECIFIED ?
    123127                                        "local" : bootstrapEp.toString()) );
     
    133137
    134138                state = OneHopStateCompleted;
    135 
    136 
    137139        } else {
    138 
    139140                bootstrapLink = baseoverlay.establishLink( bootstrapEp,
    140141                                        OverlayInterface::OVERLAY_SERVICE_ID );
     
    175176        if( state == OneHopStateInvalid ) return;
    176177
    177         //
    178178        // node went down, remove from overlay mapping
    179         //
    180 
    181179        logging_debug( "node " << remote.toString() << " left overlay structure" );
    182180
     
    223221        //
    224222
    225         if( onemsg->isType( OneHopMessage::OneHopMessageTypeListingRequest) ){
     223        if( onemsg->isType( OneHopMessage::OneHopMessageTypeListingRequest ) ){
    226224
    227225                NodeListingRequest* request = onemsg->decapsulate<NodeListingRequest>();
     
    316314        } // if( reply != NULL )
    317315
     316        if( onemsg->isType( OneHopMessage::OneHopMessageTypeRoute) ){
     317                logging_debug( "Route message arrived at destination node -> delegate to BaseOverlay" );
     318                baseoverlay.incomingRouteMessage( onemsg );
     319        }
     320
     321
    318322}
    319323
  • source/ariba/overlay/modules/onehop/OneHop.h

    r3057 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#ifndef _ONE_HOP_H
     
    4242#include <map>
    4343#include "ariba/overlay/modules/OverlayInterface.h"
    44 #include "ariba/overlay/modules/onehop/messages/OneHopMessage.h"
    45 #include "ariba/overlay/modules/onehop/messages/NodeListingRequest.h"
    46 #include "ariba/overlay/modules/onehop/messages/NodeListingReply.h"
    4744#include "ariba/utility/logging/Logging.h"
    4845
    4946using std::map;
    50 using ariba::overlay::OverlayInterface;
    51 using ariba::overlay::OneHopMessage;
    52 using ariba::overlay::NodeListingRequest;
    53 using ariba::overlay::NodeListingReply;
    5447
    5548namespace ariba {
    5649namespace overlay {
    5750
    58 class OneHop : public OverlayInterface {
     51class OneHop: public OverlayInterface {
    5952        use_logging_h( OneHop );
    6053public:
    61         OneHop(
    62                 BaseOverlay& _overlay,
    63                 const NodeID& _nodeid,
    64                 OverlayStructureEvents* _eventsReceiver
    65         );
     54        OneHop(BaseOverlay& _overlay, const NodeID& _nodeid,
     55                        OverlayStructureEvents* _eventsReceiver);
    6656
    6757        virtual ~OneHop();
    6858
    6959protected:
     60        /// @see OverlayInterface.h
     61        virtual void createOverlay();
    7062
    71         //
    72         // OverlayInterface.h
    73         //
    74 
    75         virtual void createOverlay();
     63        /// @see OverlayInterface.h
    7664        virtual void deleteOverlay();
    7765
    78         virtual void joinOverlay(const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED);
     66        /// @see OverlayInterface.h
     67        virtual void joinOverlay(const EndpointDescriptor& boot =
     68                        EndpointDescriptor::UNSPECIFIED);
     69
     70        /// @see OverlayInterface.h
    7971        virtual void leaveOverlay();
    8072
    81         virtual const EndpointDescriptor& resolveNode( const NodeID& node );
    82         virtual void routeMessage( const NodeID& destnode, Message* msg );
     73        /// @see OverlayInterface.h
     74        virtual const EndpointDescriptor& resolveNode(const NodeID& node);
    8375
     76        /// @see OverlayInterface.h
     77        virtual void routeMessage(const NodeID& destnode, Message* msg);
     78
     79        /// @see OverlayInterface.h
    8480        virtual NodeList getKnownNodes() const;
    8581
    86         //
    87         // see CommunicationListener.h or OverlayInterface.h
    88         //
     82        /// @see CommunicationListener.h or @see OverlayInterface.h
     83        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
    8984
    90         virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
     85        /// @see CommunicationListener.h or @see OverlayInterface.h
    9186        virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
    92         virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk = LinkID::UNSPECIFIED);
     87
     88        /// @see CommunicationListener.h or @see OverlayInterface.h
     89        virtual void onMessage(const DataMessage& msg, const NodeID& remote,
     90                        const LinkID& lnk = LinkID::UNSPECIFIED);
    9391
    9492private:
    95 
    96         /**
    97          * The other nodes in the overlay
    98          */
    99         typedef map<const NodeID,const LinkID> OverlayNodeMapping;
     93        /// The other nodes in the overlay
     94        typedef map<const NodeID, const LinkID> OverlayNodeMapping;
    10095        OverlayNodeMapping overlayNodes;
    10196
    102         /**
    103          * The current state of the overlay
    104          */
     97        /// The current state of the overlay
    10598        typedef enum _OneHopState {
    106                 OneHopStateInvalid                = 0,
    107                 OneHopStateJoinInitiated          = 1,
    108                 OneHopStateJoinListingRequested   = 2,
    109                 OneHopStateCompleted              = 3,
     99                OneHopStateInvalid = 0,
     100                OneHopStateJoinInitiated = 1,
     101                OneHopStateJoinListingRequested = 2,
     102                OneHopStateCompleted = 3,
    110103        } OneHopState;
    111104
    112105        OneHopState state;
    113 
    114106        uint16_t pendingLinks;
    115107        LinkID bootstrapLink;
    116 
    117108};
    118109
  • source/ariba/overlay/modules/onehop/messages/NodeListingReply.cpp

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#include "NodeListingReply.h"
  • source/ariba/overlay/modules/onehop/messages/NodeListingReply.h

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#ifndef NODE_LISTING_REPLY_H__
     
    7777
    7878sznBeginDefault( ariba::overlay::NodeListingReply, X ) {
    79         uint16_t len = X.isSerializer() ? descriptors.size() : 0;
     79        uint16_t len = descriptors.size();
    8080        X && len;
    81         if (X.isDeserializer()) {
    82                 descriptors.resize(len);
    83         }
    84         for (int i=0; i<len; i++) {
    85                 if (X.isDeserializer()) descriptors[i].second = new EndpointDescriptor();
    86                 X && &descriptors[i].first && reinterpret_cast<VSerializeable*>(descriptors[i].second);
    87         }
     81        if (X.isDeserializer()) descriptors.resize(len);
     82        for (int i=0; i<len; i++)
     83                X && &descriptors[i].first && VO(descriptors[i].second);
    8884} sznEnd();
    8985
  • source/ariba/overlay/modules/onehop/messages/NodeListingRequest.cpp

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#include "NodeListingRequest.h"
  • source/ariba/overlay/modules/onehop/messages/NodeListingRequest.h

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#ifndef NODE_LISTING_REQUEST_H__
  • source/ariba/overlay/modules/onehop/messages/OneHopMessage.cpp

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#include "OneHopMessage.h"
  • source/ariba/overlay/modules/onehop/messages/OneHopMessage.h

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#ifndef __ONE_HOP_MESSAGE_H
     
    5757                OneHopMessageTypeListingRequest = 1,
    5858                OneHopMessageTypeListingReply   = 2,
     59                OneHopMessageTypeRoute          = 3,
    5960        } OneHopMessageType;
    6061
Note: See TracChangeset for help on using the changeset viewer.