Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

GlobalNodeList Class Reference

Global module (formerly known as GlobalNodeList) that supports the node bootstrap process and contains node specific underlay parameters, malicious node states, etc... More...

#include <GlobalNodeList.h>

List of all members.

Public Types

typedef std::vector< OverlayKeyKeyList
 holds all OverlayKeys

Public Member Functions

void addPeer (const IPvXAddress &ip, PeerInfo *info)
 Adds new peers to the peer set.
void sendNotificationToAllPeers (int category)
 Sends a NotificationBoard message to all registered peers.
virtual void killPeer (const IPvXAddress &ip)
 Removes a peer from the peerSet.
virtual const NodeHandlegetRandomNode (int32_t nodeType=-1, bool bootstrappedNeeded=true, bool inoffensiveNeeded=false)
 Returns a random NodeHandle.
virtual const NodeHandlegetBootstrapNode (const NodeHandle &node=NodeHandle::UNSPECIFIED_NODE)
 Returns a random NodeHandle.
virtual void registerPeer (const TransportAddress &peer)
 Bootstraps peers in the peer set.
virtual void registerPeer (const NodeHandle &peer)
 Bootstraps peers in the peer set.
virtual void refreshEntry (const TransportAddress &peer)
 Update entry to real port without having bootstrapped.
virtual void removePeer (const TransportAddress &peer)
 Debootstraps peers in the peer set.
virtual KeyListgetKeyList (uint32_t maximumKeys)
 Returns a keylist.
virtual const OverlayKeygetRandomKeyListItem ()
 Returns random key from list.
virtual void setOverlayReadyIcon (const TransportAddress &address, bool ready)
 Colors module-icon blue (ready), green (ready, malicious) or red (not ready).
virtual PeerInfogetPeerInfo (const TransportAddress &peer)
 Searches the peerSet for the specified node.
virtual void setMalicious (const TransportAddress &address, bool malicious)
 Set a node to be malicious.
virtual bool isMalicious (const TransportAddress &address)
 Check if a node is malicious.
virtual cObject ** getContext (const TransportAddress &address)
void setPreKilled (const TransportAddress &address)
 Mark a node for deletion.
TransportAddressgetRandomAliveNode (int32_t nodeType=-1)
 Selects a random node from the peerSet, which is not already marked for deletion.
virtual PeerInfogetRandomPeerInfo (int32_t nodeType=-1, bool bootstrapNeeded=false)
 Selects a random node from the peerSet.
virtual PeerInfogetPeerInfo (const IPvXAddress &ip)
 Searches the peerSet for the specified node.
size_t getNumNodes ()
bool areNodeTypesConnected (int32_t a, int32_t b)
void connectNodeTypes (int32_t a, int32_t b)
void disconnectNodeTypes (int32_t a, int32_t b)
void mergeBootstrapNodes (int toPartition, int fromPartition, int numNodes)
void incLandmarkPeerSize ()
uint16_t getLandmarkPeerSize ()
void incLandmarkPeerSizePerType (uint16_t type)

Protected Member Functions

virtual void initialize ()
 Init member function of module.
virtual void handleMessage (cMessage *msg)
 HandleMessage member function of module.
virtual void createKeyList (uint32_t size)
 Member function to create keylist.

Protected Attributes

KeyList keyList
 the keylist
uint16_t landmarkPeerSize
uint16_t landmarkPeerSizePerType [MAX_NODETYPES]
uint32_t preKilledNodes
 number of nodes marked for deletion in the peer set
double maliciousNodeRatio
 ratio of current malicious nodes when changing the ratio dynamically
cOutVector maliciousNodesVector
 vector that records the cange of malicious node rate
PeerStorage peerStorage
 Set of nodes participating in the overlay.
uint32_t maxNumberOfKeys
 parameter used by createKeyList()
double keyProbability
 probability of keys to be owned by nodes
bool isKeyListInitialized

Private Attributes

GlobalStatisticsglobalStatistics
 pointer to GlobalStatistics module in this node
bool connectionMatrix [MAX_NODETYPES][MAX_NODETYPES]
 matrix specifices with node types (partitions) can communication

Detailed Description

