Ring Daemon
Loading...
Searching...
No Matches
jami::RoutingTable Class Reference

#include <routing_table.h>

Collaboration diagram for jami::RoutingTable:
Collaboration graph

Classes

struct  NodeStats
 

Public Member Functions

bool addConnectingNode (const NodeId &nodeId)
 Add connecting node to routing table.
 
bool addKnownNode (const NodeId &nodeId)
 Add known node to routing table.
 
bool addMobileNode (const NodeId &nodeId)
 Add mobile node to routing table.
 
bool addNode (const std::shared_ptr< dhtnet::ChannelSocketInterface > &channel, std::list< Bucket >::iterator &bucket)
 Add socket to specific bucket.
 
bool addNode (const std::shared_ptr< dhtnet::ChannelSocketInterface > &socket)
 Add socket to bucket.
 
std::vector< NodeIdclosestNodes (const NodeId &nodeId, unsigned count)
 Returns the count closest nodes to a specific nodeId.
 
bool contains (const std::list< Bucket >::iterator &it, const NodeId &nodeId) const
 Test if connected nodeId is in specific bucket.
 
void deleteNode (const NodeId &nodeId)
 Delete node from every table in bucket.
 
std::list< Bucket >::iterator findBucket (const NodeId &nodeId)
 Returns bucket iterator containing nodeId.
 
const std::list< Bucket >::const_iterator findBucket (const NodeId &nodeId) const
 Returns bucket iterator containing nodeId.
 
unsigned getActiveNodesCount () const
 
std::vector< NodeIdgetAllNodes () const
 Return every node from each bucket.
 
std::vector< NodeIdgetBucketMobileNodes () const
 Returns mobile nodes corresponding to the swarm's id.
 
std::list< Bucket > & getBuckets ()
 Returns buckets in routing table.
 
std::vector< NodeIdgetConnectedNodes () const
 
std::vector< NodeIdgetConnectingNodes () const
 Returns all routing table's connecting nodes.
 
NodeId getId () const
 Returns id for routing table.
 
std::vector< NodeIdgetKnownNodes () const
 Returns all routing table's known nodes.
 
std::vector< NodeIdgetMobileNodes () const
 Returns all routing table's mobile nodes.
 
unsigned getNodeCount () const
 Returns number of total nodes in routing table.
 
std::vector< NodeIdgetNodes () const
 Returns all routing table's connected nodes.
 
std::vector< NodeStatsgetRoutingTableStats () const
 
bool hasConnectingNode (const NodeId &nodeId) const
 Check if Connecting node exists in routing table.
 
bool hasKnownNode (const NodeId &nodeId) const
 Checks if known node exists in routing table.
 
bool hasMobileNode (const NodeId &nodeId)
 Check if mobile node exists in routing table.
 
bool hasNode (const NodeId &nodeId)
 Check if connected node exsits in routing table.
 
bool isEmpty () const
 
void printRoutingTable () const
 Prints routing table.
 
void removeConnectingNode (const NodeId &nodeId)
 Remove connecting connecting node to routing table.
 
void removeMobileNode (const NodeId &nodeId)
 Remove mobile node to routing table.
 
bool removeNode (const NodeId &nodeId)
 Removes node from routing table Adds it to known_nodes or mobile_nodes depending on mobility.
 
 RoutingTable ()
 
void setId (const NodeId &node)
 Sets id for routing table.
 
void shutdownAllNodes ()
 Shutdowns all nodes in routing table and add them to known_nodes or mobile_nodes.
 
void shutdownNode (const NodeId &nodeId)
 Shutdowns a node.
 
unsigned size () const
 Returns number of buckets in routing table.
 

Detailed Description

Definition at line 301 of file routing_table.h.

Constructor & Destructor Documentation

◆ RoutingTable()

jami::RoutingTable::RoutingTable ( )

Definition at line 245 of file routing_table.cpp.

Member Function Documentation

◆ addConnectingNode()

bool jami::RoutingTable::addConnectingNode ( const NodeId nodeId)

Add connecting node to routing table.

Parameters
nodeId
Returns
true if connecting node was added, false if not

Definition at line 343 of file routing_table.cpp.

References jami::emitSignal(), and findBucket().

Referenced by jami::SwarmManager::maintainBuckets().

Here is the call graph for this function:

◆ addKnownNode()

bool jami::RoutingTable::addKnownNode ( const NodeId nodeId)

Add known node to routing table.

Parameters
nodeId
Returns
true if known node was added, false if not

Definition at line 303 of file routing_table.cpp.

References jami::emitSignal(), and findBucket().

Here is the call graph for this function:

◆ addMobileNode()

bool jami::RoutingTable::addMobileNode ( const NodeId nodeId)

Add mobile node to routing table.

Parameters
nodeId
Returns
true if mobile node was added, false if not

Definition at line 316 of file routing_table.cpp.

