OverSim
TreeManagement Class Reference

#include <TreeManagement.h>

Inheritance diagram for TreeManagement:
RpcListener

Public Member Functions

 TreeManagement ()
void init (NeighborCache *neighborCache)
virtual ~TreeManagement ()
void handleTimerEvent (cMessage *msg)
virtual bool handleRpcCall (BaseCallMessage *msg)
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.
bool sendMessageToParent (BaseCallMessage *msg)
 send a message to the parent
bool sendMessageToChildren (BaseCallMessage *msg)
void startTreeBuilding ()
const NodeHandlegetParentNode ()
bool isRoot ()
bool isChild (TransportAddress &node)
bool isParent (TransportAddress &node)
int getCurrentTreeLevel ()
 return the current tree level of this node
const treeNodeMapgetChildNodes ()
void addMsgClient (const char *identifier, AbstractTreeMsgClient *msgClient)
void removeMsgClient (const char *identifier)
void handleChildCheckRpcCall (ChildCheckCall *call)
void handleChildCheckRpcResponse (ChildCheckResponse *response, cPolymorphic *context, int rpcId, simtime_t rtt)
void finishTreeManagement ()
 finish module and collect statistical data
- Public Member Functions inherited from RpcListener
virtual ~RpcListener ()
 destructor

Protected Member Functions

void connectToParent ()
 Check if a valid parent connection exists and establish one if not.
void removeParentConnection ()
bool checkParentValid ()
bool registerAtParent ()
bool isTreeDomainKeyValid ()
OverlayKey getResponsibleDomainKey ()
 Crawl the ID Space to find the smallest "Domain" for which the current node is NOT responsible.
void handleParentRequestRpcCall (ParentRequestCall *msg)
void handleParentRequestRpcResponse (ParentRequestResponse *response, cPolymorphic *context, int rpcId, simtime_t rtt)
void handleChildReleaseRpcCall (ChildReleaseCall *msg)
void visualizeTreeLinkToNode (const NodeHandle &treeNode)
void addChildNode (NodeHandle &childNode)
virtual void handleRpcResponse (BaseResponseMessage *msg, cPolymorphic *context, int rpcId, simtime_t rtt)
 This method is called if an RPC response has been received.
void sendChildReleaseCall ()
 send a message to my parent to release me from his children-list
void checkTreeChildNodes ()
 check the lastTouch record of theChildNode map and send a ping if the time is over limit
void removeTreeChild (const TransportAddress &childToRemove)
 remove child from list
void debugChildren ()
void cleanup ()
- Protected Member Functions inherited from RpcListener
virtual void handleRpcResponse (BaseResponseMessage *msg, const RpcState &rpcState, simtime_t rtt)
 This method is called if an RPC response has been received.
virtual void handleRpcTimeout (const RpcState &rpcState)
 This method is called if an RPC timeout has been reached.

Protected Attributes

int currentTreeLevel
 Current TreeLevel of this node - calculated by getResponsibleDomainKey.
int numTMSent [MAXTREELEVEL]
int numTMReceived [MAXTREELEVEL]
int bytesTMSent [MAXTREELEVEL]
int bytesTMReceived [MAXTREELEVEL]
simtime_t creationTime

Private Types

typedef std::pair< const char
*, AbstractTreeMsgClient * > 
msgClientPair
typedef UNORDERED_MAP< const
char *, AbstractTreeMsgClient * > 
msgClientMap

Private Attributes

GlobalNodeListglobalNodeList
NeighborCacheneighborCache
BaseOverlayoverlay
NodeHandle parentNode
OverlayKey treeDomainKey
treeNodeMap treeChildNodes
cMessage * treeBuildTimer
double treeMgmtBuildInterval
double deviation
double timeOutInSeconds
msgClientMap msgClients

Detailed Description

Definition at line 54 of file TreeManagement.h.

Member Typedef Documentation

Definition at line 77 of file TreeManagement.h.

typedef std::pair<const char*, AbstractTreeMsgClient*> TreeManagement::msgClientPair
private

Definition at line 76 of file TreeManagement.h.