Global module (formerly known as GlobalNodeList) that supports the node bootstrap process and contains node specific underlay parameters, malicious node states, etc...

Author:
Markus Mauch, Robert Palmer

Definition at line 52 of file GlobalNodeList.h.


Member Typedef Documentation

typedef std::vector<OverlayKey> GlobalNodeList::KeyList

holds all OverlayKeys

Definition at line 58 of file GlobalNodeList.h.


Member Function Documentation

void GlobalNodeList::addPeer ( const IPvXAddress &  ip,
PeerInfo info 
)

Adds new peers to the peer set.

Called automatically by the underlay, when new peers are created.

Parameters:
ip IPvXAddress of the peer to add
info underlay specific info of the peer to add

Definition at line 212 of file GlobalNodeList.cc.

Referenced by SimpleUnderlayConfigurator::createNode(), ReaSEUnderlayConfigurator::createNode(), InetUnderlayConfigurator::createNode(), SingleHostUnderlayConfigurator::initializeUnderlay(), SimpleUnderlayConfigurator::migrateNode(), ReaSEUnderlayConfigurator::migrateNode(), InetUnderlayConfigurator::migrateNode(), InetUnderlayConfigurator::setUpIPv4(), and InetUnderlayConfigurator::setUpIPv6().

{
    BootstrapEntry temp;
    temp.node = new TransportAddress(ip);
    temp.info = info;
    temp.info->setPreKilled(false);

    peerStorage.insert(std::make_pair(temp.node->getIp(), temp));

    if (uniform(0, 1) < (double) par("maliciousNodeProbability") ||
            (par("maliciousNodeChange") && uniform(0, 1) < maliciousNodeRatio)) {
        setMalicious(*temp.node, true);
    }

    if (peerStorage.size() == 1) {
        // we need at least one inoffensive bootstrap node
        setMalicious(*temp.node, false);
    }
}

bool GlobalNodeList::areNodeTypesConnected ( int32_t  a,
int32_t  b 
)

Definition at line 409 of file GlobalNodeList.cc.

Referenced by SimpleUDP::processMsgFromApp(), and SimpleTCPConnection::sendToIP().

{
    if ((a > MAX_NODETYPES) || (b > MAX_NODETYPES)) {
        throw cRuntimeError("GlobalNodeList::areNodeTypesConnected(): nodeType "
              "bigger then MAX_NODETYPES");
    }

    return connectionMatrix[a][b];
}

void GlobalNodeList::connectNodeTypes ( int32_t  a,
int32_t  b 
)

Definition at line 419 of file GlobalNodeList.cc.

Referenced by GlobalTraceManager::handleMessage().

{
    if ((a > MAX_NODETYPES) || (b > MAX_NODETYPES)) {
        throw cRuntimeError("GlobalNodeList::connectNodeTypes(): nodeType "
              "bigger then MAX_NODETYPES");
    }

    connectionMatrix[a][b]=true;

    EV << "[GlobalNodeList::connectNodeTypes()]\n"
       << "    Connecting " << a << "->" << b
       << endl;

}

void GlobalNodeList::createKeyList ( uint32_t  size  )  [protected, virtual]

Member function to create keylist.

Parameters:
size size of new keylist

Definition at line 462 of file GlobalNodeList.cc.

Referenced by getKeyList(), and getRandomKeyListItem().

{
    for (uint32_t i = 0; i < size; i++)
        keyList.push_back(OverlayKey::random());
}

void GlobalNodeList::disconnectNodeTypes ( int32_t  a,
int32_t  b 
)

Definition at line 434 of file GlobalNodeList.cc.

Referenced by GlobalTraceManager::handleMessage().

{
    if ((a > MAX_NODETYPES) || (b > MAX_NODETYPES)) {
        throw cRuntimeError("GlobalNodeList::disconnectNodeTypes(): nodeType "
              "bigger then MAX_NODETYPES");
    }

    connectionMatrix[a][b]=false;

    EV << "[GlobalNodeList::disconnectNodeTypes()]\n"
       << "    Disconnecting " << a << "->" << b
       << endl;

}

const NodeHandle & GlobalNodeList::getBootstrapNode ( const NodeHandle node = NodeHandle::UNSPECIFIED_NODE  )  [virtual]

