summaryrefslogtreecommitdiff
path: root/plugins/Ping/src/pinglist.h
blob: 0b9bfe15b8a66ccaaf1914b00632f6fd3a0259dd (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _PINGLIST_H
#define _PINGLIST_H

#define PS_RESPONDING		1
#define PS_NOTRESPONDING	2
#define PS_TESTING			3
#define PS_DISABLED			4

#define MAX_PINGADDRESS_STRING_LENGTH	256

struct PINGADDRESS
{
	int cbSize;	//size in bytes of this structure
	uint32_t item_id;
	wchar_t pszName[MAX_PINGADDRESS_STRING_LENGTH];		//IP address or domain name
	wchar_t pszLabel[MAX_PINGADDRESS_STRING_LENGTH];
	bool responding;
	int status;
	short round_trip_time;
	int miss_count;
	int port; // -1 for ICMP, non-zero for TCP
	char pszProto[MAX_PINGADDRESS_STRING_LENGTH];
	wchar_t pszCommand[MAX_PATH];
	wchar_t pszParams[MAX_PATH];
	unsigned int get_status;		// on success, if status equals this
	unsigned int set_status;	// set it to this
	int index;

	const bool operator==(const PINGADDRESS &b) const;
	const bool operator<(const PINGADDRESS &b) const;
};

typedef std::list<PINGADDRESS> PINGLIST;
typedef std::list<PINGADDRESS>::iterator pinglist_it;

void ClearPingList(void);
int  GetListSize(void);
void GetPingList(PINGLIST &list);
void LoadPingList(void);
void SavePingList(void);
void SetPingList(const PINGLIST &list); // use when you modified db yourself
void SetAndSavePingList(const PINGLIST &list);

// only call with list_cs locked!
void write_ping_addresses();

BOOL changing_clist_handle();
void set_changing_clist_handle(BOOL flag);
#endif