#include <BasePastry.h>

Definition at line 49 of file BasePastry.h.
Public Member Functions | |
| virtual | ~BasePastry () |
| virtual void | pingResponse (PingResponse *pingResponse, cPolymorphic *context, int rpcId, simtime_t rtt) |
| void | pingTimeout (PingCall *call, const TransportAddress &dest, cPolymorphic *context, int rpcId) |
| int | getMaxNumSiblings () |
| Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol. | |
| int | getMaxNumRedundantNodes () |
| Query the maximum number of redundant next hop nodes that are returned by findNode(). | |
| virtual void | handleAppMessage (BaseOverlayMessage *msg) |
| processes messages from application | |
| virtual void | updateTooltip () |
| updates information shown in tk-environment | |
| virtual NodeVector * | findNode (const OverlayKey &key, int numRedundantNodes, int numSiblings, BaseOverlayMessage *msg) |
| Implements the find node call. | |
| virtual void | handleStateMessage (PastryStateMessage *msg)=0 |
| processes state messages, merging with own state tables | |
| virtual void | finishOverlay () |
| collects statistical data in derived class | |
| void | sendStateTables (const TransportAddress &destination, int type=PASTRY_STATE_STD,...) |
| send a PastryStateMessage directly to a node | |
| void | sendStateDelayed (const TransportAddress &destination) |
| send a standard state message with a small delay | |
| 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 AbstractLookup * | createLookup (RoutingType routingType=DEFAULT_ROUTING, const BaseOverlayMessage *msg=NULL, const cObject *dummy=NULL, bool appLookup=false) |
| Creates an abstract iterative lookup instance. | |
Public Attributes | |
| int | joins |
| int | joinTries |
| int | joinPartial |
| int | joinSeen |
| int | joinBytesSeen |
| int | joinReceived |
| int | joinBytesReceived |
| int | joinSent |
| int | joinBytesSent |
| int | stateSent |
| int | stateBytesSent |
| int | stateReceived |
| int | stateBytesReceived |
| int | repairReqSent |
| int | repairReqBytesSent |
| int | repairReqReceived |
| int | repairReqBytesReceived |
| int | stateReqSent |
| int | stateReqBytesSent |
| int | stateReqReceived |
| int | stateReqBytesReceived |
| int | totalLookups |
| int | responsibleLookups |
| int | routingTableLookups |
| int | closerNodeLookups |
| int | closerNodeLookupsFromNeighborhood |
| int | leafsetReqSent |
| int | leafsetReqBytesSent |
| int | leafsetReqReceived |
| int | leafsetReqBytesReceived |
| int | leafsetSent |
| int | leafsetBytesSent |
| int | leafsetReceived |
| int | leafsetBytesReceived |
| int | routingTableReqSent |
| int | routingTableReqBytesSent |
| int | routingTableReqReceived |
| int | routingTableReqBytesReceived |
| int | routingTableSent |
| int | routingTableBytesSent |
| int | routingTableReceived |
| int | routingTableBytesReceived |
| uint32_t | rowToAsk |
Protected Types | |
| enum | StateObject { ROUTINGTABLE, LEAFSET, NEIGHBORHOODSET } |
| enum | { PING_RECEIVED_STATE = 1, PING_NEXT_HOP = 2 } |
Protected Member Functions | |
| virtual void | changeState (int toState) |
| changes node state | |
| virtual void | checkProxCache (void)=0 |
| checks whether proxCache is complete, takes appropriate actions depending on the protocol state | |
| virtual bool | recursiveRoutingHook (const TransportAddress &dest, BaseRouteMessage *msg) |
| Hook for forwarded message in recursive lookup mode. | |
| void | purgeVectors (void) |
| delete all information/messages caching vectors, used for restarting overlay or finish() | |
| void | baseInit (void) |
| initializes parameters and variables used in both Bamboo and Pastry | |
| void | baseChangeState (int) |
| changes node state, but leaves specific behavour, scheduling tasks in particular, to the inheriting protocols | |
| void | doRoutingTableMaintenance () |
| periodic routing table maintenance requests the corresponding routing table row from one node in each row | |
| void | prePing (const PastryStateMessage *stateMsg) |
| ping all nodes in a given state message. | |
| void | pingNodes (void) |
| ping all nodes in the pastry state message pointed to by private member stateCache | |
| void | determineAliveTable (const PastryStateMessage *stateMsg) |
| change the aliveTable to match the given stateMsg. | |
| void | sendRequest (const TransportAddress &ask, int type) |
| send a request to a given node | |
| void | sendLeafset (const TransportAddress &tell, bool pull=false) |
| send the leafset to a node | |
| void | sendRoutingRow (const TransportAddress &tell, int row) |
| send a row of the routing table to a node | |
| void | handleRequestMessage (PastryRequestMessage *msg) |
| processes state messages, merging with own state tables | |
| void | handleLeafsetMessage (PastryLeafsetMessage *msg, bool mergeSender=false) |
| processes leafset messages, merging with own state tables | |
| void | newLeafs (void) |
| Pastry API: send newLeafs() to application if enabled. | |
Protected Attributes | |
| uint32_t | bitsPerDigit |
| uint32_t | numberOfLeaves |
| uint32_t | numberOfNeighbors |
| uint32_t | pingRetries |
| double | timeoutPing |
| double | readyWaitAmount |
| double | joinTimeoutAmount |
| double | pingCacheExpireTime |
| double | repairTimeout |
| double | sendStateWaitAmount |
| bool | enableNewLeafs |
| bool | useRegularNextHop |
| bool | alwaysSendUpdate |
| bool | optimizeLookup |
| bool | optimisticForward |
| bool | avoidDuplicates |
| simtime_t | nearNodeRtt |
| double | repairTaskTimeoutAmount |
| uint32_t | unspecNodes |
| uint32_t | pingedNodes |
| bool | nearNodeImproved |
| bool | sendPullFlag |
| bool | useDiscovery |
| bool | periodicMaintenance |
| TransportAddress * | leaf2ask |
| TransportAddress | bootstrapNode |
| NodeHandle | nearNode |
| simtime_t | lastStateChange |
| std::vector< PastryStateMsgHandle > | stReceived |
| State messages to process during join. | |
| std::vector < PastryStateMsgHandle > ::iterator | stReceivedPos |
| std::vector< TransportAddress > | notifyList |
| List of nodes to notify after join. | |
| PastryStateMsgHandle | stateCache |
| Handle for processing a single state message. | |
| std::queue< PastryStateMsgHandle > | stateCacheQueue |
| Queue of state messages waiting to be processed in READY state. | |
| PastryStateMsgProximity | aliveTable |
| Early update of leaf set: helper structure for marking known-dead nodes. | |
| std::map< TransportAddress, BaseRouteMessage * > | recFwdQueue |
| Queue of messages to be forwarded in recursive routing mode. | |
| uint32_t | joinHopCount |
| cMessage * | joinTimeout |
| cMessage * | readyWait |
| cMessage * | joinUpdateWait |
| std::vector< PastrySendState * > | sendStateWait |
| cMessage * | repairTaskTimeout |
| PastryRoutingTable * | routingTable |
| PastryLeafSet * | leafSet |
| PastryNeighborhoodSet * | neighborhoodSet |
Friends | |
| class | PastryLeafSet |
Classes | |
| struct | PingContext |
enum BasePastry::StateObject [protected] |
Definition at line 302 of file BasePastry.h.
00303 { 00304 ROUTINGTABLE, 00305 LEAFSET, 00306 NEIGHBORHOODSET 00307 };
anonymous enum [protected] |
Definition at line 320 of file BasePastry.h.
00321 { 00322 PING_RECEIVED_STATE = 1, 00323 PING_NEXT_HOP = 2 00324 };
| BasePastry::~BasePastry | ( | ) | [virtual] |
Definition at line 1090 of file BasePastry.cc.
01091 { 01092 cancelAndDelete(joinTimeout); 01093 01094 purgeVectors(); 01095 }
| void BasePastry::pingResponse | ( | PingResponse * | pingResponse, | |
| cPolymorphic * | context, | |||
| int | rpcId, | |||
| simtime_t | rtt | |||
| ) | [virtual] |
Reimplemented from BaseRpc.
Definition at line 430 of file BasePastry.cc.
00432 { 00433 EV << "[BasePastry::pingResponse() @ " << thisNode.ip 00434 << " (" << thisNode.key.toString(16) << ")]\n" 00435 << " Pong (or Ping-context from NeighborCache) received (from " 00436 << msg->getSrcNode().ip << ")" 00437 << endl; 00438 00439 const NodeHandle& src = msg->getSrcNode(); 00440 assert(!src.isUnspecified()); 00441 00442 // a node with the an equal ID has responded 00443 if ((src.key == thisNode.key) && (src.ip != thisNode.ip)) { 00444 EV << "[BasePastry::pingResponse() @ " << thisNode.ip 00445 << " (" << thisNode.key.toString(16) << ")]\n" 00446 << " a node with the an equal ID has responded, rejoining" << endl; 00447 //std::cout << "a node with the an equal ID has responded, rejoining" << std::endl; 00448 delete context; 00449 joinOverlay(); 00450 return; 00451 } 00452 00453 if (state == DISCOVERY) { 00454 if (nearNodeRtt > rtt) { 00455 nearNode = src; 00456 nearNodeRtt = rtt; 00457 nearNodeImproved = true; 00458 } 00459 } 00460 00461 //const NodeHandle* node; 00462 if (context != NULL && stateCache.msg && stateCache.prox) { 00463 PingContext* pingContext = check_and_cast<PingContext*>(context); 00464 if (pingContext->nonce != stateCache.nonce) { 00465 throw cRuntimeError("response doesn't fit stateCache"); 00466 } 00467 switch (pingContext->stateObject) { 00468 case ROUTINGTABLE: { 00469 /*node = &(stateCache.msg->getRoutingTable(pingContext->index)); 00470 if((node->isUnspecified()) || (*node != src)) { 00471 std::cout << simTime() << " " << thisNode.ip << " rt: state from " 00472 << stateCache.msg->getSender().ip << " *** failed: node " 00473 << node->ip << " src " << src.ip << std::endl; 00474 break; 00475 }*/ 00476 *(stateCache.prox->pr_rt.begin() + pingContext->index) = rtt; 00477 break; 00478 } 00479 case LEAFSET: { 00480 /*node = &(stateCache.msg->getLeafSet(pingContext->index)); 00481 if ((node->isUnspecified()) || (*node != src)) { 00482 std::cout << simTime() << " " << thisNode.ip << " ls: state from " 00483 << stateCache.msg->getSender().ip << " *** failed: node " 00484 << node->ip << " src " << src.ip << std::endl; 00485 break; 00486 }*/ 00487 *(stateCache.prox->pr_ls.begin() + pingContext->index) = rtt; 00488 break; 00489 } 00490 case NEIGHBORHOODSET: { 00491 /*node = &(stateCache.msg->getNeighborhoodSet(pingContext->index)); 00492 if((node->isUnspecified()) || (*node != src)) { 00493 std::cout << simTime() << " " << thisNode.ip << " ns: state from " 00494 << stateCache.msg->getSender().ip << " *** failed: node " 00495 << node->ip << " src " << src.ip << std::endl; 00496 break; 00497 }*/ 00498 *(stateCache.prox->pr_ns.begin() + pingContext->index) = rtt; 00499 break; 00500 } 00501 default: { 00502 throw cRuntimeError("wrong state object type!"); 00503 } 00504 } 00505 checkProxCache(); 00506 } 00507 delete context; //test 00508 00509 std::map<TransportAddress, BaseRouteMessage*>::iterator pos; 00510 if ((pos = recFwdQueue.find(src)) != recFwdQueue.end()) { 00511 // send message 00512 if (!optimisticForward) { 00513 sendMessageToUDP(pos->first, pos->second); 00514 } else if (!avoidDuplicates) { 00515 delete pos->second; 00516 } 00517 recFwdQueue.erase(pos); 00518 } 00519 }
| void BasePastry::pingTimeout | ( | PingCall * | call, | |
| const TransportAddress & | dest, | |||
| cPolymorphic * | context, | |||
| int | rpcId | |||
| ) | [virtual] |
Reimplemented from BaseRpc.
Definition at line 743 of file BasePastry.cc.
00747 { 00748 EV << "[BasePastry::sendStateDelayed() @ " << thisNode.ip 00749 << " (" << thisNode.key.toString(16) << ")]\n" 00750 << " Ping timeout occurred (" << dest.ip << ")" 00751 << endl; 00752 00753 // handle failed node 00754 if (state == READY) { 00755 handleFailedNode(dest); 00756 updateTooltip(); 00757 00758 // this could initiate a re-join, exit the handler in that 00759 // case because all local data was erased: 00760 if (state != READY) { 00761 delete context; 00762 return; 00763 } 00764 } 00765 00766 if (context && stateCache.msg && stateCache.prox && 00767 rpcId == PING_RECEIVED_STATE) { 00768 PingContext* pingContext = check_and_cast<PingContext*>(context); 00769 if (pingContext->nonce != stateCache.nonce) { 00770 std::stringstream temp; 00771 temp << thisNode << " timeout/call doesn't fit stateCache"; 00772 throw cRuntimeError(temp.str().c_str()); 00773 } 00774 //const NodeHandle* node; 00775 switch (pingContext->stateObject) { 00776 case ROUTINGTABLE: { 00777 /*if (pingContext->index >= 00778 stateCache.msg->getRoutingTableArraySize()) { 00779 std::cout << "*** FAILED ***" << std::endl; 00780 break; 00781 } 00782 node = &(stateCache.msg->getRoutingTable(pingContext->index)); 00783 if((node->isUnspecified()) || (dest != *node)) { 00784 std::cout << msg->getNonce() << " " << simTime() << " " << thisNode.ip << " rt: state from " 00785 << stateCache.msg->getSender().ip << " *** failed: node " 00786 << node->ip << " failed dest " << dest.ip << std::endl; 00787 break; 00788 }*/ 00789 *(stateCache.prox->pr_rt.begin() + pingContext->index) = 00790 PASTRY_PROX_INFINITE; 00791 break; 00792 } 00793 case LEAFSET: { 00794 /*if (pingContext->index >= 00795 stateCache.msg->getLeafSetArraySize()) { 00796 std::cout << "*** FAILED ***" << std::endl; 00797 break; 00798 } 00799 node = &(stateCache.msg->getLeafSet(pingContext->index)); 00800 if((node->isUnspecified()) || (dest != *node)) { 00801 std::cout << msg->getNonce() << " " << simTime() << " " << thisNode.ip << " ls: state from " 00802 << stateCache.msg->getSender().ip << " *** failed: node " 00803 << node->ip << " failed dest " << dest.ip << std::endl; 00804 break; 00805 }*/ 00806 *(stateCache.prox->pr_ls.begin() + pingContext->index) = 00807 PASTRY_PROX_INFINITE; 00808 break; 00809 } 00810 case NEIGHBORHOODSET: { 00811 /*if (pingContext->index >= 00812 stateCache.msg->getNeighborhoodSetArraySize()) { 00813 std::cout << "*** FAILED ***" << std::endl; 00814 break; 00815 } 00816 node = &(stateCache.msg->getNeighborhoodSet(pingContext->index)); 00817 if((node->isUnspecified()) || (dest != *node)) { 00818 std::cout << msg->getNonce() << " " << simTime() << " " << thisNode.ip << " ns: state from " 00819 << stateCache.msg->getSender().ip << " *** failed: node " 00820 << node->ip << " failed dest " << dest.ip << std::endl; 00821 break; 00822 }*/ 00823 *(stateCache.prox->pr_ns.begin() + pingContext->index) = 00824 PASTRY_PROX_INFINITE; 00825 break; 00826 } 00827 } 00828 checkProxCache(); 00829 } 00830 00831 delete context; 00832 00833 if (rpcId == PING_NEXT_HOP) { 00834 // handle forward queue entry 00835 std::map<TransportAddress, BaseRouteMessage*>::iterator pos; 00836 if ((pos = recFwdQueue.find(dest)) == recFwdQueue.end()) return; 00837 BaseRouteMessage* rmsg = pos->second; 00838 recFwdQueue.erase(pos); 00839 if (dynamic_cast<PastryJoinMessage*>(rmsg->getEncapsulatedMsg()) && 00840 rmsg->getDestKey() == thisNode.key) { 00841 //std::cout << "join timeout -> rejoin!"; 00842 changeState(INIT); 00843 return; 00844 } 00845 assert(rmsg->getControlInfo()); 00846 sendToKey(rmsg->getDestKey(), rmsg); 00847 } 00848 }
| int BasePastry::getMaxNumSiblings | ( | ) | [virtual] |
Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol.
Reimplemented from BaseOverlay.
Definition at line 1183 of file BasePastry.cc.
Referenced by findNode().
01184 { 01185 return (int) floor(numberOfLeaves/4.0); 01186 }
| int BasePastry::getMaxNumRedundantNodes | ( | ) | [virtual] |
Query the maximum number of redundant next hop nodes that are returned by findNode().
Reimplemented from BaseOverlay.
Definition at line 1188 of file BasePastry.cc.
Referenced by findNode().
| void BasePastry::handleAppMessage | ( | BaseOverlayMessage * | msg | ) | [virtual] |
processes messages from application
| msg | message from application |
Definition at line 1061 of file BasePastry.cc.
| void BasePastry::updateTooltip | ( | ) | [virtual] |
updates information shown in tk-environment
Definition at line 1066 of file BasePastry.cc.
Referenced by baseChangeState(), Pastry::checkProxCache(), Bamboo::checkProxCache(), Pastry::doJoinUpdate(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), and pingTimeout().
01067 { 01068 if (ev.isGUI()) { 01069 std::stringstream ttString; 01070 01071 // show our predecessor and successor in tooltip 01072 ttString << leafSet->getPredecessor() << endl << thisNode << endl 01073 << leafSet->getSuccessor(); 01074 01075 getParentModule()->getParentModule()->getDisplayString(). 01076 setTagArg("tt", 0, ttString.str().c_str()); 01077 getParentModule()->getDisplayString(). 01078 setTagArg("tt", 0, ttString.str().c_str()); 01079 getDisplayString().setTagArg("tt", 0, ttString.str().c_str()); 01080 01081 // draw arrows: 01082 showOverlayNeighborArrow(leafSet->getSuccessor(), true, 01083 "m=m,50,0,50,0;ls=red,1"); 01084 showOverlayNeighborArrow(leafSet->getPredecessor(), false, 01085 "m=m,50,100,50,100;ls=green,1"); 01086 01087 } 01088 }
| NodeVector * BasePastry::findNode | ( | const OverlayKey & | key, | |
| int | numRedundantNodes, | |||
| int | numSiblings, | |||
| BaseOverlayMessage * | msg | |||
| ) | [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 from BaseOverlay.
Definition at line 1193 of file BasePastry.cc.
01197 { 01198 if ((numRedundantNodes > getMaxNumRedundantNodes()) || 01199 (numSiblings > getMaxNumSiblings())) { 01200 01201 opp_error("(Pastry::findNode()) numRedundantNodes or numSiblings " 01202 "too big!"); 01203 } 01204 RECORD_STATS(totalLookups++); 01205 01206 NodeVector* nextHops = new NodeVector(numRedundantNodes); 01207 01208 const NodeHandle* next; 01209 PastryFindNodeExtData* findNodeExt = NULL; 01210 if (msg && msg->hasObject("findNodeExt")) { 01211 findNodeExt = 01212 check_and_cast<PastryFindNodeExtData*>(msg-> 01213 getObject("findNodeExt")); 01214 } 01215 01216 if (state != READY) { 01217 return nextHops; 01218 } else if (key.isUnspecified() || leafSet->isClosestNode(key)) { 01219 RECORD_STATS(responsibleLookups++); 01220 nextHops->add(thisNode); 01221 } else { 01222 // Send state tables on any JOIN message we see: 01223 if (findNodeExt) { 01224 const TransportAddress& stateRecipient = 01225 findNodeExt->getSendStateTo(); 01226 if (!stateRecipient.isUnspecified()) { 01227 RECORD_STATS(joinSeen++); 01228 sendStateTables(stateRecipient, PASTRY_STATE_JOIN, 01229 findNodeExt->getJoinHopCount(), false); 01230 } 01231 } 01232 01233 next = &(leafSet->getDestinationNode(key)); 01234 01235 if (next->isUnspecified()) { 01236 next = &(routingTable->lookupNextHop(key)); 01237 if (!next->isUnspecified()) { 01238 RECORD_STATS(routingTableLookups++); 01239 } 01240 } else { 01241 RECORD_STATS(responsibleLookups++); 01242 } 01243 01244 if (next->isUnspecified()) { 01245 RECORD_STATS(closerNodeLookups++); 01246 // call findCloserNode() on all state objects 01247 if (optimizeLookup) { 01248 const NodeHandle* tmp; 01249 next = &(routingTable->findCloserNode(key, true)); 01250 tmp = &(neighborhoodSet->findCloserNode(key, true)); 01251 01252 if ((! tmp->isUnspecified()) && 01253 (leafSet->isCloser(*tmp, key, *next))) { 01254 RECORD_STATS(closerNodeLookupsFromNeighborhood++); 01255 next = tmp; 01256 } 01257 01258 tmp = &(leafSet->findCloserNode(key, true)); 01259 if ((! tmp->isUnspecified()) && 01260 (leafSet->isCloser(*tmp, key, *next))) { 01261 RECORD_STATS(closerNodeLookupsFromNeighborhood--); 01262 next = tmp; 01263 } 01264 } else { 01265 next = &(routingTable->findCloserNode(key)); 01266 01267 if (next->isUnspecified()) { 01268 RECORD_STATS(closerNodeLookupsFromNeighborhood++); 01269 next = &(neighborhoodSet->findCloserNode(key)); 01270 } 01271 01272 if (next->isUnspecified()) { 01273 RECORD_STATS(closerNodeLookupsFromNeighborhood--); 01274 next = &(leafSet->findCloserNode(key)); 01275 } 01276 } 01277 } 01278 01279 if (!next->isUnspecified()) { 01280 if (findNodeExt) { 01281 findNodeExt->setJoinHopCount(findNodeExt->getJoinHopCount() + 1); 01282 } 01283 nextHops->add(*next); 01284 } 01285 } 01286 01287 bool err; 01288 01289 /* if we're a sibling, return all numSiblings */ 01290 if (isSiblingFor(thisNode, key, numSiblings, &err)) { 01291 if (err == false) { 01292 delete nextHops; 01293 return leafSet->createSiblingVector(key, numSiblings); 01294 } 01295 } 01296 01297 //TODO routingType, too slow, ... 01298 if (/*(nextHops->size() > 0) &&*/ (numRedundantNodes > 1)) { 01299 //memleak... comp should be a ptr and deleted in NodeVector::~NodeVector()... 01300 KeyDistanceComparator<KeyRingMetric> comp(key); 01301 //KeyDistanceComparator<KeyRingMetric>* comp = 01302 //new KeyDistanceComparator<KeyRingMetric>( key ); 01303 NodeVector* additionalHops = new NodeVector( numRedundantNodes, &comp ); 01304 01305 routingTable->findCloserNodes(key, additionalHops); 01306 leafSet->findCloserNodes(key, additionalHops); 01307 neighborhoodSet->findCloserNodes(key, additionalHops); 01308 01309 if (useRegularNextHop && (*additionalHops)[0] != (*nextHops)[0]) { 01310 for (uint32_t i = 0; i < additionalHops->size(); i++) { 01311 if ((*additionalHops)[i] != (*nextHops)[0]) 01312 nextHops->push_back((*additionalHops)[i]); 01313 } 01314 delete additionalHops; 01315 } else { 01316 delete nextHops; 01317 return additionalHops; 01318 } 01319 } 01320 return nextHops; 01321 }
| virtual void BasePastry::handleStateMessage | ( | PastryStateMessage * | msg | ) | [pure virtual] |
processes state messages, merging with own state tables
| msg | the pastry state message |
Implemented in Bamboo, and Pastry.
Referenced by handleLeafsetMessage().
| void BasePastry::finishOverlay | ( | ) | [virtual] |
collects statistical data in derived class
Reimplemented from BaseOverlay.
Definition at line 1097 of file BasePastry.cc.
01098 { 01099 // remove this node from the bootstrap list 01100 if (!thisNode.key.isUnspecified()) bootstrapList->removeBootstrapNode(thisNode); 01101 01102 // collect statistics 01103 simtime_t time = globalStatistics->calcMeasuredLifetime(creationTime); 01104 if(time == 0) return; 01105 01106 // join statistics 01107 //if (joinTries > joins) 01108 //std::cout << thisNode << " jt:" << joinTries << " j:" << joins << " jts:" 01109 // << joinTimeout->isScheduled() << " rws:" << readyWait->isScheduled() 01110 // << " state:" << state << " time:" << time << std::endl; 01111 // join is on the way... 01112 if (joinTries > 0 && joinTimeout->isScheduled()) joinTries--; 01113 if (joinTries > 0) { 01114 globalStatistics->addStdDev("Pastry: join success ratio", (double)joins / (double)joinTries); 01115 globalStatistics->addStdDev("Pastry: join tries", joinTries); 01116 } else if (state == READY) { 01117 // nodes has joined in init-/transition-phase 01118 globalStatistics->addStdDev("Pastry: join success ratio", 1); 01119 globalStatistics->addStdDev("Pastry: join tries", 1); 01120 } else { 01121 globalStatistics->addStdDev("Pastry: join success ratio", 0); 01122 globalStatistics->addStdDev("Pastry: join tries", 1); 01123 } 01124 01125 globalStatistics->addStdDev("Pastry: joins with missing replies from routing path/s", 01126 joinPartial / time); 01127 globalStatistics->addStdDev("Pastry: JOIN Messages seen/s", joinSeen / time); 01128 globalStatistics->addStdDev("Pastry: bytes of JOIN Messages seen/s", joinBytesSeen / time); 01129 globalStatistics->addStdDev("Pastry: JOIN Messages received/s", joinReceived / time); 01130 globalStatistics->addStdDev("Pastry: bytes of JOIN Messages received/s", 01131 joinBytesReceived / time); 01132 globalStatistics->addStdDev("Pastry: JOIN Messages sent/s", joinSent / time); 01133 globalStatistics->addStdDev("Pastry: bytes of JOIN Messages sent/s", joinBytesSent / time); 01134 globalStatistics->addStdDev("Pastry: STATE Messages sent/s", stateSent / time); 01135 globalStatistics->addStdDev("Pastry: bytes of STATE Messages sent/s", stateBytesSent / time); 01136 globalStatistics->addStdDev("Pastry: STATE Messages received/s", stateReceived / time); 01137 globalStatistics->addStdDev("Pastry: bytes of STATE Messages received/s", 01138 stateBytesReceived / time); 01139 globalStatistics->addStdDev("Pastry: REPAIR Requests sent/s", repairReqSent / time); 01140 globalStatistics->addStdDev("Pastry: bytes of REPAIR Requests sent/s", 01141 repairReqBytesSent / time); 01142 globalStatistics->addStdDev("Pastry: REPAIR Requests received/s", repairReqReceived / time); 01143 globalStatistics->addStdDev("Pastry: bytes of REPAIR Requests received/s", 01144 repairReqBytesReceived / time); 01145 globalStatistics->addStdDev("Pastry: STATE Requests sent/s", stateReqSent / time); 01146 globalStatistics->addStdDev("Pastry: bytes of STATE Requests sent/s", stateReqBytesSent / time); 01147 globalStatistics->addStdDev("Pastry: STATE Requests received/s", stateReqReceived / time); 01148 globalStatistics->addStdDev("Pastry: bytes of STATE Requests received/s", 01149 stateReqBytesReceived / time); 01150 01151 globalStatistics->addStdDev("Pastry: bytes of STATE Requests received/s", 01152 stateReqBytesReceived / time); 01153 01154 globalStatistics->addStdDev("Pastry: total number of lookups", totalLookups); 01155 globalStatistics->addStdDev("Pastry: responsible lookups", responsibleLookups); 01156 globalStatistics->addStdDev("Pastry: lookups in routing table", routingTableLookups); 01157 globalStatistics->addStdDev("Pastry: lookups using closerNode()", closerNodeLookups); 01158 globalStatistics->addStdDev("Pastry: lookups using closerNode() with result from " 01159 "neighborhood set", closerNodeLookupsFromNeighborhood); 01160 globalStatistics->addStdDev("Pastry: LEAFSET Requests sent/s", leafsetReqSent / time); 01161 globalStatistics->addStdDev("Pastry: bytes of LEAFSET Requests sent/s", leafsetReqBytesSent / time); 01162 globalStatistics->addStdDev("Pastry: LEAFSET Requests received/s", leafsetReqReceived / time); 01163 globalStatistics->addStdDev("Pastry: bytes of LEAFSET Requests received/s", 01164 leafsetReqBytesReceived / time); 01165 globalStatistics->addStdDev("Pastry: LEAFSET Messages sent/s", leafsetSent / time); 01166 globalStatistics->addStdDev("Pastry: bytes of LEAFSET Messages sent/s", leafsetBytesSent / time); 01167 globalStatistics->addStdDev("Pastry: LEAFSET Messages received/s", leafsetReceived / time); 01168 globalStatistics->addStdDev("Pastry: bytes of LEAFSET Messages received/s", 01169 leafsetBytesReceived / time); 01170 globalStatistics->addStdDev("Pastry: ROUTING TABLE Requests sent/s", routingTableReqSent / time); 01171 globalStatistics->addStdDev("Pastry: bytes of ROUTING TABLE Requests sent/s", routingTableReqBytesSent / time); 01172 globalStatistics->addStdDev("Pastry: ROUTING TABLE Requests received/s", routingTableReqReceived / time); 01173 globalStatistics->addStdDev("Pastry: bytes of ROUTING TABLE Requests received/s", 01174 routingTableReqBytesReceived / time); 01175 globalStatistics->addStdDev("Pastry: ROUTING TABLE Messages sent/s", routingTableSent / time); 01176 globalStatistics->addStdDev("Pastry: bytes of ROUTING TABLE Messages sent/s", routingTableBytesSent / time); 01177 globalStatistics->addStdDev("Pastry: ROUTING TABLE Messages received/s", routingTableReceived / time); 01178 globalStatistics->addStdDev("Pastry: bytes of ROUTING TABLE Messages received/s", 01179 routingTableBytesReceived / time); 01180 01181 }
| void BasePastry::sendStateTables | ( | const TransportAddress & | destination, | |
| int | type = PASTRY_STATE_STD, |
|||
| ... | ||||
| ) |
send a PastryStateMessage directly to a node
| destination | destination node | |
| type | the type of the state message to be sent | |
| ... | additional arguments for some types: PASTRY_STATE_JOIN: int hops number of hops to destination node PASTRY_STATE_JOIN: bool last mark the state message to originate from closest node found PASTRY_STATE_UPDATE: simtime_t* timestamp pointer use this timestamp for the uptade message |
Definition at line 656 of file BasePastry.cc.
Referenced by Pastry::doJoinUpdate(), Pastry::endProcessingState(), findNode(), handleRequestMessage(), Pastry::handleTimerEvent(), Pastry::handleUDPMessage(), and recursiveRoutingHook().
00657 { 00658 if (destination.ip == thisNode.ip) 00659 opp_error("Pastry: trying to send state to self!"); 00660 00661 int hops = 0; 00662 bool last = false; 00663 simtime_t timestamp = 0; 00664 00665 if ((type == PASTRY_STATE_JOIN) || (type == PASTRY_STATE_UPDATE)) { 00666 // additional parameters needed: 00667 va_list ap; 00668 va_start(ap, type); 00669 if (type == PASTRY_STATE_JOIN) { 00670 hops = va_arg(ap, int); 00671 last = static_cast<bool>(va_arg(ap, int)); 00672 } else { 00673 timestamp = *va_arg(ap, simtime_t*); 00674 } 00675 va_end(ap); 00676 } 00677 00678 // create new state msg and set special fields for some types: 00679 PastryStateMessage* stateMsg; 00680 if (type == PASTRY_STATE_JOIN) { 00681 stateMsg = new PastryStateMessage("STATE (Join)"); 00682 stateMsg->setJoinHopCount(hops); 00683 stateMsg->setLastHop(last); 00684 stateMsg->setTimestamp(simTime()); 00685 } else if (type == PASTRY_STATE_UPDATE) { 00686 stateMsg = new PastryStateMessage("STATE (Update)"); 00687 EV << "[BasePastry::sendStateTables() @ " << thisNode.ip 00688 << " (" << thisNode.key.toString(16) << ")]\n" 00689 << " sending state (update) to " << destination 00690 << endl; 00691 stateMsg->setTimestamp(timestamp); 00692 } else if (type == PASTRY_STATE_REPAIR) { 00693 stateMsg = new PastryStateMessage("STATE (Repair)"); 00694 stateMsg->setTimestamp(timestamp); 00695 EV << "[BasePastry::sendStateTables() @ " << thisNode.ip 00696 << " (" << thisNode.key.toString(16) << ")]\n" 00697 << " sending state (repair) to " << destination 00698 << endl; 00699 } else { 00700 stateMsg = new PastryStateMessage("STATE"); 00701 EV << "[BasePastry::sendStateTables() @ " << thisNode.ip 00702 << " (" << thisNode.key.toString(16) << ")]\n" 00703 << " sending state (standard) to " << destination 00704 << endl; 00705 } 00706 00707 // fill in standard content: 00708 stateMsg->setPastryMsgType(PASTRY_MSG_STATE); 00709 stateMsg->setStatType(MAINTENANCE_STAT); 00710 stateMsg->setPastryStateMsgType(type); 00711 stateMsg->setSender(thisNode); 00712 00713 // the following part of the new join works on the assumption, that the node 00714 // routing the join message is close to the joining node 00715 // therefore its switched on together with the discovery algorithm 00716 if ((type == PASTRY_STATE_JOIN) && (useDiscovery)) { //TODO remove dependency on discovery mode 00717 routingTable->dumpRowToMessage(stateMsg, hops); //send just the needed row for new join protocol 00718 if (last) leafSet->dumpToStateMessage(stateMsg); 00719 else stateMsg->setLeafSetArraySize(0); 00720 if (hops == 1) neighborhoodSet->dumpToStateMessage(stateMsg); 00721 else stateMsg->setNeighborhoodSetArraySize(0); 00722 } 00723 else { 00724 routingTable->dumpToStateMessage(stateMsg); 00725 leafSet->dumpToStateMessage(stateMsg); 00726 neighborhoodSet->dumpToStateMessage(stateMsg); 00727 } 00728 00729 // send... 00730 stateMsg->setBitLength(PASTRYSTATE_L(stateMsg)); 00731 RECORD_STATS(stateSent++; stateBytesSent += stateMsg->getByteLength()); 00732 sendMessageToUDP(destination, stateMsg); 00733 }
| void BasePastry::sendStateDelayed | ( | const TransportAddress & | destination | ) |
send a standard state message with a small delay
| destination | destination node |
Definition at line 735 of file BasePastry.cc.
Referenced by Pastry::checkProxCache().
00736 { 00737 PastrySendState* selfMsg = new PastrySendState("sendStateWait"); 00738 selfMsg->setDest(destination); 00739 sendStateWait.push_back(selfMsg); 00740 scheduleAt(simTime() + sendStateWaitAmount, selfMsg); 00741 }
| bool BasePastry::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 from BaseOverlay.
Definition at line 1012 of file BasePastry.cc.
Referenced by findNode().
01016 { 01017 if (key.isUnspecified()) 01018 error("Pastry::isSiblingFor(): key is unspecified!"); 01019 01020 if ((numSiblings == 1) && (node == thisNode)) { 01021 if (leafSet->isClosestNode(key)) { 01022 *err = false; 01023 return true; 01024 } else { 01025 *err = false; 01026 return false; 01027 } 01028 } 01029 01030 NodeVector* result = leafSet->createSiblingVector(key, numSiblings); 01031 01032 if (result == NULL) { 01033 *err = true; 01034 return false; 01035 } 01036 01037 if (result->contains(node.key)) { 01038 delete result; 01039 *err = false; 01040 return true; 01041 } else { 01042 delete result; 01043 *err = true; 01044 return false; 01045 } 01046 01047 /* 01048 const NodeHandle& dest = leafSet->getDestinationNode(key); 01049 if (!dest.isUnspecified()) { 01050 *err = false; 01051 return true; 01052 } else { 01053 01054 *err = true; 01055 return false; 01056 } 01057 */ 01058 }
| AbstractLookup * BasePastry::createLookup | ( | RoutingType | routingType = DEFAULT_ROUTING, |
|
| const BaseOverlayMessage * | msg = NULL, |
|||
| const cObject * | findNodeExt = NULL, |
|||
| bool | appLookup = false | |||
| ) | [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 from BaseOverlay.
Definition at line 1322 of file BasePastry.cc.
Referenced by Bamboo::doGlobalTuning().
01326 { 01327 assert(dummy == NULL); 01328 PastryFindNodeExtData* findNodeExt = 01329 new PastryFindNodeExtData("findNodeExt"); 01330 01331 if (msg) { 01332 const PastryMessage* pmsg = 01333 dynamic_cast<const PastryMessage*>(msg->getEncapsulatedMsg()); 01334 if ((pmsg) && (pmsg->getPastryMsgType() == PASTRY_MSG_JOIN)) { 01335 const PastryJoinMessage* jmsg = 01336 check_and_cast<const PastryJoinMessage*>(pmsg); 01337 findNodeExt->setSendStateTo(jmsg->getSendStateTo()); 01338 findNodeExt->setJoinHopCount(1); 01339 } 01340 } 01341 findNodeExt->setBitLength(PASTRYFINDNODEEXTDATA_L); 01342 01343 AbstractLookup* newLookup = BaseOverlay::createLookup(routingType, 01344 msg, findNodeExt, 01345 appLookup); 01346 01347 delete findNodeExt; 01348 return newLookup; 01349 }
| void BasePastry::changeState | ( | int | toState | ) | [protected, virtual] |
changes node state
| toState | state to change to |
Reimplemented in Bamboo, and Pastry.
Definition at line 327 of file BasePastry.cc.
Referenced by baseChangeState(), and pingTimeout().
| virtual void BasePastry::checkProxCache | ( | void | ) | [protected, pure virtual] |
checks whether proxCache is complete, takes appropriate actions depending on the protocol state
Implemented in Bamboo, and Pastry.
Referenced by pingResponse(), and pingTimeout().
| bool BasePastry::recursiveRoutingHook | ( | const TransportAddress & | dest, | |
| BaseRouteMessage * | msg | |||
| ) | [protected, 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 from BaseOverlay.
Definition at line 333 of file BasePastry.cc.
00335 { 00336 if (dest == thisNode) { 00337 return true; 00338 } 00339 00340 PastryMessage* pmsg = 00341 dynamic_cast<PastryMessage*>(msg->getEncapsulatedMsg()); 00342 00343 if (pmsg && pmsg->getPastryMsgType() == PASTRY_MSG_JOIN) { 00344 PastryJoinMessage* jmsg = static_cast<PastryJoinMessage*>(pmsg); 00345 if (jmsg->getSendStateTo() != thisNode) { 00346 RECORD_STATS(joinSeen++; joinBytesSeen += jmsg->getByteLength()); 00347 // remove node from state if it is rejoining 00348 handleFailedNode(jmsg->getSendStateTo()); 00349 00350 sendStateTables(jmsg->getSendStateTo(), PASTRY_STATE_JOIN, 00351 check_and_cast<OverlayCtrlInfo*>(msg->getControlInfo()) 00352 ->getHopCount(), false); 00353 } 00354 } 00355 00356 if (recFwdQueue.find(dest) != recFwdQueue.end()) { 00357 // rare case, other message for same next hop is pending: 00358 // send the message and hope it isn't lost. 00359 return true; 00360 } 00361 00362 assert(msg->getControlInfo()); 00363 00364 if (optimisticForward) { 00365 // forward now: 00366 return true; 00367 } else { 00368 if (routeMsgAcks) throw cRuntimeError("!optimisticForward && " 00369 "routeMsgAcks"); 00370 // keep message in queue (forward later) 00371 recFwdQueue[dest] = msg; 00372 pingNode(dest, timeoutPing, pingRetries, NULL, 00373 "PING next hop", NULL, PING_NEXT_HOP); 00374 00375 return false; 00376 } 00377 }
| void BasePastry::purgeVectors | ( | void | ) | [protected] |
delete all information/messages caching vectors, used for restarting overlay or finish()
Definition at line 40 of file BasePastry.cc.
Referenced by baseChangeState(), Pastry::changeState(), and ~BasePastry().
00041 { 00042 // purge pending state messages 00043 if (!stReceived.empty()) { 00044 for (std::vector<PastryStateMsgHandle>::iterator it = 00045 stReceived.begin(); it != stReceived.end(); it++) { 00046 // check whether one of the pointers is a duplicate of stateCache 00047 if (it->msg == stateCache.msg) { 00048 stateCache.msg = NULL; 00049 stateCache.prox = NULL; 00050 } 00051 delete it->msg; 00052 delete it->prox; 00053 } 00054 stReceived.clear(); 00055 stReceivedPos = stReceived.end(); 00056 } 00057 00058 // purge notify list: 00059 notifyList.clear(); 00060 00061 // purge Queue for messages to be forwarded in recursive mode: 00062 for (std::map<TransportAddress, BaseRouteMessage*>::iterator i = 00063 recFwdQueue.begin(); i != recFwdQueue.end(); i++) { 00064 delete i->second; 00065 } 00066 recFwdQueue.clear(); 00067 00068 // purge Queue for processing multiple STATE messages: 00069 while (! stateCacheQueue.empty()) { 00070 delete stateCacheQueue.front().msg; 00071 stateCacheQueue.pop(); 00072 } 00073 00074 // delete cached state message: 00075 if (stateCache.msg) { 00076 delete stateCache.msg; 00077 stateCache.msg = NULL; 00078 delete stateCache.prox; 00079 stateCache.prox = NULL; 00080 } 00081 00082 // purge vector of waiting sendState messages: 00083 if (! sendStateWait.empty()) { 00084 for (std::vector<PastrySendState*>::iterator it = 00085 sendStateWait.begin(); it != sendStateWait.end(); it++) { 00086 if ( (*it)->isScheduled() ) cancelEvent(*it); 00087 delete *it; 00088 } 00089 sendStateWait.clear(); 00090 } 00091 }
| void BasePastry::baseInit | ( | void | ) | [protected] |
initializes parameters and variables used in both Bamboo and Pastry
Definition at line 93 of file BasePastry.cc.
Referenced by Pastry::initializeOverlay(), and Bamboo::initializeOverlay().
00094 { 00095 bitsPerDigit = par("bitsPerDigit"); 00096 numberOfLeaves = par("numberOfLeaves"); 00097 numberOfNeighbors = par("numberOfNeighbors"); 00098 joinTimeoutAmount = par("joinTimeout"); 00099 repairTimeout = par("repairTimeout"); 00100 enableNewLeafs = par("enableNewLeafs"); 00101 optimizeLookup = par("optimizeLookup"); 00102 optimisticForward = par("optimisticForward"); 00103 avoidDuplicates = par("avoidDuplicates"); 00104 sendStateWaitAmount = par("sendStateWaitAmount"); 00105 timeoutPing = par("pingTimeout"); 00106 pingRetries = par("pingRetries"); 00107 useRegularNextHop = par("useRegularNextHop"); 00108 alwaysSendUpdate = par("alwaysSendUpdate"); 00109 00110 useDiscovery = false; //TODO 00111 00112 if (!neighborCache->isEnabled()) { 00113 throw cRuntimeError("NeighborCache is disabled, which is mandatory " 00114 "for Pastry/Bamboo. Activate it by setting " 00115 "\"**.neighborCache.enableNeighborCache " 00116 "= true\" in your omnetpp.ini!"); 00117 } 00118 00119 if (numberOfLeaves % 2) { 00120 EV << "[BasePastry::baseInit() @ " << thisNode.ip 00121 << " (" << thisNode.key.toString(16) << ")]\n" 00122 << " Warning: numberOfLeaves must be even - adding 1." 00123 << endl; 00124 numberOfLeaves++; 00125 } 00126 00127 routingTable = check_and_cast<PastryRoutingTable*> 00128 (getParentModule()->getSubmodule("pastryRoutingTable")); 00129 leafSet = check_and_cast<PastryLeafSet*> 00130 (getParentModule()->getSubmodule("pastryLeafSet")); 00131 neighborhoodSet = check_and_cast<PastryNeighborhoodSet*> 00132 (getParentModule()->getSubmodule("pastryNeighborhoodSet")); 00133 00134 stateCache.msg = NULL; 00135 stateCache.prox = NULL; 00136 00137 rowToAsk = 0; 00138 00139 // initialize statistics 00140 joins = 0; 00141 joinTries = 0; 00142 joinPartial = 0; 00143 joinSeen = 0; 00144 joinReceived = 0; 00145 joinSent = 0; 00146 stateSent = 0; 00147 stateReceived = 0; 00148 repairReqSent = 0; 00149 repairReqReceived = 0; 00150 stateReqSent = 0; 00151 stateReqReceived = 0; 00152 00153 joinBytesSeen = 0; 00154 joinBytesReceived = 0; 00155 joinBytesSent = 0; 00156 stateBytesSent = 0; 00157 stateBytesReceived = 0; 00158 repairReqBytesSent = 0; 00159 repairReqBytesReceived = 0; 00160 stateReqBytesSent = 0; 00161 stateReqBytesReceived = 0; 00162 00163 totalLookups = 0; 00164 responsibleLookups = 0; 00165 routingTableLookups = 0; 00166 closerNodeLookups = 0; 00167 closerNodeLookupsFromNeighborhood = 0; 00168 00169 leafsetReqSent = 0; 00170 leafsetReqBytesSent = 0; 00171 leafsetReqReceived = 0; 00172 leafsetReqBytesReceived = 0; 00173 leafsetSent = 0; 00174 leafsetBytesSent = 0; 00175 leafsetReceived = 0; 00176 leafsetBytesReceived = 0; 00177 00178 routingTableReqSent = 0; 00179 routingTableReqBytesSent = 0; 00180 routingTableReqReceived = 0; 00181 routingTableReqBytesReceived = 0; 00182 routingTableSent = 0; 00183 routingTableBytesSent = 0; 00184 routingTableReceived = 0; 00185 routingTableBytesReceived = 0; 00186 00187 WATCH(joins); 00188 WATCH(joinTries); 00189 WATCH(joinSeen); 00190 WATCH(joinBytesSeen); 00191 WATCH(joinReceived); 00192 WATCH(joinBytesReceived); 00193 WATCH(joinSent); 00194 WATCH(joinBytesSent); 00195 WATCH(stateSent); 00196 WATCH(stateBytesSent); 00197 WATCH(stateReceived); 00198 WATCH(stateBytesReceived); 00199 WATCH(repairReqSent); 00200 WATCH(repairReqBytesSent); 00201 WATCH(repairReqReceived); 00202 WATCH(repairReqBytesReceived); 00203 WATCH(stateReqSent); 00204 WATCH(stateReqBytesSent); 00205 WATCH(stateReqReceived); 00206 WATCH(stateReqBytesReceived); 00207 WATCH(lastStateChange); 00208 00209 WATCH(leafsetReqSent); 00210 WATCH(leafsetReqBytesSent); 00211 WATCH(leafsetReqReceived); 00212 WATCH(leafsetReqBytesReceived); 00213 WATCH(leafsetSent); 00214 WATCH(leafsetBytesSent); 00215 WATCH(leafsetReceived); 00216 WATCH(leafsetBytesReceived); 00217 00218 WATCH(routingTableReqSent); 00219 WATCH(routingTableReqBytesSent); 00220 WATCH(routingTableReqReceived); 00221 WATCH(routingTableReqBytesReceived); 00222 WATCH(routingTableSent); 00223 WATCH(routingTableBytesSent); 00224 WATCH(routingTableReceived); 00225 WATCH(routingTableBytesReceived); 00226 00227 }
| void BasePastry::baseChangeState | ( | int | toState | ) | [protected] |
changes node state, but leaves specific behavour, scheduling tasks in particular, to the inheriting protocols
Definition at line 229 of file BasePastry.cc.
Referenced by Pastry::changeState(), and Bamboo::changeState().
00230 { 00231 switch (toState) { 00232 case INIT: 00233 00234 state = INIT; 00235 00236 if (!thisNode.key.isUnspecified()) 00237 bootstrapList->removeBootstrapNode(thisNode); 00238 00239 if (joinTimeout->isScheduled()) cancelEvent(joinTimeout); 00240 00241 purgeVectors(); 00242 00243 bootstrapNode = bootstrapList->getBootstrapNode(); 00244 00245 routingTable->initializeTable(bitsPerDigit, repairTimeout, 00246 thisNode); 00247 leafSet->initializeSet(numberOfLeaves, bitsPerDigit, 00248 repairTimeout, thisNode, 00249 this); 00250 neighborhoodSet->initializeSet(numberOfNeighbors, bitsPerDigit, 00251 thisNode); 00252 00253 updateTooltip(); 00254 lastStateChange = simTime(); 00255 00256 getParentModule()->getParentModule()->bubble("entering INIT state"); 00257 00258 break; 00259 00260 00261 case DISCOVERY: 00262 00263 break; 00264 00265 case JOINING_2: 00266 state = JOINING_2; 00267 00268 // bootstrapNode must be obtained before calling this method, 00269 // for example by calling changeState(INIT) 00270 00271 if (bootstrapNode.isUnspecified()) { 00272 // no existing pastry network -> first node of a new one 00273 changeState(READY); 00274 return; 00275 } 00276 00277 cancelEvent(joinTimeout); 00278 scheduleAt(simTime() + joinTimeoutAmount, joinTimeout); 00279 00280 updateTooltip(); 00281 getParentModule()->getParentModule()->bubble("entering JOIN state"); 00282 00283 RECORD_STATS(joinTries++); 00284 00285 break; 00286 00287 case READY: 00288 assert(state != READY); 00289 state = READY; 00290 00291 //bootstrapList->registerBootstrapNode(thisNode); 00292 00293 // if we are the first node in the network, there's nothing else 00294 // to do 00295 if (bootstrapNode.isUnspecified()) { 00296 RECORD_STATS(joinTries++); 00297 RECORD_STATS(joins++); 00298 setOverlayReady(true); 00299 return; 00300 } 00301 00302 getParentModule()->getParentModule()->bubble("entering READY state"); 00303 updateTooltip(); 00304 RECORD_STATS(joins++); 00305 00306 break; 00307 } 00308 setOverlayReady(state == READY); 00309 }
| void BasePastry::doRoutingTableMaintenance | ( | ) | [protected] |
periodic routing table maintenance requests the corresponding routing table row from one node in each row
Definition at line 379 of file BasePastry.cc.
Referenced by Pastry::handleTimerEvent(), and Bamboo::handleTimerEvent().
00380 { 00381 00382 if (sendPullFlag) { 00383 //static uint rowToAsk = 1; 00384 uint32_t rrows = routingTable->getLastRow(); 00385 if (++rowToAsk >= rrows) rowToAsk = 0; 00386 const TransportAddress& ask4row = routingTable->getRandomNode(rowToAsk); 00387 00388 if ((!ask4row.isUnspecified()) && (ask4row != thisNode)) { 00389 00390 PastryRoutingRowRequestMessage* msg = new PastryRoutingRowRequestMessage("ROWREQ"); 00391 00392 msg->setPastryMsgType(PASTRY_MSG_ROWREQ); 00393 msg->setStatType(MAINTENANCE_STAT); 00394 msg->setSendStateTo(thisNode); 00395 msg->setRow(rowToAsk+1); 00396 msg->setBitLength(PASTRYRTREQ_L(msg)); 00397 RECORD_STATS(routingTableReqSent++; routingTableReqBytesSent += msg->getByteLength()); 00398 EV << "[BasePastry::doRoutingTableMaintenance() @ " << thisNode.ip 00399 << " (" << thisNode.key.toString(16) << ")]\n" 00400 << " Sending Message to Node in Row" << rowToAsk 00401 << endl; 00402 sendMessageToUDP(ask4row, msg); 00403 } 00404 } else { 00405 00406 00407 for (int i = 0; i < routingTable->getLastRow(); i++) { 00408 const TransportAddress& ask4row = routingTable->getRandomNode(i); 00409 00410 if ((!ask4row.isUnspecified()) && (ask4row != thisNode)) { 00411 00412 PastryRoutingRowRequestMessage* msg = new PastryRoutingRowRequestMessage("ROWREQ"); 00413 00414 msg->setPastryMsgType(PASTRY_MSG_ROWREQ); 00415 msg->setStatType(MAINTENANCE_STAT); 00416 msg->setSendStateTo(thisNode); 00417 msg->setRow(i+1); 00418 msg->setBitLength(PASTRYRTREQ_L(msg)); 00419 RECORD_STATS(routingTableReqSent++; routingTableReqBytesSent += msg->getByteLength()); 00420 sendMessageToUDP(ask4row, msg); 00421 } else EV << "[BasePastry::doRoutingTableMaintenance() @ " << thisNode.ip 00422 << " (" << thisNode.key.toString(16) << ")]\n" 00423 << " could not send Message to Node in Row" << i 00424 << endl; 00425 00426 } 00427 } 00428 }
| void BasePastry::prePing | ( | const PastryStateMessage * | stateMsg | ) | [protected] |
ping all nodes in a given state message.
this is called when a state message arrives while another one is still being processed.
Definition at line 521 of file BasePastry.cc.
Referenced by Pastry::doSecondStage(), Pastry::handleStateMessage(), and Bamboo::handleStateMessage().
00522 { 00523 uint32_t rt_size = stateMsg->getRoutingTableArraySize(); 00524 uint32_t ls_size = stateMsg->getLeafSetArraySize(); 00525 uint32_t ns_size = stateMsg->getNeighborhoodSetArraySize(); 00526 00527 for (uint32_t i = 0; i < rt_size + ls_size + ns_size; i++) { 00528 const NodeHandle* node; 00529 if (i < rt_size) { 00530 node = &(stateMsg->getRoutingTable(i)); 00531 } 00532 else if (i < (rt_size + ls_size) ) { 00533 node = &(stateMsg->getLeafSet(i - rt_size)); 00534 } 00535 else { 00536 node = &(stateMsg->getNeighborhoodSet(i - rt_size - ls_size)); 00537 } 00538 if ((node->isUnspecified()) || (*node == thisNode)) { 00539 continue; 00540 } 00541 if (node->key == thisNode.key) { 00542 /* 00543 cerr << "Pastry Warning: Other node with same key found, " 00544 "restarting!" << endl; 00545 opp_error("TODO: Other node with same key found..."); 00546 joinOverlay(); //segfault 00547 return; 00548 */ 00549 continue; 00550 } 00551 pingNode(*node, timeoutPing, pingRetries, NULL, 00552 "PING received state", NULL, PING_RECEIVED_STATE, 00553 UDP_TRANSPORT, false); 00554 } 00555 }
| void BasePastry::pingNodes | ( | void | ) | [protected] |
ping all nodes in the pastry state message pointed to by private member stateCache
Definition at line 557 of file BasePastry.cc.
Referenced by Bamboo::checkProxCache(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), and Pastry::processState().
00558 { 00559 if (stateCache.msg == NULL) throw cRuntimeError("no state msg"); 00560 00561 assert(stateCache.prox == NULL); 00562 stateCache.prox = new PastryStateMsgProximity(); 00563 00564 uint32_t rt_size = stateCache.msg->getRoutingTableArraySize(); 00565 //stateCache.prox->pr_rt.clear(); 00566 stateCache.prox->pr_rt.resize(rt_size, PASTRY_PROX_UNDEF); 00567 00568 uint32_t ls_size = stateCache.msg->getLeafSetArraySize(); 00569 //stateCache.prox->pr_ls.clear(); 00570 stateCache.prox->pr_ls.resize(ls_size, PASTRY_PROX_UNDEF); 00571 00572 uint32_t ns_size = stateCache.msg->getNeighborhoodSetArraySize(); 00573 //stateCache.prox->pr_ns.clear(); 00574 stateCache.prox->pr_ns.resize(ns_size, PASTRY_PROX_UNDEF); 00575 00576 std::vector< std::pair<const NodeHandle*, PingContext*> > nodesToPing; 00577 // set prox state 00578 for (uint32_t i = 0; i < rt_size + ls_size + ns_size; i++) { 00579 const NodeHandle* node; 00580 std::vector<simtime_t>::iterator proxPos; 00581 PingContext* pingContext = NULL; 00582 StateObject stateObject; 00583 uint32_t index; 00584 if (stateCache.msg == NULL) break; 00585 if (i < rt_size) { 00586 node = &(stateCache.msg->getRoutingTable(i)); 00587 proxPos = stateCache.prox->pr_rt.begin() + i; 00588 stateObject = ROUTINGTABLE; 00589 index = i; 00590 } else if ( i < (rt_size + ls_size) ) { 00591 node = &(stateCache.msg->getLeafSet(i - rt_size)); 00592 proxPos = stateCache.prox->pr_ls.begin() + (i - rt_size); 00593 stateObject = LEAFSET; 00594 index = i - rt_size; 00595 } else { 00596 node = &(stateCache.msg->getNeighborhoodSet(i - rt_size - ls_size)); 00597 proxPos = stateCache.prox->pr_ns.begin() + (i - rt_size - ls_size); 00598 stateObject = NEIGHBORHOODSET; 00599 index = i - rt_size - ls_size; 00600 } 00601 // proximity is undefined for unspecified nodes: 00602 if (!node->isUnspecified()) { 00603 if (*node == thisNode) { 00604 *proxPos = 0; 00605 } else { 00606 *proxPos = PASTRY_PROX_PENDING; 00607 pingContext = new PingContext(stateObject, index, 00608 stateCache.nonce); 00609 nodesToPing.push_back(std::make_pair(node, pingContext)); 00610 } 00611 } 00612 } 00613 assert(nodesToPing.size() != 0); 00614 // ping nodes 00615 for (uint32_t i = 0; i < nodesToPing.size(); ++i) { 00616 pingNode(*nodesToPing[i].first, timeoutPing, pingRetries, 00617 nodesToPing[i].second, "PING received state", NULL, 00618 PING_RECEIVED_STATE, UDP_TRANSPORT, false); 00619 } 00620 00621 }
| void BasePastry::determineAliveTable | ( | const PastryStateMessage * | stateMsg | ) | [protected] |
change the aliveTable to match the given stateMsg.
each node that's knowm to be dead from our neighborCache gets a value of PASTRY_PROX_INFINITE, all other nodes just get a value of 1
Definition at line 623 of file BasePastry.cc.
Referenced by Pastry::handleStateMessage(), and Bamboo::handleStateMessage().
00624 { 00625 uint32_t rt_size = stateMsg->getRoutingTableArraySize(); 00626 aliveTable.pr_rt.clear(); 00627 aliveTable.pr_rt.resize(rt_size, 1); 00628 00629 uint32_t ls_size = stateMsg->getLeafSetArraySize(); 00630 aliveTable.pr_ls.clear(); 00631 aliveTable.pr_ls.resize(ls_size, 1); 00632 00633 uint32_t ns_size = stateMsg->getNeighborhoodSetArraySize(); 00634 aliveTable.pr_ns.clear(); 00635 aliveTable.pr_ns.resize(ns_size, 1); 00636 00637 for (uint32_t i = 0; i < rt_size + ls_size + ns_size; i++) { 00638 const TransportAddress* node; 00639 std::vector<simtime_t>::iterator tblPos; 00640 if (i < rt_size) { 00641 node = &(stateMsg->getRoutingTable(i)); 00642 tblPos = aliveTable.pr_rt.begin() + i; 00643 } else if ( i < (rt_size + ls_size) ) { 00644 node = &(stateMsg->getLeafSet(i - rt_size)); 00645 tblPos = aliveTable.pr_ls.begin() + (i - rt_size); 00646 } else { 00647 node = &(stateMsg->getNeighborhoodSet(i - rt_size - ls_size)); 00648 tblPos = aliveTable.pr_ns.begin() + (i - rt_size - ls_size); 00649 } 00650 if (neighborCache->getNodeRtt(*node) == NEIGHBORSTATE_TIMEOUT) { 00651 *tblPos = PASTRY_PROX_INFINITE; 00652 } 00653 } 00654 }
| void BasePastry::sendRequest | ( | const TransportAddress & | ask, | |
| int | type | |||
| ) | [protected] |
send a request to a given node
| ask | request from this node | |
| type | specifies the data requested |
Definition at line 850 of file BasePastry.cc.
Referenced by Pastry::changeState(), Pastry::checkProxCache(), Pastry::doSecondStage(), Pastry::handleFailedNode(), and Pastry::handleStateMessage().
00851 { 00852 std::string msgName("Req: "); 00853 switch (type) { 00854 case PASTRY_REQ_REPAIR: 00855 if (ask.isUnspecified()) 00856 opp_error("Pastry::sendRequest(): asked for repair from " 00857 "unspecified node!"); 00858 msgName += "Repair"; 00859 break; 00860 00861 case PASTRY_REQ_STATE: 00862 if (ask.isUnspecified()) 00863 opp_error("Pastry::sendRequest(): asked for state from " 00864 "unspecified node!"); 00865 msgName += "State"; 00866 break; 00867 00868 case PASTRY_REQ_LEAFSET: 00869 if (ask.isUnspecified()) 00870 opp_error("Pastry::sendRequest(): asked for leafset from " 00871 "unspecified node!"); 00872 msgName += "Leafset"; 00873 break; 00874 } 00875 PastryRequestMessage* msg = new PastryRequestMessage(msgName.c_str()); 00876 msg->setPastryMsgType(PASTRY_MSG_REQ); 00877 msg->setPastryReqType(type); 00878 msg->setStatType(MAINTENANCE_STAT); 00879 msg->setSendStateTo(thisNode); 00880 msg->setBitLength(PASTRYREQ_L(msg)); 00881 sendMessageToUDP(ask, msg); 00882 00883 switch (type) { 00884 case PASTRY_REQ_REPAIR: 00885 RECORD_STATS(repairReqSent++; repairReqBytesSent += msg->getByteLength()); 00886 break; 00887 00888 case PASTRY_REQ_STATE: 00889 RECORD_STATS(stateReqSent++; stateReqBytesSent += msg->getByteLength()); 00890 break; 00891 00892 case PASTRY_REQ_LEAFSET: 00893 RECORD_STATS(leafsetReqSent++; leafsetReqBytesSent += msg->getByteLength()); 00894 break; 00895 } 00896 }
| void BasePastry::sendLeafset | ( | const TransportAddress & | tell, | |
| bool | pull = false | |||
| ) | [protected] |
send the leafset to a node
| tell | the node to send to | |
| pull | true requests his leafset |
Definition at line 899 of file BasePastry.cc.
Referenced by Bamboo::doLeafsetMaintenance(), handleRequestMessage(), and Bamboo::handleUDPMessage().
00900 { 00901 if (tell.isUnspecified()) 00902 opp_error("Pastry::sendLeafset(): send leafset to " 00903 "unspecified node!"); 00904 //if (pull) PastryLeafsetPullMessage* msg = new PastryLeafsetPullMessage("Leafset Pull"); 00905 PastryLeafsetMessage* msg = new PastryLeafsetMessage("Leafset"); 00906 if (pull) msg->setPastryMsgType(PASTRY_MSG_LEAFSET_PULL); 00907 else msg->setPastryMsgType(PASTRY_MSG_LEAFSET); 00908 msg->setTimestamp(simTime()); 00909 msg->setStatType(MAINTENANCE_STAT); 00910 msg->setSender(thisNode); 00911 msg->setSendStateTo(thisNode); 00912 leafSet->dumpToStateMessage(msg); 00913 msg->setBitLength(PASTRYLEAFSET_L(msg)); 00914 RECORD_STATS(leafsetSent++; leafsetBytesSent += msg->getByteLength()); 00915 sendMessageToUDP(tell, msg); 00916 00917 00918 }
| void BasePastry::sendRoutingRow | ( | const TransportAddress & | tell, | |
| int | row | |||
| ) | [protected] |
send a row of the routing table to a node
| tell | the node to send to | |
| row | the number of the row |
Definition at line 920 of file BasePastry.cc.
Referenced by Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
00921 { 00922 if (tell.isUnspecified()) 00923 opp_error("Pastry::sendRoutingTable(): asked for routing Table from " 00924 "unspecified node!"); 00925 00926 PastryRoutingRowMessage* msg = new PastryRoutingRowMessage("Routing Row"); 00927 msg->setPastryMsgType(PASTRY_MSG_RROW); 00928 msg->setStatType(MAINTENANCE_STAT); 00929 //msg->setSendStateTo(thisNode); 00930 msg->setSender(thisNode); 00931 msg->setRow(row); 00932 routingTable->dumpRowToMessage(msg, row); 00933 msg->setBitLength(PASTRYRTABLE_L(msg)); 00934 RECORD_STATS(routingTableSent++; routingTableBytesSent += msg->getByteLength()); 00935 sendMessageToUDP(tell, msg); 00936 }
| void BasePastry::handleRequestMessage | ( | PastryRequestMessage * | msg | ) | [protected] |
processes state messages, merging with own state tables
| msg | the pastry state message |
Definition at line 938 of file BasePastry.cc.
Referenced by Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
00939 { 00940 uint32_t reqtype = msg->getPastryReqType(); 00941 if (reqtype == PASTRY_REQ_REPAIR) { 00942 RECORD_STATS(repairReqReceived++; repairReqBytesReceived += 00943 msg->getByteLength()); 00944 if (state == READY) 00945 sendStateTables(msg->getSendStateTo(), 00946 PASTRY_STATE_REPAIR); 00947 else 00948 EV << "[BasePastry::handleRequestMessage() @ " << thisNode.ip 00949 << " (" << thisNode.key.toString(16) << ")]\n" 00950 << " received repair request before reaching" 00951 << " READY state, dropping message!" 00952 << endl; 00953 delete msg; 00954 } 00955 else if (reqtype == PASTRY_REQ_STATE) { 00956 RECORD_STATS(stateReqReceived++; stateReqBytesReceived += 00957 msg->getByteLength()); 00958 if (state == READY) 00959 sendStateTables(msg->getSendStateTo()); 00960 else 00961 EV << "[BasePastry::handleRequestMessage() @ " << thisNode.ip 00962 << " (" << thisNode.key.toString(16) << ")]\n" 00963 << " received state request before reaching" 00964 << " READY state, dropping message!" 00965 << endl; 00966 delete msg; 00967 } 00968 else if (PASTRY_REQ_LEAFSET) { 00969 RECORD_STATS(leafsetReqReceived++; leafsetReqBytesReceived += 00970 msg->getByteLength()); 00971 if (state == READY) { 00972 sendLeafset(msg->getSendStateTo()); 00973 } 00974 else 00975 EV << "[BasePastry::handleRequestMessage() @ " << thisNode.ip 00976 << " (" << thisNode.key.toString(16) << ")]\n" 00977 << " received leafset request before reaching" 00978 << " READY state, dropping message!" 00979 << endl; 00980 delete msg; 00981 } 00982 00983 }
| void BasePastry::handleLeafsetMessage | ( | PastryLeafsetMessage * | msg, | |
| bool | mergeSender = false | |||
| ) | [protected] |
processes leafset messages, merging with own state tables
| msg | the pastry state message | |
| mergeSender | should the sender also be merged |
Definition at line 985 of file BasePastry.cc.
Referenced by Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
00986 { 00987 uint32_t lsSize = msg->getLeafSetArraySize(); 00988 PastryStateMessage* stateMsg; 00989 00990 stateMsg = new PastryStateMessage("STATE"); 00991 stateMsg->setTimestamp(msg->getTimestamp()); 00992 stateMsg->setPastryMsgType(PASTRY_MSG_STATE); 00993 stateMsg->setStatType(MAINTENANCE_STAT); 00994 stateMsg->setSender(msg->getSender()); 00995 stateMsg->setLeafSetArraySize(lsSize); 00996 stateMsg->setNeighborhoodSetArraySize(0); 00997 stateMsg->setRoutingTableArraySize(0); 00998 00999 for (uint32_t i = 0; i < lsSize; i++) { 01000 stateMsg->setLeafSet(i, msg->getLeafSet(i)); 01001 } 01002 01003 if (mergeSender) { 01004 stateMsg->setLeafSetArraySize(lsSize+1); 01005 stateMsg->setLeafSet(lsSize, msg->getSender()); 01006 } 01007 01008 handleStateMessage(stateMsg); 01009 delete msg; 01010 }
| void BasePastry::newLeafs | ( | void | ) | [protected] |
Pastry API: send newLeafs() to application if enabled.
Definition at line 312 of file BasePastry.cc.
Referenced by Pastry::handleFailedNode(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), and Pastry::mergeState().
00313 { 00314 if (! enableNewLeafs) return; 00315 00316 PastryNewLeafsMessage* msg = leafSet->getNewLeafsMessage(); 00317 if (msg) { 00318 send(msg, "appOut"); 00319 EV << "[BasePastry::newLeafs() @ " << thisNode.ip 00320 << " (" << thisNode.key.toString(16) << ")]\n" 00321 << " newLeafs() called." 00322 << endl; 00323 } 00324 }
friend class PastryLeafSet [friend] |
Definition at line 390 of file BasePastry.h.
Definition at line 134 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), and finishOverlay().
Definition at line 135 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), and finishOverlay().
Definition at line 136 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and Pastry::handleTimerEvent().
Definition at line 137 of file BasePastry.h.
Referenced by baseInit(), findNode(), finishOverlay(), and recursiveRoutingHook().
Definition at line 138 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and recursiveRoutingHook().
Definition at line 139 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and Pastry::handleUDPMessage().
Definition at line 140 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and Pastry::handleUDPMessage().
Definition at line 141 of file BasePastry.h.
Referenced by baseInit(), Pastry::changeState(), and finishOverlay().
Definition at line 142 of file BasePastry.h.
Referenced by baseInit(), Pastry::changeState(), and finishOverlay().
Definition at line 143 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendStateTables().
Definition at line 144 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendStateTables().
Definition at line 145 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 146 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 147 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRequest().
Definition at line 148 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRequest().
Definition at line 149 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and handleRequestMessage().
Definition at line 150 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and handleRequestMessage().
Definition at line 151 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRequest().
Definition at line 152 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRequest().
Definition at line 153 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and handleRequestMessage().
Definition at line 154 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and handleRequestMessage().
Definition at line 155 of file BasePastry.h.
Referenced by baseInit(), findNode(), and finishOverlay().
Definition at line 156 of file BasePastry.h.
Referenced by baseInit(), findNode(), and finishOverlay().
Definition at line 157 of file BasePastry.h.
Referenced by baseInit(), findNode(), and finishOverlay().
Definition at line 158 of file BasePastry.h.
Referenced by baseInit(), findNode(), and finishOverlay().
Definition at line 159 of file BasePastry.h.
Referenced by baseInit(), findNode(), and finishOverlay().
Definition at line 161 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRequest().
Definition at line 162 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRequest().
Definition at line 163 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and handleRequestMessage().
Definition at line 164 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and handleRequestMessage().
Definition at line 165 of file BasePastry.h.
Referenced by baseInit(), Bamboo::changeState(), finishOverlay(), and sendLeafset().
Definition at line 166 of file BasePastry.h.
Referenced by baseInit(), Bamboo::changeState(), finishOverlay(), and sendLeafset().
Definition at line 167 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 168 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 170 of file BasePastry.h.
Referenced by baseInit(), doRoutingTableMaintenance(), finishOverlay(), and Pastry::handleTimerEvent().
Definition at line 171 of file BasePastry.h.
Referenced by baseInit(), doRoutingTableMaintenance(), finishOverlay(), and Pastry::handleTimerEvent().
Definition at line 172 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 173 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 174 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRoutingRow().
Definition at line 175 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), and sendRoutingRow().
Definition at line 176 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
Definition at line 177 of file BasePastry.h.
Referenced by baseInit(), finishOverlay(), Pastry::handleUDPMessage(), and Bamboo::handleUDPMessage().
| uint32_t BasePastry::rowToAsk |
Definition at line 178 of file BasePastry.h.
Referenced by baseInit(), and doRoutingTableMaintenance().
uint32_t BasePastry::bitsPerDigit [protected] |
uint32_t BasePastry::numberOfLeaves [protected] |
Definition at line 190 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), and getMaxNumSiblings().
uint32_t BasePastry::numberOfNeighbors [protected] |
uint32_t BasePastry::pingRetries [protected] |
Definition at line 192 of file BasePastry.h.
Referenced by baseInit(), Pastry::handleTimerEvent(), pingNodes(), prePing(), and recursiveRoutingHook().
double BasePastry::timeoutPing [protected] |
Definition at line 193 of file BasePastry.h.
Referenced by baseInit(), Pastry::handleTimerEvent(), pingNodes(), prePing(), and recursiveRoutingHook().
double BasePastry::readyWaitAmount [protected] |
Definition at line 194 of file BasePastry.h.
Referenced by Pastry::handleStateMessage(), and Pastry::initializeOverlay().
double BasePastry::joinTimeoutAmount [protected] |
Definition at line 195 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), and Bamboo::changeState().
double BasePastry::pingCacheExpireTime [protected] |
Definition at line 196 of file BasePastry.h.
double BasePastry::repairTimeout [protected] |
double BasePastry::sendStateWaitAmount [protected] |
Definition at line 198 of file BasePastry.h.
Referenced by baseInit(), Pastry::changeState(), and sendStateDelayed().
bool BasePastry::enableNewLeafs [protected] |
bool BasePastry::useRegularNextHop [protected] |
bool BasePastry::alwaysSendUpdate [protected] |
Definition at line 201 of file BasePastry.h.
Referenced by baseInit(), and Pastry::endProcessingState().
bool BasePastry::optimizeLookup [protected] |
bool BasePastry::optimisticForward [protected] |
Definition at line 203 of file BasePastry.h.
Referenced by baseInit(), pingResponse(), and recursiveRoutingHook().
bool BasePastry::avoidDuplicates [protected] |
simtime_t BasePastry::nearNodeRtt [protected] |
Definition at line 206 of file BasePastry.h.
Referenced by Pastry::changeState(), and pingResponse().
double BasePastry::repairTaskTimeoutAmount [protected] |
Definition at line 207 of file BasePastry.h.
Referenced by Pastry::changeState(), Bamboo::changeState(), Pastry::handleTimerEvent(), Bamboo::handleTimerEvent(), Pastry::initializeOverlay(), Bamboo::initializeOverlay(), and Pastry::~Pastry().
uint32_t BasePastry::unspecNodes [protected] |
Definition at line 209 of file BasePastry.h.
uint32_t BasePastry::pingedNodes [protected] |
Definition at line 210 of file BasePastry.h.
Referenced by Pastry::handleTimerEvent(), and Pastry::handleUDPMessage().
bool BasePastry::nearNodeImproved [protected] |
Definition at line 211 of file BasePastry.h.
Referenced by Pastry::handleTimerEvent(), Pastry::handleUDPMessage(), and pingResponse().
bool BasePastry::sendPullFlag [protected] |
Definition at line 212 of file BasePastry.h.
Referenced by doRoutingTableMaintenance(), Pastry::initializeOverlay(), and Bamboo::initializeOverlay().
bool BasePastry::useDiscovery [protected] |
Definition at line 214 of file BasePastry.h.
Referenced by baseInit(), Pastry::initializeOverlay(), Pastry::joinOverlay(), sendStateTables(), and Pastry::~Pastry().
bool BasePastry::periodicMaintenance [protected] |
Definition at line 215 of file BasePastry.h.
TransportAddress* BasePastry::leaf2ask [protected] |
Definition at line 217 of file BasePastry.h.
TransportAddress BasePastry::bootstrapNode [protected] |
Definition at line 219 of file BasePastry.h.
Referenced by baseChangeState(), Pastry::changeState(), Bamboo::changeState(), Pastry::joinOverlay(), and Bamboo::joinOverlay().
NodeHandle BasePastry::nearNode [protected] |
Definition at line 220 of file BasePastry.h.
Referenced by Pastry::changeState(), Pastry::handleTimerEvent(), Pastry::joinOverlay(), and pingResponse().
simtime_t BasePastry::lastStateChange [protected] |
Definition at line 222 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), Pastry::checkProxCache(), Bamboo::checkProxCache(), Pastry::endProcessingState(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), and Pastry::mergeState().
std::vector<PastryStateMsgHandle> BasePastry::stReceived [protected] |
State messages to process during join.
Definition at line 227 of file BasePastry.h.
Referenced by Pastry::checkProxCache(), Pastry::doJoinUpdate(), Pastry::handleStateMessage(), Pastry::handleTimerEvent(), Pastry::mergeState(), and purgeVectors().
std::vector<PastryStateMsgHandle>::iterator BasePastry::stReceivedPos [protected] |
Definition at line 228 of file BasePastry.h.
Referenced by Pastry::checkProxCache(), Pastry::handleStateMessage(), Pastry::handleTimerEvent(), and purgeVectors().
std::vector<TransportAddress> BasePastry::notifyList [protected] |
List of nodes to notify after join.
Definition at line 233 of file BasePastry.h.
Referenced by Pastry::changeState(), Pastry::doJoinUpdate(), Pastry::doSecondStage(), and purgeVectors().
PastryStateMsgHandle BasePastry::stateCache [protected] |
Handle for processing a single state message.
Definition at line 238 of file BasePastry.h.
Referenced by baseInit(), Pastry::checkProxCache(), Bamboo::checkProxCache(), Pastry::doSecondStage(), Pastry::endProcessingState(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), Pastry::handleTimerEvent(), Pastry::mergeState(), pingNodes(), pingResponse(), pingTimeout(), Pastry::processState(), and purgeVectors().
std::queue<PastryStateMsgHandle> BasePastry::stateCacheQueue [protected] |
Queue of state messages waiting to be processed in READY state.
Definition at line 243 of file BasePastry.h.
Referenced by Bamboo::checkProxCache(), Pastry::doSecondStage(), Pastry::endProcessingState(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), and purgeVectors().
PastryStateMsgProximity BasePastry::aliveTable [protected] |
Early update of leaf set: helper structure for marking known-dead nodes.
Definition at line 248 of file BasePastry.h.
Referenced by determineAliveTable(), Pastry::handleStateMessage(), and Bamboo::handleStateMessage().
std::map<TransportAddress, BaseRouteMessage*> BasePastry::recFwdQueue [protected] |
Queue of messages to be forwarded in recursive routing mode.
Definition at line 259 of file BasePastry.h.
Referenced by pingResponse(), pingTimeout(), purgeVectors(), and recursiveRoutingHook().
uint32_t BasePastry::joinHopCount [protected] |
Definition at line 261 of file BasePastry.h.
Referenced by Pastry::changeState(), Pastry::handleStateMessage(), and Pastry::handleUDPMessage().
cMessage* BasePastry::joinTimeout [protected] |
Definition at line 262 of file BasePastry.h.
Referenced by baseChangeState(), Bamboo::changeState(), finishOverlay(), Pastry::handleStateMessage(), Bamboo::handleTimerEvent(), Bamboo::handleUDPMessage(), Pastry::initializeOverlay(), Bamboo::initializeOverlay(), and ~BasePastry().
cMessage* BasePastry::readyWait [protected] |
Definition at line 263 of file BasePastry.h.
Referenced by Pastry::changeState(), Pastry::handleStateMessage(), Pastry::initializeOverlay(), and Pastry::~Pastry().
cMessage* BasePastry::joinUpdateWait [protected] |
Definition at line 264 of file BasePastry.h.
Referenced by Pastry::changeState(), Pastry::initializeOverlay(), and Pastry::~Pastry().
std::vector<PastrySendState*> BasePastry::sendStateWait [protected] |
Definition at line 265 of file BasePastry.h.
Referenced by Pastry::handleTimerEvent(), purgeVectors(), and sendStateDelayed().
cMessage* BasePastry::repairTaskTimeout [protected] |
Definition at line 267 of file BasePastry.h.
Referenced by Pastry::changeState(), Bamboo::changeState(), Pastry::handleTimerEvent(), Bamboo::handleTimerEvent(), Pastry::initializeOverlay(), Bamboo::initializeOverlay(), Bamboo::~Bamboo(), and Pastry::~Pastry().
PastryRoutingTable* BasePastry::routingTable [protected] |
Definition at line 269 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), Pastry::changeState(), Pastry::checkProxCache(), Bamboo::checkProxCache(), doRoutingTableMaintenance(), Pastry::doSecondStage(), findNode(), Pastry::handleFailedNode(), Bamboo::handleFailedNode(), Pastry::handleStateMessage(), Pastry::handleUDPMessage(), Bamboo::handleUDPMessage(), Pastry::mergeState(), sendRoutingRow(), and sendStateTables().
PastryLeafSet* BasePastry::leafSet [protected] |
Definition at line 270 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), Pastry::changeState(), Bamboo::changeState(), Bamboo::doLeafsetMaintenance(), Pastry::doSecondStage(), findNode(), Pastry::handleFailedNode(), Bamboo::handleFailedNode(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), Pastry::handleTimerEvent(), isSiblingFor(), Pastry::mergeState(), newLeafs(), sendLeafset(), sendStateTables(), and updateTooltip().
PastryNeighborhoodSet* BasePastry::neighborhoodSet [protected] |
Definition at line 271 of file BasePastry.h.
Referenced by baseChangeState(), baseInit(), Pastry::checkProxCache(), Bamboo::checkProxCache(), Pastry::doSecondStage(), findNode(), Pastry::handleFailedNode(), Bamboo::handleFailedNode(), Pastry::handleStateMessage(), Pastry::mergeState(), and sendStateTables().
1.5.5