Returns a random NodeHandle.

Returns a random NodeHandle of an already bootstrapped node from the peerSet if at least one peer has been registered, an empty TransportAddress otherwise. If the optional node parameter is given, try to return a bootstrap node with the same TypeID.

Parameters:
node Find a bootstrap node with the same TypeID (partition) as node
Returns:
NodeHandle of the bootstrap node

Definition at line 143 of file GlobalNodeList.cc.

Referenced by KBRTestApp::handleTimerEvent(), Gia::handleTimerEvent(), and PubSubMMOG::initializeOverlay().

{
    uint32_t nodeType;
    PeerHashMap::iterator it;

    // always prefer boot node from the same TypeID
    // if there is no such node, go through all
    // connected partitions until a bootstrap node is found
    if (!node.isUnspecified()) {
        it = peerStorage.find(node.getIp());

        // this should never happen
        if (it == peerStorage.end()) {
           return getRandomNode(0, true);
        }

        nodeType = it->second.info->getTypeID();
        const NodeHandle &tempNode1 = getRandomNode(nodeType, true);

        if (tempNode1.isUnspecified()) {
            for (uint32_t i = 0; i < MAX_NODETYPES; i++) {
                if (i == nodeType)
                    continue;

                if (connectionMatrix[nodeType][i]) {
                    const NodeHandle &tempNode2 = getRandomNode(i, true);
                    if (!tempNode2.isUnspecified())
                        return tempNode2;
                }
            }
            return NodeHandle::UNSPECIFIED_NODE;
        } else {
            return tempNode1;
        }
    } else {
        return getRandomNode(0, true);
    }
}

cObject ** GlobalNodeList::getContext ( const TransportAddress address  )  [virtual]

Definition at line 376 of file GlobalNodeList.cc.

Referenced by BaseOverlay::handleMessage(), and BaseOverlay::join().

{
    PeerInfo* peer = getPeerInfo(address);

    if (peer != NULL) {
        return peer->getContext();
    }

    return NULL;
}

GlobalNodeList::KeyList * GlobalNodeList::getKeyList ( uint32_t  maximumKeys  )  [virtual]

Returns a keylist.

Parameters:
maximumKeys maximum number of keys in new keylist
Returns:
pointer to new keylist

Definition at line 468 of file GlobalNodeList.cc.

Referenced by GIASearchApp::handleTimerEvent().

{
    if( !isKeyListInitialized ) createKeyList(maxNumberOfKeys);
    if (maximumKeys > keyList.size()) {
        maximumKeys = keyList.size();
    }
    // copy keylist to temporary keylist
    KeyList tmpKeyList;
    tmpKeyList.clear();

    for (uint32_t i=0; i < keyList.size(); i++) {
        tmpKeyList.push_back(keyList[i]);
    }

    KeyList* returnList = new KeyList;

    for (uint32_t i=0; i < ((float)maximumKeys * keyProbability); i++) {
        uint32_t index = intuniform(0, tmpKeyList.size()-1);

        returnList->push_back(tmpKeyList[index]);
        tmpKeyList.erase(tmpKeyList.begin()+index);
    }

    return returnList;
}

uint16_t GlobalNodeList::getLandmarkPeerSize (  )  [inline]

Definition at line 238 of file GlobalNodeList.h.

Referenced by Nps::enoughLandmarks(), and Nps::getLandmarks().

{ return landmarkPeerSize; }

size_t GlobalNodeList::getNumNodes (  )  [inline]
PeerInfo * GlobalNodeList::getPeerInfo ( const IPvXAddress &  ip  )  [virtual]

Searches the peerSet for the specified node.

Parameters:
ip IPvXAddress of the specified node
Returns:
PeerInfo of the node or NULL if node is not in peerSet

Definition at line 307 of file GlobalNodeList.cc.

{
    PeerHashMap::iterator it = peerStorage.find(ip);

    if (it == peerStorage.end())
        return NULL;
    else
        return it->second.info;
}

PeerInfo * GlobalNodeList::getPeerInfo ( const TransportAddress peer  )  [virtual]
TransportAddress * GlobalNodeList::getRandomAliveNode ( int32_t  nodeType = -1  ) 

