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, 12 bytes */
54 typedef struct EchoReplyHeader
56 struct ICMPHeader icmpheader
;
57 struct timeval timestamp
;
58 } ECHO_REPLY_HEADER
, *PECHO_REPLY_HEADER
;
60 /* ICMP Echo Reply Header, 12 bytes */
61 typedef struct TTLExceedHeader
63 struct ICMPHeader icmpheader
;
64 struct IPv4Header ipheader
;
65 struct ICMPHeader OrigIcmpHeader
;
66 } TTL_EXCEED_HEADER
, *PTTL_EXCEED_HEADER
;
70 typedef struct _APPINFO
72 SOCKET icmpSock
; // socket descriptor
73 SOCKADDR_IN source
, dest
; // source and destination address info
74 PECHO_REPLY_HEADER SendPacket
; // ICMP echo packet
75 PIPv4_HEADER RecvPacket
; // return reveive packet
77 BOOL bUsePerformanceCounter
; // whether to use the high res performance counter
78 LARGE_INTEGER TicksPerMs
; // number of millisecs in relation to proc freq
79 LARGE_INTEGER TicksPerUs
; // number of microsecs in relation to proc freq
80 LONGLONG lTimeStart
; // send packet, timer start
81 LONGLONG lTimeEnd
; // receive packet, timer end
83 BOOL bResolveAddresses
; // -d MS ping defaults to true.
84 INT iMaxHops
; // -h Max number of hops before trace ends
85 INT iHostList
; // -j Source route
86 INT iTimeOut
; // -w time before packet times out