Broose Class Reference

#include <Broose.h>

Inheritance diagram for Broose:

BaseOverlay BaseRpc TopologyVis RpcListener

List of all members.


Detailed Description

Definition at line 61 of file Broose.h.


Public Member Functions

 ~Broose ()
virtual void initializeOverlay (int stage)
 Initializes derived-class-attributes.
virtual void finishOverlay ()
 collects statistical data in derived class
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 void joinOverlay ()
 Join the overlay with a given nodeID in thisNode.key.
virtual void handleUDPMessage (BaseOverlayMessage *msg)
 Processes messages from underlay.
virtual void recordOverlaySentStats (BaseOverlayMessage *msg)
 Collect overlay specific sent messages statistics.
virtual bool handleRpc (BaseCallMessage *msg)
 Processes Remote-Procedure-Call invokation messages.
virtual void handleTimerEvent (cMessage *msg)
 Processes "timer" self-messages.
void updateTooltip ()
 updates information shown in tk-environment

Protected Member Functions

void handleJoinTimerExpired (cMessage *msg)
 handles a expired join timer
void handleBucketTimerExpired (cMessage *msg)
 handles a expired bucket refresh timer
void changeState (int state)
 changes the node's state
NodeVector * findNode (const OverlayKey &key, int numRedundantNodes, int numSiblings, BaseOverlayMessage *msg)
 Implements the find node call.
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().
void displayBucketState ()
 debug function which output the content of the node's buckets
void handleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt)
 This method is called if an RPC response has been received.
void handleRpcTimeout (BaseCallMessage *msg, const TransportAddress &dest, cPolymorphic *context, int rpcId, const OverlayKey &destKey)
 This method is called if an RPC timeout has been reached.
void handleFindNodeTimeout (FindNodeCall *findNode, const TransportAddress &dest, const OverlayKey &destKey)
 This method is called if an Find Node Call timeout has been reached.
void handleBucketRequestRpc (BucketCall *msg)
 handles a received Bucket request
void handleBucketResponseRpc (BucketResponse *msg)
 handles a received Bucket response
void handleBucketTimeout (BucketCall *msg)
 handles a received Bucket timeout
void handleBroosePingRequestRpc (BroosePingCall *msg)
 handles a received Ping request
void handleBroosePingResponseRpc (BroosePingResponse *msg, simtime_t rtt)
 handles a received Ping response
void handleBroosePingTimeout (BroosePingCall *msg, const TransportAddress &dest, const OverlayKey &destKey)
 handles a received Ping timeout
void setLastSeen (NodeHandle node)
 updates the timestamp of a node in all buckets
void addNode (NodeHandle node, int bucket=0)
 adds a node to all buckets
void resetFailedResponses (NodeHandle node)
 resets the counter of failed responses
void setRTT (NodeHandle node, simtime_t rtt)
 sets the rtt to a node in all buckets

Protected Attributes

int chooseLookup
 decides which kind of lookup (right/left shifting) is used
int joinDelay
 time interval between two join tries
int protoState
 the state in which a node currently is
int receivedJoinResponse
 number of received join response messages
int receivedBBucketLookup
 number of received lookup responses for the B bucket
int numberBBucketLookup
 maximal number of lookup responses for the B bucket
int receivedLBucketLookup
 number of received lookup responses for the L bucket
int numberLBucketLookup
 maximal number of lookup responses for the L bucket
int shiftingBits
 number of bits shifted in/out each step
int powShiftingBits
 2^{variable shiftingBits}
uint32_t bucketSize
 maximal number of bucket entries
uint32_t rBucketSize
 maximal number of entries in the r buckets
int keyLength
 length of the node and data IDs
bool refresh
 is the node restarting the bootstrap protocol or is it a new node
int pingDelay
 time interval between bucket refreshes
int refreshTime
 time interval between pings
uint32_t userDist
 how many hops are added to the estimated hop count
int numPings
 actual number of received ping messages
int maxPings
 total number of ping messages
int numberRetries
 number of retries in case of timeout
int bucketCount
 number of Bucket messages
int bucketBytesSent
 length of all Bucket messages
int broosePingCount
 number of Ping messages
int broosePingBytesSent
 length of all Ping messages
int numFailedPackets
 number of packets which couldn't be routed correctly
BrooseBucket * lBucket
BrooseBucket * bBucket
BrooseBucket ** rBucket
cMessage * join_timer
cMessage * bucket_timer
 timer to reconstruct all buckets
TransportAddress bootstrapNode
 node handle holding the bootstrap node
BrooseHandle thisBrooseNode
 this is a BrooseHandle of the current node like thisNode

Friends

class BrooseBucket

Constructor & Destructor Documentation

Broose::~Broose (  ) 

Definition at line 35 of file Broose.cc.

00036 {
00037     // delete timer
00038     cancelEvent(join_timer);
00039     delete join_timer;
00040 
00041     cancelEvent(bucket_timer);
00042     delete bucket_timer;
00043 }


Member Function Documentation

