#include <TransportAddress.h>
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.
Public Types | |
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) | |
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 | setAddress (const IPvXAddress &ip, int port=-1) |
sets this->ip to ip and port to -1 if unspecified | |
void | setPort (int port) |
sets this->port to the given port | |
const IPvXAddress & | getAddress () const |
returns ip address | |
int | getPort () const |
returns port | |
bool | isUnspecified () const |
indicates if TransportAddress is specified | |
size_t | hash () const |
creates a hash value of ip and port | |
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 TransportAddress | |
Public Attributes | |
IPvXAddress | ip |
the ip of this TransportAddress object | |
int | port |
the port of this TransportAddress object | |
Static Public Attributes | |
static const TransportAddress | UNSPECIFIED_NODE |
TransportAddress without specified ip and port. | |
static const std::vector < TransportAddress > | UNSPECIFIED_NODES |
Private Member Functions | |
void | assertUnspecified (const TransportAddress &handle) const |
throws an opp_error if this or handle is unspecified | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const TransportAddress &n) |
standard output stream for TransportAddress, gives out ip and port | |
Classes | |
class | hashFcn |
defines a hash function for TransportAddress More... |
typedef UNORDERED_SET<TransportAddress, hashFcn> TransportAddress::Set |
TransportAddress::TransportAddress | ( | ) |
TransportAddress::TransportAddress | ( | const TransportAddress & | handle | ) |
TransportAddress::TransportAddress | ( | const IPvXAddress & | ip, | |
int | port = -1 | |||
) |
bool TransportAddress::operator== | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
00083 { 00084 assertUnspecified(rhs); 00085 return (this->ip == rhs.ip && this->port == rhs.port); 00086 }
bool TransportAddress::operator!= | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
00090 { 00091 assertUnspecified(rhs); 00092 return !(this->ip == rhs.ip && this->port == rhs.port ); 00093 }
bool TransportAddress::operator< | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
00097 { 00098 assertUnspecified(rhs); 00099 return this->ip < rhs.ip; 00100 }
bool TransportAddress::operator> | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
00104 { 00105 assertUnspecified(rhs); 00106 return !(this->ip < rhs.ip || this->ip == rhs.ip); 00107 }
bool TransportAddress::operator<= | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
00111 { 00112 assertUnspecified(rhs); 00113 return this->ip < rhs.ip || this->ip == rhs.ip; 00114 }
bool TransportAddress::operator>= | ( | const TransportAddress & | rhs | ) | const |
compares this to a given TransportAddress
rhs | the TransportAddress this is compared to |
00118 { 00119 assertUnspecified(rhs); 00120 return !(this->ip < rhs.ip); 00121 }
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 |
void TransportAddress::setAddress | ( | const IPvXAddress & | ip, | |
int | port = -1 | |||
) |
void TransportAddress::setPort | ( | int | port | ) |
const IPvXAddress & TransportAddress::getAddress | ( | ) | const |
returns ip address
Referenced by RealWorldTestApp::deliver(), and BootstrapOracle::getBootstrapNode().
00139 { 00140 return ip; 00141 }
int TransportAddress::getPort | ( | ) | const |
bool TransportAddress::isUnspecified | ( | ) | const |
indicates if TransportAddress is specified
Reimplemented in NodeHandle.
Referenced by assertUnspecified(), Pastry::checkProxCache(), Bamboo::doLeafsetMaintenance(), BasePastry::doRoutingTableMaintenance(), PubSubLobby::failedNode(), PastryRoutingTable::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::findNextNodeToAsk(), BasePastry::findNode(), Pastry::handleFailedNode(), Kademlia::handleFailedNode(), Bamboo::handleFailedNode(), Kademlia::handleRpcTimeout(), Pastry::handleStateMessage(), operator<<(), BootstrapList::removeBootstrapCandidate(), PastryLeafSet::repair(), BasePastry::sendLeafset(), BasePastry::sendRequest(), BaseRpc::sendRouteRpcCall(), BasePastry::sendRoutingRow(), and BaseRpc::sendRpcResponse().
size_t TransportAddress::hash | ( | ) | const |
creates a hash value of ip and port
Referenced by TransportAddress::hashFcn::operator()().
00151 { 00152 size_t iphash; 00153 if (ip.isIPv6()) { 00154 uint32_t* addr = (uint32_t*) ip.get6().words(); 00155 iphash = (size_t)(addr[0]^addr[1]^addr[2]^addr[3]); 00156 } else { 00157 iphash = (size_t)ip.get4().getInt(); 00158 } 00159 00160 return (size_t)(iphash^port); 00161 }
void TransportAddress::assertUnspecified | ( | const TransportAddress & | handle | ) | const [inline, private] |
throws an opp_error if this or handle is unspecified
handle | the TransportAddress to check |
Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
00170 { 00171 if ( this->isUnspecified() || handle.isUnspecified() ) 00172 opp_error("TransportAddress: Trying to compare unspecified TransportAddress!"); 00173 }
void TransportAddress::netPack | ( | cCommBuffer * | b | ) | [virtual] |
serializes the object into a buffer
b | the buffer |
Reimplemented in NodeHandle.
Referenced by doPacking().
00216 { 00217 //cMessage::netPack(b); 00218 doPacking(b,this->ip); 00219 doPacking(b,this->port); 00220 }
void TransportAddress::netUnpack | ( | cCommBuffer * | b | ) | [virtual] |
deserializes the object from a buffer
b | the buffer |
Reimplemented in NodeHandle.
Referenced by doUnpacking().
00223 { 00224 //cMessage::netUnpack(b); 00225 doUnpacking(b,this->ip); 00226 doUnpacking(b,this->port); 00227 }
TransportAddress * TransportAddress::dup | ( | ) | const [virtual] |
returns a copy of the TransportAddress
Reimplemented in NodeHandle.
Referenced by BaseRpc::sendRpcCall().
00164 { 00165 return new TransportAddress(*this); 00166 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const TransportAddress & | n | |||
) | [friend] |
standard output stream for TransportAddress, gives out ip and port
os | the ostream | |
n | the TransportAddress |
00034 { 00035 if (n.isUnspecified()) { 00036 os << "<unspec>"; 00037 } else { 00038 os << n.ip << ":" << n.port; 00039 } 00040 00041 return os; 00042 };
IPvXAddress TransportAddress::ip |
the ip of this TransportAddress object
Referenced by BootstrapOracle::addPeer(), Broose::binaryOutput(), BaseOverlay::bindToPort(), BaseApp::bindToPort(), I3BaseApp::bootstrapI3(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), BaseApp::callRoute(), BaseOverlay::callUpdate(), Vast::changeState(), Gia::changeState(), Chord::changeState(), Broose::changeState(), Pastry::checkProxCache(), Chord::closestPreceedingNode(), I3SubIdentifier::compareTo(), KBRTestApp::deliver(), Scribe::deliverALMDataToGroup(), Broose::displayBucketState(), PastryRoutingTable::failedNode(), PastryNeighborhoodSet::failedNode(), PastryLeafSet::failedNode(), BaseOverlay::findNodeRpc(), KBRTestApp::forward(), getAddress(), BrooseBucket::getClosestNode(), BrooseBucket::getFailedResponses(), BrooseBucket::getLastSeen(), BootstrapOracle::getPeerInfo(), BrooseBucket::getRTT(), Vast::handleAppMessage(), BaseOverlay::handleBaseOverlayMessage(), BaseApp::handleCommonAPIMessage(), Koorde::handleDeBruijnTimerExpired(), Scribe::handleJoinMessage(), Scribe::handleJoinResponse(), KBRTestApp::handleLookupResponse(), BootstrapList::handleLookupResponse(), GIASearchApp::handleLowerMessage(), XmlRpcInterface::handleMessage(), BaseOverlay::handleMessage(), BaseApp::handleMessage(), Scribe::handlePublishCall(), Scribe::handlePublishResponse(), SimpleGameClient::handleRealworldPacket(), Koorde::handleRpcNotifyResponse(), Chord::handleRpcNotifyResponse(), Scribe::handleRpcResponse(), PubSubMMOG::handleRpcResponse(), Koorde::handleRpcResponse(), KBRTestApp::handleRpcResponse(), Chord::handleRpcResponse(), Broose::handleRpcResponse(), BootstrapList::handleRpcResponse(), PubSubMMOG::handleRpcTimeout(), PubSubLobby::handleRpcTimeout(), Koorde::handleRpcTimeout(), Chord::handleRpcTimeout(), Broose::handleRpcTimeout(), Pastry::handleStateMessage(), SimpleGameClient::handleTimerEvent(), Scribe::handleTimerEvent(), GIASearchApp::handleTimerEvent(), BaseOverlay::handleTransportAddressChangedNotification(), Vast::handleUDPMessage(), Pastry::handleUDPMessage(), Scribe::handleUpperMessage(), hash(), I3IPAddress::I3IPAddress(), BrooseBucket::increaseFailedResponses(), BaseOverlay::initialize(), BaseApp::initialize(), I3::insertTrigger(), BaseRpc::internalHandleRpcMessage(), isUnspecified(), NodeHandle::isUnspecified(), BaseOverlay::join(), I3IPAddress::length(), IterativeLookup::lookup(), SendToKeyListener::lookupFinished(), netPack(), NodeHandle::netPack(), netUnpack(), NodeHandle::netUnpack(), NodeHandle::NodeHandle(), BrooseBucket::nodeInBucket(), operator!=(), NodeHandle::operator!=(), BrooseHandle::operator!=(), operator<(), I3IPAddress::operator<(), operator<<(), operator<=(), operator=(), NodeHandle::operator=(), GiaNode::operator=(), BrooseHandle::operator=(), operator==(), NodeHandle::operator==(), I3IPAddress::operator==(), BrooseHandle::operator==(), operator>(), operator>=(), BrooseBucket::output(), Chord::pingResponse(), BootstrapList::pingResponse(), BasePastry::pingResponse(), Chord::pingTimeout(), BootstrapList::pingTimeout(), BasePastry::pingTimeout(), I3IdentifierStack::push(), Vast::receiveChangeNotification(), I3BaseApp::refreshTriggers(), BootstrapOracle::registerPeer(), BrooseBucket::remove(), BootstrapOracle::removePeer(), BrooseBucket::resetFailedResponses(), Gia::route(), BaseOverlay::route(), Vast::sendDiscardNode(), Vast::sendMessage(), BaseOverlay::sendMessageToUDP(), BaseApp::sendMessageToUDP(), I3::sendPacket(), I3::sendQueryReply(), BasePastry::sendStateTables(), Vast::sendToApp(), BaseOverlay::sendToKey(), BrooseBucket::setLastSeen(), BrooseBucket::setRTT(), Scribe::subscribeToGroup(), TransportAddress(), SimpleGameClient::updateNeighbors(), Koorde::updateTooltip(), and Broose::updateTooltip().
the port of this TransportAddress object
Referenced by BaseOverlay::bindToPort(), BaseApp::bindToPort(), BootstrapNodeHandle::BootstrapNodeHandle(), BrooseHandle::BrooseHandle(), Gia::changeState(), I3SubIdentifier::compareTo(), getPort(), KBRTestApp::handleTimerEvent(), hash(), I3IPAddress::I3IPAddress(), BaseApp::initialize(), KBRTestApp::initializeApp(), I3::initializeApp(), isUnspecified(), netPack(), NodeHandle::netPack(), netUnpack(), NodeHandle::netUnpack(), NodeHandle::NodeHandle(), operator!=(), NodeHandle::operator!=(), BrooseHandle::operator!=(), I3IPAddress::operator<(), operator<<(), operator=(), NodeHandle::operator=(), GiaNode::operator=(), BrooseHandle::operator=(), operator==(), NodeHandle::operator==(), I3IPAddress::operator==(), BrooseHandle::operator==(), I3IdentifierStack::push(), Gia::route(), BaseOverlay::sendMessageToUDP(), BaseApp::sendMessageToUDP(), and TransportAddress().
const TransportAddress TransportAddress::UNSPECIFIED_NODE [static] |
TransportAddress without specified ip and port.
Reimplemented in NodeHandle, BrooseHandle, and GiaNode.
Referenced by PastryRoutingTable::failedNode(), PastryNeighborhoodSet::failedNode(), PastryLeafSet::failedNode(), PastryRoutingTable::findNextNodeToAsk(), PastryRoutingTable::getRandomNode(), PastryLeafSet::getRandomNode(), BaseApp::internalSendRpcResponse(), PastryStateObject::repair(), PastryRoutingTable::repair(), PastryLeafSet::repair(), BaseRpc::sendInternalRpcCall(), and BaseRpc::sendRouteRpcCall().
const std::vector< TransportAddress > TransportAddress::UNSPECIFIED_NODES [static] |