📄 ping.h
字号:
/*
********************************************************************************
* Wiznet.
* 5F Simmtech Bldg., 228-3, Nonhyun-dong, Kangnam-gu,
* Seoul, Korea
*
* (c) Copyright 2002, Wiznet, Seoul, Korea
*
* Filename : PING.H
* Programmer(s) : Wooyoul Kim
* Version : 1.0
* Created : 2002/10/20
* Modified :
* Description : Implemation of Ping
To send 'ping-request' to peer & To receive 'ping-reply' from peer.
********************************************************************************
*/
#ifndef __PING_API__
#define __PING_API__
/*
###############################################################################
Include Part
###############################################################################
*/
#include "type.h"
#include "socket.h"
/*
###############################################################################
Define Part
###############################################################################
*/
typedef struct _PING
{
char Type; // 0 - Ping Reply, 8 - Ping Request
char Code; // Always 0
u_int CheckSum; // Check sum
u_int ID; // Identification
u_int SeqNum; // Sequence Number
u_char Data[1472]; // Ping Data
}PING;
typedef struct __PINGLOG
{
u_int CheckSumErr; // Check sum Error Count
u_int UnreachableMSG; // Count of receiving unreachable message from a peer
u_int TimeExceedMSG; // Count of receiving time exceeded message from a peer
u_int UnknownMSG; // Count of receiving unknown message from a peer
u_int ARPErr; // count of fail to send ARP to the specified peer
u_int PingRequest; // Count of sending ping-request message to the specified peer
u_int PingReply; // Count of receiving ping reply message from the specifed peer
u_int Loss; // Count of timeout
}PINGLOG;
/*
###############################################################################
Grobal Variable Definition Part
###############################################################################
*/
/*
###############################################################################
Function Prototype Definition Part
###############################################################################
*/
u_int checksum(u_char * src, u_int len); /* Calculate checksum value */
SOCKET getSocket(u_char status, SOCKET start); /* Get Socket Handle if socket's status value is 'stat' */
char ping(int count, u_int size, u_int time, char* addr, PINGLOG* log); /* Send ping-request to the specified peer and receive ping-reply from the specified peer. */
void DisplayPingStatistics(PINGLOG log); /* Display result of ping */
#endif // end __PING_API_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -