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