#include <NodeHandle.h>
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.
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 | |
NodeHandle & | operator= (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 OverlayKey & | getKey () 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 TransportAddress * | dup () 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 |
typedef UNORDERED_SET<NodeHandle, hashFcn> NodeHandle::Set |
NodeHandle::NodeHandle | ( | ) |
Constructs an unspecified NodeHandle.
Referenced by dup().
00044 { 00045 port = -1; 00046 key = OverlayKey::UNSPECIFIED_KEY; 00047 }
NodeHandle::NodeHandle | ( | const NodeHandle & | handle | ) |
NodeHandle::NodeHandle | ( | const OverlayKey & | key, | |
const IPvXAddress & | ip, | |||
int | port | |||
) |
NodeHandle::NodeHandle | ( | const TransportAddress & | ta | ) |
Constructor to generate a NodeHandle from a TransportAddress.
The key will be unspecified.
ta | transport address |
00058 { 00059 this->ip = ta.ip; 00060 this->port = ta.port; 00061 this->key = OverlayKey::UNSPECIFIED_KEY; 00062 }
bool NodeHandle::operator== | ( | const NodeHandle & | rhs | ) | const |
compares this NodeHandle to another given NodeHandle
rhs | the NodeHandle this is compared to |
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
rhs | the NodeHandle this is compared to |
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
rhs | the NodeHandle this is compared to |
00107 { 00108 assertUnspecified(rhs); 00109 return this->key < rhs.key; 00110 }
bool NodeHandle::operator> | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
00114 { 00115 assertUnspecified(rhs); 00116 return this->key > rhs.key; 00117 }
bool NodeHandle::operator<= | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
00121 { 00122 assertUnspecified(rhs); 00123 return this->key <= rhs.key; 00124 }
bool NodeHandle::operator>= | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
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
rhs | the NodeHandle with the defined key, ip and port |
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
key | the given key |
Referenced by PubSubMMOG::initializeOverlay(), and PubSubLobby::initializeOverlay().
const OverlayKey & NodeHandle::getKey | ( | ) | const |
returns key of this NodeHandle
Referenced by Kademlia::handleBucketRefreshTimerExpired(), DHT::handlePutRequest(), Kademlia::isSiblingFor(), Kademlia::routingAdd(), Kademlia::routingBucketIndex(), and Kademlia::routingInit().
00141 { 00142 return key; 00143 }
bool NodeHandle::isUnspecified | ( | ) | const |
indicates if this NodeHandle is specified
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
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
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
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
Reimplemented from TransportAddress.
00211 { 00212 return new NodeHandle(*this); 00213 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const NodeHandle & | n | |||
) | [friend] |
standard output stream for NodeHandle, gives out ip, port and key
os | the ostream | |
n | the NodeHandle |
00031 { 00032 if (n.isUnspecified()) { 00033 os << "<unspec>"; 00034 } else { 00035 os << n.ip << ":" << n.port << " " << n.key; 00036 } 00037 00038 return os; 00039 };
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().
const NodeHandle NodeHandle::UNSPECIFIED_NODE [static] |
the unspecified NodeHandle
Reimplemented from TransportAddress.
Reimplemented in BrooseHandle, and GiaNode.
Referenced by NeighborCache::addressTimeout(), PastryLeafSet::balanceLeafSet(), Koorde::changeState(), Chord::changeState(), Chord::closestPreceedingNode(), PastryRoutingTable::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::findCloserNode(), PastryNeighborhoodSet::findCloserNode(), PastryLeafSet::findCloserNode(), GiaNeighborCandidateList::get(), BootstrapOracle::getBootstrapNode(), BootstrapList::getBootstrapNode(), PastryStateObject::getDestinationNode(), PastryLeafSet::getDestinationNode(), GiaMessageBookkeeping::getNextHop(), BootstrapOracle::getRandomNode(), DHTDataStorage::getSourceNode(), ChordSuccessorList::getSuccessor(), PubSubMMOG::handleBackupCallTimeout(), BaseApp::handleCommonAPIMessage(), Koorde::handleDeBruijnTimeout(), IterativePathLookup::handleFailedNodeResponse(), PubSubMMOG::handlePingCallTimeout(), Scribe::handlePublishResponse(), Chord::handleStabilizeTimerExpired(), IterativePathLookup::handleTimeout(), PastryLeafSet::initializeSet(), NeighborCache::insertPingedNode(), BaseOverlay::internalSendRpcResponse(), BaseApp::internalSendRpcResponse(), PastryRoutingTable::lookupNextHop(), Chord::pingTimeout(), PubSubSubspace::PubSubSubspace(), PubSubSubspaceResponsible::PubSubSubspaceResponsible(), ScribeGroup::ScribeGroup(), Site::Site(), and Koorde::walkDeBruijnList().