References jami::emitSignal(), and findBucket().

Here is the call graph for this function:

◆ addNode() [1/2]

bool jami::RoutingTable::addNode ( const std::shared_ptr< dhtnet::ChannelSocketInterface > &  channel,
std::list< Bucket >::iterator bucket 
)

Add socket to specific bucket.

Parameters
channel
bucket
Returns
true if socket was added to bucket, false if not

Definition at line 269 of file routing_table.cpp.

References contains(), jami::emitSignal(), and findBucket().

Here is the call graph for this function:

◆ addNode() [2/2]

bool jami::RoutingTable::addNode ( const std::shared_ptr< dhtnet::ChannelSocketInterface > &  socket)

Add socket to bucket.

Parameters
socket
Returns
true if socket was added, false if not

Definition at line 262 of file routing_table.cpp.

References addNode(), jami::emitSignal(), and findBucket().

Referenced by jami::SwarmManager::addChannel(), and addNode().

Here is the call graph for this function:

◆ closestNodes()

std::vector< NodeId > jami::RoutingTable::closestNodes ( const NodeId nodeId,
unsigned  count 
)

Returns the count closest nodes to a specific nodeId.

Parameters
nodeId
count
Returns
vector of nodeIds

Definition at line 382 of file routing_table.cpp.

References closestNodes(), jami::emitSignal(), and findBucket().

Referenced by closestNodes().

Here is the call graph for this function:

◆ contains()

bool jami::RoutingTable::contains ( const std::list< Bucket >::iterator it,
const NodeId nodeId 
) const

Test if connected nodeId is in specific bucket.

Parameters
it
nodeId
Returns
true if nodeId is in bucket, false if not

Definition at line 494 of file routing_table.cpp.

References jami::emitSignal().

Referenced by addNode(), and jami::SwarmManager::maintainBuckets().

Here is the call graph for this function:

◆ deleteNode()

void jami::RoutingTable::deleteNode ( const NodeId nodeId)

Delete node from every table in bucket.

Definition at line 534 of file routing_table.cpp.

References jami::emitSignal(), and findBucket().

Referenced by jami::SwarmManager::deleteNode().

Here is the call graph for this function:

◆ findBucket() [1/2]

std::list< Bucket >::iterator jami::RoutingTable::findBucket ( const NodeId nodeId)

◆ findBucket() [2/2]

const std::list< Bucket >::const_iterator jami::RoutingTable::findBucket ( const NodeId nodeId) const
inline

Returns bucket iterator containing nodeId.

Parameters
nodeId
Returns
bucket iterator

Definition at line 414 of file routing_table.h.

References findBucket().

Here is the call graph for this function:

◆ getActiveNodesCount()

unsigned jami::RoutingTable::getActiveNodesCount ( ) const
inline

Definition at line 445 of file routing_table.h.

References jami::emitSignal().

Referenced by jami::SwarmManager::getActiveNodesCount().

Here is the call graph for this function:

◆ getAllNodes()

std::vector< NodeId > jami::RoutingTable::getAllNodes ( ) const

Return every node from each bucket.

Definition at line 501 of file routing_table.cpp.

References jami::emitSignal().

Referenced by jami::SwarmManager::getAllNodes().

Here is the call graph for this function:

◆ getBucketMobileNodes()

std::vector< NodeId > jami::RoutingTable::getBucketMobileNodes ( ) const

Returns mobile nodes corresponding to the swarm's id.

Returns
vector of nodeIds

Definition at line 483 of file routing_table.cpp.

References jami::emitSignal(), and findBucket().

Here is the call graph for this function:

◆ getBuckets()

std::list< Bucket > & jami::RoutingTable::getBuckets ( )
inline

Returns buckets in routing table.

Returns
list buckets

Definition at line 489 of file routing_table.h.

Referenced by jami::SwarmManager::display(), jami::SwarmManager::getBuckets(), and jami::SwarmManager::maintainBuckets().

◆ getConnectedNodes()

std::vector< NodeId > jami::RoutingTable::getConnectedNodes ( ) const

Definition at line 519 of file routing_table.cpp.

References jami::emitSignal().

Referenced by jami::SwarmManager::getConnectedNodes().

Here is the call graph for this function:

◆ getConnectingNodes()

std::vector< NodeId > jami::RoutingTable::getConnectingNodes ( ) const

Returns all routing table's connecting nodes.

Returns
vector of nodeIds

Definition at line 472 of file routing_table.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getId()

NodeId jami::RoutingTable::getId ( ) const
inline

Returns id for routing table.

Returns
Nodeid

Definition at line 483 of file routing_table.h.

◆ getKnownNodes()

std::vector< NodeId > jami::RoutingTable::getKnownNodes ( ) const

Returns all routing table's known nodes.

Returns
vector of nodeIds

Definition at line 450 of file routing_table.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getMobileNodes()