Selects a random node from the peerSet, which is not already marked for deletion.

Parameters:
nodeType If != -1, return a node of that type
Returns:
A pointer to the TransportAddress of a random alive node

Definition at line 341 of file GlobalNodeList.cc.

Referenced by Nps::getLandmarks(), TCPExampleApp::handleTimerEvent(), SimpleUnderlayConfigurator::preKillNode(), ReaSEUnderlayConfigurator::preKillNode(), and InetUnderlayConfigurator::preKillNode().

{
    if (peerStorage.size() <= preKilledNodes) {
        // all nodes are already marked for deletion;
        return NULL;
    } else {
        PeerHashMap::iterator it = peerStorage.getRandomNode(nodeType, false,
                                                             false);
        while (it != peerStorage.end()) {
            if (!it->second.info->isPreKilled()) {
                return it->second.node;
            } else {
                it = peerStorage.getRandomNode(nodeType, false, false);
            }
        }
        return NULL;
    }
}

const OverlayKey & GlobalNodeList::getRandomKeyListItem (  )  [virtual]

Returns random key from list.

Returns:
the key

Definition at line 494 of file GlobalNodeList.cc.

Referenced by GIASearchApp::handleTimerEvent().

{
    if( !isKeyListInitialized ) createKeyList(maxNumberOfKeys);
    return keyList[intuniform(0,keyList.size()-1)];
}

const NodeHandle & GlobalNodeList::getRandomNode ( int32_t  nodeType = -1,
bool  bootstrappedNeeded = true,
bool  inoffensiveNeeded = false 
) [virtual]

Returns a random NodeHandle.

Returns a random NodeHandle from the peerSet if at least one peer has been registered, an empty TransportAddress otherwise.

Parameters:
nodeType If != -1, return a node of that type
bootstrappedNeeded does the node need to be bootstrapped?
inoffensiveNeeded does the node need to be inoffensive?
Returns:
NodeHandle of the node

Definition at line 182 of file GlobalNodeList.cc.

Referenced by KBRTestApp::createDestKey(), getBootstrapNode(), BootstrapList::getBootstrapNode(), NTree::getRandomNode(), handleMessage(), and mergeBootstrapNodes().

{
    PeerHashMap::iterator it = peerStorage.getRandomNode(nodeType,
                                                         bootstrappedNeeded,
                                                         inoffensiveNeeded);
    if (it == peerStorage.end()) {
        return NodeHandle::UNSPECIFIED_NODE;
    }

    if (dynamic_cast<NodeHandle*>(it->second.node)) {
        return *dynamic_cast<NodeHandle*>(it->second.node);
    } else {
        return NodeHandle::UNSPECIFIED_NODE;
    }
}

PeerInfo * GlobalNodeList::getRandomPeerInfo ( int32_t  nodeType = -1,
bool  bootstrapNeeded = false 
) [virtual]

Selects a random node from the peerSet.

Parameters:
nodeType If != -1, return a node of that type
bootstrapNeeded does the node need to be bootstrapped?
Returns:
The peerInfo of a random node

Definition at line 317 of file GlobalNodeList.cc.

Referenced by mergeBootstrapNodes(), ReaSEUnderlayConfigurator::migrateNode(), and InetUnderlayConfigurator::migrateNode().

{
    PeerHashMap::iterator it = peerStorage.getRandomNode(nodeType,
                                                         bootstrappedNeeded,
                                                         false);
    if (it == peerStorage.end()) {
        return NULL;
    } else {
        return it->second.info;
    }
}

void GlobalNodeList::handleMessage ( cMessage *  msg  )  [protected, virtual]

HandleMessage member function of module.

Parameters:
msg messag to handle

Definition at line 102 of file GlobalNodeList.cc.

