#ifndef _SYS_NETCARD_H
#define _SYS_NETCARD_H

#include <sys/socket.h>

#ifndef NIC_NAME_LEN
#define NIC_NAME_LEN   64 
#endif

#define SEM_PROJ_ID 's'	
#define MAXNICNUM  32

#ifdef __cplusplus
extern "C"{
#endif

typedef long	KEYID;

typedef struct  _msg_frame		// message frame
{
	short	len;       		// message length  	
	short	seqno;         		// send sequence 
	short	serv;      		// services ID    
	short	event;     		// event ID	
	unsigned char	domain;		// domain ID    
	unsigned char	ctxt;      	// Context ID       	
	short	stid;       		// SOURCE task id   	
	short	dtid;     		// DESTINATION task ID 
	unsigned char	ver_coding;   	// 版本号  + 编码 
	unsigned char	mes_type;    	// 帧类型
}MSG_FRAME, *LPMSG_FRAME;

typedef  struct  _net_info
{
	KEYID	ID;	
	char	charname[NIC_NAME_LEN];
	char	descr[128]; 
	struct sockaddr addr;
	struct sockaddr broadaddr;
	struct sockaddr netmask;
	struct sockaddr hwaddr;
	int		time_stamp; 
	short		flags; 	
	int		mtu; 	
	int		tx_queue_len; 
	unsigned long long average_flow;
	unsigned long long rx_packets;
	unsigned long long tx_packets;
	unsigned long long rx_bytes;
	unsigned long long tx_bytes;
	unsigned long rx_errors; 
	unsigned long tx_errors;
	unsigned long rx_dropped; 
	unsigned long tx_dropped; 
	unsigned long rx_multicast; 
	unsigned long collisions; 
	unsigned long rx_fifo_errors;
	unsigned long tx_carrier_errors;
	unsigned long tx_fifo_errors;
}NETCARD_INFO, *LPNETCARD_INFO;

#define NETCARD_ALARM_FAULT	1
#define NETCARD_ALARM_RESUME	2
#define NETCARD_ALARM_SWITCH	3
#define NETCARD_ALARM_ABNORMAL	4
#define NETCARD_ALARM_NORMAL	5
typedef struct  _sys_netcard_alarm
{
	char 	fault_devname[NIC_NAME_LEN];	/*故障设备名称 */ 
	char 	switch_devname[NIC_NAME_LEN]; 	/*切换设备名称 */
	short  	flags;				/* 状态标记 : 1:网卡故障。2:网卡恢复。3:网卡切换。4:流量异常。*/
	short 	retrytimes;			//0，1，2 重发次数
}SYS_NETCARD_ALARM, *LPSYS_NETCARD_ALARM;


typedef struct  _d5000_nic_alarm
{
	MSG_FRAME 		tMsgFrame ;
	SYS_NETCARD_ALARM 	tSysNetcardAlarm ;
}D5000_NIC_ALARM, *LPD5000_NIC_ALARM;


#ifdef __cplusplus
}
#endif

#endif

