|
Software TSN Switch
A software switch to connect VMs and Containers to a TSN network
|
Stores and provides lookup access to the controller's in-memory network topology. More...
#include <Topology.h>

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. | |
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.
| void Topology::buildIndex | ( | ) |
Creates an index for fast node lookup by hostname Must be called after populating the 'nodes' vector.
| ietfInterface_t * Topology::getInterface | ( | const LldpNeighbor_t & | neighborInfo | ) |
Retrieves an interface based on LLDP neighbor information.
| neighborInfo | The LLDP neighbor information to match |
| CncNode_t * Topology::getNode | ( | const std::string & | nodeName | ) |
Retrieves a node by its hostname.
| nodeName | The hostname of the node to retrieve |
| std::mutex & Topology::getNodeMutex | ( | const std::string & | nodeName | ) |
Retrieves a mutex for synchronizing access to a specific node.
| nodeName | The hostname of the node for which to retrieve the mutex |
|
private |
Mutex to protect access to the 'nodeMutexes' map when adding new nodes or retrieving mutexes.
|
private |
Internal helper for fast lookups. Avoids looping through the vector every time if searching for a node.
|
private |
Mutexes for synchronizing access to individual nodes. The map is protected by 'mapMutex' to ensure thread safety when adding new 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.