{
    if (msg->isName("maliciousNodeChange")) {
        double newRatio = maliciousNodeRatio + (double) par("maliciousNodeChangeRate"); // ratio to obtain
        if (maliciousNodeRatio < (double) par("maliciousNodeChangeStartValue"))
            newRatio = (double) par("maliciousNodeChangeStartValue");

        if (newRatio < (double) par("maliciousNodeChangeStopValue")) // schedule next event
            scheduleAt(simTime() + (int) par("maliciousNodeChangeInterval"), msg);

        int nodesNeeded = (int) (((double) par("maliciousNodeChangeRate")) * peerStorage.size());

        EV << "[GlobalNodeList::handleMessage()]\n"
           << "    Changing " << nodesNeeded << " nodes to be malicious"
           << endl;

        for (int i = 0; i < nodesNeeded; i++) {
            // search a node that is not yet malicious
            NodeHandle node;
            do {
                node = getRandomNode(0, false);
            } while (isMalicious(node));

            setMalicious(node, true);
        }

        maliciousNodesVector.record(newRatio);
        maliciousNodeRatio = newRatio;

        return;
    }

    else if (msg->isName("oracleTimer")) {
        RECORD_STATS(globalStatistics->recordOutVector(
                     "GlobalNodeList: Number of nodes", peerStorage.size()));
        scheduleAt(simTime() + 50, msg);
    } else {
        opp_error("GlobalNodeList::handleMessage: Unknown message type!");
    }
}

void GlobalNodeList::incLandmarkPeerSize (  )  [inline]

Definition at line 237 of file GlobalNodeList.h.

Referenced by Nps::setOwnLayer().

void GlobalNodeList::incLandmarkPeerSizePerType ( uint16_t  type  )  [inline]

Definition at line 239 of file GlobalNodeList.h.

Referenced by Nps::setOwnLayer().

void GlobalNodeList::initialize (  )  [protected, virtual]

Init member function of module.

Definition at line 61 of file GlobalNodeList.cc.

{
    maxNumberOfKeys = par("maxNumberOfKeys");
    keyProbability = par("keyProbability");
    isKeyListInitialized = false;
    WATCH_UNORDERED_MAP(peerStorage.getPeerHashMap());
    WATCH_VECTOR(keyList);
    WATCH(landmarkPeerSize);

    landmarkPeerSize = 0;

    for (int i = 0; i < MAX_NODETYPES; i++) {
        landmarkPeerSizePerType[i] = 0;
    }

    preKilledNodes = 0;

    if (par("maliciousNodeChange")) {
        if ((double) par("maliciousNodeProbability") > 0)
            error("maliciousNodeProbability and maliciousNodeChange are not supported concurrently");

        cMessage* msg = new cMessage("maliciousNodeChange");
        scheduleAt(simTime() + (int) par("maliciousNodeChangeStartTime"), msg);
        maliciousNodesVector.setName("MaliciousNodeRate");
        maliciousNodesVector.record(0);
        maliciousNodeRatio = 0;
    }

    for (int i=0; i<MAX_NODETYPES; i++) {
        for (int j=0; j<MAX_NODETYPES; j++) {
            connectionMatrix[i][j] = true;
        }
    }

    globalStatistics = GlobalStatisticsAccess().get();

    cMessage* timer = new cMessage("oracleTimer");

    scheduleAt(simTime(), timer);
}

bool GlobalNodeList::isMalicious ( const TransportAddress address  )  [virtual]

Check if a node is malicious.

Parameters:
address TransportAddress of the node
Returns:
if the node is malicious

Definition at line 365 of file GlobalNodeList.cc.

Referenced by handleMessage(), BaseOverlay::isMalicious(), and setOverlayReadyIcon().

{
    PeerInfo* peer = getPeerInfo(address);

    if (peer != NULL) {
        return peer->isMalicious();
    }

    return false;
}

void GlobalNodeList::killPeer ( const IPvXAddress &  ip  )  [virtual]

Removes a peer from the peerSet.

Called automatically by the underlay, when peers are removed.

Parameters:
ip IPvXAddress of the peer to remove

Definition at line 282 of file GlobalNodeList.cc.

Referenced by SimpleUnderlayConfigurator::handleTimerEvent(), ReaSEUnderlayConfigurator::handleTimerEvent(), InetUnderlayConfigurator::handleTimerEvent(), SimpleUnderlayConfigurator::migrateNode(), ReaSEUnderlayConfigurator::migrateNode(), and InetUnderlayConfigurator::migrateNode().

