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