|
|
@@ -1,3 +1,4 @@
|
|
|
+#include "vector.h"
|
|
|
#include "yaml.h"
|
|
|
|
|
|
#include <assert.h>
|
|
|
@@ -9,7 +10,6 @@
|
|
|
#include <linux/rtnetlink.h>
|
|
|
#include <sstream>
|
|
|
#include <string>
|
|
|
-#include <vector>
|
|
|
|
|
|
// https://netfilter.org/projects/libmnl/doxygen/html/modules.html
|
|
|
|
|
|
@@ -57,23 +57,6 @@ struct Link : public YamlObject {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-template <class T> class vector : public std::vector<T>, YamlObject {
|
|
|
-public:
|
|
|
- void write_yaml(std::ostream &stream,
|
|
|
- const yaml_indent_level_t indent_level = 0) const {
|
|
|
- if (this->empty()) {
|
|
|
- stream << "[]";
|
|
|
- } else {
|
|
|
- const std::string indent(indent_level, ' ');
|
|
|
- stream << "\n";
|
|
|
- for (auto it = this->begin(); it != this->end(); it++) {
|
|
|
- stream << indent << "- ";
|
|
|
- it->write_yaml(stream, indent_level + 2);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
static int link_attr_cb(const nlattr *attr, void *data) {
|
|
|
Link *link = (Link *)data;
|
|
|
// /usr/include/linux/if_link.h
|