tracer.gif (1255 bytes)CTraceRoute v1.0

Welcome to CTraceRoute, a freeware MFC class to implement trace route functionality.

 

 

 

Features
Usage
History
API Reference
Planned Enhancements
Contacting the Author

 

 

 

Features

 

 

 

Usage

 

 

 

History

V1.0 (18th November 1998)

 

 

 

API Reference

 

The API consists of the the 2 classes:

CTraceRouteReply
CTraceRoute

 

 

CTraceRouteReply

This is an encapsulation of all the information as returned from a trace route request. It is a typedef for the following:

typedef CArray<CHostTraceMultiReply, CHostTraceMultiReply&> CTraceRouteReply

 

The members of CHostTraceMultiReply are as follows:

DWORD dwError This is the error if any which occurred when doing a ping to this host. This corresponds to the values as returned from GetLastError. 0 represents no error occurred.
in_addr Address The IP address of the host for this part of the trace route
DWORD minRTT Minimum round trip time in milliseconds for this host
DWORD avgRTT Average round trip time in milliseconds for this host
DWORD maxRTT Maximum round trip time in milliseconds for this host

 

 

CTraceRoute

Trace
OnPingResult
OnSingleHostResult

 

CTraceRoute::Trace

BOOL CTraceRoute::Trace(LPCTSTR pszHostName, CTraceRouteReply& trr, UCHAR nHopCount = 30, DWORD dwTimeout = 30000, DWORD dwPingsPerHost = 3) const

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call ::GetLastError.

Parameters

pszHostName The network address of the socket to connect to: a machine name such as “ftp.yourisp.com”, or a dotted number such as “128.56.22.8” will both work.

trr Upon successful return, this will contain all the information related to the trace route request. See CTraceRouteReply for further details.

nHopCount This is the maximum TTL to use. This corresponds to the farthest router which the ping request will reach.

dwTimeout The timeout for each ping in milliseconds.

dwPingsPerHost The number of pings to perform per host.

Remarks

This function implements the trace route functionality.

 

CTraceRoute::OnPingResult

virtual BOOL CTraceRoute::OnPingResult(int nPingNum, const CHostTraceSingleReply& htsr);

Return Value

return TRUE to continue the trace route. Returning FALSE will cancel the operation.

Parameters

nPingNum The ping reply which this function is being called for.

htsr Contains the actual results from the ping for this host

Remarks

This function is called just after each ping reply. You can derive your own class from CTraceRoute and override this function so that your version is called at the appropriate times

 

CTraceRoute::OnSingleHostResult

virtual BOOL CTraceRoute::OnSingleHostResult(int nHostNum, const CHostTraceMultiReply& htmr);

Return Value

return TRUE to continue the trace route. Returning FALSE will cancel the operation.

Parameters

nHostNum The current host which this function is being called for.

htmr Contains the collective results from the ping for this host

Remarks

This function is called just after all the pings for each host is complete. You can derive your own class from CTraceRoute and override this function so that your version is called at the appropriate times. See the CMyTraceRoute class in main.cpp for a concrete implementation.

 

 

 

PLANNED ENHANCEMENTS

 

 

 

CONTACTING THE AUTHOR

PJ Naughter
Email: pjn@indigo.ie
Web: http://indigo.ie/~pjn
18th November 1998