NodeHandle Class Reference

#include <NodeHandle.h>

Inheritance diagram for NodeHandle:

TransportAddress BootstrapNodeHandle BrooseHandle GiaNode KademliaBucketEntry

List of all members.


Detailed Description

This class implements a node handle.


It covers the complete node information, like IP-Address, port, NodeKey and some additional flags for Simulation behaviour. The information can be sparse, so parts can be omited by setting the property to an unspecified value.

Author:
Markus Mauch

Sebastian Mies


Public Types

typedef UNORDERED_SET
< NodeHandle, hashFcn
Set
 a hash_set of NodeHandles

Public Member Functions

 NodeHandle ()
 Constructs an unspecified NodeHandle.
virtual ~NodeHandle ()
 Standard destructor.
 NodeHandle (const NodeHandle &handle)
 Copy constructor.
 NodeHandle (const OverlayKey &key, const IPvXAddress &ip, int port)
 Complete constructor.
 NodeHandle (const TransportAddress &ta)
 Constructor to generate a NodeHandle from a TransportAddress.
bool operator== (const NodeHandle &rhs) const
 compares this NodeHandle to another given NodeHandle
bool operator!= (const NodeHandle &rhs) const
 compares this NodeHandle to another given NodeHandle
bool operator< (const NodeHandle &rhs) const
 compares this to a given NodeHandle
bool operator> (const NodeHandle &rhs) const
 compares this to a given NodeHandle
bool operator<= (const NodeHandle &rhs) const
 compares this to a given NodeHandle
bool operator>= (const NodeHandle &rhs) const
 compares this to a given NodeHandle
NodeHandleoperator= (const NodeHandle &rhs)
 assigns key, ip and port of rhs to this->key, this->ip and this->port
void setKey (const OverlayKey &key)
 saves given key to NodeHandle::key
const OverlayKeygetKey () const
 returns key of this NodeHandle
bool isUnspecified () const
 indicates if this NodeHandle is specified
virtual void netPack (cCommBuffer *b)
 serializes the object into a buffer
virtual void netUnpack (cCommBuffer *b)
 deserializes the object from a buffer
virtual TransportAddressdup () const
 returns a copy of the NodeHandle

Public Attributes

OverlayKey key
 the OverlayKey of this NodeHandle

Static Public Attributes

static const NodeHandle UNSPECIFIED_NODE
 the unspecified NodeHandle

Private Member Functions

void assertUnspecified (const NodeHandle &handle) const
 throws an opp_error if this or handle is unspecified

Friends

std::ostream & operator<< (std::ostream &os, const NodeHandle &n)
 standard output stream for NodeHandle, gives out ip, port and key

Member Typedef Documentation

typedef UNORDERED_SET<NodeHandle, hashFcn> NodeHandle::Set

a hash_set of NodeHandles

Reimplemented from TransportAddress.


Constructor & Destructor Documentation

NodeHandle::NodeHandle (  ) 

Constructs an unspecified NodeHandle.

Referenced by dup().

00044 {
00045     port = -1;
00046     key = OverlayKey::UNSPECIFIED_KEY;
00047 }

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

Standard destructor.

00068 {};

NodeHandle::NodeHandle ( const NodeHandle handle  ) 

Copy constructor.

Parameters:
handle The NodeHandle to copy
00051 {
00052     key = handle.key;
00053     port = handle.port;
00054     ip = handle.ip;
00055 }

NodeHandle::NodeHandle ( const OverlayKey key,
const IPvXAddress &  ip,
int  port 
)

Complete constructor.

Parameters:
key The OverlayKey
ip The IPvXAddress
port The UDP-Port
00067 {
00068     this->ip = ip;
00069     this->port = port;
00070     this->key = key;
00071 }

NodeHandle::NodeHandle ( const TransportAddress ta  ) 

Constructor to generate a NodeHandle from a TransportAddress.

The key will be unspecified.

Parameters:
ta transport address
00058 {
00059     this->ip = ta.ip;
00060     this->port = ta.port;
00061     this->key = OverlayKey::UNSPECIFIED_KEY;
00062 }


Member Function Documentation

bool NodeHandle::operator== ( const NodeHandle rhs  )  const

compares this NodeHandle to another given NodeHandle

