NodeHandle Class Reference

This class implements a node handle. More...

#include <NodeHandle.h>

Inheritance diagram for NodeHandle:

TransportAddress BootstrapNodeHandle BrooseHandle GiaNode ProxNodeHandle KademliaBucketEntry

List of all members.

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.
 NodeHandle (const OverlayKey &key, const TransportAddress &ta)
 Constructor to generate a NodeHandle from an existing OverlayKey and 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

Static Public Attributes

static const NodeHandle UNSPECIFIED_NODE
 the unspecified NodeHandle

Protected Attributes

OverlayKey key
 the OverlayKey of this 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


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

Definition at line 50 of file NodeHandle.h.


Member Typedef Documentation

typedef UNORDERED_SET<NodeHandle, hashFcn> NodeHandle::Set

a hash_set of NodeHandles

Reimplemented from TransportAddress.

Definition at line 53 of file NodeHandle.h.


Constructor & Destructor Documentation

NodeHandle::NodeHandle (  ) 

Constructs an unspecified NodeHandle.

Definition at line 49 of file NodeHandle.cc.

Referenced by dup().

00050 {
00051     port = -1;
00052     key = OverlayKey(); // unspecified key, note: OverlayKey::UNSPECIFIED_KEY might not be initialized here
00053 }

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

Standard destructor.

Definition at line 68 of file NodeHandle.h.

00068 {};

NodeHandle::NodeHandle ( const NodeHandle handle  ) 

Copy constructor.

Parameters:
handle The NodeHandle to copy

Definition at line 56 of file NodeHandle.cc.

00057 {
00058     key = handle.key;
00059     port = handle.port;
00060     ip = handle.ip;
00061 }

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

Complete constructor.

Parameters:
key The OverlayKey
ip The IPvXAddress
port The UDP-Port

Definition at line 71 of file NodeHandle.cc.

00073 {
00074     this->setAddress(ip);
00075     this->setPort(port);
00076     this->setKey(key);
00077 }

NodeHandle::NodeHandle ( const TransportAddress ta  ) 

Constructor to generate a NodeHandle from a TransportAddress.

The key will be unspecified.

Parameters:
ta transport address

Definition at line 63 of file NodeHandle.cc.

00064 {
00065     this->setAddress(ta.getAddress());
00066     this->setPort(ta.getPort());
00067     this->setKey(OverlayKey::UNSPECIFIED_KEY);
00068 }

NodeHandle::NodeHandle ( const OverlayKey key,
const TransportAddress ta 
)

Constructor to generate a NodeHandle from an existing OverlayKey and TransportAddress.

Parameters:
key the overlay key
ta transport address

Definition at line 79 of file NodeHandle.cc.

00080 {
00081     this->setAddress(ta.getAddress());
00082     this->setPort(ta.getPort());
00083     this->setKey(key);
00084 }


Member Function Documentation

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

Definition at line 160 of file NodeHandle.cc.

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

00161 {
00162     if ( this->isUnspecified() || handle.isUnspecified() )
00163         opp_error("NodeHandle: Trying to compare unspecified NodeHandle!");
00164 }

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

returns a copy of the NodeHandle

Returns:
a copy of the NodeHandle

Reimplemented from TransportAddress.

Definition at line 183 of file NodeHandle.cc.

00184 {
00185     return new NodeHandle(*this);
00186 }

const OverlayKey & NodeHandle::getKey (  )  const

returns key of this NodeHandle

Returns:
the key of this NodeHandle

Definition at line 153 of file NodeHandle.cc.