{
    PeerHashMap::iterator it = peerStorage.find(ip);
    if (it != peerStorage.end()) {
        if (it->second.info->isPreKilled()) {
            it->second.info->setPreKilled(false);
            preKilledNodes--;
        }

        // if valid NPS landmark: decrease landmarkPeerSize
        PeerInfo* peerInfo = it->second.info;
        if (peerInfo->getNpsLayer() > -1) {
            landmarkPeerSize--;
            landmarkPeerSizePerType[it->second.info->getTypeID()]--;
        }

        peerStorage.erase(it);
    }
}

void GlobalNodeList::mergeBootstrapNodes ( int  toPartition,
int  fromPartition,
int  numNodes 
)

Definition at line 449 of file GlobalNodeList.cc.

Referenced by GlobalTraceManager::handleMessage().

{
    BootstrapList* bootstrapList =
        check_and_cast<BootstrapList*>(simulation.getModule(
            getRandomPeerInfo(toPartition, false)->getModuleID())->
            getSubmodule("bootstrapList"));

    bootstrapList->insertBootstrapCandidate(getRandomNode(fromPartition, true),
                                       DNSSD);
}

void GlobalNodeList::refreshEntry ( const TransportAddress peer  )  [virtual]

Update entry to real port without having bootstrapped.

Parameters:
peer node to refresh

Definition at line 260 of file GlobalNodeList.cc.

Referenced by Landmark::initializeApp(), and Nps::setOwnLayer().

{
    PeerHashMap::iterator it = peerStorage.find(peer.getIp());

    if (it == peerStorage.end()) {
        throw cRuntimeError("GlobalNodeList::refreshEntry(): "
                "Peer is not in peer set");
    } else {
        delete it->second.node;
        it->second.node = new TransportAddress(peer);
    }
}

void GlobalNodeList::registerPeer ( const NodeHandle peer  )  [virtual]

Bootstraps peers in the peer set.

Parameters:
peer node to register

Definition at line 246 of file GlobalNodeList.cc.

{
    PeerHashMap::iterator it = peerStorage.find(peer.getIp());

    if (it == peerStorage.end()) {
        throw cRuntimeError("GlobalNodeList::registerPeer(): "
                "Peer is not in peer set");
    } else {
        delete it->second.node;
        it->second.node = new NodeHandle(peer);
        peerStorage.setBootstrapped(it, true);
    }
}

void GlobalNodeList::registerPeer ( const TransportAddress peer  )  [virtual]

Bootstraps peers in the peer set.

Parameters:
peer node to register

Definition at line 232 of file GlobalNodeList.cc.

Referenced by Vast::changeState(), Quon::changeState(), SingleHostUnderlayConfigurator::initializeUnderlay(), and BootstrapList::registerBootstrapNode().

{
    PeerHashMap::iterator it = peerStorage.find(peer.getIp());

    if (it == peerStorage.end()) {
        throw cRuntimeError("GlobalNodeList::registerPeer(): "
                "Peer is not in peer set");
    } else {
        delete it->second.node;
        it->second.node = new TransportAddress(peer);
        peerStorage.setBootstrapped(it, true);
    }
}

void GlobalNodeList::removePeer ( const TransportAddress peer  )  [virtual]

Debootstraps peers in the peer set.

Parameters:
peer node to remove

Definition at line 273 of file GlobalNodeList.cc.

Referenced by Vast::changeState(), Quon::changeState(), Vast::finishOverlay(), SimpleUnderlayConfigurator::preKillNode(), ReaSEUnderlayConfigurator::preKillNode(), InetUnderlayConfigurator::preKillNode(), and BootstrapList::removeBootstrapNode().

{
    PeerHashMap::iterator it = peerStorage.find(peer.getIp());

    if (it != peerStorage.end()) {
        peerStorage.setBootstrapped(it, false);
    }
}

void GlobalNodeList::sendNotificationToAllPeers ( int  category  ) 

Sends a NotificationBoard message to all registered peers.

Parameters:
category Type of notification

Definition at line 200 of file GlobalNodeList.cc.

{
    PeerHashMap::iterator it;
    for (it = peerStorage.begin(); it != peerStorage.end(); it++) {
        NotificationBoard* nb = check_and_cast<NotificationBoard*>(
                simulation.getModule(it->second.info->getModuleID())
                ->getSubmodule("notificationBoard"));

        nb->fireChangeNotification(category);
    }
}

