OverSim
GiaNode Class Reference

This class represents a node in gia overlay network. More...

#include <GiaNode.h>

Inheritance diagram for GiaNode:
NodeHandle TransportAddress

Public Member Functions

 GiaNode ()
virtual ~GiaNode ()
 GiaNode (const NodeHandle &handle)
 GiaNode (const NodeHandle &handle, double cap, int degree)
GiaNodeoperator= (const NodeHandle &handle)
 an unspecified node
void setCapacity (double capacity)
 Set capacity (function of bandwidth, cpu power and HDD-fitness.
double getCapacity () const
 Get capacity.
- Public Member Functions inherited from NodeHandle
 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
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
- Public Member Functions inherited from TransportAddress
 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
TransportAddressoperator= (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 TransportAddressVectorgetSourceRoute () const
 Returns source route used to reach this node.
size_t hash () const
 creates a hash value of ip and port

Static Public Attributes

static const GiaNode UNSPECIFIED_NODE
- Static Public Attributes inherited from NodeHandle
static const NodeHandle UNSPECIFIED_NODE
 the unspecified NodeHandle
- Static Public Attributes inherited from TransportAddress
static const TransportAddress UNSPECIFIED_NODE
 TransportAddress without specified ip and port.
static const TransportAddressVector UNSPECIFIED_NODES

Protected Attributes

double capacity
- Protected Attributes inherited from NodeHandle
OverlayKey key
 the OverlayKey of this NodeHandle
- Protected Attributes inherited from TransportAddress
IPvXAddress ip
 the ip of this TransportAddress object
int port
 the port of this TransportAddress object

Friends

std::ostream & operator<< (std::ostream &os, const GiaNode &n)

Additional Inherited Members

- Public Types inherited from TransportAddress
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

Detailed Description

This class represents a node in gia overlay network.

Definition at line 38 of file GiaNode.h.

Constructor & Destructor Documentation

GiaNode::GiaNode ( )

Definition at line 31 of file GiaNode.cc.

{
//...
}
virtual GiaNode::~GiaNode ( )
inlinevirtual

Definition at line 43 of file GiaNode.h.

{};
GiaNode::GiaNode ( const NodeHandle handle)

Definition at line 36 of file GiaNode.cc.

: NodeHandle(handle)
{
//...
}
GiaNode::GiaNode ( const NodeHandle handle,
double  cap,
int  degree 
)

Definition at line 42 of file GiaNode.cc.

: NodeHandle(handle)
{
capacity = cap;
}

Member Function Documentation

GiaNode & GiaNode::operator= ( const NodeHandle handle)

an unspecified node

Reimplemented from NodeHandle.

Definition at line 47 of file GiaNode.cc.

{
ip = handle.getIp();
port = handle.getPort();
key = handle.getKey();
capacity = 0;
return *this;
}
void GiaNode::setCapacity ( double  capacity)

Set capacity (function of bandwidth, cpu power and HDD-fitness.

Parameters
capacityCapacity to set

Definition at line 57 of file GiaNode.cc.

Referenced by Gia::changeState().

{
capacity = cap;
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const GiaNode n 
)
friend

Definition at line 67 of file GiaNode.cc.

{
if(node.ip.isUnspecified() == true && node.key.isUnspecified() && node.port == -1) {
os << "<unspec>";
} else {
os << node.ip << ":" << node.port << " "
<< node.key.toString() << " with capacity: "
<< node.capacity //<< " , degree: " << node.connectionDegree
//<< " , sentTokens: " << node.sentTokens << " , receivedTokens: " << node.receivedTokens;
;
}
return os;
}

Member Data Documentation

double GiaNode::capacity
protected

Definition at line 70 of file GiaNode.h.

Referenced by getCapacity(), GiaNode(), operator<<(), operator=(), and setCapacity().

const GiaNode GiaNode::UNSPECIFIED_NODE
static

Definition at line 49 of file GiaNode.h.

Referenced by GiaNeighbors::get(), and GiaNeighbors::getDropCandidate().


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