Parameters:
rhs the NodeHandle this is compared to
Returns:
true if OverlayKey, IPvXAddress and port is equal, false otherwise
00091 {
00092     assertUnspecified( rhs );
00093     return ( this->key == rhs.key &&
00094              this->ip == rhs.ip && this->port == rhs.port );
00095 }

bool NodeHandle::operator!= ( const NodeHandle rhs  )  const

compares this NodeHandle to another given NodeHandle

Parameters:
rhs the NodeHandle this is compared to
Returns:
true if OverlayKey, IPvXAddress and port is not equal, false otherwise
00099 {
00100     assertUnspecified( rhs );
00101     return !( this->key == rhs.key &&
00102               this->ip == rhs.ip && this->port == rhs.port );
00103 }

bool NodeHandle::operator< ( const NodeHandle rhs  )  const

compares this to a given NodeHandle

Parameters:
rhs the NodeHandle this is compared to
Returns:
true if this->key is smaller than rhs->key, false otherwise
00107 {
00108     assertUnspecified(rhs);
00109     return this->key < rhs.key;
00110 }

bool NodeHandle::operator> ( const NodeHandle rhs  )  const

compares this to a given NodeHandle

Parameters:
rhs the NodeHandle this is compared to
Returns:
true if this->key is greater than rhs->key, false otherwise
00114 {
00115     assertUnspecified(rhs);
00116     return this->key > rhs.key;
00117 }

bool NodeHandle::operator<= ( const NodeHandle rhs  )  const

compares this to a given NodeHandle

Parameters:
rhs the NodeHandle this is compared to
Returns:
true if this->key is smaller than or equal to rhs->key, false otherwise
00121 {
00122     assertUnspecified(rhs);
00123     return this->key <= rhs.key;
00124 }

bool NodeHandle::operator>= ( const NodeHandle rhs  )  const

compares this to a given NodeHandle

Parameters:
rhs the NodeHandle this is compared to
Returns:
true if this->key is greater than or equal to rhs->key, false otherwise
00128 {
00129     assertUnspecified(rhs);
00130     return this->key >= rhs.key;
00131 }

NodeHandle & NodeHandle::operator= ( const NodeHandle rhs  ) 

assigns key, ip and port of rhs to this->key, this->ip and this->port

Parameters:
rhs the NodeHandle with the defined key, ip and port
Returns:
this NodeHandle object

Reimplemented in GiaNode.

00081 {
00082     this->key = rhs.key;
00083     this->ip = rhs.ip;
00084     this->port = rhs.port;
00085 
00086     return *this;
00087 }

void NodeHandle::setKey ( const OverlayKey key  ) 

saves given key to NodeHandle::key

Parameters:
key the given key

Referenced by PubSubMMOG::initializeOverlay(), and PubSubLobby::initializeOverlay().

00135 {
00136     this->key = key;
00137 }

const OverlayKey & NodeHandle::getKey (  )  const

bool NodeHandle::isUnspecified (  )  const

indicates if this NodeHandle is specified

Returns:
true, if NodeHandle has no ip or key specified, false otherwise

Reimplemented from TransportAddress.

Referenced by Gia::acceptNode(), GiaNeighborCandidateList::add(), assertUnspecified(), BasePastry::baseChangeState(), BaseOverlay::callUpdate(), Gia::changeState(), Chord::changeState(), Scribe::checkGroupEmpty(), Chord::closestPreceedingNode(), PubSubLobby::failedNode(), PastryRoutingTable::findCloserNode(), PastryLeafSet::findCloserNode(), PastryRoutingTable::findCloserNodes(), Koorde::findDeBruijnHop(), BasePastry::findNode(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), GiaNeighbors::get(), BootstrapOracle::getBootstrapNode(), BaseApp::handleCommonAPIMessage(), Koorde::handleDeBruijnTimerExpired(), PubSubMMOG::handleIntermediateResponse(), Vast::handleJoin(), PubSubLobby::handleJoin(), PubSubMMOG::handleJoinResponse(), Broose::handleJoinTimerExpired(), PubSubMMOG::handleMove(), PubSubMMOG::handlePingCallTimeout(), DHT::handlePutRequest(), PubSubLobby::handleRespCall(), Chord::handleRpcJoinResponse(), Koorde::handleRpcStabilizeResponse(), Chord::handleStabilizeTimerExpired(), Scribe::handleTimerEvent(), Pastry::handleTimerEvent(), Gia::handleTimerEvent(), Pastry::handleUDPMessage(), PastryLeafSet::insertLeaf(), PastryStateObject::isCloser(), Chord::isSiblingFor(), Pastry::joinOverlay(), Kademlia::joinOverlay(), Gia::joinOverlay(), Broose::joinOverlay(), Bamboo::joinOverlay(), BootstrapList::locateBootstrapNode(), PastryRoutingTable::lookupNextHop(), BrooseHandle::operator!=(), operator<<(), BrooseHandle::operator==(), BaseRpc::pingNode(), BasePastry::pingNodes(), BootstrapList::pingResponse(), BasePastry::pingResponse(), BaseRpc::pingRpcResponse(), BasePastry::prePing(), PastryRoutingTable::repair(), Kademlia::routingAdd(), Chord::rpcFixfingers(), Chord::rpcJoin(), Koorde::rpcNotify(), Chord::rpcNotify(), PubSubMMOG::sendMessageToChildren(), BaseOverlay::sendToKey(), and PubSubMMOG::unsubscribeChild().

