cmake: do not use icmping on *nix

This commit is contained in:
Qv2ray-dev 2020-03-06 22:19:51 +08:00
parent b930bc86a3
commit e887b15e38
2 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,7 @@
#include "ICMPPinger.hpp"
#ifdef Q_OS_WIN
ICMPPinger::ICMPPinger(UINT64 timeout = DEFAULT_TIMEOUT)
{
// create icmp handle
@ -47,3 +49,5 @@ std::pair<std::optional<UINT64>, std::optional<std::string>> ICMPPinger::ping(co
PICMP_ECHO_REPLY pReply = (PICMP_ECHO_REPLY) bufRecv.get();
return std::pair(pReply->RoundTripTime, std::nullopt);
}
#endif

View File

@ -1,17 +1,19 @@
#pragma once
#include <QtGlobal>
#ifdef Q_OS_WIN
/**
* ICMPPinger - An Implementation of ICMPPing on Windows Platform
* Required Windows Version: 2000 / XP / 7 / Vista+
* License: WTFPL
*/
#include <icmpapi.h>
#include <iphlpapi.h>
#include <memory>
#include <optional>
#include <utility>
#include <winsock2.h>
#include <icmpapi.h>
#include <iphlpapi.h>
#include <memory>
#include <optional>
#include <utility>
#include <winsock2.h>
class ICMPPinger
{
@ -29,3 +31,4 @@ class ICMPPinger
HANDLE hIcmpFile;
UINT64 timeout = DEFAULT_TIMEOUT;
};
#endif