#include <NodeHandle.h>
It covers the complete node information, like IP-Address, port, NodeID 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.
Sebastian Mies
Public Types | |
typedef hash_set< NodeHandle, hashFcn > | Set |
Public Member Functions | |
NodeHandle () | |
Constructs a unspecified NodeHandle. | |
NodeHandle (const NodeHandle &handle) | |
Copy constructor. | |
NodeHandle (const OverlayKey &key, const IPvXAddress &ip, int port, int moduleId=-1) | |
Complete constructor. | |
bool | operator== (const NodeHandle &rhs) const |
bool | operator!= (const NodeHandle &rhs) const |
bool | operator< (const NodeHandle &rhs) const |
bool | operator> (const NodeHandle &rhs) const |
bool | operator<= (const NodeHandle &rhs) const |
bool | operator>= (const NodeHandle &rhs) const |
NodeHandle & | operator= (const NodeHandle &rhs) |
void | setAddress (const IPvXAddress &ip, int port=-1) |
void | setPort (int port) |
void | setModuleId (int moduleId) |
void | setKey (const OverlayKey &key) |
const IPvXAddress & | getAddress () const |
int | getPort () const |
int | getModuleId () const |
const OverlayKey & | getKey () const |
bool | isUnspecified () const |
bool | isMalicious () const |
size_t | hash () const |
void | netPack (cCommBuffer *b) |
void | netUnpack (cCommBuffer *b) |
Public Attributes | |
IPvXAddress | ip |
OverlayKey | key |
int | port |
int | moduleId |
Static Public Attributes | |
static const NodeHandle | UNSPECIFIED_NODE |
Private Member Functions | |
void | assertUnspecified (const NodeHandle &handle) const |
Friends | |
std::ostream & | operator<< (std::ostream &os, const NodeHandle &n) |
Classes | |
class | hashFcn |
typedef hash_set<NodeHandle, hashFcn> NodeHandle::Set |
NodeHandle::NodeHandle | ( | ) |
Constructs a unspecified NodeHandle.
00052 { 00053 moduleId = -1; 00054 port = -1; 00055 key = OverlayKey::UNSPECIFIED_KEY; 00056 }
NodeHandle::NodeHandle | ( | const NodeHandle & | handle | ) |
NodeHandle::NodeHandle | ( | const OverlayKey & | key, | |
const IPvXAddress & | ip, | |||
int | port, | |||
int | moduleId = -1 | |||
) |
void NodeHandle::assertUnspecified | ( | const NodeHandle & | handle | ) | const [inline, private] |
00219 { 00220 if ( this->isUnspecified() || handle.isUnspecified() ) 00221 opp_error("NodeHandle: Trying to compare unspecified nodeHandle!"); 00222 }
const IPvXAddress & NodeHandle::getAddress | ( | ) | const |
const OverlayKey & NodeHandle::getKey | ( | ) | const |
int NodeHandle::getModuleId | ( | ) | const |
int NodeHandle::getPort | ( | ) | const |
size_t NodeHandle::hash | ( | ) | const |
bool NodeHandle::isMalicious | ( | ) | const |
00087 { 00088 BaseOverlay* overlay 00089 = dynamic_cast<BaseOverlay*>(simulation.module(moduleId)); 00090 if (overlay==NULL) 00091 opp_error("NodeHandle not associated with a BaseOverlay Module"); 00092 return overlay->isMalicious(); 00093 }
bool NodeHandle::isUnspecified | ( | ) | const |
void NodeHandle::netPack | ( | cCommBuffer * | b | ) |
void NodeHandle::netUnpack | ( | cCommBuffer * | b | ) |
00275 { 00276 //cMessage::netUnpack(b); 00277 doUnpacking(b,this->ip); 00278 doUnpacking(b,this->key); 00279 doUnpacking(b,this->port); 00280 doUnpacking(b,this->moduleId); 00281 }
bool NodeHandle::operator!= | ( | const NodeHandle & | rhs | ) | const |
bool NodeHandle::operator< | ( | const NodeHandle & | rhs | ) | const |
bool NodeHandle::operator<= | ( | const NodeHandle & | rhs | ) | const |
NodeHandle & NodeHandle::operator= | ( | const NodeHandle & | rhs | ) |
bool NodeHandle::operator== | ( | const NodeHandle & | rhs | ) | const |
00108 { 00109 assertUnspecified( rhs ); 00110 return ( this->moduleId == rhs.moduleId && 00111 this->key == rhs.key && 00112 this->ip == rhs.ip && this->port == rhs.port ); 00113 }
bool NodeHandle::operator> | ( | const NodeHandle & | rhs | ) | const |
bool NodeHandle::operator>= | ( | const NodeHandle & | rhs | ) | const |
void NodeHandle::setAddress | ( | const IPvXAddress & | ip, | |
int | port = -1 | |||
) |
void NodeHandle::setKey | ( | const OverlayKey & | key | ) |
std::ostream& operator<< | ( | std::ostream & | os, | |
const NodeHandle & | n | |||
) | [friend] |
00038 { 00039 if (n.isUnspecified()) { 00040 os << "<unspec>"; 00041 } else { 00042 os << n.ip << ":" << n.port << " " << n.key 00043 << " " << n.moduleId; 00044 } 00045 00046 return os; 00047 };
IPvXAddress NodeHandle::ip |
int NodeHandle::port |
const NodeHandle NodeHandle::UNSPECIFIED_NODE [static] |