-
Notifications
You must be signed in to change notification settings - Fork 0
/
UDPPinger.h
47 lines (31 loc) · 906 Bytes
/
UDPPinger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef UDP_PINGER_H
#define UDP_PINGER_H
#include <string>
#include <netdb.h>
#include <unordered_set>
#include <unordered_map>
namespace udppinger{
class UDPPinger
{
public:
UDPPinger(const std::string& _addr, int _port, bool _failfast, bool _lastsuccess);
~UDPPinger();
int getSocket() const;
int getPort() const;
std::string getAddr() const;
void ping();
private:
std::string addr;
int port;
int sock;
struct addrinfo* addressinfo;
bool failfast;
bool lastsuccess;
std::string blacklistfilename;
std::string whitelistfilename;
std::unordered_set<std::string> blacklist;
std::unordered_map<std::string, std::string> whitelist;
void removeFromFile(std::string filename, bool wl);
};
}
#endif //UDP_PINGER_H