Referenced by BrooseBucket::add(), GiaMessageBookkeeping::addMessage(), PastryRoutingTable::addRow(), IterativeLookup::addSibling(), Quon::addSite(), oversim::ChordSuccessorList::addSuccessor(), BasePastry::baseChangeState(), BasePastry::baseInit(), BaseOverlay::bindToPort(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), BaseApp::callRoute(), BaseOverlay::callUpdate(), Vast::changeState(), Quon::changeState(), Pastry::changeState(), Gia::changeState(), oversim::Chord::changeState(), Bamboo::changeState(), Pastry::checkProxCache(), oversim::Chord::closestPreceedingNode(), GiaNeighborCandidateList::contains(), Nps::coordsReqRpcResponse(), KBRTestApp::createDestKey(), Quon::deleteSite(), KBRTestApp::deliver(), Broose::displayBucketState(), Bamboo::doGlobalTuning(), BasePastry::doRoutingTableMaintenance(), Pastry::doSecondStage(), ConnectivityProbe::extractTopology(), PastryRoutingTable::findCloserNode(), oversim::Koorde::findDeBruijnHop(), oversim::Koorde::findNode(), oversim::Chord::findNode(), Broose::findNode(), BaseOverlay::findNodeRpc(), BasePastry::finishOverlay(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), PastryLeafSet::getBiggestKey(), PastryLeafSet::getDestinationNode(), Quon::getKey(), Gia::getRoute(), PastryLeafSet::getSmallestKey(), PubSubMMOG::handleAdoptChildCall(), PubSubMMOG::handleAdoptChildResponse(), Vast::handleAppMessage(), Quon::handleAppMessage(), BaseOverlay::handleBaseOverlayMessage(), Kademlia::handleBucketRefreshTimerExpired(), BaseApp::handleCommonAPIMessage(), oversim::Koorde::handleDeBruijnTimerExpired(), Pastry::handleFailedNode(), Kademlia::handleFailedNode(), oversim::Chord::handleFixFingersTimerExpired(), CBRDHT::handleGetCAPIRequest(), PubSubMMOG::handleHelpResponse(), PubSubMMOG::handleIntermediateResponse(), Quon::handleInvalidNode(), Scribe::handleJoinMessage(), Scribe::handleJoinResponse(), oversim::Chord::handleJoinTimerExpired(), Broose::handleJoinTimerExpired(), KBRTestApp::handleLookupResponse(), DHT::handleLookupResponse(), CBRDHT::handleLookupResponse(), BootstrapList::handleLookupResponse(), XmlRpcInterface::handleMessage(), BaseOverlay::handleMessage(), BaseApp::handleMessage(), PubSubMMOG::handleMoveMessage(), oversim::Chord::handleNewSuccessorHint(), Quon::handleNodeLeave(), Vast::handleNodeLeaveNotification(), Quon::handleNodeMove(), PubSubMMOG::handlePingCall(), Scribe::handlePublishCall(), Scribe::handlePublishResponse(), XmlRpcInterface::handleReadyMessage(), P2pns::handleReadyMessage(), BasePastry::handleRequestMessage(), IterativePathLookup::handleResponse(), oversim::Koorde::handleRpcCall(), oversim::Chord::handleRpcCall(), oversim::Koorde::handleRpcDeBruijnRequest(), oversim::Chord::handleRpcNotifyResponse(), Scribe::handleRpcResponse(), PubSubMMOG::handleRpcResponse(), oversim::Koorde::handleRpcResponse(), KBRTestApp::handleRpcResponse(), Kademlia::handleRpcResponse(), oversim::Chord::handleRpcResponse(), Broose::handleRpcResponse(), BootstrapList::handleRpcResponse(), oversim::Chord::handleRpcStabilizeResponse(), PubSubMMOG::handleRpcTimeout(), PubSubLobby::handleRpcTimeout(), oversim::Koorde::handleRpcTimeout(), Kademlia::handleRpcTimeout(), oversim::Chord::handleRpcTimeout(), Broose::handleRpcTimeout(), oversim::Chord::handleStabilizeTimerExpired(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), Scribe::handleTimerEvent(), Pastry::handleTimerEvent(), P2pns::handleTimerEvent(), DHTTestApp::handleTimerEvent(), DHT::handleTimerEvent(), CBRDHT::handleTimerEvent(), Bamboo::handleTimerEvent(), Vast::handleUDPMessage(), Quon::handleUDPMessage(), Pastry::handleUDPMessage(), Gia::handleUDPMessage(), Bamboo::handleUDPMessage(), Scribe::handleUpperMessage(), SimpleGameClient::initializeApp(), BootstrapList::initializeApp(), BrooseBucket::initializeBucket(), oversim::Chord::initializeFriendModules(), BaseRpc::internalHandleRpcMessage(), BaseOverlay::internalSendRpcResponse(), BaseApp::internalSendRpcResponse(), PastryStateObject::isCloser(), PastryLeafSet::isClosestNode(), Kademlia::isSiblingFor(), oversim::Chord::isSiblingFor(), Broose::isSiblingFor(), BasePastry::isSiblingFor(), BaseOverlay::join(), oversim::Chord::joinForeignPartition(), Kademlia::joinOverlay(), KeyExtractor< ProxNodeHandle >::key(), KeyExtractor< NodeHandle >::key(), KeyExtractor< KademliaBucketEntry >::key(), KeyExtractor< LookupEntry >::key(), BrooseBucket::keyInRange(), XmlRpcInterface::localLookup(), BootstrapList::locateBootstrapNode(), IterativeLookup::lookup(), SendToKeyListener::lookupFinished(), PastryRoutingTable::lookupNextHop(), BaseOverlay::lookupRpc(), PastryRoutingTable::mergeNode(), PastryLeafSet::mergeNode(), Pastry::mergeState(), BaseOverlay::neighborSet(), BasePastry::newLeafs(), BrooseHandle::operator!=(), operator<<(), GiaNode::operator=(), BrooseHandle::operator=(), BrooseHandle::operator==(), BrooseBucket::output(), P2pns::p2pnsRegisterRpc(), BasePastry::pingNodes(), BootstrapList::pingResponse(), BasePastry::pingResponse(), oversim::Chord::pingTimeout(), BootstrapList::pingTimeout(), BasePastry::pingTimeout(), Gia::processSearchMessage(), BasePastry::proxCallback(), Quon::purgeSites(), BaseOverlay::route(), Kademlia::routingAdd(), Kademlia::routingBucketIndex(), Kademlia::routingInit(), Kademlia::routingTimeout(), oversim::Chord::rpcNotify(), Vast::sendDiscardNode(), Vast::sendMessage(), Quon::sendMessage(), BaseOverlay::sendMessageToUDP(), BaseApp::sendMessageToUDP(), BaseRpc::sendRpcResponse(), Gia::sendSearchResponseMessage(), BasePastry::sendStateTables(), Vast::sendToApp(), Quon::sendToApp(), BaseOverlay::sendToKey(), Kademlia::setBucketUsage(), PastryStateObject::specialCloserCondition(), IterativeLookup::start(), PubSubMMOG::startTimer(), Scribe::subscribeToGroup(), Scribe::update(), P2pns::updateIdCacheWithNewTransport(), oversim::ChordSuccessorList::updateList(), Gia::updateNeighborList(), NeighborCache::updateNode(), Quon::updateThisSite(), Broose::updateTooltip(), oversim::Koorde::walkDeBruijnList(), and oversim::Koorde::walkSuccessorList().

00154 {
00155     return key;
00156 }

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.

Definition at line 87 of file NodeHandle.cc.

Referenced by Gia::acceptNode(), GiaNeighborCandidateList::add(), assertUnspecified(), BaseOverlay::callUpdate(), Gia::changeState(), oversim::Chord::changeState(), Scribe::checkGroupEmpty(), oversim::Chord::closestPreceedingNode(), PubSubLobby::failedNode(), PastryRoutingTable::findCloserNode(), PastryLeafSet::findCloserNode(), PastryRoutingTable::findCloserNodes(), oversim::Koorde::findDeBruijnHop(), oversim::Chord::findNode(), BasePastry::findNode(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), GiaNeighbors::get(), GlobalNodeList::getBootstrapNode(), BaseApp::handleCommonAPIMessage(), oversim::Koorde::handleFailedNode(), oversim::Chord::handleFailedNode(), PubSubMMOG::handleIntermediateResponse(), PubSubLobby::handleJoin(), PubSubMMOG::handleJoinResponse(), PubSubMMOG::handleMove(), PubSubMMOG::handlePingCallTimeout(), DHT::handlePutRequest(), CBRDHT::handlePutRequest(), PubSubLobby::handleRespCall(), oversim::Koorde::handleRpcDeBruijnRequest(), oversim::Chord::handleRpcFixfingersResponse(), oversim::Chord::handleRpcJoinResponse(), oversim::Chord::handleRpcStabilizeResponse(), PubSubMMOG::handleSubscriptionBackup(), Scribe::handleTimerEvent(), Pastry::handleTimerEvent(), Gia::handleTimerEvent(), oversim::Chord::handleTimerEvent(), Pastry::handleUDPMessage(), PubSubMMOG::handleUnsubscribeBackup(), PastryLeafSet::insertLeaf(), BaseRpc::internalHandleRpcMessage(), BaseOverlay::internalSendRpcResponse(), BaseApp::internalSendRpcResponse(), PastryStateObject::isCloser(), oversim::Chord::isSiblingFor(), Gia::joinOverlay(), BootstrapList::locateBootstrapNode(), PastryRoutingTable::lookupNextHop(), BrooseHandle::operator!=(), operator<<(), BrooseHandle::operator==(), BasePastry::pingNodes(), BootstrapList::pingResponse(), BasePastry::pingResponse(), BasePastry::prePing(), PastryRoutingTable::repair(), Kademlia::routingAdd(), oversim::Chord::rpcFixfingers(), oversim::Chord::rpcJoin(), oversim::Chord::rpcNotify(), oversim::Chord::rpcStabilize(), Vast::sendMessage(), PubSubMMOG::sendMessageToChildren(), BaseOverlay::sendToKey(), PubSubMMOG::unsubscribeChild(), and P2pns::updateIdCacheWithNewTransport().

00088 {
00089     return (ip.isUnspecified() || key.isUnspecified());
00090 }

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

serializes the object into a buffer

Parameters:
b the buffer

Definition at line 167 of file NodeHandle.cc.

Referenced by doPacking().

