简体   繁体   English

C / C ++中的网络拓扑

[英]Network topology in c/c++

I'm trying to define a network topology in C/C++ language. 我正在尝试使用C / C ++语言定义网络拓扑。 The goal is to parse it from C/C++ to XML and viceversa. 目标是将其从C / C ++解析为XML,反之亦然。 In this topology (as you see in the picture) routers are connected with interfaces; 在这种拓扑结构中(如图所示),路由器与接口相连; each of them have an ip address and a link capacity. 他们每个人都有一个IP地址和链接容量。 Are there classes (like graphs) or structs to implement easier a network topology? 是否有类(如图形)或结构可简化网络拓扑?

拓扑

Network topology is simply a graph. 网络拓扑只是一个图。

The most popular representations of the graph are adjacency list/matrix. 图的最受欢迎表示是邻接表/矩阵。 Adjacency list node has the following structure (for ex.): 邻接列表节点具有以下结构(例如):

template <class T>
struct Node {
    T data;
    std::vector<Node*> childs;
};

If you later want to use graph algorithms, better use adjacency matrix Adjacent matrix 如果以后要使用图算法,最好使用邻接矩阵邻接矩阵

There are plenty of good C++ XML parser API's out there, see: What XML parser should I use in C++? 有很多不错的C ++ XML解析器API,请参见: 我应该在C ++中使用哪种XML解析器?

There are also plenty of good networking libraries out there, see: Best C/C++ Network Library 也有很多好的网络库,请参见: 最佳C / C ++网络库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM