[NTOSKRNL]
[reactos.git] / base / applications / network / tracert / tracert.h
1 #define WIN32_NO_STATUS
2 #include <stdarg.h>
3 #include <windef.h>
4 #include <winbase.h>
5 #define _INC_WINDOWS
6 #include <winsock2.h>
7 #include <tchar.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <ws2tcpip.h>
11
12 #define ECHO_REPLY 0
13 #define DEST_UNREACHABLE 3
14 #define ECHO_REQUEST 8
15 #define TTL_EXCEEDED 11
16
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
21
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
25
26 /* pack the structures */
27 #include <pshpack1.h>
28
29 /* IPv4 Header, 20 bytes */
30 typedef struct IPv4Header
31 {
32 BYTE h_len:4;
33 BYTE version:4;
34 BYTE tos;
35 USHORT length;
36 USHORT id;
37 USHORT flag_frag;
38 BYTE ttl;
39 BYTE proto;
40 USHORT checksum;
41 ULONG source;
42 ULONG dest;
43 } IPv4_HEADER, *PIPv4_HEADER;
44
45 /* ICMP Header, 8 bytes */
46 typedef struct ICMPHeader
47 {
48 BYTE type;
49 BYTE code;
50 USHORT checksum;
51 USHORT id; // not used in time exceeded
52 USHORT seq; // not used in time exceeded
53 } ICMP_HEADER, *PICMP_HEADER;
54
55 /* ICMP Echo Reply Header */
56 typedef struct EchoReplyHeader
57 {
58 struct ICMPHeader icmpheader;
59 } ECHO_REPLY_HEADER, *PECHO_REPLY_HEADER;
60
61 #include <poppack.h>
62
63 typedef struct _APPINFO
64 {
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
69
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
75
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
80
81 } APPINFO, *PAPPINFO;