std::vector< NodeId > jami::RoutingTable::getMobileNodes ( ) const

Returns all routing table's mobile nodes.

Returns
vector of nodeIds

Definition at line 461 of file routing_table.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getNodeCount()

unsigned jami::RoutingTable::getNodeCount ( ) const
inline

Returns number of total nodes in routing table.

Returns
size of nodes

Definition at line 437 of file routing_table.h.

References jami::emitSignal().

Referenced by jami::SwarmManager::display().

Here is the call graph for this function:

◆ getNodes()

std::vector< NodeId > jami::RoutingTable::getNodes ( ) const

Returns all routing table's connected nodes.

Returns
vector of nodeIds

Definition at line 438 of file routing_table.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getRoutingTableStats()

std::vector< RoutingTable::NodeStats > jami::RoutingTable::getRoutingTableStats ( ) const

Definition at line 552 of file routing_table.cpp.

References jami::emitSignal(), and jami::systemTimeFromSteady().

Referenced by jami::SwarmManager::getRoutingTableInfo().

Here is the call graph for this function:

◆ hasConnectingNode()

bool jami::RoutingTable::hasConnectingNode ( const NodeId nodeId) const
inline

Check if Connecting node exists in routing table.

Parameters
nodeId
Returns
true if connecting node exists, false if not

Definition at line 396 of file routing_table.h.

References jami::emitSignal(), and findBucket().

Here is the call graph for this function:

◆ hasKnownNode()

bool jami::RoutingTable::hasKnownNode ( const NodeId nodeId) const
inline

Checks if known node exists in routing table.

Parameters
nodeId
Returns
true if known node exists, false if not

Definition at line 350 of file routing_table.h.

References jami::emitSignal(), and findBucket().

Here is the call graph for this function:

◆ hasMobileNode()

bool jami::RoutingTable::hasMobileNode ( const NodeId nodeId)

Check if mobile node exists in routing table.

Parameters
nodeId
Returns
true if mobile node exists, false if not

Definition at line 337 of file routing_table.cpp.

References findBucket().

Here is the call graph for this function:

◆ hasNode()

bool jami::RoutingTable::hasNode ( const NodeId nodeId)

Check if connected node exsits in routing table.

Parameters
nodeId
Returns
true if node exists, false if not

Definition at line 297 of file routing_table.cpp.

References findBucket().

Referenced by jami::SwarmManager::isConnectedWith().

Here is the call graph for this function:

◆ isEmpty()

bool jami::RoutingTable::isEmpty ( ) const

Definition at line 251 of file routing_table.cpp.

References jami::emitSignal().

Referenced by jami::SwarmManager::isConnected().

Here is the call graph for this function:

◆ printRoutingTable()

void jami::RoutingTable::printRoutingTable ( ) const

Prints routing table.

Definition at line 420 of file routing_table.cpp.

References jami::emitSignal(), and JAMI_DEBUG.

Here is the call graph for this function:

◆ removeConnectingNode()

void jami::RoutingTable::removeConnectingNode ( const NodeId nodeId)

Remove connecting connecting node to routing table.

Parameters
nodeId
Returns
true if connecting node was removed, false if not

Definition at line 358 of file routing_table.cpp.

References findBucket().

Here is the call graph for this function:

◆ removeMobileNode()

void jami::RoutingTable::removeMobileNode ( const NodeId nodeId)

Remove mobile node to routing table.

Parameters
nodeId
Returns
true if mobile node was removed, false if not

Definition at line 331 of file routing_table.cpp.

References findBucket().

Here is the call graph for this function:

◆ removeNode()

bool jami::RoutingTable::removeNode ( const NodeId nodeId)

Removes node from routing table Adds it to known_nodes or mobile_nodes depending on mobility.

Parameters
socket
Returns
true if node was removed, false if not

Definition at line 291 of file routing_table.cpp.

References findBucket().

Here is the call graph for this function:

◆ setId()

void jami::RoutingTable::setId ( const NodeId node)
inline

Sets id for routing table.

Parameters
node

Definition at line 477 of file routing_table.h.

Referenced by jami::SwarmManager::SwarmManager().

◆ shutdownAllNodes()

void jami::RoutingTable::shutdownAllNodes ( )
inline

Shutdowns all nodes in routing table and add them to known_nodes or mobile_nodes.

Definition at line 467 of file routing_table.h.

References jami::emitSignal().

Referenced by jami::SwarmManager::shutdown().

Here is the call graph for this function:

◆ shutdownNode()

void jami::RoutingTable::shutdownNode ( const NodeId nodeId)

Shutdowns a node.

Parameters
nodeId

Definition at line 432 of file routing_table.cpp.

References findBucket().

Here is the call graph for this function:

◆ size()

unsigned jami::RoutingTable::size ( ) const
inline

Returns number of buckets in routing table.

Returns
size of buckets

Definition at line 431 of file routing_table.h.


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