Constructor & Destructor Documentation

TreeManagement::TreeManagement ( )

Definition at line 38 of file TreeManagement.cc.

{
treeBuildTimer = new cMessage("treeBuildTimer");
}
TreeManagement::~TreeManagement ( )
virtual

Definition at line 46 of file TreeManagement.cc.

{
neighborCache->cancelAndDelete(treeBuildTimer);
}

Member Function Documentation

void TreeManagement::addChildNode ( NodeHandle childNode)
protected

Definition at line 545 of file TreeManagement.cc.

Referenced by handleParentRequestRpcCall().

{
if (overlay->getThisNode() == childNode) return;
if (treeChildNodes.find(childNode) == treeChildNodes.end()) {
entry.node = childNode;
entry.lastTouch = simTime();
treeChildNodes.insert(treeNodePair(childNode, entry));
//inform clients
for (msgClientMap::iterator it = msgClients.begin();
it != msgClients.end(); ++it) {
it->second->newChild(childNode);
}
}
}
void TreeManagement::addMsgClient ( const char *  identifier,
AbstractTreeMsgClient msgClient 
)

Definition at line 705 of file TreeManagement.cc.

Referenced by NeighborCache::initializeApp().

{
if(msgClients.find(identifier) == msgClients.end()) {
msgClients.insert(msgClientPair(identifier, msgClient));
}
}
bool TreeManagement::checkParentValid ( )
protected

Definition at line 332 of file TreeManagement.cc.

Referenced by connectToParent().

{
bool err = false;
EV << "|DD|> TreeManagement::checkParentValid (Not Valid: Unspecified) <||" << endl;
return false;
}
if(isRoot()) {
OverlayKey testKey = (OverlayKey::getMax()>>1);
if(overlay->isSiblingFor(overlay->getThisNode(), testKey ,1, &err)) {
//std::cout << neighborCache->getThisNode().getIp() << " is still ROOT" << std::endl;
EV << "[TreeManagement::checkParentValid() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " I'm still ROOT!"
<< endl;
//std::cout << neighborCache->getThisNode().getIp() << " is still ROOT" << std::endl;
return true;
} else {
EV << "[TreeManagement::checkParentValid() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " I'm NOT longer ROOT!"
<< endl;
//std::cout << simTime() << " " << neighborCache->getThisNode().getIp() << " is NOT longer ROOT" << std::endl;
return false;
}
}
// 1. if my treeDomainKey is still valid
// 2. check if parent is responsible for my TreeDomainKey
bool isSiblingReturn = overlay->isSiblingFor(parentNode, treeDomainKey,1, &err);
if(isSiblingReturn && !err) {
// 3. check if I am not responsible for my TreeDomainKey
isSiblingReturn = overlay->isSiblingFor(overlay->getThisNode(), treeDomainKey, 1, &err);
if(!isSiblingReturn && !err) {
//std::cout << neighborCache->getThisNode().getIp() << " 3 checks passed" << std::endl;
EV << neighborCache->getThisNode().getIp() << " 3 checks passed" << endl;
return true;
}
}
}
return false;
}
void TreeManagement::checkTreeChildNodes ( )
protected

check the lastTouch record of theChildNode map and send a ping if the time is over limit

Definition at line 293 of file TreeManagement.cc.

Referenced by handleTimerEvent().

{
treeNodeMap::const_iterator nodeIterator = treeChildNodes.begin();
while (nodeIterator != treeChildNodes.end()) {
if(nodeIterator->second.lastTouch + timeOutInSeconds < simTime()) {
ChildCheckCall* childCheckCall = new ChildCheckCall("ChildCheckCall");
nodeIterator->second.node,
childCheckCall,
-1, 0, -1, this);
//neighborCache->pingNode(nodeIterator->second.node, -1, -1, NULL,
// "CheckChildAlive");
}
nodeIterator++;
}
}
void TreeManagement::cleanup ( )
protected
void TreeManagement::connectToParent ( )
protected

Check if a valid parent connection exists and establish one if not.

Definition at line 240 of file TreeManagement.cc.

