mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
Create ICMPPinger.hpp
This commit is contained in:
parent
2a0c459202
commit
1b7659a30e
32
src/components/icmping/win/ICMPPinger.hpp
Normal file
32
src/components/icmping/win/ICMPPinger.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* ICMPPinger - An Implementation of ICMPPing on Windows Platform
|
||||
* Required Windows Version: 2000 / XP / 7 / Vista+
|
||||
* License: WTFPL
|
||||
*/
|
||||
|
||||
#include<winsock2.h>
|
||||
#include<iphlpapi.h>
|
||||
#include<icmpapi.h>
|
||||
|
||||
#include<utility>
|
||||
#include<optional>
|
||||
#include<memory>
|
||||
|
||||
|
||||
class ICMPPinger {
|
||||
public:
|
||||
ICMPPinger(UINT64 timeout = DEFAULT_TIMEOUT);
|
||||
~ICMPPinger();
|
||||
|
||||
public:
|
||||
static const UINT64 DEFAULT_TIMEOUT = 10000U;
|
||||
|
||||
public:
|
||||
std::pair<std::optional<UINT64>, std::optional<std::string>> ping(const std::string& ipAddr);
|
||||
|
||||
private:
|
||||
HANDLE hIcmpFile;
|
||||
UINT64 timeout = DEFAULT_TIMEOUT;
|
||||
};
|
Loading…
Reference in New Issue
Block a user