link.h 705 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef _IPYML_LINK_H
  2. #define _IPYML_LINK_H
  3. #include "hardware_address.h"
  4. #include "operstate.h"
  5. #include "yaml.h"
  6. #include <linux/netlink.h>
  7. #include <linux/rtnetlink.h> // struct ifinfomsg
  8. #include <ostream>
  9. #include <string>
  10. class Link : public YamlObject {
  11. public:
  12. unsigned int index;
  13. private:
  14. std::string ifname;
  15. HardwareAddress address, broadcast;
  16. unsigned long int mtu;
  17. OperState operstate;
  18. public:
  19. Link(const ifinfomsg *msg);
  20. // typedef int (*mnl_attr_cb_t)(const struct nlattr *attr, void *data);
  21. static int mnl_attr_cb(const nlattr *attr, void *data);
  22. void write_yaml(std::ostream &stream,
  23. const yaml_indent_level_t indent_level = 0) const;
  24. };
  25. #endif