?? icmp.h
字號:
// Icmp.h : header file
//
//////////////////////////////////////////////////////////////////////////////////
// //
// The CIcmp class //
// //
//////////////////////////////////////////////////////////////////////////////////
// //
// 1998. EarthWalk Designs Software, by Jay Wheeler. //
// All inquiries and/or comments to Jay@EarthWalkDesigns.com //
// Latest version can be downloaded from: //
// //
// http://www.earthwalkdesigns.com //
// //
//////////////////////////////////////////////////////////////////////////////////
// //
// Designed using Microsoft VisualC++ 4.2 and MFC //
// Tested on WindowsNT 4.0 Workstation and Server //
// //
//////////////////////////////////////////////////////////////////////////////////
// //
// This software is released into the public domain as is and //
// without warranty. //
// //
// Use it in good health, and please let me know if it was useful. //
// If you make improvements or fixed problems, please drop me an //
// e-mail describing your changes. I will try to incorporate //
// them into this package so that others may benefit from your //
// improvements. //
// //
// Enjoy! //
// //
//////////////////////////////////////////////////////////////////////////////////
// //
// Icmp Class - Derived from CSocket class //
// //
// Provides the following class methods for WindowsNT 4.0 systems //
// utilizing the WindowsNT Winsock 2 interface to the Internet. //
// //
//////////////////////////////////////////////////////////////////////////////////
// //
// OpenNewSocket //
// When called with no arguements, opens a SOCKET connection to a //
// RAW socket with ICMP protocol. //
// //
// Requires a handle to a message processor which will process the //
// socket events, the message number to process, and a mask giving //
// the events to process. //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns TRUE if successful, else FALSE. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// OpenNewSocket //
// Opens a SOCKET connection to a socket of specified family, type //
// and protocol //
// //
// Requires a handle to a message processor which will process the //
// socket events, the message number to process, and a mask giving //
// the events to process. //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns TRUE if successful, else FALSE. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// Connect //
// When called with 2 arguements, connects an Icmp object to a RAW //
// socket with ICMP protocol. //
// //
// Requires 2 integer values specifying the receive and transmit //
// timeouts //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns TRUE if successful, else FALSE. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// Connect //
// When called with 5 arguements, connects an Icmp object to a socket //
// of specified family, type and protocol. //
// //
// Requires 2 integer values specifying the receive and transmit //
// timeouts //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns TRUE if successful, else FALSE. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// CloseIcmpSocket //
// Closes a socket associated with an Icmp object. //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns the integer result of the operation. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// SetAsynchNotification //
// Sets the window (process) to notify when a network event on the //
// socket associated with the Icmp object occurs. //
// //
// Requires the message number to send to the window, and the events //
// to notify on. //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns the integer result of the operation. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// SetTTL //
// Set the TTL option on the socket associated with an Icmp object. //
// A TTL value of non-zero specifies the number of hops to query //
// before a response is returned. By incrementing the TTL from 1 to //
// (number of hops to final destination), a TraceRoute function //
// can be performed. //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns the integer result of the operation. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// Ping //
// Sends an ICMP ping message to the host indicated in the Icmp //
// variable icmpSockAddr. The Icmp variables icmpCurSeq and //
// icmpCurId are sent in the buffer referenced by pIcmpBuffer. The //
// referenced buffer must be large enough to hold DataLen bytes plus //
// the size of the ICMP message header. //
// //
// The Icmp variable icmpPingSentAt is set to the time value at the //
// time the ping message is sent. //
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns the integer result of the operation. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// IcmpChecksum //
// Computes the icmp checksum of the Len data in the buffer referenced //
// by lpBuf. //
// //
// Returns an unsigned integer value of the computed checksum. //
// //
// GetIPAddress //
// Returns the value of the IP address of the host pointed by //
// iHostName as an unsigned long in network byte order, as described //
// in inet_aton //
// //
// Sets iHostName to the value of the host name returned in //
// icmpHostEnt. //
// //
// Requires the message number to send to the window, and the events //
// to notify on. //
// //
// Sets Icmp variable icmpSockAddr fields appropriately, leaving the //
// IP address in icmpSockAddr.sin_addr, and the type of address in //
// icmpSockAddr.sin_family. Also sets icmpHostEnt fields appropriately//
// //
// Sets icmpSocketError and icmpSocketErrorMod to indicate the type //
// of error, and returns the integer result of the operation. //
// //
// icmpSocketError and icmpSocketErrorMod are preserved until the next //
// operation on this Icmp object is performed. //
// //
// Receive //
// //
// Reads the socket associated with the Icmp object and returns the //
// number of bytes read, or SOCKET_ERROR, if an error occurs. //
// //
// Requires the address of the buffer to store the incoming message //
// and an integer buffer size. The buffer must be large enough to //
// contain the incoming message. In the case of an ICMP ping echo //
// response, the size would be the size of the outgoing message plus //
// the size of an ICMP header plus the size of an IP header. //
// //
// Sets icmpPingReceivedAt to the time the receive command is issued, //
// icmpRoundTripTime to the difference between icmpPingSentAt and //
// icmpPingReceivedAt, icmpCurSeq to the incoming sequence number //
// and icmpCurId to the incoming id field. //
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -