Software TSN Switch
A software switch to connect VMs and Containers to a TSN network
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
Topology Class Reference

Stores and provides lookup access to the controller's in-memory network topology. More...

#include <Topology.h>

Collaboration diagram for Topology:
Collaboration graph

Public Member Functions

void buildIndex ()
 Creates an index for fast node lookup by hostname Must be called after populating the 'nodes' vector.
 
CncNode_t * getNode (const std::string &nodeName)
 Retrieves a node by its hostname.
 
ietfInterface_t * getInterface (const LldpNeighbor_t &neighborInfo)
 Retrieves an interface based on LLDP neighbor information.
 
std::mutex & getNodeMutex (const std::string &nodeName)
 Retrieves a mutex for synchronizing access to a specific node.
 

Public Attributes

std::vector< CncNode_t > nodes
 The main database storing all network nodes (Switches/End-Devices). This vector owns the memory of the objects.
 

Private Attributes

std::map< std::string, CncNode_t * > nodeLookup
 Internal helper for fast lookups. Avoids looping through the vector every time if searching for a node.
 
std::map< std::string, std::unique_ptr< std::mutex > > nodeMutexes
 Mutexes for synchronizing access to individual nodes. The map is protected by 'mapMutex' to ensure thread safety when adding new nodes.
 
std::mutex mapMutex
 Mutex to protect access to the 'nodeMutexes' map when adding new nodes or retrieving mutexes.
 

Detailed Description

Stores and provides lookup access to the controller's in-memory network topology.

This class owns the collection of CncNode_t objects representing switches and end devices, and builds auxiliary indices for efficient hostname-based access. It also offers helper queries to resolve interfaces from LLDP neighbor information during topology correlation.

Member Function Documentation

◆ buildIndex()

void Topology::buildIndex ( )

Creates an index for fast node lookup by hostname Must be called after populating the 'nodes' vector.

◆ getInterface()

ietfInterface_t * Topology::getInterface ( const LldpNeighbor_t &  neighborInfo)

Retrieves an interface based on LLDP neighbor information.

Parameters
neighborInfoThe LLDP neighbor information to match
Returns
Pointer to the ietfInterface_t if found, nullptr otherwise

◆ getNode()

CncNode_t * Topology::getNode ( const std::string &  nodeName)

Retrieves a node by its hostname.

Parameters
nodeNameThe hostname of the node to retrieve
Returns
Pointer to the CncNode_t if found, nullptr otherwise

◆ getNodeMutex()

std::mutex & Topology::getNodeMutex ( const std::string &  nodeName)

Retrieves a mutex for synchronizing access to a specific node.

Parameters
nodeNameThe hostname of the node for which to retrieve the mutex
Returns
Reference to the mutex associated with the node

Member Data Documentation

◆ mapMutex

std::mutex Topology::mapMutex
private

Mutex to protect access to the 'nodeMutexes' map when adding new nodes or retrieving mutexes.

◆ nodeLookup

std::map<std::string, CncNode_t*> Topology::nodeLookup
private

Internal helper for fast lookups. Avoids looping through the vector every time if searching for a node.

◆ nodeMutexes

std::map<std::string, std::unique_ptr<std::mutex> > Topology::nodeMutexes
private

Mutexes for synchronizing access to individual nodes. The map is protected by 'mapMutex' to ensure thread safety when adding new nodes.

◆ nodes

std::vector<CncNode_t> Topology::nodes

The main database storing all network nodes (Switches/End-Devices). This vector owns the memory of the objects.


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