void Broose::initializeOverlay ( int  stage  )  [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.

Parameters:
stage the init stage

Reimplemented from BaseOverlay.

Definition at line 45 of file Broose.cc.

00046 {
00047     // because of IPAddressResolver, we need to wait until interfaces
00048     // are registered, address auto-assignment takes place etc.
00049     if(stage != MIN_STAGE_OVERLAY)
00050         return;
00051 
00052     // Broose provides KBR services
00053     kbr = true;
00054 
00055     // fetch some parameters
00056     bucketSize = par("bucketSize"); // = k
00057     rBucketSize = par("rBucketSize"); // = k'
00058     joinDelay = par("joinDelay");
00059     shiftingBits = par("brooseShiftingBits");
00060     pingDelay = par("pingDelay");
00061     userDist = par("userDist");
00062     refreshTime = par("refreshTime");
00063     numberRetries = par("numberRetries");
00064 
00065     //statistics
00066     bucketCount = 0;
00067     bucketBytesSent = 0;
00068     broosePingCount = 0;
00069     broosePingBytesSent = 0;
00070 
00071     //init local parameters
00072     chooseLookup = 0;
00073     receivedJoinResponse = 0;
00074     receivedBBucketLookup = 0;
00075     numberBBucketLookup = 0;
00076     receivedLBucketLookup = 0;
00077     numberLBucketLookup = 0;
00078     powShiftingBits = (int) pow(2.0, shiftingBits);
00079     keyLength = OverlayKey::getLength();
00080     numFailedPackets = 0;
00081     refresh = false;
00082     numPings = 0;
00083     maxPings = 0;
00084 
00085     // add some watches
00086     WATCH(receivedJoinResponse);
00087     WATCH(receivedBBucketLookup);
00088     WATCH(numberBBucketLookup);
00089     WATCH(receivedLBucketLookup);
00090     WATCH(numberLBucketLookup);
00091     WATCH(numPings);
00092     WATCH(maxPings);
00093 
00094     // get module references - these are references to the buckets
00095     // each node have in order to get a lookup done
00096     rBucket = new BrooseBucket*[powShiftingBits];
00097 
00098     for (int i = 0; i < powShiftingBits; i++) {
00099         rBucket[i] = check_and_cast<BrooseBucket*>
00100                      (getParentModule()->getSubmodule("rBucket",i));
00101     }
00102 
00103     lBucket = check_and_cast<BrooseBucket*>
00104               (getParentModule()->getSubmodule("lBucket"));
00105 
00106     bBucket = check_and_cast<BrooseBucket*>
00107               (getParentModule()->getSubmodule("bBucket"));
00108 
00109     // create join and bucket timer
00110     join_timer = new cMessage("join_timer");
00111     bucket_timer = new cMessage("bucket_timer");
00112 }

void Broose::finishOverlay (  )  [virtual]

collects statistical data in derived class

Reimplemented from BaseOverlay.

Definition at line 550 of file Broose.cc.

00551 {
00552     // print out statistics and delete pointers
00553 
00554     // remove this node from the bootstrap list
00555     bootstrapList->removeBootstrapNode(thisNode);
00556 
00557     simtime_t time = globalStatistics->calcMeasuredLifetime(creationTime);
00558     if(time == 0) return;
00559 
00560     globalStatistics->addStdDev("Broose: Number of non-routable packets/s", numFailedPackets / time);
00561 
00562     globalStatistics->addStdDev("Broose: Sent BUCKET Messages/s", bucketCount / time);
00563     globalStatistics->addStdDev("Broose: Sent BUCKET Byte/s", bucketBytesSent / time);
00564 
00565     globalStatistics->addStdDev("Broose: Sent BROOSEPING Messages/s", broosePingCount / time);
00566     globalStatistics->addStdDev("Broose: Sent BROOSEPING Bytes/s", broosePingBytesSent / time);
00567 }

bool Broose::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.

Parameters:
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
Returns:
bool true, if the node is responsible for the key.

Reimplemented from BaseOverlay.

Definition at line 611 of file Broose.cc.

Referenced by findNode().

00615 {
00616 // TODO: node != thisNode doesn't work yet
00617     if (key.isUnspecified())
00618         error("Broose::isSiblingFor(): key is unspecified!");
00619 
00620     if (node != thisNode)
00621         error("Broose::isSiblingsFor(): "
00622               "node != thisNode is not implemented!");
00623 
00624     if (numSiblings > getMaxNumSiblings()) {
00625         opp_error("Broose::isSiblingFor(): numSiblings too big!");
00626     }
00627     // set default number of siblings to consider
00628     if (numSiblings == -1) numSiblings = getMaxNumSiblings();
00629 
00630     if (protoState != READY) {
00631         *err = true;
00632         return false;
00633     }
00634 
00635     return bBucket->keyInRange(key);
00636 }

void Broose::joinOverlay (  )  [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 from BaseOverlay.

Definition at line 114 of file Broose.cc.

00115 {
00116     changeState(INIT);
00117 
00118     // if the bootstrap node is unspecified we are the only node in the network
00119     // so we can skip the "normal" join protocol
00120     if (bootstrapNode.isUnspecified()) {
00121         changeState(READY);
00122     }
00123 }

void Broose::handleUDPMessage ( BaseOverlayMessage *  msg  )  [virtual]

Processes messages from underlay.

Parameters:
msg Message from UDP

Reimplemented from BaseOverlay.

Definition at line 265 of file Broose.cc.

00266 {
00267     error("Broose::handleUDPMessage called!");
00268 }

void Broose::recordOverlaySentStats ( BaseOverlayMessage *  msg  )  [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.

Parameters:
msg The overlay message to be sent to the UDP layer

Reimplemented from BaseOverlay.

Definition at line 569 of file Broose.cc.

00570 {
00571     BaseOverlayMessage* innerMsg;
00572 
00573     if (msg->getType() == OVERLAYROUTE)
00574         innerMsg = dynamic_cast<BaseOverlayMessage*>(msg->getEncapsulatedMsg());
00575     else
00576         innerMsg = msg;
00577 
00578     switch (innerMsg->getType()) {
00579 
00580     case RPC: {
00581         if ((dynamic_cast<BucketCall*>(innerMsg) != NULL) ||
00582                 (dynamic_cast<BucketResponse*>(innerMsg) != NULL)) {
00583             RECORD_STATS(bucketCount++; bucketBytesSent +=
00584                              msg->getByteLength());
00585         } else if ((dynamic_cast<BroosePingCall*>(innerMsg) != NULL) ||
00586                    (dynamic_cast<BroosePingResponse*>(innerMsg) != NULL)) {
00587             RECORD_STATS(broosePingCount++; broosePingBytesSent +=
00588                              msg->getByteLength());
00589         }
00590         break;
00591     }
00592     }
00593 }

bool Broose::handleRpc ( BaseCallMessage *  msg  )  [virtual]

Processes Remote-Procedure-Call invokation messages.


This method should be overloaded when the overlay provides RPC functionality.

Returns:
true, if rpc has been handled

Reimplemented from BaseRpc.

Definition at line 655 of file Broose.cc.

00656 {
00657     if (protoState == BSET || protoState == READY) {
00658         // delegate messages
00659         RPC_SWITCH_START( msg )
00660         // RPC_DELEGATE( <messageName>[Call|Response], <methodToCall> )
00661         RPC_DELEGATE(Bucket, handleBucketRequestRpc);
00662         RPC_DELEGATE(BroosePing, handleBroosePingRequestRpc);
00663         RPC_SWITCH_END( )
00664         return RPC_HANDLED;
00665     } else {
00666 //        EV << "[Broose::handleRpc() @ " << thisNode.ip
00667 //           << " (" << thisNode.key.toString(16) << ")]\n"
00668 //           << "    Received RPC call and state != READY || BSET!"
00669 //           << endl;
00670         return false;
00671     }
00672 }

void Broose::handleTimerEvent ( cMessage *  msg  )  [virtual]

Processes "timer" self-messages.

Parameters:
msg A self-message

Reimplemented from BaseOverlay.

Definition at line 270 of file Broose.cc.

00271 {
00272     if(msg->isName("join_timer"))
00273         handleJoinTimerExpired(msg);
00274     else if (msg->isName("bucket_timer"))
00275         handleBucketTimerExpired(msg);
00276     else
00277         error("Broose::handleTimerEvent - no other timer currently in use!");
00278 }

void Broose::updateTooltip (  ) 

updates information shown in tk-environment

Definition at line 638 of file Broose.cc.

Referenced by changeState().

00639 {
00640     if (ev.isGUI()) {
00641         std::stringstream ttString;
00642 
00643         // show our ip and key in tooltip
00644         ttString << thisNode.ip << " " << thisNode.key;
00645 
00646         getParentModule()->getParentModule()->getDisplayString().
00647         setTagArg("tt", 0, ttString.str().c_str());
00648         getParentModule()->getDisplayString().
00649         setTagArg("tt", 0, ttString.str().c_str());
00650         getDisplayString().setTagArg("tt", 0, ttString.str().c_str());
00651 
00652     }
00653 }

void Broose::handleJoinTimerExpired ( cMessage *  msg  )  [protected]

handles a expired join timer

Parameters:
msg the timer self-message

Definition at line 280 of file Broose.cc.

Referenced by handleTimerEvent().

00281 {
00282     if (protoState == READY)
00283         return;
00284 
00285     if (!bootstrapNode.isUnspecified()) {
00286         // create new lookup message
00287         BucketCall* bCallArray[powShiftingBits];
00288 
00289         // do lookups for key >> shiftingBits for each prefix
00290         OverlayKey newKey = thisNode.key >> shiftingBits;
00291         for (int i = 0; i < powShiftingBits; i++) {
00292             OverlayKey add(i);
00293             add = add << (keyLength - shiftingBits);
00294             add += newKey;
00295 
00296             bCallArray[i] = new BucketCall("BBucketCall");
00297             bCallArray[i]->setBucketType(BROTHER);
00298             bCallArray[i]->setBucketIndex(i);
00299             bCallArray[i]->setProState(PINIT);
00300             bCallArray[i]->setBitLength(BUCKETCALL_L(bCallArray[i]));
00301 
00302             // restart join protocol if one call times out
00303             // otherwise the node might be isolated
00304             sendRouteRpcCall(OVERLAY_COMP, bootstrapNode, add,
00305                              bCallArray[i]);
00306         }
00307     } else {
00308         // if the bootstrap node is unspecified we are the only node in the network
00309         // so we can skip the "normal" join protocol
00310         changeState(READY);
00311     }
00312 }

void Broose::handleBucketTimerExpired ( cMessage *  msg  )  [protected]

handles a expired bucket refresh timer

Parameters:
msg the bucket refresh self-message

Definition at line 314 of file Broose.cc.

Referenced by handleTimerEvent().

00315 {
00316     BrooseBucket* tmpBucket = new BrooseBucket();
00317     tmpBucket->initializeBucket (0, 0, thisBrooseNode,
00318                                  (2*powShiftingBits*rBucketSize + 7*bucketSize),
00319                                  this);
00320 
00321     for (int i = 0; i < powShiftingBits; i++) {
00322         for(uint32_t j = 0; j < rBucket[i]->getSize(); j++) {
00323             if ((simTime() - rBucket[i]->getLastSeen(
00324                         rBucket[i]->get(j))) > refreshTime
00325                     || rBucket[i]->getRTT(rBucket[i]->get(j)) == -1) {
00326 
00327                 tmpBucket->add(BrooseHandle(rBucket[i]->get(j)));
00328             }
00329         }
00330     }
00331 
00332     for (uint32_t i = 0; i < lBucket->getSize(); i++) {
00333         if ((simTime() - lBucket->getLastSeen(
00334                     lBucket->get(i))) > refreshTime
00335                 || lBucket->getRTT(lBucket->get(i)) == -1) {
00336 
00337             tmpBucket->add(BrooseHandle(lBucket->get(i)));
00338         }
00339     }
00340 
00341     for (uint32_t i = 0; i < bBucket->getSize(); i++) {
00342         if ((simTime() - bBucket->getLastSeen(
00343                     bBucket->get(i))) > refreshTime
00344                 || bBucket->getRTT(bBucket->get(i)) == -1 ) {
00345 
00346             tmpBucket->add(BrooseHandle(bBucket->get(i)));
00347         }
00348     }
00349 
00350     maxPings = tmpBucket->getSize();
00351 
00352     if (maxPings != 0) {
00353         BroosePingCall** array = new BroosePingCall*[tmpBucket->getSize()];
00354 
00355         for (uint32_t i = 0; i < tmpBucket->getSize(); i++) {
00356             array[i] = new BroosePingCall("PingCall");
00357             array[i]->setBitLength(BROOSEPINGCALL_L(array[i]));
00358 
00359             sendUdpRpcCall(tmpBucket->get(i), array[i]);
00360         }
00361     } else {
00362         numPings = 0;
00363         scheduleAt(simTime() + pingDelay, bucket_timer);
00364     }
00365     delete tmpBucket;
00366 }

void Broose::changeState ( int  state  )  [protected]

changes the node's state

Parameters:
state the state to which a node is changing

Definition at line 126 of file Broose.cc.

Referenced by handleBucketResponseRpc(), handleBucketTimeout(), handleJoinTimerExpired(), and joinOverlay().

00127 {
00128     switch (state) {
00129     case INIT: {
00130         protoState = INIT;
00131 
00132         if (!refresh) {
00133             // Calculate node's id by hashing its IP address
00134             thisNode.key = OverlayKey::sha1(
00135                                const_cast<char*>(thisNode.ip.str().c_str()));
00136             callUpdate(thisNode, true);
00137             thisBrooseNode = BrooseHandle(thisNode);
00138             updateTooltip();
00139         } else {
00140             bootstrapList->removeBootstrapNode(thisNode);
00141         }
00142 
00143         // find a new bootstrap node and enroll to the bootstrap list
00144         bootstrapNode = bootstrapList->getBootstrapNode();
00145 
00146         cancelEvent(join_timer);
00147         scheduleAt(simTime(), join_timer);
00148 
00149         // initialize respectively clear the buckets
00150         for (int i = 0; i < powShiftingBits; i++) {
00151             rBucket[i]->initializeBucket(shiftingBits, i,
00152                                          thisBrooseNode, rBucketSize, this);
00153         }
00154 
00155         lBucket->initializeBucket(-shiftingBits, 0, thisBrooseNode,
00156                                   powShiftingBits*rBucketSize, this);
00157         bBucket->initializeBucket(0, 0, thisBrooseNode, 7*bucketSize,
00158                                   this, true);
00159 
00160         // if we have restarted the join protocol reset parameters
00161         refresh = false;
00162         receivedBBucketLookup = 0;
00163         receivedLBucketLookup = 0;
00164         receivedJoinResponse = 0;
00165 
00166         assert(getParentModule()->getParentModule());
00167         getParentModule()->getParentModule()->bubble("Enter INIT state.");
00168         break;
00169     }
00170 
00171     case RSET: {
00172         protoState = RSET;
00173 
00174         BrooseBucket* tmpBucket = new BrooseBucket();
00175         tmpBucket->initializeBucket(0, 0, thisNode,
00176                                     powShiftingBits*rBucketSize, this);
00177 
00178         for (int i = 0; i < powShiftingBits; i++) {
00179             int size = rBucket[i]->getSize();
00180 
00181             for (int j = 0; j < size; j++) {
00182                 tmpBucket->add(rBucket[i]->get(j));
00183             }
00184         }
00185 
00186         BucketCall** bCall = new BucketCall*[tmpBucket->getSize()];
00187         for (uint32_t i = 0; i < tmpBucket->getSize(); i++) {
00188             bCall[i] = new BucketCall("LBucketCall");
00189             bCall[i]->setBucketType(LEFT);
00190             bCall[i]->setProState(PRSET);
00191             bCall[i]->setBitLength(BUCKETCALL_L(bcall[i]));
00192 
00193             sendUdpRpcCall(tmpBucket->get(i), bCall[i], NULL,
00194                            numberRetries, joinDelay);
00195         }
00196 
00197         // half of the calls must return to init a state change
00198         numberBBucketLookup = tmpBucket->getSize();
00199         numberBBucketLookup = (numberBBucketLookup == 1) ?
00200                               numberBBucketLookup : (numberBBucketLookup/2);
00201 
00202         delete tmpBucket;
00203 
00204         assert(getParentModule()->getParentModule());
00205         getParentModule()->getParentModule()->bubble("Enter RSET state.");
00206         break;
00207     }
00208 
00209     case BSET: {
00210         protoState = BSET;
00211 
00212         // half of the calls must return to init a state change
00213         numberLBucketLookup = bBucket->getSize();
00214         numberLBucketLookup = (numberLBucketLookup == 1) ?
00215                               numberLBucketLookup : (numberLBucketLookup/2);
00216 
00217         // send messages to all entries of the B Bucket
00218         int size2 = bBucket->getSize();
00219         BucketCall** bCall2 = new BucketCall*[size2];
00220         for (int i = 0; i < size2; i++) {
00221             bCall2[i] = new BucketCall("LBucketCall");
00222             bCall2[i]->setBucketType(LEFT);
00223             bCall2[i]->setProState(PBSET);
00224             bCall2[i]->setBitLength(BUCKETCALL_L(bcall2[i]));
00225 
00226             sendUdpRpcCall(bBucket->get(i), bCall2[i], NULL,
00227                            numberRetries, joinDelay);
00228         }
00229 
00230         assert(getParentModule()->getParentModule());
00231         getParentModule()->getParentModule()->bubble("Enter BSET state.");
00232         break;
00233     }
00234 
00235     case READY: {
00236         protoState = READY;
00237 //        bootstrapList->registerBootstrapNode(thisNode);
00238 
00239         //fill the bucket also with this node
00240         for (int i = 0; i < powShiftingBits; i++) {
00241             rBucket[i]->add(thisBrooseNode);
00242         }
00243 
00244         lBucket->add(thisBrooseNode);
00245         bBucket->add(thisBrooseNode);
00246 
00247         // to disable the ping protocol a pingDelay or
00248         // refreshTime of zero was given
00249         if (!(pingDelay == 0 || refreshTime == 0)) {
00250             cancelEvent(bucket_timer);
00251             scheduleAt(simTime() + pingDelay, bucket_timer);
00252         }
00253 
00254         assert(getParentModule()->getParentModule());
00255         getParentModule()->getParentModule()->bubble("Enter READY state.");
00256 
00257         updateTooltip();
00258         break;
00259     }
00260 
00261     }
00262     setOverlayReady(protoState == READY);
00263 }

NodeVector * Broose::findNode ( const OverlayKey &  key,
int  numRedundantNodes,
int  numSiblings,
BaseOverlayMessage *  msg 
) [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.

Parameters:
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.
Returns:
NodeVector with closest nodes.

Reimplemented from BaseOverlay.

Definition at line 380 of file Broose.cc.

00384 {
00385     NodeVector* nextHop = new NodeVector(1);
00386     BrooseFindNodeExtMessage *findNodeExt = NULL;
00387     bool err;
00388 
00389     //return the closest nodes
00390     if (isSiblingFor(thisNode, key, numSiblings, &err)) {
00391         BrooseBucket* tmpBBucket = new BrooseBucket();
00392         BrooseHandle node;
00393         node.key = key;
00394         tmpBBucket->initializeBucket(0, 0, node, bucketSize, this);
00395         int size;
00396 
00397         if (bBucket->getSize() > bucketSize)
00398             size = bucketSize;
00399         else
00400             size = bBucket->getSize();
00401 
00402         for (uint32_t i= 0; i < bBucket->getSize();i++)
00403             tmpBBucket->add(bBucket->get(i));
00404 
00405         // todo: this has to be returned, if IterativeLookup can deal
00406         // with the complete vector:
00407         for (int i = 0; i < size; i++)
00408             nextHop->push_back(tmpBBucket->get(i));
00409 
00410 //        nextHop->push_back(tmpBBucket->get(0));
00411 
00412         delete tmpBBucket;
00413         return nextHop;
00414     }
00415 
00416     if (msg != NULL) {
00417         if (!msg->hasObject("findNodeExt")) {
00418             findNodeExt = new BrooseFindNodeExtMessage("findNodeExt");
00419 
00420             OverlayKey routeKey = thisNode.key;
00421             // estimate distance
00422             int dist = max(rBucket[0]->longestPrefix(),
00423                            rBucket[1]->longestPrefix()) + 1 + userDist;
00424 
00425             if ((dist % shiftingBits) != 0)
00426                 dist += (shiftingBits - (dist % shiftingBits));
00427 
00428             if (dist > keyLength) {
00429                 if ((keyLength % shiftingBits) == 0) {
00430                     dist = keyLength;
00431                 } else {
00432                     dist = (keyLength - keyLength % shiftingBits);
00433                 }
00434             }
00435 
00436             if ((chooseLookup++) % 2 == 0) {
00437                 // init left shifting lookup
00438                 findNodeExt->setRightShifting(false);
00439 
00440                 int prefix = 0;
00441                 for (int i = 0; i < dist; i++) {
00442                     prefix += thisNode.key.getBitRange(thisNode.key.getLength() - i - 1, 1) << (dist - i - 1);
00443                 }
00444 
00445                 OverlayKey pre(prefix);
00446                 routeKey = key >> dist;
00447                 routeKey += (pre << key.getLength() - dist);
00448 
00449                 dist = -dist;
00450             } else {
00451                 // init right shifting lookup
00452                 findNodeExt->setRightShifting(true);
00453             }
00454 
00455             //add contact for next Hop
00456             findNodeExt->setLastNode(thisNode);
00457             findNodeExt->setRouteKey(routeKey);
00458             findNodeExt->setStep(dist);
00459             findNodeExt->setBitLength(BROOSEFINDNODEEXTMESSAGE_L);
00460 
00461             msg->addObject( findNodeExt );
00462         }
00463 
00464         findNodeExt = (BrooseFindNodeExtMessage*) msg->getObject("findNodeExt");
00465     }
00466 
00467 
00468     // check for messages which couldn't be routed
00469     if (findNodeExt->getStep() == 0) {
00470         if (!isSiblingFor(thisNode, key, numSiblings, &err)) {
00471             //      cout << "Message failed - destKey " << key << "@ simtime " << simTime()
00472             // << " @node " << thisNode.ip << " lastNode " << findNodeExt->getLastNode().ip << endl;
00473             numFailedPackets++;
00474         } else
00475             error("Broose::findNode - unexpected Error");
00476         return nextHop;
00477     }
00478 
00479     if (findNodeExt->getRightShifting() == false) {
00480         // Left Shifting Lookup
00481 
00482         // can't handle left shifting lookup in BSET-State
00483         if (protoState == BSET)
00484             return nextHop;
00485 
00486         // update buckets with last hop
00487         addNode(findNodeExt->getLastNode());
00488         setLastSeen(findNodeExt->getLastNode());
00489 
00490         // replace last hop contact information with
00491         // this hop contact information
00492         findNodeExt->setLastNode(thisNode);
00493 
00494 
00495         // calculate routing key
00496         findNodeExt->setRouteKey((findNodeExt->getRouteKey()) << shiftingBits);
00497         findNodeExt->setStep(findNodeExt->getStep() + shiftingBits);
00498 
00499         // On last hop exchange routeKey for destKey especially
00500         // useful when using lookupNodeIds
00501         NodeHandle nextNode;
00502 
00503         if (findNodeExt->getStep() == 0)
00504             nextNode = lBucket->getClosestNode(key);
00505         else
00506             nextNode = lBucket->getClosestNode(findNodeExt->getRouteKey());
00507 
00508         nextHop->push_back(nextNode);
00509     } else {
00510         // Right Shifting Lookup
00511 
00512         // update buckets with last hop
00513         addNode(findNodeExt->getLastNode());
00514         setLastSeen(findNodeExt->getLastNode());
00515 
00516         // replace last hop contact information with
00517         // this hop contact information
00518         findNodeExt->setLastNode(thisNode);
00519 
00520         // calculate routing key
00521         int prefix = 0;
00522         int dist = findNodeExt->getStep();
00523         OverlayKey routeKey = findNodeExt->getRouteKey() >> shiftingBits;
00524         for (int i = 0; i < shiftingBits; i++)
00525             prefix += ((int)key.getBit(key.getLength() - dist + i) << i);
00526         OverlayKey pre(prefix);
00527         routeKey += (pre << (routeKey.getLength()-shiftingBits));
00528 
00529         findNodeExt->setRouteKey(routeKey);
00530         findNodeExt->setStep(dist - shiftingBits);
00531 
00532         // On last hop exchange routeKey for destKey especially
00533         // useful when using lookupNodeIds
00534         NodeHandle nextNode;
00535 
00536         if (findNodeExt->getStep() == 0)
00537             nextNode = rBucket[prefix]->getClosestNode(key);
00538         else
00539             nextNode = rBucket[prefix]->getClosestNode(routeKey);
00540 
00541         nextHop->push_back(nextNode);
00542     }
00543 
00544     if ((*nextHop)[0] == thisNode) {
00545         return (findNode(key, numRedundantNodes, numSiblings, msg));
00546     } else
00547         return nextHop;
00548 }

int Broose::getMaxNumSiblings (  )  [protected, virtual]

Query the maximum number of siblings (nodes close to a key) that are maintained by this overlay protocol.

Returns:
int number of siblings.

Reimplemented from BaseOverlay.

Definition at line 369 of file Broose.cc.

Referenced by isSiblingFor().

00370 {
00371     return bucketSize;
00372 }

int Broose::getMaxNumRedundantNodes (  )  [protected, virtual]

Query the maximum number of redundant next hop nodes that are returned by findNode().

Returns:
int number of redundant nodes returned by findNode().

Reimplemented from BaseOverlay.

Definition at line 374 of file Broose.cc.

00375 {
00376     return bucketSize;
00377 }

void Broose::displayBucketState (  )  [protected]

debug function which output the content of the node's buckets

Definition at line 595 of file Broose.cc.

00596 {
00597     EV << "[Broose::displayBucketState() @ " << thisNode.ip
00598     << " (" << thisNode.key.toString(16) << ")]" << endl;
00599     for (int i = 0; i < powShiftingBits; i++) {
00600         EV << "    Content of rBucket[" << i << "]: ";
00601         rBucket[i]->output();
00602     }
00603     EV << "    Content of lBucket: ";
00604     lBucket->output();
00605     EV << "    Content of bBucket: ";
00606     bBucket->output();
00607     EV << endl;
00608 }

void Broose::handleRpcResponse ( BaseResponseMessage *  msg,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
) [protected, virtual]

This method is called if an RPC response has been received.

Parameters:
msg The response message.
context Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code
rpcId The RPC id.
rtt The Round-Trip-Time of this RPC

Reimplemented from RpcListener.

Definition at line 674 of file Broose.cc.

00677 {
00678     RPC_SWITCH_START(msg)
00679     RPC_ON_RESPONSE( BroosePing ) {
00680         handleBroosePingResponseRpc(_BroosePingResponse, rtt);
00681         EV << "[Broose::handleRpcResponse() @ " << thisNode.ip
00682         << " (" << thisNode.key.toString(16) << ")]\n"
00683         << "    Ping RPC Response received: id=" << rpcId << "\n"
00684         << "    msg=" << *_BroosePingResponse << " rtt=" << rtt
00685         << endl;
00686         break;
00687     }
00688     RPC_ON_RESPONSE( Bucket ) {
00689         handleBucketResponseRpc(_BucketResponse);
00690         EV << "[Broose::handleRpcResponse() @ " << thisNode.ip
00691         << " (" << thisNode.key.toString(16) << ")]\n"
00692         << "    Bucket RPC Response received: id=" << rpcId << "\n"
00693         << "    msg=" << *_BucketResponse << " rtt=" << rtt
00694         << endl;
00695         break;
00696     }
00697     RPC_SWITCH_END( )
00698 }

void Broose::handleRpcTimeout ( BaseCallMessage *  msg,
const TransportAddress &  dest,
cPolymorphic *  context,
int  rpcId,
const OverlayKey &  destKey 
) [protected, virtual]

This method is called if an RPC timeout has been reached.

Parameters:
msg The original RPC message.
dest The destination node
context Pointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code
rpcId The RPC id.
destKey the destination OverlayKey

Reimplemented from RpcListener.

Definition at line 700 of file Broose.cc.

00704 {
00705     RPC_SWITCH_START(msg)
00706     RPC_ON_CALL( BroosePing ) {
00707         handleBroosePingTimeout(_BroosePingCall, dest, destKey);
00708         EV << "[Broose::handleRpcTimeout() @ " << thisNode.ip
00709         << " (" << thisNode.key.toString(16) << ")]\n"
00710         << "    Ping RPC Call timed out: id=" << rpcId << "\n"
00711         << "    msg=" << *_BroosePingCall
00712         << endl;
00713         break;
00714     }
00715     RPC_ON_CALL( FindNode ) {
00716         handleFindNodeTimeout(_FindNodeCall, dest, destKey);
00717         EV << "[Broose::handleRpcTimeout() @ " << thisNode.ip
00718         << " (" << thisNode.key.toString(16) << ")]\n"
00719         << "    Find Node RPC Call timed out: id=" << rpcId << "\n"
00720         << "    msg=" << *_FindNodeCall
00721         << endl;
00722         break;
00723     }
00724     RPC_ON_CALL( Bucket ) {
00725         handleBucketTimeout(_BucketCall);
00726         EV << "[Broose::handleRpcTimeout() @ " << thisNode.ip
00727         << " (" << thisNode.key.toString(16) << ")]\n"
00728         << "    Bucket RPC Call timed out: id=" << rpcId << "\n"
00729         << "    msg=" << *_BucketCall
00730         << endl;
00731         break;
00732     }
00733     RPC_SWITCH_END( )
00734 }

void Broose::handleFindNodeTimeout ( FindNodeCall *  findNode,
const TransportAddress &  dest,
const OverlayKey &  destKey 
) [protected]

This method is called if an Find Node Call timeout has been reached.

Parameters:
findNode The original FindNodeCall
dest the destination node
destKey the destination OverlayKey

Definition at line 737 of file Broose.cc.

Referenced by handleRpcTimeout().

00740 {
00741     for (int i = 0; i < powShiftingBits; i++) {
00742         if (rBucket[i]->getFailedResponses(BrooseHandle(dest, destKey)) == numberRetries)
00743             rBucket[i]->remove
00744             (BrooseHandle(dest, destKey));
00745         else
00746             rBucket[i]->increaseFailedResponses(BrooseHandle(dest, destKey));
00747     }
00748 
00749     if (lBucket->getFailedResponses(BrooseHandle(dest, destKey)) == numberRetries)
00750         lBucket->remove
00751         (BrooseHandle(dest, destKey));
00752     else
00753         lBucket->increaseFailedResponses(BrooseHandle(dest, destKey));
00754 
00755     if (bBucket->getFailedResponses(BrooseHandle(dest, destKey)) == numberRetries)
00756         bBucket->remove
00757         (BrooseHandle(dest, destKey));
00758     else
00759         bBucket->increaseFailedResponses(BrooseHandle(dest, destKey));
00760 }

void Broose::handleBucketRequestRpc ( BucketCall *  msg  )  [protected]

handles a received Bucket request

Parameters:
msg the message to process

Definition at line 761 of file Broose.cc.

Referenced by handleRpc().

00762 {
00763     if (msg->getBucketType() == LEFT) {
00764         // can't handle LBucketRequest in BSET-State
00765         if (protoState == BSET) {
00766             delete msg;
00767             return;
00768         }
00769 
00770         // return L-Bucket
00771         int size = lBucket->getSize();
00772         BucketResponse* bResponse = new BucketResponse("LBucketResponse");
00773         bResponse->setBucketType(msg->getBucketType());
00774         bResponse->setProState(msg->getProState());
00775         bResponse->setNodeNum(size);
00776         bResponse->setNodesArraySize(size);
00777 
00778         for (int i = 0; i < size; i++) {
00779             bResponse->setNodes(i, lBucket->get(i));
00780         }
00781 
00782         bResponse->setBitLength(BUCKETRESPONSE_L(bResponse));
00783 
00784         addNode(msg->getSrcNode());
00785         setLastSeen(msg->getSrcNode());
00786 
00787         sendRpcResponse(msg, bResponse );
00788     } else if(msg->getBucketType() == BROTHER) {
00789         // return B-Bucket
00790         int size = bBucket->getSize();
00791         BucketResponse* bResponse = new BucketResponse("BBucketResponse");
00792         bResponse->setBucketType(msg->getBucketType());
00793         bResponse->setBucketIndex(msg->getBucketIndex());
00794         bResponse->setProState(msg->getProState());
00795         bResponse->setNodeNum(size);
00796         bResponse->setNodesArraySize(size);
00797 
00798         for (int i = 0; i < size; i++) {
00799             bResponse->setNodes(i, bBucket->get(i));
00800         }
00801         bResponse->setBitLength(BUCKETRESPONSE_L(bResponse));
00802 
00803         sendRpcResponse(msg, bResponse );
00804     } else
00805         error("Broose::handleBucketRequestRpc() - Wrong Bucket Type!");
00806 }

void Broose::handleBucketResponseRpc ( BucketResponse *  msg  )  [protected]

handles a received Bucket response

Parameters:
msg the message to process

Definition at line 808 of file Broose.cc.

Referenced by handleRpcResponse().

00809 {
00810     if (msg->getBucketType() == LEFT) {
00811         switch (protoState) {
00812         case RSET:
00813             if (msg->getProState() == PRSET) {
00814                 for (int i = 0; i < msg->getNodeNum(); i++) {
00815                     bBucket->add(BrooseHandle(msg->getNodes(i)));
00816                 }
00817                 receivedBBucketLookup++;
00818 
00819                 if (receivedBBucketLookup == numberBBucketLookup)
00820                     changeState(BSET);
00821             }
00822             break;
00823         case BSET:
00824             if (msg->getProState() == PBSET) {
00825                 for (int i = 0; i < msg->getNodeNum(); i++) {
00826                     lBucket->add(BrooseHandle(msg->getNodes(i)));
00827                 }
00828                 receivedLBucketLookup++;
00829 
00830                 if(receivedLBucketLookup == numberLBucketLookup)
00831                     changeState(READY);
00832             }
00833             break;
00834         }
00835     } else if(msg->getBucketType() == BROTHER) {
00836         switch(protoState) {
00837         case INIT:
00838             if (msg->getProState() == PINIT) {
00839                 int k = msg->getBucketIndex();
00840 
00841                 for (int i = 0; i < msg->getNodeNum(); i++) {
00842                     rBucket[k]->add(msg->getNodes(i));
00843                 }
00844 
00845                 receivedJoinResponse++;
00846                 if (receivedJoinResponse == powShiftingBits)
00847                     changeState(RSET);
00848             }
00849         }
00850     } else
00851         error("Broose::handleBucketRequestRpc() - unknown error.");
00852 }

void Broose::handleBucketTimeout ( BucketCall *  msg  )  [protected]

handles a received Bucket timeout

Parameters:
msg the message to process

Definition at line 855 of file Broose.cc.

Referenced by handleRpcTimeout().

00856 {
00857     if (protoState == READY)
00858         return;
00859     else {
00860         refresh = true;
00861         changeState(INIT);
00862     }
00863 }

void Broose::handleBroosePingRequestRpc ( BroosePingCall *  msg  )  [protected]

handles a received Ping request

Parameters:
msg the message to process

Definition at line 866 of file Broose.cc.

Referenced by handleRpc().

00867 {
00868     BroosePingResponse* pingResponse = new BroosePingResponse("PingResponse");
00869     pingResponse->setBitLength(BROOSEPINGRESPONSE_L(pingResponse));
00870 
00871     // add pinging node to all buckets and update lastSeen of node
00872     addNode(msg->getSrcNode());
00873     setLastSeen(msg->getSrcNode());
00874 
00875     sendRpcResponse(msg, pingResponse);
00876 }

void Broose::handleBroosePingResponseRpc ( BroosePingResponse *  msg,
simtime_t  rtt 
) [protected]

handles a received Ping response

Parameters:
msg the message to process
rtt the round trip time of the message

Definition at line 878 of file Broose.cc.

Referenced by handleRpcResponse().

00880 {
00881     // if node respond reset failedResponses and add lastSeen to node
00882     setLastSeen(msg->getSrcNode());
00883     resetFailedResponses(msg->getSrcNode());
00884     setRTT(msg->getSrcNode(), rtttime);
00885 
00886     numPings++;
00887 
00888     if (numPings == maxPings) {
00889         numPings = 0;
00890         scheduleAt(simTime() + pingDelay, bucket_timer);
00891     }
00892 }

void Broose::handleBroosePingTimeout ( BroosePingCall *  msg,
const TransportAddress &  dest,
const OverlayKey &  destKey 
) [protected]

handles a received Ping timeout

Parameters:
msg the message to process
dest the destination node
destKey the destination OverlayKey

Definition at line 894 of file Broose.cc.

Referenced by handleRpcTimeout().

00897 {
00898     for (int i = 0; i < powShiftingBits; i++) {
00899         if (rBucket[i]->getFailedResponses(BrooseHandle(dest, destKey)) == numberRetries)
00900             rBucket[i]->remove(BrooseHandle(dest, destKey));
00901         else
00902             rBucket[i]->increaseFailedResponses(BrooseHandle(dest, destKey));
00903     }
00904 
00905     if (lBucket->getFailedResponses(BrooseHandle(dest, destKey)) == numberRetries) {
00906         lBucket->remove(BrooseHandle(dest, destKey));
00907     } else {
00908         lBucket->increaseFailedResponses(BrooseHandle(dest, destKey));
00909     }
00910 
00911     if (bBucket->getFailedResponses(BrooseHandle(dest, destKey)) == numberRetries) {
00912         bBucket->remove(BrooseHandle(dest, destKey));
00913     } else {
00914         bBucket->increaseFailedResponses(BrooseHandle(dest, destKey));
00915     }
00916 
00917     numPings++;
00918 
00919     if (numPings == maxPings) {
00920         numPings = 0;
00921         scheduleAt(simTime() + pingDelay, bucket_timer);
00922     }
00923 }

void Broose::setLastSeen ( NodeHandle  node  )  [protected]

updates the timestamp of a node in all buckets

Parameters:
node node handle which should be updated

Definition at line 925 of file Broose.cc.

Referenced by findNode(), handleBroosePingRequestRpc(), handleBroosePingResponseRpc(), and handleBucketRequestRpc().

00926 {
00927     for (int i = 0; i < powShiftingBits; i++) {
00928         rBucket[i]->setLastSeen(BrooseHandle(node), simTime());
00929     }
00930 
00931     lBucket->setLastSeen(BrooseHandle(node), simTime());
00932     bBucket->setLastSeen(BrooseHandle(node), simTime());
00933 }

void Broose::addNode ( NodeHandle  node,
int  bucket = 0 
) [protected]

adds a node to all buckets

Parameters:
node node handle which should be added
bucket reserved

Definition at line 935 of file Broose.cc.

Referenced by findNode(), handleBroosePingRequestRpc(), and handleBucketRequestRpc().

00936 {
00937     if (bucket == 0) {
00938         // add node to all buckets
00939         for (int i = 0; i < powShiftingBits; i++) {
00940             rBucket[i]->add
00941             (BrooseHandle(node));
00942         }
00943 
00944         lBucket->add(BrooseHandle(node));
00945         bBucket->add(BrooseHandle(node));
00946     } else
00947         error("Broose::addNode() - not implemented");
00948 }

void Broose::resetFailedResponses ( NodeHandle  node  )  [protected]

resets the counter of failed responses

Parameters:
node node handle of the responding node

Definition at line 950 of file Broose.cc.

Referenced by handleBroosePingResponseRpc().

00951 {
00952     for (int i = 0; i < powShiftingBits; i++) {
00953         rBucket[i]->resetFailedResponses(BrooseHandle(node));
00954     }
00955 
00956     lBucket->resetFailedResponses(BrooseHandle(node));
00957     bBucket->resetFailedResponses(BrooseHandle(node));
00958 }

void Broose::setRTT ( NodeHandle  node,
simtime_t  rtt 
) [protected]

sets the rtt to a node in all buckets

Parameters:
node node handle to which a rtt is added/updated
rtt round trip time to the node

Definition at line 960 of file Broose.cc.

Referenced by handleBroosePingResponseRpc().

00961 {
00962     for (int i = 0; i < powShiftingBits; i++) {
00963         rBucket[i]->setRTT(BrooseHandle(node), rtttime);
00964     }
00965 
00966     lBucket->setRTT(BrooseHandle(node), rtttime);
00967     bBucket->setRTT(BrooseHandle(node), rtttime);
00968 }


Friends And Related Function Documentation

friend class BrooseBucket [friend]

Definition at line 278 of file Broose.h.

Referenced by changeState(), findNode(), and handleBucketTimerExpired().


Member Data Documentation

int Broose::chooseLookup [protected]

decides which kind of lookup (right/left shifting) is used

Definition at line 100 of file Broose.h.

Referenced by findNode(), and initializeOverlay().

int Broose::joinDelay [protected]

time interval between two join tries

Definition at line 101 of file Broose.h.

Referenced by changeState(), and initializeOverlay().

int Broose::protoState [protected]

the state in which a node currently is

Definition at line 102 of file Broose.h.

Referenced by changeState(), findNode(), handleBucketRequestRpc(), handleBucketResponseRpc(), handleBucketTimeout(), handleJoinTimerExpired(), handleRpc(), and isSiblingFor().

number of received join response messages

Definition at line 103 of file Broose.h.

Referenced by changeState(), handleBucketResponseRpc(), and initializeOverlay().

number of received lookup responses for the B bucket

Definition at line 104 of file Broose.h.

Referenced by changeState(), handleBucketResponseRpc(), and initializeOverlay().

int Broose::numberBBucketLookup [protected]

maximal number of lookup responses for the B bucket

Definition at line 105 of file Broose.h.

Referenced by changeState(), handleBucketResponseRpc(), and initializeOverlay().

number of received lookup responses for the L bucket

Definition at line 106 of file Broose.h.

Referenced by changeState(), handleBucketResponseRpc(), and initializeOverlay().

int Broose::numberLBucketLookup [protected]

maximal number of lookup responses for the L bucket

Definition at line 107 of file Broose.h.

Referenced by changeState(), handleBucketResponseRpc(), and initializeOverlay().

int Broose::shiftingBits [protected]

number of bits shifted in/out each step

Definition at line 108 of file Broose.h.

Referenced by changeState(), findNode(), handleJoinTimerExpired(), and initializeOverlay().

int Broose::powShiftingBits [protected]

uint32_t Broose::bucketSize [protected]

maximal number of bucket entries

Definition at line 110 of file Broose.h.

Referenced by changeState(), findNode(), getMaxNumRedundantNodes(), getMaxNumSiblings(), handleBucketTimerExpired(), and initializeOverlay().

uint32_t Broose::rBucketSize [protected]

maximal number of entries in the r buckets

Definition at line 111 of file Broose.h.

Referenced by changeState(), handleBucketTimerExpired(), and initializeOverlay().

int Broose::keyLength [protected]

length of the node and data IDs

Definition at line 112 of file Broose.h.

Referenced by findNode(), handleJoinTimerExpired(), and initializeOverlay().

bool Broose::refresh [protected]

is the node restarting the bootstrap protocol or is it a new node

Definition at line 113 of file Broose.h.

Referenced by changeState(), handleBucketTimeout(), and initializeOverlay().

int Broose::pingDelay [protected]

time interval between bucket refreshes

Definition at line 114 of file Broose.h.

Referenced by changeState(), handleBroosePingResponseRpc(), handleBroosePingTimeout(), handleBucketTimerExpired(), and initializeOverlay().

int Broose::refreshTime [protected]

time interval between pings

Definition at line 115 of file Broose.h.

Referenced by changeState(), handleBucketTimerExpired(), and initializeOverlay().

uint32_t Broose::userDist [protected]

how many hops are added to the estimated hop count

Definition at line 116 of file Broose.h.

Referenced by findNode(), and initializeOverlay().

int Broose::numPings [protected]

actual number of received ping messages

Definition at line 117 of file Broose.h.

Referenced by handleBroosePingResponseRpc(), handleBroosePingTimeout(), handleBucketTimerExpired(), and initializeOverlay().

int Broose::maxPings [protected]

total number of ping messages

Definition at line 118 of file Broose.h.

Referenced by handleBroosePingResponseRpc(), handleBroosePingTimeout(), handleBucketTimerExpired(), and initializeOverlay().

int Broose::numberRetries [protected]

number of retries in case of timeout

Definition at line 119 of file Broose.h.

Referenced by changeState(), handleBroosePingTimeout(), handleFindNodeTimeout(), and initializeOverlay().

int Broose::bucketCount [protected]

number of Bucket messages

Definition at line 122 of file Broose.h.

Referenced by finishOverlay(), initializeOverlay(), and recordOverlaySentStats().

int Broose::bucketBytesSent [protected]

length of all Bucket messages

Definition at line 123 of file Broose.h.

Referenced by finishOverlay(), initializeOverlay(), and recordOverlaySentStats().

int Broose::broosePingCount [protected]

number of Ping messages

Definition at line 124 of file Broose.h.

Referenced by finishOverlay(), initializeOverlay(), and recordOverlaySentStats().

int Broose::broosePingBytesSent [protected]

length of all Ping messages

Definition at line 125 of file Broose.h.

Referenced by finishOverlay(), initializeOverlay(), and recordOverlaySentStats().

int Broose::numFailedPackets [protected]

number of packets which couldn't be routed correctly

Definition at line 126 of file Broose.h.

Referenced by findNode(), finishOverlay(), and initializeOverlay().

cMessage* Broose::join_timer [protected]

Definition at line 133 of file Broose.h.

Referenced by changeState(), initializeOverlay(), and ~Broose().

cMessage* Broose::bucket_timer [protected]

timer to reconstruct all buckets

Definition at line 134 of file Broose.h.

Referenced by changeState(), handleBroosePingResponseRpc(), handleBroosePingTimeout(), handleBucketTimerExpired(), initializeOverlay(), and ~Broose().

node handle holding the bootstrap node

Definition at line 137 of file Broose.h.

Referenced by changeState(), handleJoinTimerExpired(), and joinOverlay().

this is a BrooseHandle of the current node like thisNode

Definition at line 138 of file Broose.h.

Referenced by changeState(), and handleBucketTimerExpired().


The documentation for this class was generated from the following files:

Generated on Wed Mar 25 16:32:52 2009 for OverSim by  doxygen 1.5.5