Changeset 3690 for source/ariba/overlay/modules/onehop
- Timestamp:
- May 26, 2009, 1:40:23 AM (16 years ago)
- Location:
- source/ariba/overlay/modules/onehop
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/modules/onehop/OneHop.cpp
r3067 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #include "OneHop.h" 40 40 #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" 41 45 42 46 namespace ariba { … … 84 88 return; 85 89 } 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 96 void OneHop::createOverlay() { 92 97 // don't need to bootstrap against ourselfs. 93 98 // the create and join process is completed now. 94 95 99 logging_info( "creating onehop overlay structure" ); 96 100 state = OneHopStateCompleted; … … 119 123 void OneHop::joinOverlay(const EndpointDescriptor& bootstrapEp){ 120 124 121 logging_info( "joining onehop overlay structure through end point " <<125 logging_info( "joining onehop overlay structure through end-point " << 122 126 (bootstrapEp == EndpointDescriptor::UNSPECIFIED ? 123 127 "local" : bootstrapEp.toString()) ); … … 133 137 134 138 state = OneHopStateCompleted; 135 136 137 139 } else { 138 139 140 bootstrapLink = baseoverlay.establishLink( bootstrapEp, 140 141 OverlayInterface::OVERLAY_SERVICE_ID ); … … 175 176 if( state == OneHopStateInvalid ) return; 176 177 177 //178 178 // node went down, remove from overlay mapping 179 //180 181 179 logging_debug( "node " << remote.toString() << " left overlay structure" ); 182 180 … … 223 221 // 224 222 225 if( onemsg->isType( OneHopMessage::OneHopMessageTypeListingRequest ) ){223 if( onemsg->isType( OneHopMessage::OneHopMessageTypeListingRequest ) ){ 226 224 227 225 NodeListingRequest* request = onemsg->decapsulate<NodeListingRequest>(); … … 316 314 } // if( reply != NULL ) 317 315 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 318 322 } 319 323 -
source/ariba/overlay/modules/onehop/OneHop.h
r3057 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #ifndef _ONE_HOP_H … … 42 42 #include <map> 43 43 #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"47 44 #include "ariba/utility/logging/Logging.h" 48 45 49 46 using std::map; 50 using ariba::overlay::OverlayInterface;51 using ariba::overlay::OneHopMessage;52 using ariba::overlay::NodeListingRequest;53 using ariba::overlay::NodeListingReply;54 47 55 48 namespace ariba { 56 49 namespace overlay { 57 50 58 class OneHop 51 class OneHop: public OverlayInterface { 59 52 use_logging_h( OneHop ); 60 53 public: 61 OneHop( 62 BaseOverlay& _overlay, 63 const NodeID& _nodeid, 64 OverlayStructureEvents* _eventsReceiver 65 ); 54 OneHop(BaseOverlay& _overlay, const NodeID& _nodeid, 55 OverlayStructureEvents* _eventsReceiver); 66 56 67 57 virtual ~OneHop(); 68 58 69 59 protected: 60 /// @see OverlayInterface.h 61 virtual void createOverlay(); 70 62 71 // 72 // OverlayInterface.h 73 // 74 75 virtual void createOverlay(); 63 /// @see OverlayInterface.h 76 64 virtual void deleteOverlay(); 77 65 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 79 71 virtual void leaveOverlay(); 80 72 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); 83 75 76 /// @see OverlayInterface.h 77 virtual void routeMessage(const NodeID& destnode, Message* msg); 78 79 /// @see OverlayInterface.h 84 80 virtual NodeList getKnownNodes() const; 85 81 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); 89 84 90 virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);85 /// @see CommunicationListener.h or @see OverlayInterface.h 91 86 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); 93 91 94 92 private: 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; 100 95 OverlayNodeMapping overlayNodes; 101 96 102 /** 103 * The current state of the overlay 104 */ 97 /// The current state of the overlay 105 98 typedef enum _OneHopState { 106 OneHopStateInvalid 107 OneHopStateJoinInitiated 108 OneHopStateJoinListingRequested 109 OneHopStateCompleted 99 OneHopStateInvalid = 0, 100 OneHopStateJoinInitiated = 1, 101 OneHopStateJoinListingRequested = 2, 102 OneHopStateCompleted = 3, 110 103 } OneHopState; 111 104 112 105 OneHopState state; 113 114 106 uint16_t pendingLinks; 115 107 LinkID bootstrapLink; 116 117 108 }; 118 109 -
source/ariba/overlay/modules/onehop/messages/NodeListingReply.cpp
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #include "NodeListingReply.h" -
source/ariba/overlay/modules/onehop/messages/NodeListingReply.h
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #ifndef NODE_LISTING_REPLY_H__ … … 77 77 78 78 sznBeginDefault( ariba::overlay::NodeListingReply, X ) { 79 uint16_t len = X.isSerializer() ? descriptors.size() : 0;79 uint16_t len = descriptors.size(); 80 80 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); 88 84 } sznEnd(); 89 85 -
source/ariba/overlay/modules/onehop/messages/NodeListingRequest.cpp
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #include "NodeListingRequest.h" -
source/ariba/overlay/modules/onehop/messages/NodeListingRequest.h
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #ifndef NODE_LISTING_REQUEST_H__ -
source/ariba/overlay/modules/onehop/messages/OneHopMessage.cpp
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #include "OneHopMessage.h" -
source/ariba/overlay/modules/onehop/messages/OneHopMessage.h
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #ifndef __ONE_HOP_MESSAGE_H … … 57 57 OneHopMessageTypeListingRequest = 1, 58 58 OneHopMessageTypeListingReply = 2, 59 OneHopMessageTypeRoute = 3, 59 60 } OneHopMessageType; 60 61
Note:
See TracChangeset
for help on using the changeset viewer.