00075 {
00076     return (ip.isUnspecified() || key.isUnspecified());
00077 }

void NodeHandle::assertUnspecified ( const NodeHandle handle  )  const [inline, private]

throws an opp_error if this or handle is unspecified

Parameters:
handle the NodeHandle to check

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

00148 {
00149     if ( this->isUnspecified() || handle.isUnspecified() )
00150         opp_error("NodeHandle: Trying to compare unspecified NodeHandle!");
00151 }

void NodeHandle::netPack ( cCommBuffer *  b  )  [virtual]

serializes the object into a buffer

Parameters:
b the buffer

Reimplemented from TransportAddress.

Referenced by doPacking().

00195 {
00196     //cMessage::netPack(b);
00197     doPacking(b,this->ip);
00198     doPacking(b,this->key);
00199     doPacking(b,this->port);
00200 }

void NodeHandle::netUnpack ( cCommBuffer *  b  )  [virtual]

deserializes the object from a buffer

Parameters:
b the buffer

Reimplemented from TransportAddress.

Referenced by doUnpacking().

00203 {
00204     //cMessage::netUnpack(b);
00205     doUnpacking(b,this->ip);
00206     doUnpacking(b,this->key);
00207     doUnpacking(b,this->port);
00208 }

TransportAddress * NodeHandle::dup (  )  const [virtual]

returns a copy of the NodeHandle

Returns:
a copy of the NodeHandle

Reimplemented from TransportAddress.

00211 {
00212     return new NodeHandle(*this);
00213 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const NodeHandle n 
) [friend]

standard output stream for NodeHandle, gives out ip, port and key

Parameters:
os the ostream
n the NodeHandle
Returns:
the output stream
00031 {
00032     if (n.isUnspecified()) {
00033         os << "<unspec>";
00034     } else {
00035         os << n.ip << ":" << n.port << " " << n.key;
00036     }
00037 
00038     return os;
00039 };


Member Data Documentation

the OverlayKey of this NodeHandle

