#include <BaseOverlay.h>
Base class for overlay modules, with KBR-API, statistics and pointers to the BootstrapOracle and the UnderlayConfigurator. Derived classes must use BaseOverlayMessage as base class for own message types.
Public Types | |
enum | States { INIT = 0, JOINING_1 = 1, JOINING_2 = 2, JOINING_3 = 3, READY = 4, REFRESH = 5, SHUTDOWN = 6, JOINING = JOINING_1, JOIN = JOINING_1, BOOTSTRAP = JOINING_1, RSET = JOINING_2, BSET = JOINING_3 } |
Public Member Functions | |
BaseOverlay () | |
virtual | ~BaseOverlay () |
Virtual destructor. | |
States | getState () |
bool | isMalicious () |
Returns true, if node is malicious. | |
bool | isInSimpleMultiOverlayHost () |
Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost. | |
void | join (const OverlayKey &nodeID=OverlayKey::UNSPECIFIED_KEY) |
Join the overlay with a given nodeID. | |
virtual NodeVector * | local_lookup (const OverlayKey &key, int num, bool safe) |
finds nodes closest to the given OverlayKey | |
virtual NodeVector * | neighborSet (int num) |
virtual bool | isSiblingFor (const NodeHandle &node, const OverlayKey &key, int numSiblings, bool *err) |
Query if a node is among the siblings for a given key. | |
virtual int | getMaxNumSiblings () |
Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol. | |
virtual int | getMaxNumRedundantNodes () |
Query the maximum number of redundant next hop nodes that are returned by findNode(). | |
void | sendMessageToUDP (const TransportAddress &dest, cMessage *msg) |
Sends message to underlay. | |
void | sendToKey (const OverlayKey &key, BaseOverlayMessage *message, int numSiblings=1, const std::vector< TransportAddress > &sourceRoute=TransportAddress::UNSPECIFIED_NODES, RoutingType routingType=DEFAULT_ROUTING) |
Sends a message to an overlay node, with the generic routing algorithm. | |
void | registerComp (CompType compType, cModule *module) |
cModule * | getCompModule (CompType compType) |
cGate * | getCompRpcGate (CompType compType) |
void | sendMessageToAllComp (cMessage *msg, CompType srcComp) |
bool | providesKbr () |
Protected Types | |
typedef UNORDERED_SET < AbstractLookup *, lookupHashFcn, lookupHashFcn > | LookupSet |
Protected Member Functions | |
int | numInitStages () const |
Sets init stage. | |
virtual void | initializeOverlay (int stage) |
Initializes derived-class-attributes. | |
virtual void | finishOverlay () |
collects statistical data in derived class | |
void | bindToPort (int port) |
Tells UDP we want to get all packets arriving on the given port. | |
virtual void | route (const OverlayKey &key, CompType destComp, CompType srcComp, cMessage *msg, const std::vector< TransportAddress > &sourceRoute=TransportAddress::UNSPECIFIED_NODES, RoutingType routingType=DEFAULT_ROUTING) |
Routes message through overlay. | |
void | callDeliver (BaseOverlayMessage *msg, const OverlayKey &destKey) |
Calls deliver function in application. | |
void | callForward (const OverlayKey &key, BaseRouteMessage *msg, const NodeHandle &nextHopNode) |
Calls forward function in application. | |
void | callUpdate (const NodeHandle &node, bool joined) |
Informs application about state changes of nodes or newly joined nodes. | |
virtual void | handleUDPMessage (BaseOverlayMessage *msg) |
Processes messages from underlay. | |
virtual void | handleTimerEvent (cMessage *msg) |
Processes "timer" self-messages. | |
virtual void | handleAppMessage (cMessage *msg) |
Processes non-commonAPI messages. | |
virtual void | receiveChangeNotification (int category, cPolymorphic *details) |
callback-method for events at the NotificationBoard | |
virtual void | handleTransportAddressChangedNotification () |
This method gets call if the node has a new TransportAddress (IP address) because he changed his access network. | |
virtual void | handleNodeLeaveNotification () |
This method gets call **.gracefulLeaveDelay seconds before it is killed. | |
virtual void | handleNodeGracefulLeaveNotification () |
This method gets call **.gracefulLeaveDelay seconds before it is killed if this node is among the gracefulLeaveProbability nodes. | |
virtual void | recordOverlaySentStats (BaseOverlayMessage *msg) |
Collect overlay specific sent messages statistics. | |
void | setOverlayReady (bool ready) |
Sets the overlay ready icon and register/deregisters the node at the BootstrapOracle. | |
virtual AbstractLookup * | createLookup (RoutingType routingType=DEFAULT_ROUTING, const BaseOverlayMessage *msg=NULL, const cObject *findNodeExt=NULL, bool appLookup=false) |
Creates an abstract iterative lookup instance. | |
virtual void | removeLookup (AbstractLookup *lookup) |
Removes the abstract lookup instance. | |
virtual OverlayKey | distance (const OverlayKey &x, const OverlayKey &y) const |
This method should implement the distance between two keys. | |
virtual NodeVector * | findNode (const OverlayKey &key, int numRedundantNodes, int numSiblings, BaseOverlayMessage *msg=NULL) |
Implements the find node call. | |
virtual void | joinOverlay () |
Join the overlay with a given nodeID in thisNode.key. | |
virtual void | joinForeignPartition (const NodeHandle &node) |
Join another overlay partition with the given node as bootstrap node. | |
virtual bool | handleFailedNode (const TransportAddress &failed) |
Handles a failed node. | |
virtual void | lookupRpc (LookupCall *call) |
virtual void | nextHopRpc (NextHopCall *call) |
void | countFindNodeCall (const FindNodeCall *call) |
void | countFailedNodeCall (const FailedNodeCall *call) |
bool | internalHandleRpc (BaseCallMessage *msg) |
Handles internal rpc requests. | |
bool | internalHandleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt) |
Handles rpc responses internal in base classes . | |
void | internalHandleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey) |
Handles rpc timeouts internal in base classes . | |
void | internalSendRouteRpc (BaseRpcMessage *message, const OverlayKey &destKey, const std::vector< TransportAddress > &sourceRoute, RoutingType routingType) |
CompType | getThisCompType () |
Return the component type of this module. | |
Protected Attributes | |
int | numAppDataForwarded |
int | bytesAppDataForwarded |
int | numAppLookupForwarded |
int | bytesAppLookupForwarded |
int | numMaintenanceForwarded |
int | bytesMaintenanceForwarded |
int | numFindNodeSent |
int | bytesFindNodeSent |
int | numFindNodeResponseSent |
int | bytesFindNodeResponseSent |
int | numFailedNodeSent |
int | bytesFailedNodeSent |
int | numFailedNodeResponseSent |
int | bytesFailedNodeResponseSent |
std::vector< HopDelayRecord * > | singleHopDelays |
simtime_t | creationTime |
BootstrapOracle * | bootstrapOracle |
pointer to BootstrapOracle in this node | |
NotificationBoard * | notificationBoard |
pointer to NotificationBoard in this node | |
UnderlayConfigurator * | underlayConfigurator |
pointer to UnderlayConfigurator in this node | |
BootstrapList * | bootstrapList |
pointer to the BootstrapList module | |
bool | debugOutput |
debug output ? | |
RoutingType | defaultRoutingType |
bool | useCommonAPIforward |
forward messages to applications? | |
bool | collectPerHopDelay |
collect delay for single hops | |
bool | routeMsgAcks |
send ACK when receiving route message | |
uint | recNumRedundantNodes |
numRedundantNodes for recursive routing | |
bool | drawOverlayTopology |
int | localPort |
used UDP-port | |
int | hopCountMax |
maximum hop count | |
int | numDropped |
number of dropped packets | |
int | bytesDropped |
number of dropped bytes | |
cOutVector | delayVector |
statistical output vector for packet-delays | |
cOutVector | hopCountVector |
statistical output vector for hop-counts | |
States | state |
IterativeLookupConfiguration | iterativeLookupConfig |
LookupSet | lookups |
bool | kbr |
set this to true, if the overlay provides KBR services | |
Private Types | |
typedef std::map< CompType, std::pair< cModule *, cGate * > > | CompModuleList |
Private Member Functions | |
void | initialize (int stage) |
initializes base-class-attributes | |
void | finish () |
collects statistical data | |
virtual void | setOwnNodeID () |
Overlay implementations can overwrite this virtual method to set a specific nodeID. | |
void | handleMessage (cMessage *msg) |
Checks for message type and calls corresponding method. | |
void | handleBaseOverlayMessage (BaseOverlayMessage *msg, const OverlayKey &destKey=OverlayKey::UNSPECIFIED_KEY) |
Handles a BaseOverlayMessage . | |
void | sendRouteMessage (const TransportAddress &dest, BaseRouteMessage *msg, bool ack) |
bool | checkFindNode (BaseRouteMessage *routeMsg) |
void | initLookups () |
creates a LookupSet | |
void | finishLookups () |
deletes entries in lookups | |
virtual bool | forwardMessageRecursive (const TransportAddress &dest, BaseRouteMessage *msg) |
Hook for forwarded message in recursive lookup mode. | |
void | internalSendRpcResponse (BaseCallMessage *call, BaseResponseMessage *response) |
void | findNodeRpc (FindNodeCall *call) |
void | failedNodeRpc (FailedNodeCall *call) |
Private Attributes | |
int | numAppDataSent |
int | bytesAppDataSent |
int | numAppLookupSent |
int | bytesAppLookupSent |
int | numMaintenanceSent |
int | bytesMaintenanceSent |
int | numAppDataReceived |
int | bytesAppDataReceived |
int | numAppLookupReceived |
int | bytesAppLookupReceived |
int | numMaintenanceReceived |
int | bytesMaintenanceReceived |
int | numInternalSent |
int | bytesInternalSent |
int | numInternalReceived |
int | bytesInternalReceived |
CompModuleList | compModuleList |
Friends | |
class | IterativeLookup |
class | RecursiveLookup |
class | IterativePathLookup |
class | BootstrapList |
class | SendToKeyListener |
Classes | |
struct | HopDelayRecord |
Structure for computing the average delay in one specific hop. More... | |
class | lookupHashFcn |
typedef UNORDERED_SET<AbstractLookup*, lookupHashFcn, lookupHashFcn> BaseOverlay::LookupSet [protected] |
typedef std::map<CompType, std::pair<cModule*, cGate*> > BaseOverlay::CompModuleList [private] |
enum BaseOverlay::States |
INIT | |
JOINING_1 | |
JOINING_2 | |
JOINING_3 | |
READY | |
REFRESH | |
SHUTDOWN | |
JOINING | |
JOIN | |
BOOTSTRAP | |
RSET | |
BSET |
00079 { 00080 INIT = 0, 00081 JOINING_1 = 1, 00082 JOINING_2 = 2, 00083 JOINING_3 = 3, 00084 READY = 4, 00085 REFRESH = 5, 00086 SHUTDOWN = 6, 00087 00088 //some aliases for compatibility 00089 JOINING = JOINING_1, 00090 JOIN = JOINING_1, 00091 BOOTSTRAP = JOINING_1, 00092 RSET = JOINING_2, 00093 BSET = JOINING_3 00094 };
BaseOverlay::BaseOverlay | ( | ) |
00055 { 00056 bootstrapOracle = NULL; 00057 underlayConfigurator = NULL; 00058 notificationBoard = NULL; 00059 globalParameters = NULL; 00060 bootstrapList = NULL; 00061 }
BaseOverlay::~BaseOverlay | ( | ) | [virtual] |
States BaseOverlay::getState | ( | ) | [inline] |
Referenced by ConnectivityProbe::extractTopology(), and BootstrapList::locateBootstrapNode().
00096 { return state; };
void BaseOverlay::initialize | ( | int | stage | ) | [private] |
initializes base-class-attributes
stage | the init stage |
00075 { 00076 if (stage == MIN_STAGE_OVERLAY) { 00077 OverlayKey::setKeyLength(par("keyLength")); 00078 00079 // find friend modules 00080 bootstrapOracle = BootstrapOracleAccess().get(); 00081 underlayConfigurator = UnderlayConfiguratorAccess().get(); 00082 notificationBoard = NotificationBoardAccess().get(); 00083 globalParameters = GlobalParametersAccess().get(); 00084 bootstrapList = check_and_cast<BootstrapList*>(parentModule()-> 00085 parentModule()->submodule("bootstrapList", 0)); 00086 00087 // fetch some parameters 00088 debugOutput = par("debugOutput"); 00089 collectPerHopDelay = par("collectPerHopDelay"); 00090 localPort = par("localPort"); 00091 hopCountMax = par("hopCountMax"); 00092 drawOverlayTopology = par("drawOverlayTopology"); 00093 00094 // we assume most overlays don't provide KBR services 00095 kbr = false; 00096 00097 // set routing type 00098 std::string temp(par("routingType")); 00099 if (temp == "iterative") 00100 defaultRoutingType = ITERATIVE_ROUTING; 00101 else if (temp == "exhaustive-iterative") 00102 defaultRoutingType = EXHAUSTIVE_ITERATIVE_ROUTING; 00103 else if (temp == "semi-recursive") 00104 defaultRoutingType = SEMI_RECURSIVE_ROUTING; 00105 else if (temp == "full-recursive") 00106 defaultRoutingType = FULL_RECURSIVE_ROUTING; 00107 else if (temp == "source-routing-recursive") 00108 defaultRoutingType = RECURSIVE_SOURCE_ROUTING; 00109 else throw new cRuntimeError((std::string("Wrong routing type: ") 00110 + temp).c_str()); 00111 00112 collectPerHopDelay = par("collectPerHopDelay"); 00113 useCommonAPIforward = par("useCommonAPIforward"); 00114 routeMsgAcks = par("routeMsgAcks"); 00115 recNumRedundantNodes = par("recNumRedundantNodes"); 00116 00117 // set base lookup parameters 00118 iterativeLookupConfig.redundantNodes = par("lookupRedundantNodes"); 00119 iterativeLookupConfig.parallelPaths = par("lookupParallelPaths"); 00120 iterativeLookupConfig.parallelRpcs = par("lookupParallelRpcs"); 00121 iterativeLookupConfig.secure = par("lookupSecure"); 00122 iterativeLookupConfig.merge = par("lookupMerge"); 00123 iterativeLookupConfig.failedNodeRpcs = par("lookupFailedNodeRpcs"); 00124 iterativeLookupConfig.strictParallelRpcs = 00125 par("lookupStrictParallelRpcs"); 00126 iterativeLookupConfig.useAllParallelResponses = 00127 par("lookupUseAllParallelResponses"); 00128 iterativeLookupConfig.newRpcOnEveryTimeout = 00129 par("lookupNewRpcOnEveryTimeout"); 00130 iterativeLookupConfig.newRpcOnEveryResponse = 00131 par("lookupNewRpcOnEveryResponse"); 00132 iterativeLookupConfig.finishOnFirstUnchanged = 00133 par("lookupFinishOnFirstUnchanged"); 00134 00135 // statistics 00136 numAppDataSent = 0; 00137 bytesAppDataSent = 0; 00138 numAppLookupSent = 0; 00139 bytesAppLookupSent = 0; 00140 numMaintenanceSent = 0; 00141 bytesMaintenanceSent = 0; 00142 numAppDataReceived = 0; 00143 bytesAppDataReceived = 0; 00144 numAppLookupReceived = 0; 00145 bytesAppLookupReceived = 0; 00146 numMaintenanceReceived = 0; 00147 bytesMaintenanceReceived = 0; 00148 numAppDataForwarded = 0; 00149 bytesAppDataForwarded = 0; 00150 numAppLookupForwarded = 0; 00151 bytesAppLookupForwarded = 0; 00152 numMaintenanceForwarded = 0; 00153 bytesMaintenanceForwarded = 0; 00154 00155 numDropped = 0; 00156 bytesDropped = 0; 00157 numFindNodeSent = 0; 00158 bytesFindNodeSent = 0; 00159 numFindNodeResponseSent = 0; 00160 bytesFindNodeResponseSent = 0; 00161 numFailedNodeSent = 0; 00162 bytesFailedNodeSent = 0; 00163 numFailedNodeResponseSent = 0; 00164 bytesFailedNodeResponseSent = 0; 00165 00166 numInternalSent = 0; 00167 bytesInternalSent = 0; 00168 numInternalReceived = 0; 00169 bytesInternalReceived = 0; 00170 00171 WATCH(numAppDataSent); 00172 WATCH(bytesAppDataSent); 00173 WATCH(numAppLookupSent); 00174 WATCH(bytesAppLookupSent); 00175 WATCH(numMaintenanceSent); 00176 WATCH(bytesMaintenanceSent); 00177 WATCH(numAppDataReceived); 00178 WATCH(bytesAppDataReceived); 00179 WATCH(numAppLookupReceived); 00180 WATCH(bytesAppLookupReceived); 00181 WATCH(numMaintenanceReceived); 00182 WATCH(bytesMaintenanceReceived); 00183 WATCH(numAppDataForwarded); 00184 WATCH(bytesAppDataForwarded); 00185 WATCH(numAppLookupForwarded); 00186 WATCH(bytesAppLookupForwarded); 00187 WATCH(numMaintenanceForwarded); 00188 WATCH(bytesMaintenanceForwarded); 00189 00190 WATCH(numDropped); 00191 WATCH(bytesDropped); 00192 WATCH(numFindNodeSent); 00193 WATCH(bytesFindNodeSent); 00194 WATCH(numFindNodeResponseSent); 00195 WATCH(bytesFindNodeResponseSent); 00196 WATCH(numFailedNodeSent); 00197 WATCH(bytesFailedNodeSent); 00198 WATCH(numFailedNodeResponseSent); 00199 WATCH(bytesFailedNodeResponseSent); 00200 00201 if (isInSimpleMultiOverlayHost()) { 00202 WATCH(numInternalSent); 00203 WATCH(bytesInternalSent); 00204 WATCH(numInternalReceived); 00205 WATCH(bytesInternalReceived); 00206 } 00207 00208 // set up local nodehandle 00209 thisNode.ip = IPAddressResolver(). 00210 addressOf(parentModule()->parentModule()).get4(); 00211 thisNode.key = OverlayKey::UNSPECIFIED_KEY; 00212 00213 // set up UDP 00214 bindToPort(localPort); 00215 00216 // subscribe to the notification board 00217 notificationBoard->subscribe(this, NF_OVERLAY_TRANSPORTADDRESS_CHANGED); 00218 notificationBoard->subscribe(this, NF_OVERLAY_NODE_LEAVE); 00219 notificationBoard->subscribe(this, NF_OVERLAY_NODE_GRACEFUL_LEAVE); 00220 00221 // init visualization with terminal ptr 00222 if (drawOverlayTopology) 00223 initVis(parentModule()->parentModule()); 00224 00225 // init rpcs 00226 initRpcs(); 00227 initLookups(); 00228 00229 // statistics 00230 globalStatistics->nodesInitialized++; 00231 creationTime = simTime(); 00232 } 00233 00234 if (stage >= MIN_STAGE_OVERLAY && stage <= MAX_STAGE_OVERLAY) 00235 initializeOverlay(stage); 00236 00237 if (stage == MAX_STAGE_TIER_1) { 00238 // bootstrapList registered its gate to the overlay 0 00239 // if this is not overlay 0, we may not have the gate, so retrieve it 00240 // this assumes that the overlay is in a container module! 00241 if (!compModuleList.count(BOOTSTRAPLIST_COMP)) { 00242 BaseOverlay *firstOverlay = dynamic_cast<BaseOverlay*> 00243 (parentModule()->parentModule() 00244 ->submodule("overlay", 0)->gate("from_app") 00245 ->toGate()->ownerModule()); 00246 if (!firstOverlay) { 00247 opp_error("BaseOverlay.cc: Couldn't obtain bootstrap gate"); 00248 } 00249 registerComp(BOOTSTRAPLIST_COMP, 00250 firstOverlay->getCompModule(BOOTSTRAPLIST_COMP)); 00251 } 00252 } 00253 00254 // join after all components are registered 00255 if (stage == MAX_STAGE_TIER_3) { 00256 if ((bool)par("joinOnApplicationRequest") == false) { 00257 join(); 00258 } 00259 } 00260 }
void BaseOverlay::finish | ( | ) | [private] |
collects statistical data
00267 { 00268 finishOverlay(); 00269 00270 globalStatistics->nodesFinished++; 00271 00272 simtime_t time = globalStatistics->calcMeasuredLifetime(creationTime); 00273 if (time == 0) return; 00274 00275 if (collectPerHopDelay) { 00276 std::ostringstream singleHopName; 00277 HopDelayRecord* hdrl = NULL; 00278 HopDelayRecord* hdr = NULL; 00279 for (size_t i = 0; i < singleHopDelays.size();) { 00280 hdrl = singleHopDelays[i++]; 00281 hdr = hdrl; 00282 for (size_t j = 1; j <= i; ++j) { 00283 if (hdr->count == 0) continue; 00284 singleHopName.str(""); 00285 singleHopName << "BaseOverlay: Average Delay in Hop " 00286 << j << " of " << i; 00287 globalStatistics->addStdDev(singleHopName.str(), 00288 hdr->val / hdr->count); 00289 ++hdr; 00290 } 00291 delete[] hdrl; 00292 } 00293 singleHopDelays.clear(); 00294 } 00295 00296 globalStatistics->addStdDev("BaseOverlay: Sent App Data Messages/s", 00297 numAppDataSent / time); 00298 globalStatistics->addStdDev("BaseOverlay: Sent App Data Bytes/s", 00299 bytesAppDataSent / time); 00300 if (isInSimpleMultiOverlayHost()) { 00301 globalStatistics->addStdDev("BaseOverlay: Internal Sent Messages/s", 00302 numInternalReceived / time); 00303 globalStatistics->addStdDev("BaseOverlay: Internal Sent Bytes/s", 00304 bytesInternalReceived / time); 00305 } 00306 globalStatistics->addStdDev("BaseOverlay: Sent App Lookup Messages/s", 00307 numAppLookupSent / time); 00308 globalStatistics->addStdDev("BaseOverlay: Sent App Lookup Bytes/s", 00309 bytesAppLookupSent / time); 00310 globalStatistics->addStdDev("BaseOverlay: Sent Maintenance Messages/s", 00311 numMaintenanceSent / time); 00312 globalStatistics->addStdDev("BaseOverlay: Sent Maintenance Bytes/s", 00313 bytesMaintenanceSent / time); 00314 00315 globalStatistics->addStdDev("BaseOverlay: Sent Total Messages/s", 00316 (numAppDataSent + numAppLookupSent + 00317 numMaintenanceSent) / time); 00318 globalStatistics->addStdDev("BaseOverlay: Sent Total Bytes/s", 00319 (bytesAppDataSent + bytesAppLookupSent + 00320 bytesMaintenanceSent) / time); 00321 globalStatistics->addStdDev("BaseOverlay: Sent FindNode Messages/s", 00322 numFindNodeSent / time); 00323 globalStatistics->addStdDev("BaseOverlay: Sent FindNode Bytes/s", 00324 bytesFindNodeSent / time); 00325 00326 globalStatistics->addStdDev("BaseOverlay: Sent FindNodeResponse Messages/s", 00327 numFindNodeResponseSent / time); 00328 globalStatistics->addStdDev("BaseOverlay: Sent FindNodeResponse Bytes/s", 00329 bytesFindNodeResponseSent / time); 00330 globalStatistics->addStdDev("BaseOverlay: Sent FailedNode Messages/s", 00331 numFailedNodeSent / time); 00332 globalStatistics->addStdDev("BaseOverlay: Sent FailedNode Bytes/s", 00333 bytesFailedNodeSent / time); 00334 globalStatistics->addStdDev("BaseOverlay: Sent FailedNodeResponse Messages/s", 00335 numFailedNodeResponseSent / time); 00336 globalStatistics->addStdDev("BaseOverlay: Sent FailedNodeResponse Bytes/s", bytesFailedNodeResponseSent / time); 00337 00338 globalStatistics->addStdDev("BaseOverlay: Received App Data Messages/s", 00339 numAppDataReceived / time); 00340 globalStatistics->addStdDev("BaseOverlay: Received App Data Bytes/s", 00341 bytesAppDataReceived / time); 00342 if (isInSimpleMultiOverlayHost()) { 00343 globalStatistics->addStdDev("BaseOverlay: Internal Received Messages/s", 00344 numInternalReceived / time); 00345 globalStatistics->addStdDev("BaseOverlay: Internal Received Bytes/s", 00346 bytesInternalReceived / time); 00347 } 00348 globalStatistics->addStdDev("BaseOverlay: Received App Lookup Messages/s", 00349 numAppLookupReceived / time); 00350 globalStatistics->addStdDev("BaseOverlay: Received App Lookup Bytes/s", 00351 bytesAppLookupReceived / time); 00352 globalStatistics->addStdDev("BaseOverlay: Received Maintenance Messages/s", 00353 numMaintenanceReceived / time); 00354 globalStatistics->addStdDev("BaseOverlay: Received Maintenance Bytes/s", 00355 bytesMaintenanceReceived / time); 00356 00357 globalStatistics->addStdDev("BaseOverlay: Received Total Messages/s", 00358 (numAppDataReceived + numAppLookupReceived + 00359 numMaintenanceReceived)/time); 00360 globalStatistics->addStdDev("BaseOverlay: Received Total Bytes/s", 00361 (bytesAppDataReceived + bytesAppLookupReceived + 00362 bytesMaintenanceReceived)/time); 00363 globalStatistics->addStdDev("BaseOverlay: Forwarded App Data Messages/s", 00364 numAppDataForwarded / time); 00365 globalStatistics->addStdDev("BaseOverlay: Forwarded App Data Bytes/s", 00366 bytesAppDataForwarded / time); 00367 globalStatistics->addStdDev("BaseOverlay: Forwarded App Lookup Messages/s", 00368 numAppLookupForwarded / time); 00369 globalStatistics->addStdDev("BaseOverlay: Forwarded Signaling Bytes/s", 00370 bytesAppLookupForwarded / time); 00371 globalStatistics->addStdDev("BaseOverlay: Forwarded Maintenance Messages/s", 00372 numMaintenanceForwarded / time); 00373 globalStatistics->addStdDev("BaseOverlay: Forwarded Maintenance Bytes/s", 00374 bytesMaintenanceForwarded / time); 00375 globalStatistics->addStdDev("BaseOverlay: Forwarded Total Messages/s", 00376 (numAppDataForwarded + numAppLookupForwarded + 00377 numMaintenanceForwarded) / time); 00378 globalStatistics->addStdDev("BaseOverlay: Forwarded Total Bytes/s", 00379 (bytesAppDataForwarded + bytesAppLookupForwarded + 00380 bytesMaintenanceForwarded) / time); 00381 00382 globalStatistics->addStdDev("BaseOverlay: Dropped Messages/s", 00383 numDropped / time); 00384 globalStatistics->addStdDev("BaseOverlay: Dropped Bytes/s", 00385 bytesDropped / time); 00386 00387 globalStatistics->addStdDev("BaseOverlay: Measured Session Time", 00388 simTime() - creationTime); 00389 00390 globalStatistics->addStdDev("BaseRpc: Sent Ping Messages/s", 00391 numPingSent / time); 00392 globalStatistics->addStdDev("BaseRpc: Sent Ping Bytes/s", 00393 bytesPingSent / time); 00394 globalStatistics->addStdDev("BaseRpc: Sent Ping Response Messages/s", 00395 numPingResponseSent / time); 00396 globalStatistics->addStdDev("BaseRpc: Sent Ping Response Bytes/s", 00397 bytesPingResponseSent / time); 00398 00399 globalStatistics->doFinish(); 00400 00401 }
int BaseOverlay::numInitStages | ( | ) | const [protected] |
Sets init stage.
00070 { 00071 return NUM_STAGES_ALL; 00072 }
void BaseOverlay::initializeOverlay | ( | int | stage | ) | [protected, virtual] |
Initializes derived-class-attributes.
Initializes derived-class-attributes, called by BaseOverlay::initialize(). By default this method is called once. If more stages are needed one can overload numInitStages() and add more stages.
stage | the init stage |
Reimplemented in Bamboo, Broose, Chord, Gia, Kademlia, Koorde, Pastry, PubSubLobby, PubSubMMOG, and Vast.
Referenced by initialize().
void BaseOverlay::finishOverlay | ( | ) | [protected, virtual] |
collects statistical data in derived class
Reimplemented in Broose, Chord, Gia, Kademlia, Koorde, BasePastry, PubSubLobby, PubSubMMOG, and Vast.
Referenced by finish().
void BaseOverlay::setOwnNodeID | ( | ) | [private, virtual] |
Overlay implementations can overwrite this virtual method to set a specific nodeID.
The default implementation sets a random nodeID.
Reimplemented in BasePastry.
Referenced by join().
00559 { 00560 thisNode.key = OverlayKey::random(); 00561 }
bool BaseOverlay::isMalicious | ( | ) |
Returns true, if node is malicious.
Referenced by findNodeRpc(), and handleBaseOverlayMessage().
00411 { 00412 return bootstrapOracle->isMalicious(getThisNode()); 00413 }
bool BaseOverlay::isInSimpleMultiOverlayHost | ( | ) |
Returns true if overlay is one in an array, inside a SimpleMultiOverlayHost.
Referenced by finish(), and initialize().
void BaseOverlay::bindToPort | ( | int | port | ) | [protected] |
Tells UDP we want to get all packets arriving on the given port.
Referenced by initialize().
00424 { 00425 EV << "[BaseOverlay::bindToPort() @ " << thisNode.ip 00426 << " (" << thisNode.key.toString(16) << ")]\n" 00427 << " Binding to UDP port " << port 00428 << endl; 00429 00430 thisNode.port = port; 00431 00432 // TODO UDPAppBase should be ported to use UDPSocket sometime, but for now 00433 // we just manage the UDP socket by hand... 00434 cMessage *msg = new cMessage("UDP_C_BIND", UDP_C_BIND); 00435 UDPControlInfo *ctrl = new UDPControlInfo(); 00436 ctrl->setSrcPort(port); 00437 ctrl->setSockId(UDPSocket::generateSocketId()); 00438 msg->setControlInfo(ctrl); 00439 send(msg, "to_udp"); 00440 }
void BaseOverlay::route | ( | const OverlayKey & | key, | |
CompType | destComp, | |||
CompType | srcComp, | |||
cMessage * | msg, | |||
const std::vector< TransportAddress > & | sourceRoute = TransportAddress::UNSPECIFIED_NODES , |
|||
RoutingType | routingType = DEFAULT_ROUTING | |||
) | [protected, virtual] |
Routes message through overlay.
The default implementation uses FindNode to determine next hops and a generic greedy routing algorithm provides with SendToKey.
key | destination key | |
destComp | the destination component | |
srcComp | the source component | |
msg | message to route | |
sourceRoute | If sourceRoute is given, the message gets sent via all nodes in the list before it is routed (nextHop is used as a proxy) | |
routingType | specifies the routing mode (ITERATIVE_ROUTING, ...) |
Reimplemented in Gia.
Referenced by handleMessage().
01182 { 01183 if (key.isUnspecified() && 01184 (!sourceRoute.size() || sourceRoute[0].isUnspecified())) 01185 error("route(): Key and hint unspecified!"); 01186 01187 // create base route message 01188 BaseAppDataMessage* baseAppDataMsg = 01189 new BaseAppDataMessage("BaseAppDataMessage"); 01190 baseAppDataMsg->setType(APPDATA); 01191 baseAppDataMsg->setDestComp(destComp); 01192 baseAppDataMsg->setSrcComp(srcComp); 01193 baseAppDataMsg->setLength(BASEAPPDATA_L(baseAppDataMsg)); 01194 baseAppDataMsg->setName(msg->name()); 01195 01196 baseAppDataMsg->setStatType(APP_DATA_STAT); 01197 baseAppDataMsg->encapsulate(msg); 01198 01199 // debug output 01200 if (debugOutput) { 01201 EV << "[BaseOverlay::route() @ " << thisNode.ip 01202 << " (" << thisNode.key.toString(16) << ")]\n" 01203 << " Received message from application" 01204 << endl; 01205 } 01206 01207 if (key.isUnspecified()) { 01208 sendMessageToUDP(sourceRoute[0], baseAppDataMsg); 01209 } else { 01210 sendToKey(key, baseAppDataMsg, 1, sourceRoute, routingType); 01211 } 01212 }
void BaseOverlay::callDeliver | ( | BaseOverlayMessage * | msg, | |
const OverlayKey & | destKey | |||
) | [protected] |
Calls deliver function in application.
Encapsulates messages in KBRdeliver messages and sends them to application.
msg | delivered message | |
destKey | the destination key of the message |
Referenced by Gia::forwardMessage(), and handleBaseOverlayMessage().
00449 { 00450 KBRdeliver* deliverMsg = new KBRdeliver(); 00451 00452 OverlayCtrlInfo* overlayCtrlInfo = 00453 check_and_cast<OverlayCtrlInfo*>(msg->removeControlInfo()); 00454 00455 BaseAppDataMessage* appDataMsg = dynamic_cast<BaseAppDataMessage*>(msg); 00456 00457 // TODO GIA 00458 if (appDataMsg != NULL) { 00459 overlayCtrlInfo->setSrcComp(appDataMsg->getSrcComp()); 00460 overlayCtrlInfo->setDestComp(appDataMsg->getDestComp()); 00461 } 00462 00463 deliverMsg->setControlInfo(overlayCtrlInfo); 00464 deliverMsg->setDestKey(destKey); 00465 deliverMsg->encapsulate(msg->decapsulate()); 00466 deliverMsg->setType(KBR_DELIVER); 00467 00468 cGate* destGate = getCompRpcGate(static_cast<CompType>( 00469 overlayCtrlInfo->getDestComp())); 00470 00471 if (destGate == NULL) { 00472 opp_error("BaseOverlay::callDeliver(): Unknown destComp!"); 00473 } 00474 00475 sendDirect(deliverMsg, 0, destGate); 00476 00477 delete msg; 00478 }
void BaseOverlay::callForward | ( | const OverlayKey & | key, | |
BaseRouteMessage * | msg, | |||
const NodeHandle & | nextHopNode | |||
) | [protected] |
Calls forward function in application.
Encapsulates messages in KBRforward messages and sends them to application.
the message to be sent through the API must be encapsulated in msg
.
key | destination key | |
msg | message to forward | |
nextHopNode | next hop |
Referenced by sendToKey().
00482 { 00483 KBRforward* forwardMsg = new KBRforward(); 00484 00485 forwardMsg->setDestKey(msg->getDestKey()); 00486 forwardMsg->setNextHopNode(nextHopNode); 00487 forwardMsg->encapsulate(msg->encapsulatedMsg()->decapsulate()); 00488 00489 OverlayCtrlInfo* overlayCtrlInfo = 00490 new OverlayCtrlInfo(); 00491 overlayCtrlInfo->setTransportType(ROUTE_TRANSPORT); 00492 overlayCtrlInfo->setRoutingType(msg->getRoutingType()); 00493 overlayCtrlInfo->setHopCount(msg->getHopCount()); 00494 overlayCtrlInfo->setSrcNode(msg->getSrcNode()); 00495 overlayCtrlInfo->setSrcComp(check_and_cast<BaseAppDataMessage*> 00496 (msg->encapsulatedMsg())->getSrcComp()); 00497 overlayCtrlInfo->setDestComp(check_and_cast<BaseAppDataMessage*> 00498 (msg->encapsulatedMsg())->getDestComp()); 00499 00500 if (msg->controlInfo() != NULL) { 00501 OverlayCtrlInfo* ctrlInfo = 00502 check_and_cast<OverlayCtrlInfo*>(msg->removeControlInfo()); 00503 00504 overlayCtrlInfo->setLastHop(ctrlInfo->getLastHop()); 00505 00506 delete ctrlInfo; 00507 } 00508 00509 forwardMsg->setControlInfo(overlayCtrlInfo); 00510 00511 forwardMsg->setType(KBR_FORWARD); 00512 00513 send(forwardMsg, "to_app"); 00514 00515 delete msg; 00516 }
void BaseOverlay::callUpdate | ( | const NodeHandle & | node, | |
bool | joined | |||
) | [protected] |
Informs application about state changes of nodes or newly joined nodes.
Creates a KBRUpdate message and sends it up to the application
node | the node that has joined or changed its state | |
joined | has the node joined or changed its state? |
Referenced by BrooseBucket::add(), ChordSuccessorList::addSuccessor(), Gia::changeState(), Chord::changeState(), Broose::changeState(), PastryLeafSet::failedNode(), Kademlia::handleFailedNode(), Chord::handleRpcJoinResponse(), Chord::handleStabilizeTimerExpired(), PastryLeafSet::insertLeaf(), ChordSuccessorList::popSuccessor(), BrooseBucket::remove(), ChordSuccessorList::removeOldSuccessors(), ChordSuccessorList::removeSuccessor(), Kademlia::routingAdd(), Kademlia::routingTimeout(), Chord::rpcJoin(), Koorde::rpcNotify(), and Chord::rpcNotify().
00571 { 00572 if ((!node.isUnspecified()) && (node != thisNode)) { 00573 if (joined) { 00574 EV << "[BaseOverlay::callUpdate() @ " << thisNode.ip 00575 << " (" << thisNode.key.toString(16) << ")]\n" 00576 << " (" << node << ", " << joined << ") joined" 00577 << endl; 00578 } else { 00579 EV << "[BaseOverlay::callUpdate() @ " << thisNode.ip 00580 << " (" << thisNode.key.toString(16) << ")]\n" 00581 << " (" << node << ", " << joined << ") left" 00582 << endl; 00583 } 00584 } 00585 00586 KBRupdate* updateMsg = new KBRupdate("UPDATE"); 00587 00588 updateMsg->setNode(node); 00589 updateMsg->setJoined(joined); 00590 00591 updateMsg->setType(KBR_UPDATE); 00592 00593 send(updateMsg, "to_app"); 00594 }
void BaseOverlay::join | ( | const OverlayKey & | nodeID = OverlayKey::UNSPECIFIED_KEY |
) |
Join the overlay with a given nodeID.
Join the overlay with a given nodeID. This method may be called by an application to join the overlay with a specific nodeID. It is also called if the node's IP address changes.
nodeID | The new nodeID for this node. |
Referenced by initialize(), and XmlRpcInterface::joinOverlay().
00537 { 00538 Enter_Method("join()"); 00539 00540 // set nodeID and IP 00541 thisNode.ip = 00542 IPAddressResolver().addressOf(parentModule()->parentModule()).get4(); 00543 if (nodeID.isUnspecified()) { 00544 setOwnNodeID(); 00545 } else { 00546 thisNode.key = nodeID; 00547 } 00548 00549 joinOverlay(); 00550 }
NodeVector * BaseOverlay::local_lookup | ( | const OverlayKey & | key, | |
int | num, | |||
bool | safe | |||
) | [virtual] |
finds nodes closest to the given OverlayKey
calls findNode() (that should be overridden in derived overlay) and returns a list with (num) nodes ordered by distance to the node defined by key.
key | the given node | |
num | number of nodes that are returned | |
safe | The safe parameters is not implemented yet |
Referenced by BaseApp::callLocalLookup(), XmlRpcInterface::localLookup(), and neighborSet().
00520 { 00521 Enter_Method("local_lookup()"); 00522 00523 if (safe == true) { 00524 error("BaseOverlay::local_lookup(): safe flag is not implemented!"); 00525 } 00526 00527 NodeVector* nodeVector = findNode(key, min(num, getMaxNumRedundantNodes()), 00528 min(num,getMaxNumSiblings())); 00529 00530 if (((int)nodeVector->size()) > num) 00531 nodeVector->resize(num); 00532 00533 return nodeVector; 00534 }
NodeVector * BaseOverlay::neighborSet | ( | int | num | ) | [virtual] |
Referenced by BaseApp::callNeighborSet().
00564 { 00565 Enter_Method("neighborSet()"); 00566 00567 return local_lookup(thisNode.key, num, false); 00568 }
bool BaseOverlay::isSiblingFor | ( | const NodeHandle & | node, | |
const OverlayKey & | key, | |||
int | numSiblings, | |||
bool * | err | |||
) | [virtual] |
Query if a node is among the siblings for a given key.
Query if a node is among the siblings for a given key. This means, that the nodeId of this node is among the closest numSiblings nodes to the key and that by a local findNode() call all other siblings to this key can be retrieved.
node | the NodeHandle | |
key | destination key | |
numSiblings | The nodes knows all numSiblings nodes close to this key | |
err | return false if the range could not be determined |
Reimplemented in Broose, Chord, Kademlia, and BasePastry.
Referenced by findNodeRpc(), handleBaseOverlayMessage(), DHT::handlePutRequest(), BaseApp::isSiblingFor(), sendToKey(), IterativeLookup::start(), and DHT::update().
00598 { 00599 Enter_Method("isSiblingFor()"); 00600 00601 opp_error( "isSiblingFor: Not implemented!" ); 00602 00603 return false; 00604 }
int BaseOverlay::getMaxNumSiblings | ( | ) | [virtual] |
Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol.
Reimplemented in Broose, Chord, Kademlia, and BasePastry.
Referenced by KBRTestApp::handleTimerEvent(), DHT::initializeApp(), local_lookup(), BootstrapList::locateBootstrapNode(), and XmlRpcInterface::lookup().
00607 { 00608 Enter_Method("getMaxNumSiblings()"); 00609 00610 opp_error( "getMaxNumSiblings: Not implemented!" ); 00611 00612 return false; 00613 }
int BaseOverlay::getMaxNumRedundantNodes | ( | ) | [virtual] |
Query the maximum number of redundant next hop nodes that are returned by findNode().
Reimplemented in Broose, Chord, Kademlia, and BasePastry.
Referenced by local_lookup().
00616 { 00617 Enter_Method("getMaxNumRedundantNodes()"); 00618 00619 opp_error( "getMaxNumRedundantNodes: Not implemented!" ); 00620 00621 return false; 00622 }
void BaseOverlay::handleMessage | ( | cMessage * | msg | ) | [private] |
Checks for message type and calls corresponding method.
Checks for message type (from UDP/App or selfmessage) and calls corresponding method like route(), get(), put(), remove(), handleTimerEvent(), handleAppMessage() and handleUDPMessage().
msg | The message to be handled |
00631 { 00632 // process self-messages 00633 if (msg->isSelfMessage()) { 00634 // process rpc self-messages 00635 BaseRpcMessage* rpcMessage = dynamic_cast<BaseRpcMessage*>(msg); 00636 if (rpcMessage!=NULL) { 00637 internalHandleRpcMessage(rpcMessage); 00638 return; 00639 } 00640 // process all other self-messages 00641 handleTimerEvent(msg); 00642 } 00643 00644 // process messages from UDP 00645 else if (msg->arrivedOn("from_udp")) { 00646 UDPControlInfo* udpControlInfo = 00647 check_and_cast<UDPControlInfo*>(msg->removeControlInfo()); 00648 OverlayCtrlInfo* overlayCtrlInfo = new OverlayCtrlInfo; 00649 overlayCtrlInfo 00650 ->setLastHop(TransportAddress(udpControlInfo->srcAddr(), 00651 udpControlInfo->srcPort())); 00652 overlayCtrlInfo->setTransportType(UDP_TRANSPORT); 00653 00654 msg->setControlInfo(overlayCtrlInfo); 00655 delete udpControlInfo; 00656 00657 // debug message 00658 if (debugOutput) { 00659 EV << "[BaseOverlay:handleMessage() @ " << thisNode.ip 00660 << " (" << thisNode.key.toString(16) << ")]\n" 00661 << " Received " << *msg << " from " 00662 << overlayCtrlInfo->getLastHop().ip << endl; 00663 } 00664 00665 BaseOverlayMessage* baseOverlayMsg = 00666 dynamic_cast<BaseOverlayMessage*>(msg); 00667 00668 if (baseOverlayMsg == NULL) { 00669 RECORD_STATS(numDropped++; bytesDropped += msg->byteLength()); 00670 delete msg; 00671 return; 00672 } 00673 00674 // records stats if message is not a UDP "self message" 00675 if (overlayCtrlInfo->getLastHop() != thisNode) { 00676 // is this from anywhere else? 00677 if (baseOverlayMsg->getStatType() == APP_DATA_STAT) 00678 RECORD_STATS(numAppDataReceived++; bytesAppDataReceived += 00679 baseOverlayMsg->byteLength()); 00680 else if (baseOverlayMsg->getStatType() == APP_LOOKUP_STAT) 00681 RECORD_STATS(numAppLookupReceived++;bytesAppLookupReceived += 00682 baseOverlayMsg->byteLength()); 00683 else // MAINTENANCE_STAT 00684 RECORD_STATS(numMaintenanceReceived++; 00685 bytesMaintenanceReceived += 00686 baseOverlayMsg->byteLength()); 00687 } 00688 if (overlayCtrlInfo->getLastHop().ip == thisNode.ip) { 00689 // is this from the same node? 00690 RECORD_STATS(numInternalReceived++; bytesInternalReceived += 00691 baseOverlayMsg->byteLength()); 00692 } 00693 00694 handleBaseOverlayMessage(baseOverlayMsg); 00695 } 00696 00697 // process CommonAPIMessages from App 00698 else if (dynamic_cast<CommonAPIMessage*>(msg) != NULL) { 00699 if (dynamic_cast<KBRroute*>(msg) != NULL) { 00700 KBRroute* apiMsg = static_cast<KBRroute*>(msg); 00701 00702 std::vector<TransportAddress> sourceRoute; 00703 for (uint i = 0; i < apiMsg->getSourceRouteArraySize(); ++i) 00704 sourceRoute.push_back(apiMsg->getSourceRoute(i)); 00705 00706 route(apiMsg->getDestKey(), static_cast<CompType>(apiMsg->getDestComp()), 00707 static_cast<CompType>(apiMsg->getSrcComp()), apiMsg->decapsulate(), 00708 sourceRoute); 00709 } else if (dynamic_cast<KBRforward*>(msg) != NULL) { 00710 KBRforward* apiMsg = static_cast<KBRforward*>(msg); 00711 OverlayCtrlInfo* overlayCtrlInfo = 00712 check_and_cast<OverlayCtrlInfo*> 00713 (msg->removeControlInfo()); 00714 00715 BaseAppDataMessage* dataMsg = 00716 new BaseAppDataMessage(); 00717 dataMsg->setType(APPDATA); 00718 dataMsg->setLength(BASEAPPDATA_L(dataMsg)); 00719 dataMsg->setName(msg->encapsulatedMsg()->name()); 00720 dataMsg->encapsulate(msg->decapsulate()); 00721 dataMsg->setSrcComp(overlayCtrlInfo->getSrcComp()); 00722 dataMsg->setDestComp(overlayCtrlInfo->getDestComp()); 00723 dataMsg->setStatType(APP_DATA_STAT); 00724 00725 BaseRouteMessage* routeMsg = new BaseRouteMessage(dataMsg->name()); 00726 routeMsg->setType(OVERLAYROUTE); 00727 routeMsg->setLength(BASEROUTE_L(routeMsg)); 00728 routeMsg->encapsulate(dataMsg); 00729 00730 routeMsg->setStatType(APP_DATA_STAT); 00731 routeMsg->setRoutingType(overlayCtrlInfo->getRoutingType()); 00732 routeMsg->setDestKey(apiMsg->getDestKey()); 00733 routeMsg->setSrcNode(overlayCtrlInfo->getSrcNode()); 00734 routeMsg->setHopCount(overlayCtrlInfo->getHopCount()); 00735 routeMsg->setControlInfo(overlayCtrlInfo); 00736 00737 // message marked with this-pointer as already forwarded to tier1 00738 routeMsg->setContextPointer(this); 00739 00740 std::vector<TransportAddress> sourceRoute; 00741 sourceRoute.push_back(apiMsg->getNextHopNode()); 00742 sendToKey(apiMsg->getDestKey(), routeMsg, 1, sourceRoute); 00743 } 00744 00745 delete msg; 00746 } else if (dynamic_cast<BaseRpcMessage*>(msg) != NULL) { 00747 BaseRpcMessage* rpcMessage = 00748 static_cast<BaseRpcMessage*>(msg); 00749 internalHandleRpcMessage(rpcMessage); 00750 } 00751 00752 // process other messages from App 00753 else if (msg->arrivedOn("from_app")) { 00754 handleAppMessage(msg); 00755 00756 } else { 00757 opp_error("BaseOverlay::handleMessage(): Received msg with " 00758 "unknown type!"); 00759 delete msg; 00760 } 00761 }
void BaseOverlay::handleBaseOverlayMessage | ( | BaseOverlayMessage * | msg, | |
const OverlayKey & | destKey = OverlayKey::UNSPECIFIED_KEY | |||
) | [private] |
Handles a BaseOverlayMessage
.
Handles BaseOverlayMessages of type OVERLAYSIGNALING, RPC, APPDATA or OVERLAYROUTE.
msg | The message to be handled | |
destKey | the destination key of the message |
Referenced by handleMessage(), internalHandleRpcTimeout(), nextHopRpc(), and sendToKey().
00765 { 00766 switch (msg->getType()) { 00767 case OVERLAYSIGNALING: 00768 handleUDPMessage(msg); 00769 return; 00770 00771 case RPC: { 00772 // process rpc-messages 00773 BaseRpcMessage* rpcMessage = 00774 check_and_cast<BaseRpcMessage*>(msg); 00775 internalHandleRpcMessage(rpcMessage); 00776 return; 00777 } 00778 00779 case APPDATA: { 00780 //TODO use route messages? here: set transport type to ROUTE for "naked" 00781 // app messages 00782 OverlayCtrlInfo* overlayCtrlInfo = check_and_cast<OverlayCtrlInfo*>(msg->controlInfo()); 00783 overlayCtrlInfo->setTransportType(ROUTE_TRANSPORT); 00784 00785 // TODO: Should be removed if we used route messages here (definition of srcNode?) 00786 //if (overlayCtrlInfo->getSrcNode().isUnspecified()) { 00787 // overlayCtrlInfo->setSrcNode(NodeHandle(overlayCtrlInfo->getLastHop())); 00788 //} 00789 00790 BaseAppDataMessage* baseAppDataMsg = 00791 check_and_cast<BaseAppDataMessage*>(msg); 00792 callDeliver(baseAppDataMsg, destKey); 00793 return; 00794 } 00795 00796 case OVERLAYROUTE: { 00797 BaseRouteMessage* baseRouteMsg = 00798 check_and_cast<BaseRouteMessage*>(msg); 00799 00800 // if this node is malicious drop the message 00801 if (isMalicious()) { 00802 EV << "[BaseOverlay::handleBaseOverlayMessage() @ " << thisNode.ip 00803 << " (" << thisNode.key.toString(16) << ")]\n" 00804 << " BaseRouteMessage gets dropped because this node is malicious" 00805 << endl; 00806 RECORD_STATS(numDropped++; 00807 bytesDropped += baseRouteMsg->byteLength()); 00808 delete msg; 00809 return; 00810 } 00811 00812 // collect delay-value of completed hop 00813 if (collectPerHopDelay) { 00814 baseRouteMsg->setHopDelayArraySize(baseRouteMsg-> 00815 getHopDelayArraySize() + 1); 00816 baseRouteMsg->setHopDelay(baseRouteMsg->getHopDelayArraySize() - 1, 00817 simTime() - baseRouteMsg->getHopStamp()); 00818 } 00819 00820 OverlayCtrlInfo* overlayCtrlInfo 00821 = check_and_cast<OverlayCtrlInfo*>(baseRouteMsg 00822 ->removeControlInfo()); 00823 // set transport type 00824 overlayCtrlInfo->setTransportType(ROUTE_TRANSPORT); 00825 00826 // source routing: save visited nodes, copy next hops 00827 std::vector<TransportAddress> sourceRoute; 00828 if ((baseRouteMsg->getNextHopsArraySize() > 0) || 00829 (baseRouteMsg->getRoutingType() == RECURSIVE_SOURCE_ROUTING)) { 00830 // save this node as visited 00831 baseRouteMsg 00832 ->setVisitedHopsArraySize(baseRouteMsg 00833 ->getVisitedHopsArraySize() + 1); 00834 baseRouteMsg->setVisitedHops(baseRouteMsg 00835 ->getVisitedHopsArraySize() - 1, 00836 thisNode); 00837 00838 // remove nodes from next hops and copy them to sourceRoute 00839 if (baseRouteMsg->getNextHopsArraySize() > 0) { 00840 sourceRoute.resize(baseRouteMsg->getNextHopsArraySize()- 1); 00841 for (uint i = 1; i < baseRouteMsg->getNextHopsArraySize(); 00842 ++i) { 00843 sourceRoute[i - 1] = baseRouteMsg->getNextHops(i); 00844 } 00845 baseRouteMsg->setNextHopsArraySize(0); 00846 } 00847 } 00848 00849 // decapsulate msg if node is sibling for destKey 00850 // or message is at its destination node 00851 bool err; 00852 if ((sourceRoute.size() == 0) && 00853 (baseRouteMsg->getDestKey().isUnspecified() || 00854 isSiblingFor(thisNode, baseRouteMsg->getDestKey(), 1, &err) 00855 /*&& !err*/)) { 00856 overlayCtrlInfo->setHopCount(baseRouteMsg->getHopCount()); 00857 overlayCtrlInfo->setSrcNode(baseRouteMsg->getSrcNode()); 00858 overlayCtrlInfo->setRoutingType(baseRouteMsg->getRoutingType()); 00859 00860 // copy visited nodes to control info 00861 overlayCtrlInfo 00862 ->setVisitedHopsArraySize(baseRouteMsg 00863 ->getVisitedHopsArraySize()); 00864 for (uint i = 0; i < baseRouteMsg->getVisitedHopsArraySize(); ++i) 00865 overlayCtrlInfo 00866 ->setVisitedHops(i, baseRouteMsg->getVisitedHops(i)); 00867 00868 BaseOverlayMessage* tmpMsg 00869 = check_and_cast<BaseOverlayMessage*>(baseRouteMsg 00870 ->decapsulate()); 00871 tmpMsg->setControlInfo(overlayCtrlInfo); 00872 00873 // delay between hops 00874 if (collectPerHopDelay) { 00875 RECORD_STATS( 00876 size_t i; 00877 for (i = singleHopDelays.size(); 00878 i < baseRouteMsg->getHopDelayArraySize();) { 00879 singleHopDelays.push_back(new HopDelayRecord[++i]); 00880 } 00881 00882 i = baseRouteMsg->getHopDelayArraySize() - 1; 00883 HopDelayRecord* hdr = singleHopDelays[i]; 00884 00885 for (size_t j = 0; j <= i; ++j) { 00886 hdr[j].count++; 00887 hdr[j].val += baseRouteMsg->getHopDelay(j); 00888 } 00889 ); 00890 } 00891 00892 // handle encapsulated message at destination node 00893 if (((baseRouteMsg->getRoutingType() == ITERATIVE_ROUTING) 00894 || (baseRouteMsg->getRoutingType() == EXHAUSTIVE_ITERATIVE_ROUTING)) 00895 || forwardMessageRecursive(thisNode, baseRouteMsg)) { 00896 handleBaseOverlayMessage(tmpMsg, baseRouteMsg->getDestKey()); 00897 delete baseRouteMsg; 00898 } 00899 return; 00900 } else { 00901 // forward msg if this node is not responsible for the key 00902 baseRouteMsg->setControlInfo(overlayCtrlInfo); 00903 sendToKey(baseRouteMsg->getDestKey(), baseRouteMsg, 1, sourceRoute); 00904 return; 00905 } 00906 break; 00907 } 00908 00909 default: 00910 EV << "[BaseOverlay::handleBaseOverlayMessage() @ " << thisNode.ip 00911 << " (" << thisNode.key.toString(16) << ")]\n" 00912 << " Received unknown message from UDP of type " << msg->name() 00913 << endl; 00914 break; 00915 } 00916 }
void BaseOverlay::handleUDPMessage | ( | BaseOverlayMessage * | msg | ) | [protected, virtual] |
Processes messages from underlay.
msg | Message from UDP |
Reimplemented in Bamboo, Broose, Chord, Gia, Kademlia, Koorde, Pastry, PubSubLobby, PubSubMMOG, and Vast.
Referenced by handleBaseOverlayMessage().
void BaseOverlay::handleTimerEvent | ( | cMessage * | msg | ) | [protected, virtual] |
Processes "timer" self-messages.
msg | A self-message |
Reimplemented in Bamboo, Broose, Chord, Gia, Kademlia, Koorde, Pastry, PubSubLobby, PubSubMMOG, and Vast.
Referenced by handleMessage().
void BaseOverlay::handleAppMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Processes non-commonAPI messages.
msg | non-commonAPIMessage |
Reimplemented in Gia, PubSubMMOG, and Vast.
Referenced by handleMessage().
void BaseOverlay::receiveChangeNotification | ( | int | category, | |
cPolymorphic * | details | |||
) | [protected, virtual] |
callback-method for events at the NotificationBoard
category | ... TODO ... | |
details | ... TODO ... |
Reimplemented in PubSubMMOG, and Vast.
00919 { 00920 Enter_Method_Silent(); 00921 if (category == NF_OVERLAY_TRANSPORTADDRESS_CHANGED) { 00922 handleTransportAddressChangedNotification(); 00923 } else if (category == NF_OVERLAY_NODE_LEAVE) { 00924 handleNodeLeaveNotification(); 00925 } else if (category == NF_OVERLAY_NODE_GRACEFUL_LEAVE) { 00926 handleNodeGracefulLeaveNotification(); 00927 } 00928 }
void BaseOverlay::handleTransportAddressChangedNotification | ( | ) | [protected, virtual] |
This method gets call if the node has a new TransportAddress (IP address) because he changed his access network.
Referenced by receiveChangeNotification().
00931 { 00932 // get new ip address 00933 thisNode.ip = IPAddressResolver().addressOf( 00934 parentModule()->parentModule()).get4(); 00935 00936 joinOverlay(); 00937 }
void BaseOverlay::handleNodeLeaveNotification | ( | ) | [protected, virtual] |
This method gets call **.gracefulLeaveDelay seconds before it is killed.
Referenced by receiveChangeNotification().
void BaseOverlay::handleNodeGracefulLeaveNotification | ( | ) | [protected, virtual] |
This method gets call **.gracefulLeaveDelay seconds before it is killed if this node is among the gracefulLeaveProbability nodes.
Referenced by receiveChangeNotification().
void BaseOverlay::recordOverlaySentStats | ( | BaseOverlayMessage * | msg | ) | [protected, virtual] |
Collect overlay specific sent messages statistics.
This method is called from BaseOverlay::sendMessageToUDP() for every overlay message that is sent by a node. Use this to collect statistical data for overlay protocol specific message types.
msg | The overlay message to be sent to the UDP layer |
Reimplemented in Broose, Chord, and Koorde.
Referenced by sendMessageToUDP().
void BaseOverlay::setOverlayReady | ( | bool | ready | ) | [protected] |
Sets the overlay ready icon and register/deregisters the node at the BootstrapOracle.
ready | true if the overlay changed to ready state (joined successfully) |
Referenced by BasePastry::baseChangeState(), Gia::changeState(), Chord::changeState(), Broose::changeState(), Kademlia::joinOverlay(), Kademlia::lookupFinished(), and Kademlia::routingInit().
00973 { 00974 //TODO new setOverlayState(State state) function 00975 //if (ready && state == READY) return; 00976 00977 displayString().setTagArg("i", 1, ready ? "" : "red"); 00978 bootstrapOracle->setOverlayReadyIcon(getThisNode(), ready); 00979 00980 if (ready) { 00981 bootstrapList->registerBootstrapNode(thisNode); 00982 } else { 00983 bootstrapList->removeBootstrapNode(thisNode); 00984 } 00985 00986 if (globalParameters->getPrintStateToStdOut()) { 00987 std::cout << "OVERLAY STATE: " << (ready ? "READY (" : "OFFLINE (") 00988 << thisNode << ")" << std::endl; 00989 } 00990 00991 CompReadyMessage* msg = new CompReadyMessage; 00992 msg->setReady(ready); 00993 msg->setComp(OVERLAY_COMP); 00994 // TODO: fix MMOG protocols to handle new CompReadyMessage 00995 //sendMessageToAllComp(msg, OVERLAY_COMP); 00996 sendDirect((cMessage*)msg->dup(), 0, getCompRpcGate(TIER1_COMP)); 00997 sendDirect(msg, 0, getCompRpcGate(BOOTSTRAPLIST_COMP)); 00998 }
void BaseOverlay::sendRouteMessage | ( | const TransportAddress & | dest, | |
BaseRouteMessage * | msg, | |||
bool | ack | |||
) | [private] |
Referenced by SendToKeyListener::lookupFinished(), and sendToKey().
01009 { 01010 if (msg && (dest != thisNode)) { 01011 msg->setHopCount(msg->getHopCount() + 1); 01012 } 01013 if (!ack) 01014 sendMessageToUDP(dest, msg); 01015 else { 01016 NextHopCall* nextHopCall = new NextHopCall(msg->name()); 01017 nextHopCall->setLength(NEXTHOPCALL_L(nextHopCall)); 01018 nextHopCall->encapsulate(msg); 01019 nextHopCall->setStatType(msg->getStatType()); 01020 sendUdpRpcCall(dest, nextHopCall); 01021 } 01022 }
bool BaseOverlay::checkFindNode | ( | BaseRouteMessage * | routeMsg | ) | [private] |
Referenced by sendToKey().
01440 { 01441 if (dynamic_cast<FindNodeCall*>(routeMsg->encapsulatedMsg())) { 01442 FindNodeCall* findNodeCall = 01443 static_cast<FindNodeCall*>(routeMsg->decapsulate()); 01444 findNodeCall 01445 ->setControlInfo(check_and_cast<OverlayCtrlInfo*> 01446 (routeMsg->removeControlInfo())); 01447 findNodeRpc(findNodeCall); 01448 //std::cout << "+" << std::endl; 01449 return true; 01450 } 01451 //std::cout << "-" << std::endl; 01452 return false; 01453 }
void BaseOverlay::sendMessageToUDP | ( | const TransportAddress & | dest, | |
cMessage * | msg | |||
) | [virtual] |
Sends message to underlay.
dest | destination node | |
msg | message to send |
Reimplemented from BaseRpc.
Referenced by BasePastry::doRoutingTableMaintenance(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), PubSubMMOG::handleAdoptChildResponse(), PubSubMMOG::handleBackupCallTimeout(), PubSubMMOG::handleIntermediateResponse(), PubSubMMOG::handleMove(), PubSubMMOG::handleMoveListMessage(), PubSubMMOG::handlePingCallTimeout(), Chord::handleRpcJoinResponse(), PubSubMMOG::handleSubscriptionCall(), PubSubMMOG::handleSubscriptionCallTimeout(), Pastry::handleTimerEvent(), BasePastry::pingResponse(), PubSubMMOG::publishEvents(), route(), Chord::rpcJoin(), Chord::rpcNotify(), Gia::sendKeyListToNeighbor(), BasePastry::sendLeafset(), Vast::sendMessage(), Gia::sendMessage_DISCONNECT(), Gia::sendMessage_JOIN_ACK(), Gia::sendMessage_JOIN_DNY(), Gia::sendMessage_JOIN_REQ(), Gia::sendMessage_JOIN_RSP(), Gia::sendMessage_UPDATE(), PubSubMMOG::sendMessageToChildren(), BasePastry::sendRequest(), sendRouteMessage(), BasePastry::sendRoutingRow(), BasePastry::sendStateTables(), Gia::sendToken(), PubSubMMOG::takeOverSubspace(), and PubSubMMOG::unsubscribeChild().
01025 { 01026 // if there's still a control info attached to the message, remove it 01027 cPolymorphic* ctrlInfo = msg->removeControlInfo(); 01028 if (ctrlInfo != NULL) 01029 delete ctrlInfo; 01030 01031 // debug message 01032 if (debugOutput) { 01033 EV << "[BaseOverlay::sendMessageToUDP() @ " << thisNode.ip 01034 << " (" << thisNode.key.toString(16) << ")]\n" 01035 << " Sending " << *msg << " to " << dest.ip 01036 << endl; 01037 } 01038 01039 msg->setKind(UDP_C_DATA); 01040 UDPControlInfo* udpControlInfo = new UDPControlInfo(); 01041 udpControlInfo->setSrcAddr(thisNode.ip); 01042 udpControlInfo->setSrcPort(thisNode.port); 01043 udpControlInfo->setDestAddr(dest.ip); 01044 udpControlInfo->setDestPort(dest.port); 01045 msg->setControlInfo(udpControlInfo); 01046 01047 send(msg, "to_udp"); 01048 01049 if (dest != thisNode) { 01050 BaseOverlayMessage* baseOverlayMsg 01051 = check_and_cast<BaseOverlayMessage*>(msg); 01052 // record statistics, if message is not local 01053 if (baseOverlayMsg->getStatType() == APP_DATA_STAT) { 01054 RECORD_STATS(numAppDataSent++; 01055 bytesAppDataSent += msg->byteLength()); 01056 } else if (baseOverlayMsg->getStatType() == APP_LOOKUP_STAT){ 01057 RECORD_STATS(numAppLookupSent++; bytesAppLookupSent += 01058 msg->byteLength()); 01059 } else { // MAINTENANCE_STAT 01060 RECORD_STATS(numMaintenanceSent++; bytesMaintenanceSent += 01061 msg->byteLength()); 01062 } 01063 recordOverlaySentStats(baseOverlayMsg); 01064 } else { 01065 if (dest.ip == thisNode.ip) { // to same node, but different port 01066 RECORD_STATS(numInternalSent++; bytesInternalSent += msg->byteLength()); 01067 } 01068 } 01069 }
void BaseOverlay::initLookups | ( | ) | [private] |
void BaseOverlay::finishLookups | ( | ) | [private] |
deletes entries in lookups
Referenced by ~BaseOverlay().
01083 { 01084 while (lookups.size() > 0) { 01085 (*lookups.begin())->abortLookup(); 01086 } 01087 lookups.clear(); 01088 }
bool BaseOverlay::forwardMessageRecursive | ( | const TransportAddress & | dest, | |
BaseRouteMessage * | msg | |||
) | [private, virtual] |
Hook for forwarded message in recursive lookup mode.
This hook is called just before a message is forwarded to a next hop or if the message is at its destination just before it is sent to the app. Default implementation just returns true. This hook can for example be used to detect failed nodes and call handleFailedNode() before the actual forwarding takes place.
dest | destination node | |
msg | message to send |
Reimplemented in Kademlia, and BasePastry.
Referenced by handleBaseOverlayMessage(), and sendToKey().
void BaseOverlay::sendToKey | ( | const OverlayKey & | key, | |
BaseOverlayMessage * | message, | |||
int | numSiblings = 1 , |
|||
const std::vector< TransportAddress > & | sourceRoute = TransportAddress::UNSPECIFIED_NODES , |
|||
RoutingType | routingType = DEFAULT_ROUTING | |||
) |
Sends a message to an overlay node, with the generic routing algorithm.
key | The destination key | |
message | Message to be sent | |
numSiblings | number of siblings to send message to (numSiblings > 1 means multicast) | |
sourceRoute | If sourceRoute is given, the message gets sent via all nodes in the list before it is routed (nextHop is used as a proxy) | |
routingType | specifies the routing mode (ITERATIVE_ROUTING, ...) |
Referenced by Pastry::changeState(), Bamboo::changeState(), handleBaseOverlayMessage(), handleMessage(), internalSendRouteRpc(), BasePastry::pingTimeout(), and route().
01224 { 01225 BaseRouteMessage* routeMsg = NULL; 01226 01227 if (routingType == DEFAULT_ROUTING) routingType = defaultRoutingType; 01228 01229 if (debugOutput) { 01230 EV << "[BaseOverlay::sendToKey() @ " << thisNode.ip 01231 << " (" << thisNode.key.toString(16) << ")]\n" 01232 << " Sending " << msg << " to " << key 01233 << endl; 01234 } 01235 01236 if (key.isUnspecified() && 01237 !(sourceRoute.size() && !sourceRoute[0].isUnspecified())) 01238 error("BaseOverlay::sendToKey(): unspecified destination key!"); 01239 01240 if (msg->getType() != OVERLAYROUTE) { 01241 assert(!msg->controlInfo()); 01242 routeMsg = new BaseRouteMessage("BaseRouteMessage"); 01243 routeMsg->setType(OVERLAYROUTE); 01244 routeMsg->setRoutingType(routingType); 01245 routeMsg->setDestKey(key); 01246 routeMsg->setSrcNode(thisNode); 01247 routeMsg->setStatType(msg->getStatType()); 01248 // copy the name of the inner message 01249 routeMsg->setName(msg->name()); 01250 routeMsg->setLength(BASEROUTE_L(routeMsg)); 01251 routeMsg->encapsulate(msg); 01252 01253 OverlayCtrlInfo* routeCtrlInfo = new OverlayCtrlInfo; 01254 routeCtrlInfo->setLastHop(thisNode); 01255 routeCtrlInfo->setTransportType(ROUTE_TRANSPORT); 01256 routeCtrlInfo->setRoutingType(routingType); 01257 routeMsg->setControlInfo(routeCtrlInfo); 01258 01259 //message marked as not already forwarded to tier1 01260 routeMsg->setContextPointer(NULL); 01261 } else { 01262 routeMsg = check_and_cast<BaseRouteMessage*>(msg); 01263 routingType = static_cast<RoutingType>(routeMsg->getRoutingType()); 01264 } 01265 01266 /* // only used as workaround - uncomment if assert fails! 01267 if (!routeMsg->controlInfo()) { 01268 // workaround 01269 OverlayCtrlInfo* routeCtrlInfo = new OverlayCtrlInfo; 01270 routeCtrlInfo->setLastHopAddr(thisNode.ip); 01271 routeCtrlInfo->setLastHopPort(thisNode.port); 01272 routeCtrlInfo->setTransportType(ROUTE_TRANSPORT); 01273 routeMsg->setControlInfo(routeCtrlInfo); 01274 } 01275 */ 01276 01277 // set timestamp for next hop 01278 if (collectPerHopDelay) { 01279 routeMsg->setHopStamp(simTime()); 01280 } 01281 01282 if (sourceRoute.size() && !sourceRoute[0].isUnspecified()) { 01283 // send msg to nextHop if specified (used for e.g. join rpcs) 01284 OverlayCtrlInfo* ctrlInfo = check_and_cast<OverlayCtrlInfo*> 01285 (routeMsg->controlInfo()); 01286 ctrlInfo->setTransportType(UDP_TRANSPORT); 01287 assert(routeMsg->getNextHopsArraySize() == 0); 01288 routeMsg->setNextHopsArraySize(sourceRoute.size()); 01289 for (uint i = 0; i < sourceRoute.size(); ++i) 01290 routeMsg->setNextHops(i, sourceRoute[i]); 01291 sendRouteMessage(sourceRoute[0], routeMsg, routeMsgAcks); 01292 return; 01293 } 01294 01295 if ((routingType == ITERATIVE_ROUTING) 01296 || (routingType == EXHAUSTIVE_ITERATIVE_ROUTING)) { 01297 01298 // create lookup and sent to key 01299 AbstractLookup* lookup = createLookup(routingType, routeMsg, NULL, true); 01300 lookup->lookup(routeMsg->getDestKey(), numSiblings, hopCountMax, 01301 0, new SendToKeyListener(this, routeMsg)); 01302 } else { 01303 // recursive routing 01304 NodeVector* nextHops = findNode(routeMsg->getDestKey(), 01305 recNumRedundantNodes, 01306 numSiblings, routeMsg); 01307 01308 if (nextHops->size() == 0) { 01309 EV << "[BaseOverlay::sendToKey() @ " << thisNode.ip 01310 << " (" << thisNode.key.toString(16) << ")]\n" 01311 << " FindNode() returned NULL - dropping message" 01312 << endl; 01313 //std::cout << simTime() << " " << thisNode.ip << " " << state 01314 // << " FindNode() returned NULL - dropping message " 01315 // << routeMsg->name() << " from " 01316 // << routeMsg->getSrcNode() << std::endl; 01317 // statistics 01318 RECORD_STATS(numDropped++; bytesDropped += routeMsg->byteLength()); 01319 delete routeMsg; 01320 } else { 01321 // delete message if the hop count maximum is exceeded 01322 if (routeMsg->getHopCount() >= hopCountMax) { 01323 01324 EV << "[BaseOverlay::sendToKey() @ " << thisNode.ip 01325 << " (" << thisNode.key.toString(16) << ")]\n" 01326 << " Discards " << routeMsg->name() << " from " 01327 << routeMsg->getSrcNode().ip << "\n" 01328 << " The hop count maximum has been exceeded (" 01329 << routeMsg->getHopCount() << ">=" 01330 << hopCountMax << ")" 01331 << endl; 01332 // statistics 01333 RECORD_STATS(numDropped++; 01334 bytesDropped += routeMsg->byteLength()); 01335 delete routeMsg; 01336 delete nextHops; 01337 return; 01338 } 01339 01340 OverlayCtrlInfo* overlayCtrlInfo = 01341 dynamic_cast<OverlayCtrlInfo*>(routeMsg->controlInfo()); 01342 assert(overlayCtrlInfo); 01343 01344 // check and choose nextHop candidate 01345 NodeHandle* nextHop = NULL; 01346 bool err, isSibling; 01347 isSibling = isSiblingFor(thisNode, routeMsg->getDestKey(), 01348 numSiblings, &err); 01349 01350 for (uint index = 0; nextHop == NULL && nextHops->size() > index; 01351 ++index) { 01352 nextHop = &((*nextHops)[index]); 01353 // loop detection 01354 if (((overlayCtrlInfo->getLastHop() == *nextHop) && 01355 (*nextHop != thisNode)) || 01356 // do not forward msg to source node 01357 ((*nextHop == routeMsg->getSrcNode()) && 01358 (thisNode != routeMsg->getSrcNode())) || 01359 // nextHop is thisNode, but isSiblingFor() is false 01360 ((*nextHop == thisNode) && (!isSibling))) { 01361 nextHop = NULL; 01362 } 01363 } 01364 01365 if (nextHop == NULL) { 01366 if (!checkFindNode(routeMsg)) { 01367 EV << "[BaseOverlay::sendToKey() @ " << thisNode.ip 01368 << " (" << thisNode.key.toString(16) << ")]\n" 01369 << " Discards " << routeMsg->name() << " from " 01370 << routeMsg->getSrcNode().ip << "\n" 01371 << " No useful nextHop found!" 01372 << endl; 01373 //std::cout << thisNode.ip << " packet dropped" << std::endl; 01374 RECORD_STATS(numDropped++; 01375 bytesDropped += routeMsg->byteLength()); 01376 } 01377 delete routeMsg; 01378 delete nextHops; 01379 return; 01380 } 01381 01382 assert(!nextHop->isUnspecified()); 01383 01384 // callForward to app 01385 if (useCommonAPIforward && 01386 dynamic_cast<BaseAppDataMessage*>( 01387 routeMsg->encapsulatedMsg()) && 01388 routeMsg->contextPointer() == NULL) { 01389 callForward(routeMsg->getDestKey(), routeMsg, *nextHop); 01390 delete nextHops; 01391 return; 01392 } 01393 //message marked as not already forwarded 01394 routeMsg->setContextPointer(NULL); 01395 01396 // is this node responsible? 01397 if (*nextHop == thisNode) { 01398 if (isSibling && !err) { 01399 //EV << "[BaseOverlay::sendToKey() @ " << thisNode.ip 01400 // << " (" << thisNode.key.toString(16) << ")]\n" 01401 // << " Forwards msg for key " << routeMsg->getDestKey() "\n" 01402 // << " to node " << (*nextHops)[0] 01403 // << endl; 01404 delete nextHops; 01405 assert(routeMsg->controlInfo()); 01406 handleBaseOverlayMessage(routeMsg, key); 01407 return; 01408 } else { 01409 error("isSiblingsFor() is true with an error: " 01410 "Erroneous method isSiblingFor()!"); 01411 } 01412 } // else forward msg if this node is not responsible for the key 01413 01414 // records statistics, if we forward this message 01415 if (overlayCtrlInfo->getLastHop().ip != thisNode.ip) { 01416 if (routeMsg->getStatType() == APP_DATA_STAT) { 01417 RECORD_STATS(numAppDataForwarded++; bytesAppDataForwarded += 01418 routeMsg->byteLength()); 01419 } else if (routeMsg->getStatType() == APP_LOOKUP_STAT){ 01420 RECORD_STATS(numAppLookupForwarded++; 01421 bytesAppLookupForwarded += 01422 routeMsg->byteLength()); 01423 } else { 01424 RECORD_STATS(numMaintenanceForwarded++; 01425 bytesMaintenanceForwarded += 01426 routeMsg->byteLength()); 01427 } 01428 } 01429 overlayCtrlInfo->setHopCount(routeMsg->getHopCount()); 01430 if (forwardMessageRecursive(*nextHop, routeMsg)) { 01431 delete routeMsg->removeControlInfo(); 01432 sendRouteMessage(*nextHop, routeMsg, routeMsgAcks); 01433 } 01434 } 01435 delete nextHops; 01436 } 01437 }
AbstractLookup * BaseOverlay::createLookup | ( | RoutingType | routingType = DEFAULT_ROUTING , |
|
const BaseOverlayMessage * | msg = NULL , |
|||
const cObject * | findNodeExt = NULL , |
|||
bool | appLookup = false | |||
) | [protected, virtual] |
Creates an abstract iterative lookup instance.
routingType | The routing type for this lookup (e.g. recursive/iterative) | |
msg | pointer to the message for which the lookup is created. Derived classes can use it to construct an object with additional info for the lookup class. | |
findNodeExt | object that will be sent with the findNodeCalls | |
appLookup | Set to true, if lookup is triggered by application (for statistics) |
Reimplemented in BasePastry.
Referenced by BasePastry::createLookup(), Kademlia::handleBucketRefreshTimerExpired(), lookupRpc(), and sendToKey().
01460 { 01461 AbstractLookup* newLookup; 01462 01463 if (routingType == DEFAULT_ROUTING) { 01464 routingType = defaultRoutingType; 01465 } 01466 01467 switch (routingType) { 01468 case ITERATIVE_ROUTING: 01469 case EXHAUSTIVE_ITERATIVE_ROUTING: 01470 newLookup = new IterativeLookup(this, routingType, 01471 iterativeLookupConfig, findNodeExt, 01472 appLookup); 01473 break; 01474 case RECURSIVE_SOURCE_ROUTING: 01475 case SEMI_RECURSIVE_ROUTING: 01476 case FULL_RECURSIVE_ROUTING: 01477 newLookup = new RecursiveLookup(this, routingType, appLookup); 01478 break; 01479 default: 01480 throw new cRuntimeError("BaseOverlay::createLookup():" 01481 " Unknown routingType!"); 01482 break; 01483 } 01484 01485 lookups.insert(newLookup); 01486 return newLookup; 01487 }
void BaseOverlay::removeLookup | ( | AbstractLookup * | lookup | ) | [protected, virtual] |
Removes the abstract lookup instance.
lookup | the Lookup to remove |
Referenced by IterativeLookup::~IterativeLookup(), and RecursiveLookup::~RecursiveLookup().
01490 { 01491 lookups.erase(lookup); 01492 }
OverlayKey BaseOverlay::distance | ( | const OverlayKey & | x, | |
const OverlayKey & | y | |||
) | const [protected, virtual] |
This method should implement the distance between two keys.
It may be overloaded to implement a new metric. The default implementation uses the standard-metric d = abs(x-y).
x | Left-hand-side Key | |
y | Right-hand-side key |
Reimplemented in Chord, and Kademlia.
Referenced by IterativeLookup::compare().
01497 { 01498 opp_error("BaseOverlay::distance(): Not implemented!"); 01499 return OverlayKey::UNSPECIFIED_KEY; 01500 }
NodeVector * BaseOverlay::findNode | ( | const OverlayKey & | key, | |
int | numRedundantNodes, | |||
int | numSiblings, | |||
BaseOverlayMessage * | msg = NULL | |||
) | [protected, virtual] |
Implements the find node call.
This method simply returns the closest nodes known in the corresponding routing topology. If the node is a sibling for this key (isSiblingFor(key) = true), this method returns all numSiblings siblings, with the closest neighbor to the key first.
key | The lookup key. | |
numRedundantNodes | Maximum number of next hop nodes to return. | |
numSiblings | number of siblings to return | |
msg | A pointer to the BaseRouteMessage or FindNodeCall message of this lookup. |
Reimplemented in Broose, Chord, Kademlia, Koorde, and BasePastry.
Referenced by findNodeRpc(), IterativePathLookup::handleTimeout(), local_lookup(), sendToKey(), and IterativeLookup::start().
void BaseOverlay::joinOverlay | ( | ) | [protected, virtual] |
Join the overlay with a given nodeID in thisNode.key.
Join the overlay with a given nodeID in thisNode.key. This method may be called by an application to join the overlay with a specific nodeID. It is also called if the node's IP address changes.
Reimplemented in Bamboo, Broose, Chord, Gia, Kademlia, and Pastry.
Referenced by handleTransportAddressChangedNotification(), internalHandleRpcTimeout(), join(), and BasePastry::pingResponse().
01514 { 01515 // std::cout << "BaseOverlay::joinOverlay(): Not implemented!" << endl; 01516 return; 01517 }
void BaseOverlay::joinForeignPartition | ( | const NodeHandle & | node | ) | [protected, virtual] |
Join another overlay partition with the given node as bootstrap node.
Join another overlay partition with the given node as bootstrap node. This method is called to join a foreign overlay partition and start the merging process.
node | The foreign bootstrap node |
Reimplemented in Chord.
Referenced by BootstrapList::handleLookupResponse().
00553 { 00554 throw new cRuntimeError("BaseOverlay::joinForeignPartition(): " 00555 "This overlay doesn't support merging!"); 00556 }
bool BaseOverlay::handleFailedNode | ( | const TransportAddress & | failed | ) | [protected, virtual] |
Handles a failed node.
This method is called whenever a node given by findNode() was unreachable. The default implementation does nothing at all.
failed | the failed node |
Reimplemented in Bamboo, Kademlia, and Pastry.
Referenced by failedNodeRpc(), IterativePathLookup::handleTimeout(), internalHandleRpcTimeout(), and BasePastry::pingTimeout().
void BaseOverlay::lookupRpc | ( | LookupCall * | call | ) | [protected, virtual] |
Referenced by internalHandleRpc().
01732 { 01733 // create lookup and sent to key 01734 AbstractLookup* lookup = createLookup(DEFAULT_ROUTING, call, NULL, true); 01735 lookup->lookup(call->getKey(), call->getNumSiblings(), hopCountMax, 01736 1, new SendToKeyListener( this, call )); 01737 01738 }
void BaseOverlay::nextHopRpc | ( | NextHopCall * | call | ) | [protected, virtual] |
Referenced by internalHandleRpc().
01741 { 01742 //test 01743 if (state != READY) { 01744 delete call; 01745 return; 01746 } 01747 01748 BaseRouteMessage* routeMsg 01749 = check_and_cast<BaseRouteMessage*>(call->decapsulate()); 01750 01751 OverlayCtrlInfo* overlayCtrlInfo = 01752 check_and_cast<OverlayCtrlInfo*>(call->controlInfo()->dup()); 01753 overlayCtrlInfo->setHopCount(routeMsg->getHopCount()); 01754 overlayCtrlInfo->setSrcNode(routeMsg->getSrcNode()); 01755 overlayCtrlInfo->setRoutingType(routeMsg->getRoutingType()); 01756 01757 routeMsg->setControlInfo(overlayCtrlInfo); 01758 assert(routeMsg->controlInfo()); 01759 01760 std::string temp("ACK: ["); 01761 (temp += routeMsg->name()) += "]"; 01762 01763 NextHopResponse* response 01764 = new NextHopResponse(temp.c_str()); 01765 response->setLength(NEXTHOPRESPONSE_L(response)); 01766 sendRpcResponse(call, response); 01767 01768 handleBaseOverlayMessage(routeMsg, routeMsg->getDestKey()); 01769 }
void BaseOverlay::countFindNodeCall | ( | const FindNodeCall * | call | ) | [protected] |
Referenced by IterativePathLookup::sendRpc().
01652 { 01653 RECORD_STATS(numFindNodeSent++; 01654 bytesFindNodeSent += call->byteLength()); 01655 }
void BaseOverlay::countFailedNodeCall | ( | const FailedNodeCall * | call | ) | [protected] |
Referenced by IterativePathLookup::handleTimeout().
01658 { 01659 RECORD_STATS(numFailedNodeSent++; 01660 bytesFailedNodeSent += call->byteLength()); 01661 }
bool BaseOverlay::internalHandleRpc | ( | BaseCallMessage * | msg | ) | [protected, virtual] |
Handles internal rpc requests.
This method is used to implement basic functionionality in the BaseRpc.
msg | The call message |
Reimplemented from BaseRpc.
01530 { 01531 // call rpc stubs 01532 RPC_SWITCH_START( msg ); 01533 RPC_DELEGATE( FindNode, findNodeRpc ); 01534 RPC_DELEGATE( FailedNode, failedNodeRpc ); 01535 RPC_DELEGATE( Lookup, lookupRpc ); 01536 RPC_DELEGATE( NextHop, nextHopRpc ); 01537 RPC_SWITCH_END( ); 01538 01539 // if RPC was handled return true, else tell the parent class to handle it 01540 return RPC_HANDLED || BaseRpc::internalHandleRpc(msg); 01541 }
bool BaseOverlay::internalHandleRpcResponse | ( | BaseResponseMessage * | msg, | |
cPolymorphic * | context, | |||
int | rpcId, | |||
simtime_t | rtt | |||
) | [protected, virtual] |
Handles rpc responses internal in base classes
.
This method is used to implement basic functionionality in the BaseRpc.
msg | The call message | |
context | Pointer to an optional state object. The object has to be handled/deleted by the internalHandleRpcResponse() code | |
rpcId | The ID of the call | |
rtt | the time between sending the call and receiving the response |
Reimplemented from BaseRpc.
01546 { 01547 // if RPC was handled return true, else tell the parent class to handle it 01548 //RPC_SWITCH_START( msg ); 01549 //RPC_ON_RESPONSE( NextHop ) { 01550 //if (rtt > 1.0) std::cout << rtt << " to " 01551 // << msg->getSrcNode() << std::endl; 01552 //} 01553 //RPC_SWITCH_END( ); 01554 01555 return /*RPC_HANDLED ||*/ BaseRpc::internalHandleRpcResponse(msg, context, 01556 rpcId, rtt); 01557 }
void BaseOverlay::internalHandleRpcTimeout | ( | BaseCallMessage * | msg, | |
const TransportAddress & | dest, | |||
cPolymorphic * | context, | |||
int | rpcId, | |||
const OverlayKey & | destKey | |||
) | [protected, virtual] |
Handles rpc timeouts internal in base classes
.
This method is used to implement basic functionality in the BaseRpc.
msg | The call message | |
dest | The node that did not response | |
context | Pointer to an optional state object. The object has to be handled/deleted by the internalHandleRpcResponse() code | |
rpcId | The ID of the call | |
destKey | The key of the call if used |
Reimplemented from BaseRpc.
01563 { 01564 RPC_SWITCH_START( msg ) 01565 RPC_ON_CALL( NextHop ) 01566 { 01567 //std::cout << "nextHopRpc timeout" << std::endl; 01568 BaseRouteMessage* tempMsg 01569 = check_and_cast<BaseRouteMessage*>(msg->decapsulate()); 01570 01571 if (!tempMsg->controlInfo()) { 01572 OverlayCtrlInfo* overlayCtrlInfo = new OverlayCtrlInfo; 01573 overlayCtrlInfo->setLastHop(thisNode); 01574 overlayCtrlInfo->setHopCount(tempMsg->getHopCount()); 01575 overlayCtrlInfo->setSrcNode(tempMsg->getSrcNode()); 01576 overlayCtrlInfo->setRoutingType(tempMsg->getRoutingType());//test 01577 overlayCtrlInfo->setTransportType(UDP_TRANSPORT); 01578 tempMsg->setControlInfo(overlayCtrlInfo); 01579 } 01580 // remove node from local routing tables 01581 // + send message again 01582 if (handleFailedNode(dest)) 01583 handleBaseOverlayMessage(tempMsg, destKey); 01584 else { 01585 delete tempMsg; 01586 //std::cout << thisNode.ip << " ***" << std::endl; 01587 RECORD_STATS(numDropped++; 01588 bytesDropped += tempMsg->byteLength()); 01589 joinOverlay(); 01590 } 01591 break; 01592 } 01593 RPC_SWITCH_END( ) 01594 01595 BaseRpc::internalHandleRpcTimeout(msg, dest, context, rpcId, destKey); 01596 }
void BaseOverlay::internalSendRouteRpc | ( | BaseRpcMessage * | message, | |
const OverlayKey & | destKey, | |||
const std::vector< TransportAddress > & | sourceRoute, | |||
RoutingType | routingType | |||
) | [protected, virtual] |
CompType BaseOverlay::getThisCompType | ( | ) | [protected, virtual] |
Return the component type of this module.
This method is overloaded by BaseOverlay/BaseApp and returns the appropriate component type of this module.
Implements BaseRpc.
Referenced by Vast::changeState(), PubSubMMOG::handleAppMessage(), PubSubMMOG::handleSubscriptionResponse(), PubSubMMOG::handleTimerEvent(), and Vast::receiveChangeNotification().
void BaseOverlay::internalSendRpcResponse | ( | BaseCallMessage * | call, | |
BaseResponseMessage * | response | |||
) | [private, virtual] |
Implements BaseRpc.
01613 { 01614 OverlayCtrlInfo* overlayCtrlInfo = 01615 check_and_cast<OverlayCtrlInfo*>(call->controlInfo()); 01616 01617 TransportType transportType = ROUTE_TRANSPORT; 01618 const TransportAddress* destNode; 01619 if (overlayCtrlInfo->getSrcNode().isUnspecified()) 01620 destNode = &(overlayCtrlInfo->getLastHop()); 01621 else 01622 destNode = &(overlayCtrlInfo->getSrcNode()); 01623 const OverlayKey* destKey = &OverlayKey::UNSPECIFIED_KEY; 01624 01625 RoutingType routingType 01626 = static_cast<RoutingType>(overlayCtrlInfo->getRoutingType()); 01627 01628 assert(overlayCtrlInfo->getTransportType() != INTERNAL_TRANSPORT); 01629 01630 if ((overlayCtrlInfo->getTransportType() == UDP_TRANSPORT) || 01631 (routingType == SEMI_RECURSIVE_ROUTING) || 01632 (routingType == ITERATIVE_ROUTING) || 01633 (routingType == EXHAUSTIVE_ITERATIVE_ROUTING)) { 01634 // received by UDP or direct response (IR, EIR or SRR routing) 01635 transportType = UDP_TRANSPORT; 01636 overlayCtrlInfo->setVisitedHopsArraySize(0); //??? 01637 } else if ((static_cast<RoutingType> (overlayCtrlInfo->getRoutingType()) 01638 == FULL_RECURSIVE_ROUTING)) { 01639 // full recursive routing 01640 destKey = &(overlayCtrlInfo->getSrcNode().key); 01641 destNode = &NodeHandle::UNSPECIFIED_NODE; 01642 } 01643 // else: source routing -> route back over visited hops 01644 01645 sendRpcResponse(transportType, 01646 static_cast<CompType>(overlayCtrlInfo->getSrcComp()), 01647 *destNode, *destKey, call, response); 01648 }
void BaseOverlay::registerComp | ( | CompType | compType, | |
cModule * | module | |||
) |
Referenced by initialize(), and BaseRpc::initRpcs().
01772 { 01773 cGate *gate = NULL; 01774 01775 if (module != NULL) 01776 gate = module->gate("direct_in"); 01777 01778 compModuleList[compType] = make_pair<cModule*, cGate*>(module, gate); 01779 }
cModule * BaseOverlay::getCompModule | ( | CompType | compType | ) |
Referenced by XmlRpcInterface::dumpDht(), XmlRpcInterface::get(), initialize(), XmlRpcInterface::p2pnsRegister(), XmlRpcInterface::p2pnsResolve(), and XmlRpcInterface::put().
01782 { 01783 CompModuleList::iterator it = compModuleList.find(compType); 01784 01785 if (it != compModuleList.end()) 01786 return it->second.first; 01787 else 01788 return NULL; 01789 }
cGate * BaseOverlay::getCompRpcGate | ( | CompType | compType | ) |
Referenced by callDeliver(), BaseApp::callRoute(), BaseApp::forwardResponse(), BaseRpc::sendRpcMessageWithTransport(), and setOverlayReady().
01792 { 01793 CompModuleList::iterator it = compModuleList.find(compType); 01794 01795 if (it != compModuleList.end()) 01796 return it->second.second; 01797 else 01798 return NULL; 01799 }
void BaseOverlay::sendMessageToAllComp | ( | cMessage * | msg, | |
CompType | srcComp | |||
) |
01802 { 01803 for (CompModuleList::iterator it = compModuleList.begin(); 01804 it != compModuleList.end(); it++) { 01805 01806 // don't send message to the origination component 01807 if (it->first != srcComp) 01808 sendDirect((cMessage*)msg->dup(), 0, it->second.second); 01809 } 01810 01811 delete msg; 01812 }
bool BaseOverlay::providesKbr | ( | ) | [inline] |
void BaseOverlay::findNodeRpc | ( | FindNodeCall * | call | ) | [private] |
Referenced by checkFindNode(), and internalHandleRpc().
01665 { 01666 // if this node is malicious don't answer a findNodeCall 01667 if (isMalicious()) { 01668 EV << "[BaseOverlay::findNodeRpc() @ " << thisNode.ip 01669 << " (" << thisNode.key.toString(16) << ")]\n" 01670 << " Node ignores findNodeCall because this node is malicious" 01671 << endl; 01672 delete call; 01673 return; 01674 } 01675 01676 FindNodeResponse* findNodeResponse = 01677 new FindNodeResponse("FindNodeResponse"); 01678 01679 NodeVector* nextHops = findNode(call->getLookupKey(), 01680 call->getNumRedundantNodes(), 01681 call->getNumSiblings(), call); 01682 01683 findNodeResponse->setClosestNodesArraySize(nextHops->size()); 01684 01685 for (uint i=0; i < nextHops->size(); i++) { 01686 findNodeResponse->setClosestNodes(i, (*nextHops)[i]); 01687 } 01688 01689 bool err; 01690 if (isSiblingFor(thisNode, call->getLookupKey(), call->getNumSiblings(), 01691 &err)) { 01692 findNodeResponse->setSiblings(true); 01693 } 01694 01695 findNodeResponse->setLength(FINDNODERESPONSE_L(findNodeResponse)); 01696 01697 if (call->hasObject("findNodeExt")) { 01698 cMessage* findNodeExt = (cMessage*)call->removeObject("findNodeExt"); 01699 findNodeResponse->addObject(findNodeExt); 01700 findNodeResponse->addLength(findNodeExt->length()); 01701 } 01702 01703 RECORD_STATS(numFindNodeResponseSent++; bytesFindNodeResponseSent += 01704 findNodeResponse->byteLength()); 01705 01706 delete nextHops; 01707 01708 sendRpcResponse(call, findNodeResponse); 01709 }
void BaseOverlay::failedNodeRpc | ( | FailedNodeCall * | call | ) | [private] |
Referenced by internalHandleRpc().
01712 { 01713 FailedNodeResponse* failedNodeResponse = 01714 new FailedNodeResponse("FailedNodeResponse"); 01715 failedNodeResponse->setTryAgain(handleFailedNode(call->getFailedNode())); 01716 failedNodeResponse->setLength(FAILEDNODERESPONSE_L(failedNodeResponse)); 01717 01718 if (call->hasObject("findNodeExt")) { 01719 cMessage* findNodeExt = check_and_cast<cMessage*>( 01720 call->removeObject("findNodeExt")); 01721 failedNodeResponse->addObject(findNodeExt); 01722 failedNodeResponse->addLength(findNodeExt->length()); 01723 } 01724 01725 RECORD_STATS(numFailedNodeResponseSent++; bytesFailedNodeResponseSent += 01726 failedNodeResponse->byteLength()); 01727 01728 sendRpcResponse(call, failedNodeResponse); 01729 }
friend class IterativeLookup [friend] |
Referenced by createLookup().
friend class RecursiveLookup [friend] |
Referenced by createLookup().
friend class IterativePathLookup [friend] |
friend class BootstrapList [friend] |
friend class SendToKeyListener [friend] |
Referenced by lookupRpc(), and sendToKey().
int BaseOverlay::numAppDataSent [private] |
Referenced by finish(), initialize(), and sendMessageToUDP().
int BaseOverlay::bytesAppDataSent [private] |
Referenced by finish(), initialize(), and sendMessageToUDP().
int BaseOverlay::numAppLookupSent [private] |
Referenced by finish(), initialize(), and sendMessageToUDP().
int BaseOverlay::bytesAppLookupSent [private] |
Referenced by finish(), initialize(), and sendMessageToUDP().
int BaseOverlay::numMaintenanceSent [private] |
Referenced by finish(), initialize(), and sendMessageToUDP().
int BaseOverlay::bytesMaintenanceSent [private] |
Referenced by finish(), initialize(), and sendMessageToUDP().
int BaseOverlay::numAppDataReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::bytesAppDataReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::numAppLookupReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::bytesAppLookupReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::numMaintenanceReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::bytesMaintenanceReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::numInternalSent [private] |
Referenced by initialize(), and sendMessageToUDP().
int BaseOverlay::bytesInternalSent [private] |
Referenced by initialize(), and sendMessageToUDP().
int BaseOverlay::numInternalReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::bytesInternalReceived [private] |
Referenced by finish(), handleMessage(), and initialize().
int BaseOverlay::numAppDataForwarded [protected] |
Referenced by finish(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), initialize(), and sendToKey().
int BaseOverlay::bytesAppDataForwarded [protected] |
Referenced by finish(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), initialize(), and sendToKey().
int BaseOverlay::numAppLookupForwarded [protected] |
Referenced by finish(), initialize(), and sendToKey().
int BaseOverlay::bytesAppLookupForwarded [protected] |
Referenced by finish(), initialize(), and sendToKey().
int BaseOverlay::numMaintenanceForwarded [protected] |
Referenced by finish(), initialize(), and sendToKey().
int BaseOverlay::bytesMaintenanceForwarded [protected] |
Referenced by finish(), initialize(), and sendToKey().
int BaseOverlay::numFindNodeSent [protected] |
Referenced by countFindNodeCall(), finish(), initialize(), and IterativeLookup::sendRpc().
int BaseOverlay::bytesFindNodeSent [protected] |
Referenced by countFindNodeCall(), finish(), initialize(), and IterativeLookup::sendRpc().
int BaseOverlay::numFindNodeResponseSent [protected] |
Referenced by findNodeRpc(), finish(), and initialize().
int BaseOverlay::bytesFindNodeResponseSent [protected] |
Referenced by findNodeRpc(), finish(), and initialize().
int BaseOverlay::numFailedNodeSent [protected] |
Referenced by countFailedNodeCall(), finish(), and initialize().
int BaseOverlay::bytesFailedNodeSent [protected] |
Referenced by countFailedNodeCall(), finish(), and initialize().
int BaseOverlay::numFailedNodeResponseSent [protected] |
Referenced by failedNodeRpc(), finish(), and initialize().
int BaseOverlay::bytesFailedNodeResponseSent [protected] |
Referenced by failedNodeRpc(), finish(), and initialize().
std::vector<HopDelayRecord*> BaseOverlay::singleHopDelays [protected] |
Referenced by finish(), and handleBaseOverlayMessage().
simtime_t BaseOverlay::creationTime [protected] |
BootstrapOracle* BaseOverlay::bootstrapOracle [protected] |
pointer to BootstrapOracle in this node
Reimplemented from TopologyVis.
Referenced by BaseOverlay(), Vast::changeState(), Vast::finishOverlay(), BootstrapList::getBootstrapNode(), initialize(), PubSubMMOG::initializeOverlay(), isMalicious(), BootstrapList::removeBootstrapNode(), and setOverlayReady().
NotificationBoard* BaseOverlay::notificationBoard [protected] |
UnderlayConfigurator* BaseOverlay::underlayConfigurator [protected] |
pointer to UnderlayConfigurator in this node
Referenced by BasePastry::baseInit(), BaseOverlay(), and initialize().
BootstrapList* BaseOverlay::bootstrapList [protected] |
pointer to the BootstrapList module
Referenced by BasePastry::baseChangeState(), BaseOverlay(), Gia::changeState(), Chord::changeState(), Broose::changeState(), Gia::finishOverlay(), Chord::finishOverlay(), Broose::finishOverlay(), BasePastry::finishOverlay(), Vast::handleJoin(), Gia::handleTimerEvent(), initialize(), Kademlia::joinOverlay(), and setOverlayReady().
bool BaseOverlay::debugOutput [protected] |
debug output ?
Reimplemented from BaseRpc.
Referenced by Gia::acceptNode(), Vast::changeState(), Gia::changeState(), Chord::changeState(), Pastry::checkProxCache(), Gia::deliverSearchResult(), Gia::forwardMessage(), Vast::handleAppMessage(), handleMessage(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), Vast::handleUDPMessage(), Pastry::handleUDPMessage(), Gia::handleUDPMessage(), Bamboo::handleUDPMessage(), initialize(), Vast::receiveChangeNotification(), Gia::removeNeighbor(), route(), Vast::sendDiscardNode(), Vast::sendMessage(), sendMessageToUDP(), Vast::sendToApp(), and sendToKey().
RoutingType BaseOverlay::defaultRoutingType [protected] |
bool BaseOverlay::useCommonAPIforward [protected] |
forward messages to applications?
Referenced by initialize(), Chord::initializeOverlay(), and sendToKey().
bool BaseOverlay::collectPerHopDelay [protected] |
collect delay for single hops
Referenced by finish(), handleBaseOverlayMessage(), initialize(), and sendToKey().
bool BaseOverlay::routeMsgAcks [protected] |
send ACK when receiving route message
Referenced by BasePastry::forwardMessageRecursive(), initialize(), SendToKeyListener::lookupFinished(), and sendToKey().
uint BaseOverlay::recNumRedundantNodes [protected] |
bool BaseOverlay::drawOverlayTopology [protected] |
Referenced by initialize().
int BaseOverlay::localPort [protected] |
int BaseOverlay::hopCountMax [protected] |
int BaseOverlay::numDropped [protected] |
number of dropped packets
Referenced by finish(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), handleBaseOverlayMessage(), handleMessage(), Gia::handleUDPMessage(), initialize(), internalHandleRpcTimeout(), SendToKeyListener::lookupFinished(), Gia::route(), and sendToKey().
int BaseOverlay::bytesDropped [protected] |
number of dropped bytes
Referenced by finish(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), handleBaseOverlayMessage(), handleMessage(), Gia::handleUDPMessage(), initialize(), internalHandleRpcTimeout(), SendToKeyListener::lookupFinished(), Gia::route(), and sendToKey().
cOutVector BaseOverlay::delayVector [protected] |
statistical output vector for packet-delays
cOutVector BaseOverlay::hopCountVector [protected] |
statistical output vector for hop-counts
States BaseOverlay::state [protected] |
Referenced by BasePastry::baseChangeState(), Pastry::changeState(), Koorde::changeState(), Gia::changeState(), Chord::changeState(), Pastry::checkProxCache(), Bamboo::checkProxCache(), Koorde::findNode(), Chord::findNode(), BasePastry::findNode(), Vast::handleAppMessage(), PubSubMMOG::handleAppMessage(), Gia::handleAppMessage(), Kademlia::handleBucketRefreshTimerExpired(), Koorde::handleDeBruijnTimerExpired(), Pastry::handleFailedNode(), Bamboo::handleFailedNode(), Chord::handleFixFingersTimerExpired(), PubSubMMOG::handleJoinResponse(), Chord::handleJoinTimerExpired(), BasePastry::handleRequestMessage(), Koorde::handleRpc(), Chord::handleRpc(), Kademlia::handleRpcResponse(), Kademlia::handleRpcTimeout(), Chord::handleStabilizeTimerExpired(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), PubSubMMOG::handleSubscriptionResponse(), Pastry::handleTimerEvent(), Vast::handleUDPMessage(), Pastry::handleUDPMessage(), Gia::handleUDPMessage(), Bamboo::handleUDPMessage(), PubSubMMOG::initializeOverlay(), Kademlia::isSiblingFor(), Chord::isSiblingFor(), Kademlia::joinOverlay(), Kademlia::lookupFinished(), nextHopRpc(), BasePastry::pingTimeout(), Vast::receiveChangeNotification(), PubSubMMOG::receiveChangeNotification(), Gia::route(), Kademlia::routingInit(), Vast::setBootstrapedIcon(), and PubSubMMOG::setBootstrapedIcon().
Referenced by createLookup(), initialize(), and Chord::initializeOverlay().
LookupSet BaseOverlay::lookups [protected] |
Referenced by createLookup(), finishLookups(), initLookups(), and removeLookup().
bool BaseOverlay::kbr [protected] |
set this to true, if the overlay provides KBR services
Referenced by initialize(), Pastry::initializeOverlay(), Kademlia::initializeOverlay(), Chord::initializeOverlay(), Broose::initializeOverlay(), Bamboo::initializeOverlay(), and providesKbr().
CompModuleList BaseOverlay::compModuleList [private] |
Referenced by getCompModule(), getCompRpcGate(), initialize(), registerComp(), and sendMessageToAllComp().