ifconfig.h 686 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef HV_IFCONFIG_H_
  2. #define HV_IFCONFIG_H_
  3. #include <vector>
  4. #ifdef _MSC_VER
  5. #pragma comment(lib, "iphlpapi.lib")
  6. #pragma comment(lib, "ws2_32.lib")
  7. #endif
  8. typedef struct ifconfig_s {
  9. char name[128];
  10. char ip[16];
  11. char mask[16];
  12. char broadcast[16];
  13. char mac[20];
  14. } ifconfig_t;
  15. /*
  16. * @test
  17. std::vector<ifconfig_t> ifcs;
  18. ifconfig(ifcs);
  19. for (auto& item : ifcs) {
  20. printf("%s\nip: %s\nmask: %s\nbroadcast: %s\nmac: %s\n\n",
  21. item.name,
  22. item.ip,
  23. item.mask,
  24. item.broadcast,
  25. item.mac);
  26. }
  27. */
  28. int ifconfig(std::vector<ifconfig_t>& ifcs);
  29. #endif // HV_IFCONFIG_H_