2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS traceroute utility
4 * FILE: apps/utils/net/tracert/tracert.h
5 * PURPOSE: trace a packets route through a network
6 * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
12 #define DEST_UNREACHABLE 3
13 #define ECHO_REQUEST 8
14 #define TTL_EXCEEDED 11
16 #define ICMP_MIN_SIZE 8
17 #define ICMP_MAX_SIZE 65535
18 #define PACKET_SIZE 32
19 /* we need this for packets which have the 'dont fragment'
20 * bit set, as they can get quite large otherwise
21 * (I've seen some reach 182 bytes */
22 #define MAX_REC_SIZE 200
24 /* pack the structures */
27 /* IPv4 Header, 20 bytes */
28 typedef struct IPv4Header
{
40 } IPv4_HEADER
, *PIPv4_HEADER
;
42 /* ICMP Header, 8 bytes */
43 typedef struct ICMPHeader
{
47 USHORT id
; // not used in time exceeded
48 USHORT seq
; // not used in time exceeded
49 } ICMP_HEADER
, *PICMP_HEADER
;
51 /* ICMP Echo Reply Header, 12 bytes */
52 typedef struct EchoReplyHeader
{
53 struct ICMPHeader icmpheader
;
54 struct timeval timestamp
;
55 } ECHO_REPLY_HEADER
, *PECHO_REPLY_HEADER
;
57 /* ICMP Echo Reply Header, 12 bytes */
58 typedef struct TTLExceedHeader
{
59 struct ICMPHeader icmpheader
;
60 struct IPv4Header ipheader
;
61 struct ICMPHeader OrigIcmpHeader
;
62 } TTL_EXCEED_HEADER
, *PTTL_EXCEED_HEADER
;
64 /* return to normal */
68 /* function definitions */
69 //BOOL ParseCmdline(int argc, char* argv[]);
72 VOID
SetupTimingMethod(void);
73 VOID
ResolveHostname(void);
74 VOID
PreparePacket(INT packetSize
, INT seqNum
);
75 INT
SendPacket(INT datasize
);
76 INT
ReceivePacket(INT datasize
);
77 INT
DecodeResponse(INT packetSize
, INT seqNum
);
79 WORD
CheckSum(PUSHORT data
, UINT size
);