1 #define WIN32_LEAN_AND_MEAN
11 #define DEST_UNREACHABLE 3
12 #define ECHO_REQUEST 8
13 #define TTL_EXCEEDED 11
15 #define MAX_PING_PACKET_SIZE 1024
16 #define MAX_PING_DATA_SIZE (MAX_PING_PACKET_SIZE + sizeof(IPv4Header))
17 #define PACKET_SIZE 32
18 #define ICMP_MIN_SIZE 8
20 /* we need this for packets which have the 'dont fragment'
21 * bit set, as they can get quite large otherwise */
22 #define MAX_REC_SIZE 200
24 /* pack the structures */
27 /* IPv4 Header, 20 bytes */
28 typedef struct IPv4Header
41 } IPv4_HEADER
, *PIPv4_HEADER
;
43 /* ICMP Header, 8 bytes */
44 typedef struct ICMPHeader
49 USHORT id
; // not used in time exceeded
50 USHORT seq
; // not used in time exceeded
51 } ICMP_HEADER
, *PICMP_HEADER
;
53 /* ICMP Echo Reply Header */
54 typedef struct EchoReplyHeader
56 struct ICMPHeader icmpheader
;
57 } ECHO_REPLY_HEADER
, *PECHO_REPLY_HEADER
;
61 typedef struct _APPINFO
63 SOCKET icmpSock
; // socket descriptor
64 SOCKADDR_IN source
, dest
; // source and destination address info
65 PECHO_REPLY_HEADER SendPacket
; // ICMP echo packet
66 PIPv4_HEADER RecvPacket
; // return reveive packet
68 BOOL bUsePerformanceCounter
; // whether to use the high res performance counter
69 LARGE_INTEGER TicksPerMs
; // number of millisecs in relation to proc freq
70 LARGE_INTEGER TicksPerUs
; // number of microsecs in relation to proc freq
71 LONGLONG lTimeStart
; // send packet, timer start
72 LONGLONG lTimeEnd
; // receive packet, timer end
74 BOOL bResolveAddresses
; // -d MS ping defaults to true.
75 INT iMaxHops
; // -h Max number of hops before trace ends
76 INT iHostList
; // -j Source route
77 INT iTimeOut
; // -w time before packet times out