From b61df7acc1235b3b2a66217d0d7358199c5d37f9 Mon Sep 17 00:00:00 2001 From: sje Date: Wed, 1 Nov 2006 14:44:17 +0000 Subject: git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@11 4f64403b-2f21-0410-a795-97e2b3489a10 --- ping/common.h | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 ping/common.h (limited to 'ping/common.h') diff --git a/ping/common.h b/ping/common.h new file mode 100644 index 0000000..b43eca2 --- /dev/null +++ b/ping/common.h @@ -0,0 +1,124 @@ +#ifndef _COMMON_H +#define _COMMON_H + +#define MAX_HISTORY (1440) // 12 hrs at 30 sec intervals + +#define PLUG "PING" + +#define DEFAULT_PING_PERIOD 30 +#define DEFAULT_PING_TIMEOUT 2 +#define DEFAULT_SHOW_POPUP true +#define DEFAULT_SHOW_POPUP2 false +#define DEFAULT_BLOCK_REPS true +#define DEFAULT_LOGGING_ENABLED false +#define DEFAULT_LOG_FILENAME "ping_log.txt" +#define DEFAULT_NO_TEST_ICON true +#define DEFAULT_ATTACH_TO_CLIST false + +#define MAX_PINGADDRESS_STRING_LENGTH 256 + +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +//#define VC_EXTRALEAN +//#define _WIN32_WINNT 0x0500 + +#define WINVER 0x0500 +#define _WIN32_WINNT 0x0400 +#define _WIN32_IE 0x0300 + +#include +#include +//#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "IcoLib.h" + +#include "collection.h" + +typedef struct { + int ping_period, ping_timeout; + bool show_popup, show_popup2, block_reps, logging; + char log_filename[MAX_PATH]; + bool no_test_icon; + int row_height; + int indent; + COLORREF bg_colour; + int retries; + bool attach_to_clist; + bool log_csv; +} PingOptions; + +#pragma warning( disable : 4786 ) + +// a deque of pairs - ping time and timestamp +struct HistPair { + short first; + time_t second; + + const bool operator==(const HistPair &other) const {return first == other.first && second == other.second;} +}; +typedef LinkedList< HistPair > HistoryList; + + +#define PS_RESPONDING 1 +#define PS_NOTRESPONDING 2 +#define PS_TESTING 3 +#define PS_DISABLED 4 + +struct PINGADDRESS { + int cbSize; //size in bytes of this structure + DWORD item_id; + char pszName[MAX_PINGADDRESS_STRING_LENGTH]; //IP address or domain name + char 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]; + char pszCommand[MAX_PATH]; + char 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 Map HistoryMap; + + +extern HANDLE hNetlibUser; +extern HINSTANCE hInst; + +extern bool use_raw_ping; + +#endif -- cgit v1.2.3