ifconfig.h 718 B

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