1
0

link.h 771 B

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