OverSim
|
This class implements a common transport address. More...
#include <TransportAddress.h>
Classes | |
class | hashFcn |
defines a hash function for TransportAddress More... |
Public Types | |
enum | NatType { UNKNOWN_NAT = 0, NO_NAT = 1, FULL_CONE_NAT = 2, PORT_RESTRICTED_NAT = 3, SYMMETRIC_NAT = 4 } |
typedef UNORDERED_SET < TransportAddress, hashFcn > | Set |
a hashed set of TransportAddresses |
Public Member Functions | |
TransportAddress () | |
Constructs a unspecified TransportAddress. | |
virtual | ~TransportAddress () |
Standard destructor. | |
TransportAddress (const TransportAddress &handle) | |
Copy constructor. | |
TransportAddress (const IPvXAddress &ip, int port=-1, NatType natType=UNKNOWN_NAT) | |
Complete constructor. | |
bool | operator== (const TransportAddress &rhs) const |
compares this to a given TransportAddress | |
bool | operator!= (const TransportAddress &rhs) const |
compares this to a given TransportAddress | |
bool | operator< (const TransportAddress &rhs) const |
compares this to a given TransportAddress | |
bool | operator> (const TransportAddress &rhs) const |
compares this to a given TransportAddress | |
bool | operator<= (const TransportAddress &rhs) const |
compares this to a given TransportAddress | |
bool | operator>= (const TransportAddress &rhs) const |
compares this to a given TransportAddress | |
TransportAddress & | operator= (const TransportAddress &rhs) |
assigns ip and port of rhs to this->ip and this->port | |
void | setIp (const IPvXAddress &ip, int port=-1, NatType natType=UNKNOWN_NAT) |
Sets the ip address, port and NAT type. | |
void | setAddress (const IPvXAddress &ip, int port=-1, NatType natType=UNKNOWN_NAT) __attribute((deprecated)) |
Sets the ip address, port and NAT type. | |
void | appendSourceRoute (const TransportAddress &sourceRoute) |
Appends a source route to this TransportAddress. | |
void | clearSourceRoute () |
Clears the source route of this TransportAddress. | |
void | setPort (int port) |
sets this->port to the given port | |
const IPvXAddress & | getIp () const |
returns ip address | |
const IPvXAddress & | getAddress () const __attribute((deprecated)) |
returns ip address. | |
int | getPort () const |
returns port | |
NatType | getNatType () const |
returns the type of NAT this node is behind | |
size_t | getSourceRouteSize () const |
Returns the length of the source route to reach this node. | |
const TransportAddressVector & | getSourceRoute () const |
Returns source route used to reach this node. | |
bool | isUnspecified () const |
indicates if TransportAddress is specified | |
size_t | hash () const |
creates a hash value of ip and port | |
virtual TransportAddress * | dup () const |
returns a copy of the TransportAddress |
Static Public Attributes | |
static const TransportAddress | UNSPECIFIED_NODE |
TransportAddress without specified ip and port. | |
static const TransportAddressVector | UNSPECIFIED_NODES |
Protected Attributes | |
IPvXAddress | ip |
the ip of this TransportAddress object | |
int | port |
the port of this TransportAddress object |
Private Member Functions | |
void | assertUnspecified (const TransportAddress &handle) const |
throws an opp_error if this or handle is unspecified |
Private Attributes | |
NatType | natType |
the assumed type of a NAT this node is behind (work in progress and currently not used | |
TransportAddressVector | sourceRoute |
source route for NAT traversal |
Friends | |
std::ostream & | operator<< (std::ostream &os, const TransportAddress &n) |
standard output stream for TransportAddress, gives out ip and port |
This class implements a common transport address.
It covers the complete node information, like IP-Address, and port. The information can be sparse, so parts can be omited by setting the property to an unspecified value.
Definition at line 49 of file TransportAddress.h.
a hashed set of TransportAddresses
Definition at line 76 of file TransportAddress.h.
Definition at line 66 of file TransportAddress.h.
TransportAddress::TransportAddress | ( | ) |
Constructs a unspecified TransportAddress.
Definition at line 55 of file TransportAddress.cc.
Referenced by appendSourceRoute(), and dup().
|
inlinevirtual |
TransportAddress::TransportAddress | ( | const TransportAddress & | handle | ) |
Copy constructor.
handle | The TransportAddress to copy |
Definition at line 62 of file TransportAddress.cc.
TransportAddress::TransportAddress | ( | const IPvXAddress & | ip, |
int | port = -1 , |
||
NatType | natType = UNKNOWN_NAT |
||
) |
void TransportAddress::appendSourceRoute | ( | const TransportAddress & | sourceRoute | ) |
Appends a source route to this TransportAddress.
sourceRoute | the source route to append |
Definition at line 197 of file TransportAddress.cc.
Referenced by doUnpacking(), and BaseOverlay::handleBaseOverlayMessage().
|
inlineprivate |
throws an opp_error if this or handle is unspecified
handle | the TransportAddress to check |
Definition at line 232 of file TransportAddress.cc.
Referenced by operator!=(), operator<(), operator==(), and operator>().
|
inline |
Clears the source route of this TransportAddress.
Definition at line 216 of file TransportAddress.h.
|
virtual |
returns a copy of the TransportAddress
Reimplemented in NodeHandle.
Definition at line 226 of file TransportAddress.cc.
Referenced by BaseRpc::sendRpcCall().
|
inline |
returns ip address.
DEPRECATED: Use getIp() instead!
Definition at line 237 of file TransportAddress.h.
const IPvXAddress & TransportAddress::getIp | ( | ) | const |
returns ip address
Definition at line 167 of file TransportAddress.cc.
Referenced by IterativeLookup::addSibling(), Quon::addSite(), BasePastry::baseInit(), I3BaseApp::bootstrapI3(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), MyOverlay::callbackNeighbors(), BaseOverlay::callUpdate(), Gia::changeState(), Quon::changeState(), Vast::changeState(), oversim::Nice::checkLeaderHeartbeatsForCollisions(), TreeManagement::checkParentValid(), Pastry::checkProxCache(), oversim::Nice::cleanPeers(), BaseTcpSupport::closeTcpConnection(), oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), I3SubIdentifier::compareTo(), TreeManagement::connectToParent(), Nps::coordsReqRpcResponse(), BasePastry::createStateMessage(), TreeManagement::debugChildren(), Quon::deleteSite(), RealWorldTestApp::deliver(), MyApplication::deliver(), KBRTestApp::deliver(), Bamboo::doLocalTuning(), doPacking(), Pastry::doRoutingTableMaintenance(), Pastry::doSecondStage(), BaseTcpSupport::establishTcpConnection(), PastryNeighborhoodSet::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::failedNode(), KBRTestApp::forward(), getAddress(), GlobalNodeList::getBootstrapNode(), BrooseBucket::getFailedResponses(), Nps::getLandmarks(), BrooseBucket::getLastSeen(), GlobalNodeList::getPeerInfo(), BrooseBucket::getPos(), Gia::getRoute(), BrooseBucket::getRTT(), oversim::Nice::gracefulLeave(), Vast::handleAppMessage(), Quon::handleAppMessage(), oversim::Nice::handleAppMessage(), GlobalViewBuilder::handleCoordinateRpcCall(), TCPExampleApp::handleDataReceived(), Pastry::handleFailedNode(), CBRDHT::handleGetResponse(), KBRTestApp::handleLookupResponse(), SimpleGameClient::handleLowerMessage(), GIASearchApp::handleLowerMessage(), oversim::Nice::handleNiceClusterMergeRequest(), oversim::Nice::handleNiceHeartbeat(), oversim::Nice::handleNiceJoinCluster(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::handleNiceQuery(), oversim::Nice::handleNiceRemove(), Vast::handleNodeLeaveNotification(), TreeManagement::handleParentRequestRpcCall(), TreeManagement::handleParentRequestRpcResponse(), Pastry::handlePastryJoinCall(), Pastry::handlePastryJoinResponse(), SimpleGameClient::handleRealworldPacket(), BasePastry::handleRequestLeafSetCall(), Bamboo::handleRequestLeafSetResponse(), Pastry::handleRequestLeafSetResponse(), BasePastry::handleRequestLeafSetResponse(), Pastry::handleRequestRepairCall(), Pastry::handleRequestRepairResponse(), BasePastry::handleRequestRoutingRowCall(), Pastry::handleRequestRoutingRowResponse(), BasePastry::handleRequestRoutingRowResponse(), Pastry::handleRequestStateCall(), Pastry::handleRequestStateResponse(), Pastry::handleRpcCall(), BasePastry::handleRpcCall(), DiscoveryMode::handleRpcResponse(), Bamboo::handleRpcResponse(), Pastry::handleRpcResponse(), KBRTestApp::handleRpcResponse(), BasePastry::handleRpcResponse(), TreeManagement::handleRpcTimeout(), Pastry::handleRpcTimeout(), KBRTestApp::handleRpcTimeout(), Kademlia::handleRpcTimeout(), BasePastry::handleRpcTimeout(), Pastry::handleStateMessage(), Bamboo::handleStateMessage(), MyApplication::handleTimerEvent(), TCPExampleApp::handleTimerEvent(), SimpleGameClient::handleTimerEvent(), Pastry::handleTimerEvent(), Bamboo::handleTimerEvent(), GIASearchApp::handleTimerEvent(), Vast::handleUDPMessage(), Quon::handleUDPMessage(), MyApplication::handleUDPMessage(), Pastry::handleUDPMessage(), BrooseBucket::increaseFailedResponses(), SimpleNcs::init(), Landmark::initializeApp(), SimpleGameClient::initializeApp(), MyOverlay::initializeOverlay(), PastryLeafSet::insertLeaf(), BaseRpc::internalHandleRpcMessage(), BaseOverlay::internalHandleRpcTimeout(), BaseTcpSupport::isAlreadyConnected(), Kademlia::isSiblingFor(), oversim::Nice::JoinCluster(), IterativeLookup::lookup(), Bamboo::lookupFinished(), oversim::Nice::maintenance(), Pastry::mergeState(), BasePastry::newLeafs(), NodeHandle::NodeHandle(), BrooseHandle::operator!=(), __gnu_cxx::hash< TransportAddress >::operator()(), operator<<(), GiaNode::operator=(), BrooseHandle::operator=(), BrooseHandle::operator==(), BrooseBucket::output(), BasePastry::pingNodes(), Pastry::pingResponse(), BootstrapList::pingResponse(), oversim::Nice::pollRP(), Pastry::processState(), BasePastry::proxCallback(), Quon::purgeSites(), oversim::Nice::Query(), GlobalNodeList::refreshEntry(), I3BaseApp::refreshTriggers(), GlobalNodeList::registerPeer(), BrooseBucket::remove(), oversim::Nice::Remove(), TreeManagement::removeParentConnection(), GlobalNodeList::removePeer(), BrooseBucket::resetFailedResponses(), NTree::routeViaNTree(), Kademlia::routingAdd(), Vast::sendDiscardNode(), Quon::sendMessage(), Vast::sendMessage(), BaseApp::sendMessageToUDP(), BaseOverlay::sendMessageToUDP(), DiscoveryMode::sendNewRequest(), BaseOverlay::sendRouteMessage(), IterativePathLookup::sendRpc(), BaseTcpSupport::sendTcpData(), I3BaseApp::sendThroughUDP(), Quon::sendToApp(), Vast::sendToApp(), BaseOverlay::sendToKey(), NeighborCache::setCbrNodeId(), BrooseBucket::setLastSeen(), GlobalNodeList::setMalicious(), BrooseBucket::setRTT(), GlobalViewBuilder::spreadGlobalView(), DiscoveryMode::start(), DiscoveryMode::stop(), IterativeLookup::stop(), NeighborCache::updateNcsInfo(), SimpleGameClient::updateNeighbors(), NeighborCache::updateNode(), Quon::updateThisSite(), oversim::Koorde::updateTooltip(), and oversim::Nice::updateVisualization().
TransportAddress::NatType TransportAddress::getNatType | ( | ) | const |
returns the type of NAT this node is behind
Definition at line 179 of file TransportAddress.cc.
Referenced by doPacking().
int TransportAddress::getPort | ( | ) | const |
returns port
Definition at line 173 of file TransportAddress.cc.
Referenced by BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), Gia::changeState(), BaseTcpSupport::closeTcpConnection(), I3SubIdentifier::compareTo(), doPacking(), BaseTcpSupport::establishTcpConnection(), Gia::getRoute(), KBRTestApp::handleTimerEvent(), Gia::handleUDPMessage(), BaseTcpSupport::isAlreadyConnected(), MyOverlay::joinOverlay(), NodeHandle::NodeHandle(), BrooseHandle::operator!=(), __gnu_cxx::hash< TransportAddress >::operator()(), operator<<(), GiaNode::operator=(), BrooseHandle::operator=(), BrooseHandle::operator==(), Kademlia::routingAdd(), BaseApp::sendMessageToUDP(), BaseOverlay::sendMessageToUDP(), BaseTcpSupport::sendTcpData(), and I3BaseApp::sendThroughUDP().
const TransportAddressVector & TransportAddress::getSourceRoute | ( | ) | const |
Returns source route used to reach this node.
Definition at line 191 of file TransportAddress.cc.
Referenced by appendSourceRoute(), doPacking(), BaseRpc::internalHandleRpcMessage(), operator<<(), and BaseRpc::sendRpcCall().
size_t TransportAddress::getSourceRouteSize | ( | ) | const |
Returns the length of the source route to reach this node.
Definition at line 185 of file TransportAddress.cc.
Referenced by appendSourceRoute(), doPacking(), BaseRpc::internalHandleRpcMessage(), operator<<(), and BaseRpc::sendRpcCall().
size_t TransportAddress::hash | ( | ) | const |
creates a hash value of ip and port
Definition at line 213 of file TransportAddress.cc.
Referenced by TransportAddress::hashFcn::operator()().
bool TransportAddress::isUnspecified | ( | ) | const |
indicates if TransportAddress is specified
Reimplemented in NodeHandle.
Definition at line 81 of file TransportAddress.cc.
Referenced by assertUnspecified(), BasePastry::baseChangeState(), oversim::Nice::changeState(), Pastry::checkProxCache(), oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), NiceCluster::contains(), BasePastry::determineAliveTable(), Bamboo::doLeafsetMaintenance(), Bamboo::doLocalTuning(), Pastry::doRoutingTableMaintenance(), PubSubLobby::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::failedNode(), oversim::Nice::findCenter(), PastryRoutingTable::findNextNodeToAsk(), BootstrapList::getBootstrapNode(), NeighborCache::getNodeRtt(), NeighborCache::getProx(), oversim::Nice::gracefulLeave(), NTree::handleAppMessage(), Bamboo::handleFailedNode(), Pastry::handleFailedNode(), Kademlia::handleFailedNode(), Quon::handleJoin(), Vast::handleJoin(), oversim::Nice::handleNiceLeaderHeartbeat(), oversim::Nice::handleNiceLeaderTransfer(), oversim::Nice::handleNicePollRpResponse(), oversim::Nice::handleNiceRemove(), DiscoveryMode::handleRpcResponse(), TreeManagement::handleRpcTimeout(), Kademlia::handleRpcTimeout(), BasePastry::handleRpcTimeout(), Pastry::handleStateMessage(), P2pns::handleTimerEvent(), KBRTestApp::handleTimerEvent(), oversim::Nice::handleTimerEvent(), BaseRpc::internalHandleRpcMessage(), BaseOverlay::internalHandleRpcTimeout(), TreeManagement::isParent(), Pastry::iterativeJoinHook(), Kademlia::joinOverlay(), Bamboo::joinOverlay(), Pastry::joinOverlay(), oversim::Nice::maintenance(), operator<<(), P2pns::pingTimeout(), NeighborCache::prepareOverlay(), NiceCluster::remove(), BootstrapList::removeBootstrapCandidate(), PastryLeafSet::repair(), oversim::Chord::rpcNotify(), GlobalViewBuilder::sendCapRequest(), NTree::sendMessage(), BaseRpc::sendRouteRpcCall(), BaseRpc::sendRpcResponse(), NiceCluster::setLeader(), oversim::Nice::splitNeeded(), DiscoveryMode::start(), and P2pns::updateIdCacheWithNewTransport().
bool TransportAddress::operator!= | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
Definition at line 103 of file TransportAddress.cc.
bool TransportAddress::operator< | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
Definition at line 110 of file TransportAddress.cc.
Referenced by operator>=().
bool TransportAddress::operator<= | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
Definition at line 138 of file TransportAddress.cc.
TransportAddress & TransportAddress::operator= | ( | const TransportAddress & | rhs | ) |
assigns ip and port of rhs to this->ip and this->port
rhs | the TransportAddress with the defined ip and port |
Definition at line 87 of file TransportAddress.cc.
bool TransportAddress::operator== | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
Definition at line 96 of file TransportAddress.cc.
Referenced by operator!=().
bool TransportAddress::operator> | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
Definition at line 124 of file TransportAddress.cc.
Referenced by operator<=().
bool TransportAddress::operator>= | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
Definition at line 144 of file TransportAddress.cc.
|
inline |
void TransportAddress::setIp | ( | const IPvXAddress & | ip, |
int | port = -1 , |
||
NatType | natType = UNKNOWN_NAT |
||
) |
Sets the ip address, port and NAT type.
ip | the new IPvXAddress |
port | the new port |
natType | the type of NAT this node is behind |
Definition at line 150 of file TransportAddress.cc.
Referenced by doUnpacking(), NeighborCache::getNearestNode(), MyOverlay::joinOverlay(), SimpleUnderlayConfigurator::migrateNode(), NodeHandle::NodeHandle(), I3IdentifierStack::push(), Vast::sendDiscardNode(), setAddress(), and Nps::setLandmarkSet().
void TransportAddress::setPort | ( | int | port | ) |
sets this->port to the given port
port | the new port |
Definition at line 161 of file TransportAddress.cc.
Referenced by NeighborCache::getNearestNode(), KBRTestApp::handleTimerEvent(), KBRTestApp::initializeApp(), MyOverlay::joinOverlay(), NodeHandle::NodeHandle(), I3IdentifierStack::push(), and Nps::setLandmarkSet().
|
friend |
standard output stream for TransportAddress, gives out ip and port
os | the ostream |
n | the TransportAddress |
Definition at line 33 of file TransportAddress.cc.
|
protected |
the ip of this TransportAddress object
Definition at line 80 of file TransportAddress.h.
Referenced by appendSourceRoute(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), getIp(), hash(), I3IPAddress::I3IPAddress(), NodeHandle::isUnspecified(), isUnspecified(), I3IPAddress::length(), NodeHandle::netPack(), NodeHandle::netUnpack(), NodeHandle::NodeHandle(), BrooseHandle::operator!=(), I3IPAddress::operator<(), NodeHandle::operator<(), operator<(), operator<<(), GiaNode::operator=(), BrooseHandle::operator=(), NodeHandle::operator=(), operator=(), I3IPAddress::operator==(), BrooseHandle::operator==(), NodeHandle::operator==(), operator==(), NodeHandle::operator>(), operator>(), setIp(), and TransportAddress().
|
private |
the assumed type of a NAT this node is behind (work in progress and currently not used
Definition at line 84 of file TransportAddress.h.
Referenced by appendSourceRoute(), getNatType(), setAddress(), setIp(), and TransportAddress().
|
protected |
the port of this TransportAddress object
Definition at line 81 of file TransportAddress.h.
Referenced by appendSourceRoute(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), getPort(), hash(), I3IPAddress::I3IPAddress(), isUnspecified(), NodeHandle::netPack(), NodeHandle::netUnpack(), NodeHandle::NodeHandle(), BrooseHandle::operator!=(), I3IPAddress::operator<(), NodeHandle::operator<(), operator<(), operator<<(), GiaNode::operator=(), BrooseHandle::operator=(), NodeHandle::operator=(), operator=(), I3IPAddress::operator==(), BrooseHandle::operator==(), NodeHandle::operator==(), operator==(), NodeHandle::operator>(), operator>(), setAddress(), setIp(), setPort(), and TransportAddress().
|
private |
source route for NAT traversal
Definition at line 86 of file TransportAddress.h.
Referenced by appendSourceRoute(), clearSourceRoute(), getSourceRoute(), getSourceRouteSize(), and TransportAddress().
|
static |
TransportAddress without specified ip and port.
Definition at line 119 of file TransportAddress.h.
Referenced by AddressExtractor< T >::address(), NiceCluster::clear(), oversim::Nice::ClusterMerge(), oversim::Nice::ClusterSplit(), KBRTestApp::createDestKey(), PastryNeighborhoodSet::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::failedNode(), oversim::Nice::findCenter(), PastryRoutingTable::findNextNodeToAsk(), oversim::Nice::finishOverlay(), NeighborCache::getBootstrapNode(), NeighborCache::getNearestNode(), PastryLeafSet::getRandomNode(), PastryRoutingTable::getRandomNode(), oversim::Nice::handleNicePollRpResponse(), oversim::Chord::handleRpcStabilizeResponse(), oversim::Chord::initializeOverlay(), oversim::Nice::initializeOverlay(), BaseApp::internalSendRpcResponse(), oversim::Nice::LeaderTransfer(), oversim::Nice::maintenance(), NiceCluster::NiceCluster(), NiceCluster::remove(), PastryStateObject::repair(), PastryRoutingTable::repair(), PastryLeafSet::repair(), BaseRpc::sendInternalRpcCall(), and BaseRpc::sendRouteRpcCall().
|
static |
Definition at line 120 of file TransportAddress.h.