You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.9 KiB
C

/************************************************************************************
*
* Copyright (C) 2002-2003 SCADA Control Technology Co., Ltd. All rights reserved.
*
* $Source: /opt/CVS_ROOT_PGC_EX2000/commserver/windows/widgets/udpping.h,v $
*
* $Author: jehu $
*
* $Date: 2006/07/05 07:31:44 $
*
* $Revision: 1.1.1.1 $
*
* $State: Exp $
*
* $Name: $
*
* $Locker: $
*
* $Log: udpping.h,v $
* Revision 1.1.1.1 2006/07/05 07:31:44 jehu
* no message
*
* Revision 1.4 2006/04/28 06:29:18 administrator
* 修改ping数据包为点对点发送
*
* Revision 1.3 2006/04/22 07:51:07 administrator
* 竞争时间用宏代替
*
* Revision 1.2 2005/10/20 07:03:56 Administrator
* 前置机功能完善
*
* Revision 1.1 2005/10/12 06:03:47 Administrator
* 增加前置机功能
*
*
* 添加CVS关键字,每次提交自动更新;
*
**************************************************************************************/
//***************************************************************
//* udpcomm.h *
//* Liangchu Lee 2000.07.10 *
//***************************************************************
#ifndef __UDPPING_H_ICL__
#define __UDPPING_H_ICL__
#include "common.h"
#define MAX_DELAYTIME 20
#define MAX_RANDOM 32
#define MAX_NODENAME 64
#define PINGRANDOM ("!L$Q_TO5U^8&J @T#H*F(J)+D%RG|<>T~?:{}AESRGA")
typedef struct tagUDP_PING_INFO
{
SOCKET rSocket __attribute__ ((packed));
SOCKET sSocket[MAX_ADDR] __attribute__ ((packed));
struct sockaddr_in SerAddr __attribute__ ((packed));
struct sockaddr_in CliAddr __attribute__ ((packed));
} UDP_PING_INFO;
typedef struct tagUDP_PING_REV_DATA
{
int MsgLen __attribute__ ((packed));
char MsgData[MAX_NET_BUF] __attribute__ ((packed));
} UDP_PING_REV_DATA;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// 是pc机系统还是嵌入式系统
#ifdef PC_MACHINE
#ifdef OS_WINDOWS
#pragma pack (push,1)
#else// OS_UNIX
#pragma pack(1)
#endif //OS_UNIX
#endif
typedef struct tagPINGINFORMATION
{
BYTE barrRandom[MAX_RANDOM] __attribute__ ((packed));
char szNodeName[MAX_NODENAME] __attribute__ ((packed));
BYTE bNodeType __attribute__ ((packed)); /*节点类型*/
WORD wNodeID __attribute__ ((packed)); /*接点号*/
u_long inetMask __attribute__ ((packed)); /*网络掩码, 发送者, 主机字节顺序*/
u_long inetAddr __attribute__ ((packed)); /*完整IP地址, 发送者, 主机字节顺序*/
DWORD dwStatus __attribute__ ((packed)); /*该网络接口IP地址的状态*/
} PINGINFORMATION;
// 是pc机系统还是嵌入式系统
#ifdef PC_MACHINE
#ifdef OS_WINDOWS
#pragma pack (pop)
#else// OS_UNIX
#pragma pack (0)
#endif //OS_UNIX
#endif
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void UdpPingTimer(void);
BOOL UdpPingInit(void);
void UdpPingSendData(void);
void UdpPingSendDataP2P(void);
void UdpPingReaddata(void);
void UdpPingClose(void);
//
void UdpPingSwitch(void);
#endif