mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
start to redo tracert
svn path=/trunk/; revision=26277
This commit is contained in:
parent
78117fc10d
commit
2ee0f4dca0
2 changed files with 659 additions and 689 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,24 +1,24 @@
|
||||||
/*
|
#define WIN32_LEAN_AND_MEAN
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
#include <winsock2.h>
|
||||||
* PROJECT: ReactOS traceroute utility
|
#include <tchar.h>
|
||||||
* FILE: apps/utils/net/tracert/tracert.h
|
#include <stdio.h>
|
||||||
* PURPOSE: trace a packets route through a network
|
#include <stdlib.h>
|
||||||
* PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
|
#include <ws2tcpip.h>
|
||||||
* REVISIONS:
|
#include <string.h>
|
||||||
* GM 03/05/05 Created
|
#include <time.h>
|
||||||
*/
|
|
||||||
|
|
||||||
#define ECHO_REPLY 0
|
#define ECHO_REPLY 0
|
||||||
#define DEST_UNREACHABLE 3
|
#define DEST_UNREACHABLE 3
|
||||||
#define ECHO_REQUEST 8
|
#define ECHO_REQUEST 8
|
||||||
#define TTL_EXCEEDED 11
|
#define TTL_EXCEEDED 11
|
||||||
|
|
||||||
#define ICMP_MIN_SIZE 8
|
#define MAX_PING_PACKET_SIZE 1024
|
||||||
#define ICMP_MAX_SIZE 65535
|
#define MAX_PING_DATA_SIZE (MAX_PING_PACKET_SIZE + sizeof(IPv4Header)
|
||||||
#define PACKET_SIZE 32
|
#define PACKET_SIZE 32
|
||||||
|
#define ICMP_MIN_SIZE 8
|
||||||
|
|
||||||
/* we need this for packets which have the 'dont fragment'
|
/* we need this for packets which have the 'dont fragment'
|
||||||
* bit set, as they can get quite large otherwise
|
* bit set, as they can get quite large otherwise */
|
||||||
* (I've seen some reach 182 bytes */
|
|
||||||
#define MAX_REC_SIZE 200
|
#define MAX_REC_SIZE 200
|
||||||
|
|
||||||
/* pack the structures */
|
/* pack the structures */
|
||||||
|
@ -65,19 +65,24 @@ typedef struct TTLExceedHeader
|
||||||
struct ICMPHeader OrigIcmpHeader;
|
struct ICMPHeader OrigIcmpHeader;
|
||||||
} TTL_EXCEED_HEADER, *PTTL_EXCEED_HEADER;
|
} TTL_EXCEED_HEADER, *PTTL_EXCEED_HEADER;
|
||||||
|
|
||||||
/* return to normal */
|
|
||||||
#include <poppack.h>
|
#include <poppack.h>
|
||||||
|
|
||||||
/* function definitions */
|
typedef struct _APPINFO
|
||||||
static BOOL ParseCmdline(int argc, char* argv[]);
|
{
|
||||||
static INT Driver(void);
|
SOCKET icmpSock; // socket descriptor
|
||||||
static INT Setup(INT ttl);
|
SOCKADDR_IN source, dest; // source and destination address info
|
||||||
static VOID SetupTimingMethod(void);
|
PECHO_REPLY_HEADER SendPacket; // ICMP echo packet
|
||||||
static VOID ResolveHostname(void);
|
PIPv4_HEADER RecvPacket; // return reveive packet
|
||||||
static VOID PreparePacket(INT packetSize, USHORT seqNum);
|
|
||||||
static INT SendPacket(INT datasize);
|
BOOL bUsePerformanceCounter; // whether to use the high res performance counter
|
||||||
static INT ReceivePacket(INT datasize);
|
LARGE_INTEGER TicksPerMs; // number of millisecs in relation to proc freq
|
||||||
static INT DecodeResponse(INT packetSize);
|
LARGE_INTEGER TicksPerUs; // number of microsecs in relation to proc freq
|
||||||
static LONGLONG GetTime(void);
|
LONGLONG lTimeStart; // send packet, timer start
|
||||||
static WORD CheckSum(PUSHORT data, UINT size);
|
LONGLONG lTimeEnd; // receive packet, timer end
|
||||||
static VOID Usage(void);
|
|
||||||
|
BOOL bResolveAddresses; // -d MS ping defaults to true.
|
||||||
|
INT iMaxHops; // -h Max number of hops before trace ends
|
||||||
|
INT iHostList; // -j Source route
|
||||||
|
INT iTimeOut; // -w time before packet times out
|
||||||
|
|
||||||
|
} APPINFO, *PAPPINFO;
|
||||||
|
|
Loading…
Reference in a new issue