Referenced by handleTimerEvent().

{
EV << "|DD|> TreeManagement::connectToParent (=== PARENTCHECK for Node "
<< overlay->getThisNode().getIp() <<" ===) <||" << endl;
EV << "|DD|> TreeManagement::connectToParent (Parent is not Valid) <||"
<< endl;
// add a new connection
}
}
void TreeManagement::debugChildren ( )
protected

Definition at line 565 of file TreeManagement.cc.

Referenced by addChildNode().

{
std::stringstream shortChildMapString;
shortChildMapString << "CL ";
EV << "=== Children List of " << overlay->getThisNode().getIp() << "===" << endl;
treeNodeMap::const_iterator nodeMapIterator = treeChildNodes.begin();
while(nodeMapIterator != treeChildNodes.end()) {
EV << " - " << (*nodeMapIterator).first << endl;
shortChildMapString << (*nodeMapIterator).first.getIp() << " | ";
++nodeMapIterator;
}
//neighborCache->getParentModule()->getDisplayString().setTagArg("t2", 0, shortChildMapString.str().c_str());
EV << "=====================" << endl;
}
void TreeManagement::finishTreeManagement ( )

finish module and collect statistical data

Definition at line 728 of file TreeManagement.cc.

Referenced by NeighborCache::finishApp().

{
int i;
std::stringstream statName;
for(i = 1; i < MAXTREELEVEL; i++) {
if(numTMSent[i] > 0 || numTMReceived[i] > 0) {
//int branchingFactor = 2;
// messages sent per level
statName.str("");
statName << "TreeManagement Level " << i << " numTMSent/Node/s";
neighborCache->globalStatistics->addStdDev(statName.str(), (double)numTMSent[i] / SIMTIME_DBL(time) );
statName.str("");
statName << "TreeManagement Level " << i << " numTMReceived/Node/s";
neighborCache->globalStatistics->addStdDev(statName.str(), (double)numTMReceived[i] / SIMTIME_DBL(time));
statName.str("");
statName << "TreeManagement Level " << i << " numTMTotal/Node/s";
neighborCache->globalStatistics->addStdDev(statName.str(), ((double)numTMReceived[i] + (double)numTMSent[i]) / SIMTIME_DBL(time));
// bytes per time send per level
statName.str("");
statName << "TreeManagement Level " << i << " bytesTMSent/Node/s";
neighborCache->globalStatistics->addStdDev(statName.str(), (double)bytesTMSent[i] / SIMTIME_DBL(time));
statName.str("");
statName << "TreeManagement Level " << i << " bytesTMReceived/Node/s";
neighborCache->globalStatistics->addStdDev(statName.str(), (double)bytesTMReceived[i] / SIMTIME_DBL(time));
statName.str("");
statName << "TreeManagement Level " << i << " bytesTMTotal/Node/s";
neighborCache->globalStatistics->addStdDev(statName.str(), ((double)bytesTMReceived[i] + (double)bytesTMSent[i]) / SIMTIME_DBL(time));
}
}
}
const treeNodeMap & TreeManagement::getChildNodes ( )
int TreeManagement::getCurrentTreeLevel ( )

return the current tree level of this node

Definition at line 722 of file TreeManagement.cc.

Referenced by GlobalViewBuilder::handleCoordSendTimer().

{
}
const NodeHandle & TreeManagement::getParentNode ( )
OverlayKey TreeManagement::getResponsibleDomainKey ( )
protected

Crawl the ID Space to find the smallest "Domain" for which the current node is NOT responsible.

Returns
OverlayKey a random key from this domain

Definition at line 587 of file TreeManagement.cc.

Referenced by isTreeDomainKeyValid(), and registerAtParent().