Referenced by BrooseBucket::add(), GiaMessageBookkeeping::addMessage(), PastryRoutingTable::addRow(), IterativeLookup::addSibling(), ChordSuccessorList::addSuccessor(), BasePastry::baseChangeState(), BaseOverlay::bindToPort(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), BaseApp::callRoute(), BaseOverlay::callUpdate(), Pastry::changeState(), Gia::changeState(), Chord::changeState(), Broose::changeState(), Bamboo::changeState(), Pastry::checkProxCache(), Chord::closestPreceedingNode(), GiaNeighborCandidateList::contains(), KBRTestApp::deliver(), Broose::displayBucketState(), ConnectivityProbe::extractTopology(), PastryRoutingTable::findCloserNode(), Koorde::findDeBruijnHop(), Koorde::findNode(), Chord::findNode(), Broose::findNode(), BaseOverlay::findNodeRpc(), BasePastry::finishOverlay(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), PastryLeafSet::getBiggestKey(), BrooseBucket::getClosestNode(), PastryLeafSet::getDestinationNode(), getKey(), PastryLeafSet::getSmallestKey(), BaseOverlay::handleBaseOverlayMessage(), BaseApp::handleCommonAPIMessage(), Koorde::handleDeBruijnTimerExpired(), Kademlia::handleFailedNode(), Chord::handleFixFingersTimerExpired(), Scribe::handleJoinMessage(), Scribe::handleJoinResponse(), Chord::handleJoinTimerExpired(), Broose::handleJoinTimerExpired(), KBRTestApp::handleLookupResponse(), DHT::handleLookupResponse(), BootstrapList::handleLookupResponse(), XmlRpcInterface::handleMessage(), BaseOverlay::handleMessage(), BaseApp::handleMessage(), Chord::handleNewSuccessorHint(), Scribe::handlePublishCall(), Scribe::handlePublishResponse(), IterativePathLookup::handleResponse(), Koorde::handleRpcDeBruijnRequest(), Koorde::handleRpcNotifyResponse(), Chord::handleRpcNotifyResponse(), Scribe::handleRpcResponse(), PubSubMMOG::handleRpcResponse(), Koorde::handleRpcResponse(), KBRTestApp::handleRpcResponse(), Chord::handleRpcResponse(), Broose::handleRpcResponse(), BootstrapList::handleRpcResponse(), Koorde::handleRpcStabilizeResponse(), Chord::handleRpcStabilizeResponse(), PubSubMMOG::handleRpcTimeout(), PubSubLobby::handleRpcTimeout(), Koorde::handleRpcTimeout(), Kademlia::handleRpcTimeout(), Chord::handleRpcTimeout(), Broose::handleRpcTimeout(), Chord::handleStabilizeTimerExpired(), Pastry::handleStateMessage(), Scribe::handleTimerEvent(), KBRTestApp::handleTimerEvent(), DHT::handleTimerEvent(), Vast::handleUDPMessage(), Pastry::handleUDPMessage(), Gia::handleUDPMessage(), Scribe::handleUpperMessage(), BaseOverlay::initialize(), BrooseBucket::initializeBucket(), Chord::initializeFriendModules(), Vast::initializeOverlay(), BaseRpc::internalHandleRpcMessage(), PastryStateObject::isCloser(), PastryLeafSet::isClosestNode(), Kademlia::isSiblingFor(), Chord::isSiblingFor(), BasePastry::isSiblingFor(), isUnspecified(), BaseOverlay::join(), Chord::joinForeignPartition(), Kademlia::joinOverlay(), KeyExtractor< NodeHandle >::key(), KeyExtractor< KademliaBucketEntry >::key(), KeyExtractor< LookupEntry >::key(), BrooseBucket::keyInRange(), BootstrapList::locateBootstrapNode(), BrooseBucket::longestPrefix(), IterativeLookup::lookup(), SendToKeyListener::lookupFinished(), PastryRoutingTable::lookupNextHop(), PastryRoutingTable::mergeNode(), PastryLeafSet::mergeNode(), BaseOverlay::neighborSet(), netPack(), netUnpack(), NodeHandle(), operator!=(), BrooseHandle::operator!=(), operator<(), operator<<(), operator<=(), operator=(), GiaNode::operator=(), BrooseHandle::operator=(), operator==(), BrooseHandle::operator==(), operator>(), operator>=(), BrooseBucket::output(), P2pns::p2pnsRegisterRpc(), Chord::pingResponse(), BootstrapList::pingResponse(), BasePastry::pingResponse(), Chord::pingTimeout(), BootstrapList::pingTimeout(), BasePastry::pingTimeout(), BasePastry::prePing(), Gia::processSearchMessage(), ChordSuccessorList::removeSuccessor(), Gia::route(), BaseOverlay::route(), Kademlia::routingAdd(), Kademlia::routingTimeout(), Koorde::rpcNotify(), Chord::rpcNotify(), Vast::sendDiscardNode(), Vast::sendMessage(), BaseOverlay::sendMessageToUDP(), BaseApp::sendMessageToUDP(), Gia::sendSearchResponseMessage(), BaseOverlay::sendToKey(), BasePastry::setOwnNodeID(), BaseOverlay::setOwnNodeID(), PastryStateObject::specialCloserCondition(), IterativeLookup::start(), Scribe::subscribeToGroup(), Scribe::update(), ChordSuccessorList::updateList(), Broose::updateTooltip(), Koorde::walkDeBruijnList(), and Koorde::walkSuccessorList().


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

Generated on Fri Sep 19 13:05:07 2008 for ITM OverSim by  doxygen 1.5.5