00168 {
00169     //cMessage::netPack(b);
00170     doPacking(b,this->ip);
00171     doPacking(b,this->key);
00172     doPacking(b,this->port);
00173 }

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

deserializes the object from a buffer

Parameters:
b the buffer

Definition at line 175 of file NodeHandle.cc.

Referenced by doUnpacking().

00176 {
00177     //cMessage::netUnpack(b);
00178     doUnpacking(b,this->ip);
00179     doUnpacking(b,this->key);
00180     doUnpacking(b,this->port);
00181 }

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

Definition at line 111 of file NodeHandle.cc.

00112 {
00113     assertUnspecified( rhs );
00114     return !( this->key == rhs.key &&
00115               this->ip == rhs.ip && this->port == rhs.port );
00116 }

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

Definition at line 119 of file NodeHandle.cc.

00120 {
00121     assertUnspecified(rhs);
00122     return this->key < rhs.key;
00123 }

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

Definition at line 133 of file NodeHandle.cc.

00134 {
00135     assertUnspecified(rhs);
00136     return this->key <= rhs.key;
00137 }

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.

Definition at line 93 of file NodeHandle.cc.

00094 {
00095     this->key = rhs.key;
00096     this->ip = rhs.ip;
00097     this->port = rhs.port;
00098 
00099     return *this;
00100 }

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

Definition at line 103 of file NodeHandle.cc.

00104 {
00105     assertUnspecified( rhs );
00106     return ( this->key == rhs.key &&
00107              this->ip == rhs.ip && this->port == rhs.port );
00108 }

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

Definition at line 126 of file NodeHandle.cc.

00127 {
00128     assertUnspecified(rhs);
00129     return this->key > rhs.key;
00130 }

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

Definition at line 140 of file NodeHandle.cc.

00141 {
00142     assertUnspecified(rhs);
00143     return this->key >= rhs.key;
00144 }

void NodeHandle::setKey ( const OverlayKey key  ) 


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

Definition at line 30 of file NodeHandle.cc.

00031 {
00032     if (n.ip.isUnspecified()) {
00033         os << "<addr unspec> ";
00034     } else {
00035         os << n.ip << ":" << n.port << " ";
00036     }
00037 
00038     if (n.key.isUnspecified()) {
00039         os << "<key unspec>";
00040     } else {
00041         os << n.key;
00042     }
00043 
00044     return os;
00045 };


Member Data Documentation

the unspecified NodeHandle

Reimplemented from TransportAddress.

Reimplemented in GiaNode.

Definition at line 107 of file NodeHandle.h.

Referenced by PastryLeafSet::balanceLeafSet(), oversim::Koorde::changeState(), oversim::Chord::changeState(), oversim::Chord::closestPreceedingNode(), Nps::coordsReqRpcResponse(), PastryRoutingTable::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::findCloserNode(), PastryNeighborhoodSet::findCloserNode(), PastryLeafSet::findCloserNode(), GiaNeighborCandidateList::get(), GlobalNodeList::getBootstrapNode(), BootstrapList::getBootstrapNode(), PastryStateObject::getDestinationNode(), PastryLeafSet::getDestinationNode(), GiaMessageBookkeeping::getNextHop(), GlobalNodeList::getRandomNode(), DHTDataStorage::getSourceNode(), oversim::ChordSuccessorList::getSuccessor(), PubSubMMOG::handleBackupCallTimeout(), BaseApp::handleCommonAPIMessage(), oversim::Koorde::handleFailedNode(), oversim::ChordFingerTable::handleFailedNode(), oversim::Chord::handleFailedNode(), IterativePathLookup::handleFailedNodeResponse(), PubSubMMOG::handlePingCallTimeout(), Scribe::handlePublishResponse(), oversim::Chord::handleStabilizeTimerExpired(), IterativePathLookup::handleTimeout(), PastryLeafSet::initializeSet(), NeighborCache::insertNodeContext(), BaseRpc::internalHandleRpcMessage(), BaseOverlay::internalSendRpcResponse(), BaseApp::internalSendRpcResponse(), PastryRoutingTable::lookupNextHop(), PubSubSubspace::PubSubSubspace(), PubSubSubspaceResponsible::PubSubSubspaceResponsible(), QuonSite::QuonSite(), oversim::ChordFingerTable::removeFinger(), ScribeGroup::ScribeGroup(), oversim::ChordFingerTable::setFinger(), NeighborCache::setNodeCoordsInfo(), NeighborCache::setNodeTimeout(), Site::Site(), oversim::ChordFingerTable::updateFinger(), and oversim::Koorde::walkDeBruijnList().


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

Generated on Tue Sep 8 17:27:00 2009 for OverSim by  doxygen 1.5.8