{
bool err = false;
OverlayKey rightBorder = OverlayKey::getMax(); // 1
OverlayKey testKey = OverlayKey::getMax()>>1; // middle of idSpace
OverlayKey domainKey = OverlayKey::getMax()>>1;
int it = 1;
int maxIteration = overlay->par("keyLength");
while(it < maxIteration) {
domainKey = testKey;
testKey = (leftBorder>>1) + (rightBorder>>1);
EV << "|DD|> TreeManagement::getResponsibleDomain (Checking: "
<< testKey <<") <||" << endl;
if(overlay->isSiblingFor(node, testKey,1, &err)) {
EV << "|DD|> TreeManagement::getResponsibleDomainKey ("
<< "CURTREELEVEL: " << currentTreeLevel << ") <||" << endl;
return domainKey;
}
if(err) {
EV << "|DD|> TreeManagement::getResponsibleDomain (ERROR WHILE CALLING isSiblingFor) <||" << endl;
}
if(node.getKey().isBetween(leftBorder, testKey)) { // linke Seite
rightBorder = testKey;
} else if (node.getKey().isBetween((rightBorder+leftBorder)>>1,rightBorder)) {
leftBorder=testKey;
} else {
EV << "|DD|> TreeManagement::getResponsibleDomain (KEY IS THE BORDER!) <||" << endl;
}
it++;
}
}
void TreeManagement::handleChildCheckRpcCall ( ChildCheckCall call)

Definition at line 459 of file TreeManagement.cc.

Referenced by handleRpcCall().

{
if (parentNode.isUnspecified() || msg->getSrcNode() != parentNode) {
delete msg;
return;
}
ChildCheckResponse* response = new ChildCheckResponse("ChildCheckReponse");
neighborCache->sendRpcResponse(msg, response);
}
void TreeManagement::handleChildCheckRpcResponse ( ChildCheckResponse response,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
)

Definition at line 312 of file TreeManagement.cc.

Referenced by handleRpcResponse().

{
if (treeChildNodes.find(response->getSrcNode()) != treeChildNodes.end()) {
treeChildNodes.find(response->getSrcNode())->second.lastTouch = simTime();
}
}
void TreeManagement::handleChildReleaseRpcCall ( ChildReleaseCall msg)
protected

Definition at line 450 of file TreeManagement.cc.

Referenced by handleRpcCall().

{
delete msg;
}
void TreeManagement::handleParentRequestRpcCall ( ParentRequestCall msg)
protected

Definition at line 484 of file TreeManagement.cc.

Referenced by handleRpcCall().

{
EV << "|DD|> TreeManagement::handleParentRequestRpcCall (ADDCHILDNODE!!! "
<< msg->getSrcNode().getIp() << " to "
<< overlay->getThisNode().getIp() << ") <||" << endl;
/*
if (dynamic_cast<OverlayCtrlInfo*>(msg->getControlInfo())) {
//OverlayCtrlInfo* overlayCtrlInfo = static_cast<OverlayCtrlInfo*>(msg->getControlInfo());
if (msg->getDomainKey() != getResponsibleDomainKey().second) {
std::cout << neighborCache->getThisNode().getIp()
<< ", msg->getDomainKey(): " << msg->getDomainKey()
<< ", getResponsibleDomainKey().second: " << getResponsibleDomainKey().second
<< " --> not responsible!" << std::endl;
//delete msg;
//return;
}
}
*/
ParentRequestResponse* parentResp = new ParentRequestResponse("ParentResponse");
parentResp->setBitLength(PARENTREQUESTRESPONSE_L(parentResp));
neighborCache->sendRpcResponse(msg, parentResp);
}
void TreeManagement::handleParentRequestRpcResponse ( ParentRequestResponse response,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
)
protected

Definition at line 511 of file TreeManagement.cc.

Referenced by handleRpcResponse().

{
EV << "|DD|> TreeManagement::handleParentRequestRpcResponse ("
<< overlay->getThisNode().getIp() <<" ISCHILDOF "
<< response->getSrcNode().getIp() << ") <||" << endl;
if(parentNode.isUnspecified() || response->getSrcNode() != parentNode) {
// remove old connection
// add new connection
if (response->getSrcNode() == neighborCache->overlay->getThisNode()) {
//std::cout << simTime() << " " << neighborCache->getThisNode().getIp() << " (thinks that it) is now ROOT!" << std::endl;
}
parentNode = response->getSrcNode();
// TODO
"m=m,50,0,50,0;ls=blue,1");
//inform clients
for (msgClientMap::iterator it = msgClients.begin();
it != msgClients.end(); ++it) {
it->second->newParent();
}
} /*else {
std::cout << (parentNode.isUnspecified()?"parentNode.isUnspecified()":"NOT parentNode.isUnspecified()") << "\n"
<< response->getSrcNode() << " " << parentNode << std::endl;
}*/
}
bool TreeManagement::handleRpcCall ( BaseCallMessage msg)
virtual
void TreeManagement::handleRpcResponse ( BaseResponseMessage msg,
cPolymorphic *  context,
int  rpcId,
simtime_t  rtt 
)
protectedvirtual

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

Parameters
msgThe response message.
contextPointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code
rpcIdThe RPC id.
rttThe Round-Trip-Time of this RPC

Reimplemented from RpcListener.

Definition at line 114 of file TreeManagement.cc.

{
bytesTMReceived[currentTreeLevel] += msg->getByteLength();
}
RPC_ON_RESPONSE( ParentRequest ) {
handleParentRequestRpcResponse(_ParentRequestResponse, context,
rpcId, rtt);
}
RPC_ON_RESPONSE( ChildCheck ) {
handleChildCheckRpcResponse(_ChildCheckResponse, context,
rpcId, rtt);
}
return;
}
void TreeManagement::handleRpcTimeout ( BaseCallMessage msg,
const TransportAddress dest,
cPolymorphic *  context,
int  rpcId,
const OverlayKey destKey 
)
virtual

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

Parameters
msgThe original RPC message.
destThe destination node
contextPointer to an optional state object. The object has to be handled/deleted by the handleRpcResponse() code
rpcIdThe RPC id.
destKeythe destination OverlayKey

Reimplemented from RpcListener.

Definition at line 138 of file TreeManagement.cc.

{
RPC_ON_CALL( ChildRelease ) {
break;
}
RPC_ON_CALL( ChildCheck ) {
EV << "[TreeManagement::handleRpcTimeout() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " Child timout: " << dest.getIp()
<< endl;
treeChildNodes.erase(dest);
break;
}
RPC_ON_CALL( ParentRequest ) {
EV << "[TreeManagement::handleRpcTimeout() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " Parent timout, domainKey = " << destKey
<< endl;
std::cout << "[TreeManagement::handleRpcTimeout() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " Parent timout, domainKey = " << destKey
<< std::endl;
break;
}
RPC_ON_CALL( TreeApp ) {
EV << "[TreeManagement::handleRpcTimeout() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " Peer in tree timout: " << dest.getIp()
<< " (" << destKey << ")"
<< endl;
if (!dest.isUnspecified() && !parentNode.isUnspecified() &&
(dest == parentNode)) {
EV << "[TreeManagement::handleRpcTimeout() @ "
<< " (" << neighborCache->getThisNode().getKey().toString(16) << ")]\n"
<< " TreeAppCall (sent directly to parent "
<< dest << ") timed out, retry sending message to key " << treeDomainKey
<< endl;
// retry to key
//TODO delayed
msg->dup(), NULL, DEFAULT_ROUTING,
-1 , 0, -1, this);
} else std::cout << neighborCache->getThisNode().getIp() << ": " << msg->getName()
<< " timed out to " << dest.getIp()
<< " (" << destKey << ")"
<< std::endl;
}
/*
// check parentNode
if (!destKey.isUnspecified() && destKey == treeDomainKey) {
treeDomainKey = OverlayKey::UNSPECIFIED_KEY;
overlay->deleteOverlayNeighborArrow(parentNode);
parentNode = NodeHandle::UNSPECIFIED_NODE;
std::cout << "parent timeout" << std::endl;
//return;
} else
// check children
if (dest.isUnspecified()) {
for (treeNodeMap::iterator it = treeChildNodes.begin();
it != treeChildNodes.end(); ++it) {
if (destKey == it->second.node.getKey()) {
treeChildNodes.erase(it);
//return;
}
}
} else if (dynamic_cast<ChildReleaseCall*>(msg)) {
//TODO there is no response...???
return;
} else std::cout << msg->getName() << std::endl;
handleTimerEvent(treeBuildTimer);
*/
}
void TreeManagement::handleTimerEvent ( cMessage *  msg)

