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

#include <routing_table.h>

Collaboration diagram for jami::RoutingTable:
Collaboration graph

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.
 
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< 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.
 
std::vector< NodeIdgetNodes () const
 Returns all routing table's connected nodes.
 
unsigned getRoutingTableNodeCount () const
 Returns number of total nodes in routing table.
 
unsigned getRoutingTableSize () const
 Returns number of buckets in routing table.
 
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.
 
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.
 

Detailed Description

Definition at line 307 of file routing_table.h.

Constructor & Destructor Documentation

◆ RoutingTable()

jami::RoutingTable::RoutingTable ( )

Definition at line 247 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 334 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 294 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 307 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 260 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 253 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 373 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 487 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 513 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 419 of file routing_table.h.

References findBucket().

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 495 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 476 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 487 of file routing_table.h.

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

◆ getConnectingNodes()

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

Returns all routing table's connecting nodes.

Returns
vector of nodeIds

Definition at line 465 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 481 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 443 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 454 of file routing_table.cpp.

References jami::emitSignal().

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 431 of file routing_table.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getRoutingTableNodeCount()

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

Returns number of total nodes in routing table.

Returns
size of nodes

Definition at line 443 of file routing_table.h.

References jami::emitSignal().

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

Here is the call graph for this function:

◆ getRoutingTableSize()

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

Returns number of buckets in routing table.

Returns
size of buckets

Definition at line 437 of file routing_table.h.

◆ 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 401 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 355 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 328 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 288 of file routing_table.cpp.

References findBucket().

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

Here is the call graph for this function:

◆ printRoutingTable()

void jami::RoutingTable::printRoutingTable ( ) const

Prints routing table.

Definition at line 413 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 349 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 322 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 282 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 475 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 465 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 425 of file routing_table.cpp.

References findBucket().

Here is the call graph for this function:

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