PeerInfo Class Reference

Base class for providing additional underlay specific information associated with a certain transport address. More...

#include <PeerInfo.h>

Inheritance diagram for PeerInfo:
InetInfo SimpleInfo

List of all members.

Public Member Functions

 PeerInfo (uint32_t type, int moduleId, cObject **context)
 constructor
virtual ~PeerInfo ()
bool isBootstrapped ()
 has the peer bootstrapped yet?
void setBootstrapped (bool bootstrap=true)
 sets or deletes the bootstrapped parameter
int getModuleID ()
 returns the moduleId of the peer
int8_t getNpsLayer ()
 returns the NPS layer of the peer
void setNpsLayer (int8_t layer)
 set the NPS layer of the peer
uint32_t getTypeID ()
 returns the type of the node
bool isPreKilled ()
 is the peer marked for deletion?
void setPreKilled (bool killed=true)
 mark that the peer gets deleted soon
bool isMalicious ()
 is the peer malicious?
cObject ** getContext ()
void setMalicious (bool malic=true)
 set the maliciousness of the peer

Protected Member Functions

virtual void dummy ()
 dummy-function to make PeerInfo polymorphic

Protected Attributes

bool bootstrapped
 true if node has bootstrapped
bool malicious
 true if the node is malicious
bool preKilled
 true, if the node is marked for deletion
int moduleId
 the moduleId of the peer
uint32_t type
 ID of the node type.
int8_t npsLayer
 NPS Layer of the node.
cObject ** context
 context pointer

Friends

std::ostream & operator<< (std::ostream &os, const PeerInfo info)
 standard output stream for PeerInfo, gives moduleID and true if peer has bootstrapped, false otherwise

Detailed Description

Base class for providing additional underlay specific information associated with a certain transport address.

Definition at line 39 of file PeerInfo.h.


Constructor & Destructor Documentation

PeerInfo::PeerInfo ( uint32_t  type,
int  moduleId,
cObject **  context 
)

constructor

Definition at line 26 of file PeerInfo.cc.

00027 {
00028     bootstrapped = false;
00029     malicious = false;
00030     this->moduleId = moduleId;
00031     this->type = type;
00032     this->npsLayer = -1;   // layer not determined yet
00033     this->context = context;
00034 }

virtual PeerInfo::~PeerInfo (  )  [inline, virtual]

Definition at line 48 of file PeerInfo.h.

00048 {};


Member Function Documentation

void PeerInfo::dummy (  )  [protected, virtual]

dummy-function to make PeerInfo polymorphic

Reimplemented in InetInfo, and SimpleInfo.

Definition at line 36 of file PeerInfo.cc.

00036 {}

cObject** PeerInfo::getContext (  )  [inline]

Definition at line 111 of file PeerInfo.h.

Referenced by GlobalNodeList::getContext().

00111 { return context; };

int PeerInfo::getModuleID (  )  [inline]

returns the moduleId of the peer

Returns:
the moduleId

Definition at line 69 of file PeerInfo.h.

Referenced by TraceChurn::createNode(), TopologyVis::deleteOverlayNeighborArrow(), operator<<(), and GlobalNodeList::setOverlayReadyIcon().

00069 { return moduleId; };

int8_t PeerInfo::getNpsLayer (  )  [inline]

returns the NPS layer of the peer

Returns:
the NPS layer

Definition at line 76 of file PeerInfo.h.

Referenced by Nps::getLandmarks(), GlobalNodeList::killPeer(), operator<<(), and SimpleUDP::processMsgFromApp().

00076 { return npsLayer; };

uint32_t PeerInfo::getTypeID (  )  [inline]

returns the type of the node

Returns:
the node's typeID

Definition at line 88 of file PeerInfo.h.

Referenced by operator<<(), SimpleUnderlayConfigurator::preKillNode(), InetUnderlayConfigurator::preKillNode(), SimpleUDP::processMsgFromApp(), GlobalNodeList::registerPeer(), and Nps::setOwnLayer().

00088 { return type; };

bool PeerInfo::isBootstrapped (  )  [inline]

