From 1b7659a30ee76577ba059e7bb4dab88dacb8f51c Mon Sep 17 00:00:00 2001 From: DuckSoft Date: Sat, 8 Feb 2020 15:57:56 +0800 Subject: [PATCH] Create ICMPPinger.hpp --- src/components/icmping/win/ICMPPinger.hpp | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/components/icmping/win/ICMPPinger.hpp diff --git a/src/components/icmping/win/ICMPPinger.hpp b/src/components/icmping/win/ICMPPinger.hpp new file mode 100644 index 00000000..f6382049 --- /dev/null +++ b/src/components/icmping/win/ICMPPinger.hpp @@ -0,0 +1,32 @@ +#pragma once + +/** + * ICMPPinger - An Implementation of ICMPPing on Windows Platform + * Required Windows Version: 2000 / XP / 7 / Vista+ + * License: WTFPL + */ + +#include +#include +#include + +#include +#include +#include + + +class ICMPPinger { + public: + ICMPPinger(UINT64 timeout = DEFAULT_TIMEOUT); + ~ICMPPinger(); + + public: + static const UINT64 DEFAULT_TIMEOUT = 10000U; + + public: + std::pair, std::optional> ping(const std::string& ipAddr); + + private: + HANDLE hIcmpFile; + UINT64 timeout = DEFAULT_TIMEOUT; +};