void GlobalNodeList::setMalicious ( const TransportAddress address,
bool  malicious 
) [virtual]

Set a node to be malicious.

Parameters:
address TransportAddress of the node
malicious state to set

Definition at line 360 of file GlobalNodeList.cc.

Referenced by addPeer(), handleMessage(), and BaseOverlay::handleMessage().

{
    peerStorage.setMalicious(peerStorage.find(address.getIp()), malicious);
}

void GlobalNodeList::setOverlayReadyIcon ( const TransportAddress address,
bool  ready 
) [virtual]

Colors module-icon blue (ready), green (ready, malicious) or red (not ready).

Parameters:
address TransportAddress of the specified node
ready state to visualize

Definition at line 387 of file GlobalNodeList.cc.

Referenced by BaseOverlay::initialize(), Landmark::initializeApp(), and BaseOverlay::setOverlayReady().

{
    if (ev.isGUI()) {
        const char* color;

        if (ready) {
            // change color if node is malicious
            color = isMalicious(address) ? "green" : "";
        } else {
            color = isMalicious(address) ? "yellow" : "red";
        }

        PeerInfo* info = getPeerInfo(address);

        if (info != NULL) {
            simulation.getModule(info->getModuleID())->
                    getDisplayString().setTagArg("i2", 1, color);
        }
    }
}

void GlobalNodeList::setPreKilled ( const TransportAddress address  ) 

Mark a node for deletion.

Parameters:
address TransportAddress of the node

Definition at line 330 of file GlobalNodeList.cc.

Referenced by SimpleUnderlayConfigurator::preKillNode().

{
    PeerInfo* peer = getPeerInfo(address);

    if ((peer != NULL) && !(peer->isPreKilled())) {
        preKilledNodes++;
        peer->setPreKilled(true);
    }
}


Member Data Documentation

bool GlobalNodeList::connectionMatrix[MAX_NODETYPES][MAX_NODETYPES] [private]

matrix specifices with node types (partitions) can communication

Definition at line 276 of file GlobalNodeList.h.

Referenced by areNodeTypesConnected(), connectNodeTypes(), disconnectNodeTypes(), getBootstrapNode(), and initialize().

pointer to GlobalStatistics module in this node

Definition at line 275 of file GlobalNodeList.h.

Referenced by handleMessage(), and initialize().

Definition at line 272 of file GlobalNodeList.h.

Referenced by getKeyList(), getRandomKeyListItem(), and initialize().

the keylist

Definition at line 261 of file GlobalNodeList.h.

Referenced by createKeyList(), getKeyList(), getRandomKeyListItem(), and initialize().

double GlobalNodeList::keyProbability [protected]

probability of keys to be owned by nodes

Definition at line 271 of file GlobalNodeList.h.

Referenced by getKeyList(), and initialize().

uint16_t GlobalNodeList::landmarkPeerSize [protected]

Definition at line 262 of file GlobalNodeList.h.

Referenced by getLandmarkPeerSize(), incLandmarkPeerSize(), initialize(), and killPeer().

uint16_t GlobalNodeList::landmarkPeerSizePerType[MAX_NODETYPES] [protected]

Definition at line 263 of file GlobalNodeList.h.

Referenced by incLandmarkPeerSizePerType(), initialize(), and killPeer().

ratio of current malicious nodes when changing the ratio dynamically

Definition at line 265 of file GlobalNodeList.h.

Referenced by addPeer(), handleMessage(), and initialize().

cOutVector GlobalNodeList::maliciousNodesVector [protected]

vector that records the cange of malicious node rate

Definition at line 266 of file GlobalNodeList.h.

Referenced by handleMessage(), and initialize().

uint32_t GlobalNodeList::maxNumberOfKeys [protected]

parameter used by createKeyList()

Definition at line 270 of file GlobalNodeList.h.

Referenced by getKeyList(), getRandomKeyListItem(), and initialize().

uint32_t GlobalNodeList::preKilledNodes [protected]

number of nodes marked for deletion in the peer set

Definition at line 264 of file GlobalNodeList.h.

Referenced by getRandomAliveNode(), initialize(), killPeer(), and setPreKilled().


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