has the peer bootstrapped yet?

Returns:
true if the peer has bootstrapped, false otherwise

Definition at line 55 of file PeerInfo.h.

Referenced by operator<<(), GlobalNodeList::registerPeer(), and GlobalNodeList::setMalicious().

00055 { return bootstrapped; };

bool PeerInfo::isMalicious (  )  [inline]

is the peer malicious?

Returns:
true if the peer is malicious, false otherwise

Definition at line 109 of file PeerInfo.h.

Referenced by GlobalNodeList::isMalicious(), GlobalNodeList::registerPeer(), and GlobalNodeList::setMalicious().

00109 { return malicious; };

bool PeerInfo::isPreKilled (  )  [inline]

is the peer marked for deletion?

Returns:
true if the peer is marked for deletion, false otherwise

Definition at line 95 of file PeerInfo.h.

Referenced by GlobalNodeList::setPreKilled().

00095 { return preKilled; };

void PeerInfo::setBootstrapped ( bool  bootstrap = true  )  [inline]

sets or deletes the bootstrapped parameter

Parameters:
bootstrap true or () if peer has bootstrapped, false otherwise

Definition at line 62 of file PeerInfo.h.

Referenced by GlobalNodeList::registerPeer().

00062 { bootstrapped = bootstrap; };

void PeerInfo::setMalicious ( bool  malic = true  )  [inline]

set the maliciousness of the peer

Parameters:
malic whether the peer is malicious or not

Definition at line 118 of file PeerInfo.h.

Referenced by GlobalNodeList::setMalicious().

00118 { malicious = malic; };

void PeerInfo::setNpsLayer ( int8_t  layer  )  [inline]

set the NPS layer of the peer

Definition at line 81 of file PeerInfo.h.

Referenced by Nps::setOwnLayer().

00081 { npsLayer = layer; }

void PeerInfo::setPreKilled ( bool  killed = true  )  [inline]

mark that the peer gets deleted soon

Parameters:
killed true, if the peer gets deleted soon

Definition at line 102 of file PeerInfo.h.

Referenced by GlobalNodeList::addPeer(), and GlobalNodeList::setPreKilled().

00102 { preKilled = killed; };


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const PeerInfo  info 
) [friend]

standard output stream for PeerInfo, gives moduleID and true if peer has bootstrapped, false otherwise

Parameters:
os the ostream
info the PeerInfo
Returns:
the output stream

Definition at line 40 of file PeerInfo.cc.

00041 {
00042     os  << "ModuleId: " << info.moduleId << "Bootstrapped: "
00043         << (info.bootstrapped ? "true" : "false");
00044 
00045     if (info.npsLayer >= 0) os << "; NPS Layer: " << info.npsLayer;
00046     return os;
00047 }


Member Data Documentation

bool PeerInfo::bootstrapped [protected]

true if node has bootstrapped

Definition at line 133 of file PeerInfo.h.

Referenced by isBootstrapped(), operator<<(), PeerInfo(), and setBootstrapped().

cObject** PeerInfo::context [protected]

context pointer

Definition at line 139 of file PeerInfo.h.

bool PeerInfo::malicious [protected]

true if the node is malicious

Definition at line 134 of file PeerInfo.h.

Referenced by isMalicious(), PeerInfo(), and setMalicious().

int PeerInfo::moduleId [protected]

the moduleId of the peer

Definition at line 136 of file PeerInfo.h.

Referenced by operator<<().

int8_t PeerInfo::npsLayer [protected]

NPS Layer of the node.

Definition at line 138 of file PeerInfo.h.

Referenced by getNpsLayer(), operator<<(), PeerInfo(), and setNpsLayer().

bool PeerInfo::preKilled [protected]

true, if the node is marked for deletion

Definition at line 135 of file PeerInfo.h.

Referenced by isPreKilled(), and setPreKilled().

uint32_t PeerInfo::type [protected]

ID of the node type.

Definition at line 137 of file PeerInfo.h.


The documentation for this class was generated from the following files:
Generated on Wed May 26 16:21:18 2010 for OverSim by  doxygen 1.6.3