Definition at line 82 of file TreeManagement.cc.

Referenced by handleRpcTimeout(), NeighborCache::handleTimerEvent(), and startTreeBuilding().

{
if(msg == treeBuildTimer) {
neighborCache->scheduleAt(simTime() +
truncnormal(treeMgmtBuildInterval,
msg);
}
}
void TreeManagement::init ( NeighborCache neighborCache)

Definition at line 59 of file TreeManagement.cc.

Referenced by NeighborCache::initializeApp().

{
this->neighborCache = neighborCache;
this->overlay = neighborCache->overlay;
treeMgmtBuildInterval = neighborCache->par("treeMgmtBuildInterval");
neighborCache->par("treeMgmtChildrenTimeOut").doubleValue();
creationTime = simTime();
// init stats Counter
for(int i = 0; i < MAXTREELEVEL; i++) {
numTMReceived[i] = 0;
numTMSent[i] = 0;
bytesTMSent[i] = 0;
}
}
bool TreeManagement::isChild ( TransportAddress node)

Definition at line 403 of file TreeManagement.cc.

Referenced by GlobalViewBuilder::handleCoordinateRpcCall().

{
return (treeChildNodes.find(node) != treeChildNodes.end());
}
bool TreeManagement::isParent ( TransportAddress node)

Definition at line 409 of file TreeManagement.cc.

{
assert(!node.isUnspecified());
return (!parentNode.isUnspecified() && (node == parentNode));
}
bool TreeManagement::isRoot ( )

Definition at line 394 of file TreeManagement.cc.

Referenced by checkParentValid(), GlobalViewBuilder::handleCoordSendTimer(), and GlobalViewBuilder::handleTimerEvent().

{
return true;
} else {
return false;
}
}
bool TreeManagement::isTreeDomainKeyValid ( )
protected

Definition at line 382 of file TreeManagement.cc.

Referenced by checkParentValid().

{
if (treeDomainKey.isUnspecified()) return false;
return true;
} else {
return false;
}
}
bool TreeManagement::registerAtParent ( )
protected

Definition at line 423 of file TreeManagement.cc.

Referenced by connectToParent().

{
ParentRequestCall* parentReq = new ParentRequestCall("ParentRequest");
simtime_t timeout = -1;
parentReq->setBitLength(PARENTREQUESTCALL_L(parentReq));
bytesTMSent[currentTreeLevel] += parentReq->getByteLength();
}
parentReq,
timeout, 0, -1, this
);
return true;
}
void TreeManagement::removeMsgClient ( const char *  identifier)

Definition at line 714 of file TreeManagement.cc.

{
if(msgClients.find(identifier) != msgClients.end()) {
msgClients.erase(identifier);
}
}
void TreeManagement::removeParentConnection ( )
protected

Definition at line 255 of file TreeManagement.cc.

Referenced by handleParentRequestRpcResponse().

{
if(parentNode.isUnspecified()) return;
//TODO
EV << "|DD|> TreeManagement::removeParentConnection (RELEASE Connection From "
<< " to Parent " << parentNode.getIp() << ") <||" << endl;
}
void TreeManagement::removeTreeChild ( const TransportAddress childToRemove)
protected

remove child from list

Parameters
NodeHandlehandle to childNode

Definition at line 471 of file TreeManagement.cc.

Referenced by handleChildReleaseRpcCall().

{
if(treeChildNodes.empty()) return;
//debugChildren();
if(treeChildNodes.find(childToRemove) != treeChildNodes.end()) {
treeChildNodes.erase(childToRemove);
}
//debugChildren();
}
void TreeManagement::sendChildReleaseCall ( )
protected

send a message to my parent to release me from his children-list

Definition at line 272 of file TreeManagement.cc.

Referenced by removeParentConnection().

{
ChildReleaseCall* childReleaseRequest = new ChildReleaseCall("ChildRelease");
simtime_t timeout = -1;
childReleaseRequest->setBitLength(CHILDRELEASECALL_L(childReleaseRequest));
bytesTMSent[currentTreeLevel] += childReleaseRequest->getByteLength();
}
childReleaseRequest,
timeout, 0, -1, this
);
}
bool TreeManagement::sendMessageToChildren ( BaseCallMessage msg)

Definition at line 662 of file TreeManagement.cc.

Referenced by GlobalViewBuilder::handleCoordinateRpcCall(), and GlobalViewBuilder::spreadGlobalView().

{
simtime_t timeout = -1;
bytesTMSent[currentTreeLevel] += msg->getByteLength();
}
treeNodeMap::const_iterator nodeMapIterator = treeChildNodes.begin();
while(nodeMapIterator != treeChildNodes.end()) {
/*
neighborCache->sendRouteRpcCall(neighborCache->getThisCompType(),
(*nodeMapIterator).second.node.getKey(),
msg->dup(),
NULL,DEFAULT_ROUTING,
timeout, 0, -1, this);
*/
(*nodeMapIterator).second.node,
msg->dup(),
timeout, 0, -1, this);
++nodeMapIterator;
}
delete msg;
return true;
}
bool TreeManagement::sendMessageToParent ( BaseCallMessage msg)

send a message to the parent

Parameters
msgBaseCallMessage

Definition at line 634 of file TreeManagement.cc.

Referenced by GlobalViewBuilder::handleCoordSendTimer().

{
return false;
}
bytesTMSent[currentTreeLevel] += msg->getByteLength();
}
/*
// send to key
neighborCache->sendRouteRpcCall(neighborCache->getThisCompType(),
treeDomainKey,
msg, NULL, DEFAULT_ROUTING,
-1 , 0, -1, this);
*/
// send directly
-1 , 0, -1, this);
return true;
}
void TreeManagement::startTreeBuilding ( )
void TreeManagement::visualizeTreeLinkToNode ( const NodeHandle treeNode)
protected

Member Data Documentation

int TreeManagement::bytesTMReceived[MAXTREELEVEL]
protected

Definition at line 175 of file TreeManagement.h.

Referenced by finishTreeManagement(), handleRpcCall(), handleRpcResponse(), and init().

int TreeManagement::bytesTMSent[MAXTREELEVEL]
protected
simtime_t TreeManagement::creationTime
protected

Definition at line 177 of file TreeManagement.h.

Referenced by finishTreeManagement(), and init().

int TreeManagement::currentTreeLevel
protected

Current TreeLevel of this node - calculated by getResponsibleDomainKey.

Definition at line 170 of file TreeManagement.h.

Referenced by getCurrentTreeLevel(), getResponsibleDomainKey(), handleRpcCall(), handleRpcResponse(), registerAtParent(), sendChildReleaseCall(), sendMessageToChildren(), sendMessageToParent(), and TreeManagement().

double TreeManagement::deviation
private

Definition at line 70 of file TreeManagement.h.

Referenced by handleTimerEvent(), and init().

GlobalNodeList* TreeManagement::globalNodeList
private

Definition at line 59 of file TreeManagement.h.

Referenced by init(), and TreeManagement().

msgClientMap TreeManagement::msgClients
private
int TreeManagement::numTMReceived[MAXTREELEVEL]
protected

Definition at line 173 of file TreeManagement.h.

Referenced by finishTreeManagement(), handleRpcCall(), handleRpcResponse(), and init().

int TreeManagement::numTMSent[MAXTREELEVEL]
protected
double TreeManagement::timeOutInSeconds
private

Definition at line 71 of file TreeManagement.h.

Referenced by checkTreeChildNodes(), and init().

cMessage* TreeManagement::treeBuildTimer
private
OverlayKey TreeManagement::treeDomainKey
private
double TreeManagement::treeMgmtBuildInterval
private

Definition at line 69 of file TreeManagement.h.

Referenced by handleTimerEvent(), and init().


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