summaryrefslogtreecommitdiff
path: root/plugins/Ping/src/icmp.h
blob: 91b0749a651da560aed4468f4cfd767b16f39063 (plain)
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
// adapted 23/9/2004 from public domain code at http://tangentsoft.net/wskfaq/examples/dllping.html

#ifndef _ICMP_H
#define _ICMP_H

class ICMP {
protected:
	HANDLE hIP;

	unsigned int timeout;
	bool functions_loaded;

	// protected constructor - singleton class
	ICMP();
	static ICMP *instance;

	char *buff;

public:
	~ICMP();
	static ICMP *get_instance();
	static void cleanup();

	bool ping(char *host, ICMP_ECHO_REPLY &reply);

	void set_timeout(unsigned int t) {
		timeout = t;
	}

	void stop();

	unsigned int get_timeout() { return timeout; }

};
#endif //_ICMP_H