www.pudn.com > PortScan_sjtu.rar > ICMP_ECHO.h
#ifndef ICMP_ECHO_H
#define ICMP_ECHO_H
class ICMP_ECHO
{
typedef struct icmp_hdr
{
unsigned char icmp_type;
unsigned char icmp_code;
unsigned short icmp_checksum;
unsigned short icmp_id;
unsigned short icmp_sequence;
unsigned long icmp_timestamp;
} ICMP_HDR, *PICMP_HDR, FAR *LPICMP_HDR;
typedef struct ip_hdr
{
unsigned char ip_verlen; // 4-bit IPv4 version
// 4-bit header length (in 32-bit words)
unsigned char ip_tos; // IP type of service
unsigned short ip_totallength; // Total length
unsigned short ip_id; // Unique identifier
unsigned short ip_offset; // Fragment offset field
unsigned char ip_ttl; // Time to live
unsigned char ip_protocol; // Protocol(TCP,UDP etc)
unsigned short ip_checksum; // IP checksum
unsigned long ip_srcaddr; // Source address
unsigned long ip_destaddr; // Source address
} IPV4_HDR, *PIPV4_HDR, FAR * LPIPV4_HDR;
public:
int Ping(char*,unsigned int,char*);
private:
ICMP_HDR *icmp;
USHORT checksum(USHORT *buffer, int size);
void Init_Header(char*);
};
#endif