OverSim
KademliaBucketEntry Class Reference

#include <KademliaNodeHandle.h>

Inheritance diagram for KademliaBucketEntry:
ProxNodeHandle NodeHandle TransportAddress

Public Member Functions

 KademliaBucketEntry ()
 Constructs an unspecified NodeHandle.
 KademliaBucketEntry (const NodeHandle &handle, simtime_t prox=MAXTIME)
simtime_t getRtt () const
void setRtt (simtime_t rtt)
uint8_t getStaleCount () const
void setStaleCount (uint8_t staleCount)
void resetStaleCount ()
void incStaleCount ()
void setLastSeen (simtime_t lastSeen)
simtime_t getLastSeen ()
void setPingSent (bool pingSent)
bool getPingSent () const
- Public Member Functions inherited from ProxNodeHandle
 ProxNodeHandle ()
 ProxNodeHandle (const NodeHandle &nodeHandle)
 ProxNodeHandle (const NodeHandle &nodeHandle, const Prox &prox)
virtual ~ProxNodeHandle ()
void setProx (Prox prox)
Prox getProx () const
- 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
NodeHandleoperator= (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 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

Private Attributes

uint8_t staleCount
simtime_t lastSeen
bool pingSent

Friends

std::ostream & operator<< (std::ostream &os, const KademliaBucketEntry &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
- Static Public Attributes inherited from ProxNodeHandle
static const ProxNodeHandle UNSPECIFIED_NODE
 the unspecified ProxNodeHandle
- Protected Attributes inherited from ProxNodeHandle
Prox prox

Detailed Description

Definition at line 28 of file KademliaNodeHandle.h.

Constructor & Destructor Documentation

KademliaBucketEntry::KademliaBucketEntry ( )
inline

Constructs an unspecified NodeHandle.

Definition at line 34 of file KademliaNodeHandle.h.

{
pingSent = false;
}
KademliaBucketEntry::KademliaBucketEntry ( const NodeHandle handle,
simtime_t  prox = MAXTIME 
)
inline

Definition at line 41 of file KademliaNodeHandle.h.

: ProxNodeHandle(handle)
{
this->prox.proximity = SIMTIME_DBL(prox);
this->prox.accuracy = 1.0;
pingSent = false;
}

Member Function Documentation

simtime_t KademliaBucketEntry::getLastSeen ( )
inline

Definition at line 64 of file KademliaNodeHandle.h.

{ return this->lastSeen; }
bool KademliaBucketEntry::getPingSent ( ) const
inline

Definition at line 68 of file KademliaNodeHandle.h.

{ return pingSent; };
simtime_t KademliaBucketEntry::getRtt ( ) const
inline

Definition at line 51 of file KademliaNodeHandle.h.

Referenced by Kademlia::routingAdd().

{ return getProx(); } //deprecated
uint8_t KademliaBucketEntry::getStaleCount ( ) const
inline

Definition at line 54 of file KademliaNodeHandle.h.

{ return staleCount; }
void KademliaBucketEntry::incStaleCount ( )
inline

Definition at line 60 of file KademliaNodeHandle.h.

{ this->staleCount++; }
void KademliaBucketEntry::resetStaleCount ( )
inline

Definition at line 58 of file KademliaNodeHandle.h.

{ this->setStaleCount(0); }
void KademliaBucketEntry::setLastSeen ( simtime_t  lastSeen)
inline

Definition at line 62 of file KademliaNodeHandle.h.

Referenced by Kademlia::routingAdd().

{ this->lastSeen = lastSeen; }
void KademliaBucketEntry::setPingSent ( bool  pingSent)
inline

Definition at line 66 of file KademliaNodeHandle.h.

{ this->pingSent = pingSent; }
void KademliaBucketEntry::setRtt ( simtime_t  rtt)
inline

Definition at line 52 of file KademliaNodeHandle.h.

Referenced by Kademlia::routingAdd().

{ this->prox.proximity = SIMTIME_DBL(rtt); this->prox.accuracy = 1; } //deprecated
void KademliaBucketEntry::setStaleCount ( uint8_t  staleCount)
inline

Definition at line 56 of file KademliaNodeHandle.h.

Referenced by resetStaleCount().

{ this->staleCount = staleCount; }

Friends And Related Function Documentation

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

Definition at line 76 of file KademliaNodeHandle.h.

{
os << (NodeHandle)n << " " << n.prox.proximity;
return os;
};

Member Data Documentation

simtime_t KademliaBucketEntry::lastSeen
private

Definition at line 73 of file KademliaNodeHandle.h.

Referenced by getLastSeen(), and setLastSeen().

bool KademliaBucketEntry::pingSent
private

Definition at line 74 of file KademliaNodeHandle.h.

Referenced by KademliaBucketEntry(), and setPingSent().

uint8_t KademliaBucketEntry::staleCount
private

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