link.h 627 B

12345678910111213141516171819202122232425262728
  1. #ifndef _IPYML_LINK_H
  2. #define _IPYML_LINK_H
  3. #include "hardware_address.h"
  4. #include "yaml.h"
  5. #include <ostream>
  6. #include <string>
  7. class Link : public YamlObject {
  8. public:
  9. std::string ifname;
  10. HardwareAddress hwaddr, broadcast;
  11. void write_yaml(std::ostream &stream,
  12. const yaml_indent_level_t indent_level = 0) const {
  13. const std::string indent(indent_level, ' ');
  14. stream << "ifname: " + ifname + "\n";
  15. stream << indent + "hwaddr: ";
  16. hwaddr.write_yaml(stream);
  17. stream << "\n";
  18. stream << indent + "broadcast: ";
  19. broadcast.write_yaml(stream);
  20. stream << "\n";
  21. }
  22. };
  23. #endif