/*******************************************************************************
 * Copyright	: (c) 2007 Video Surveillance(China) Co. Ltd.
 *					All rights reserved.
 *
 * Filename	 : ems_alarm.h
 * Product	  : VS
 * Component	: OAM_SVR
 * Version	  : 1.0.0.1
 * Abstract	 : head file of alarm interface declare
 *
 * Modification :
 * ---------------------------------------------------------
 * No.	 Date		Author		  Comment
 * ---------------------------------------------------------
 * 1)	  2007-07-17  Bruce.Zhang	 new creation
 * 2)	  2007-12-21  Bruce.Zhang	 add macro FM_INST_VALUE_LEN define
 *
 ******************************************************************************/
#ifndef _EMS_ALARM_H
#define _EMS_ALARM_H

#include "ssi.h"

#define FM_MAX_NUM_ENTITY_INST	  8
#define FM_ADD_TEXT_SIZE			256
#define FM_INST_VALUE_LEN		   32

/**
 * entity type
 */
typedef enum
{
	ENT_TYPE_PHY_NE		 = 1,	/* physical ne	  */
	ENT_TYPE_LOG_NE		 = 2,	/* logical ne	   */
	ENT_TYPE_DEVICE		 = 3,	/* device		   */
	ENT_TYPE_NT			 = 4,	/* nt			   */
	ENT_TYPE_NTP_CLIENT	 = 5,	/* ntp client	   */
	ENT_TYPE_IPADDR		 = 6,	/* ip address	   */
	ENT_TYPE_VR			 = 7,	/* vr			   */
	ENT_TYPE_SERVER		 = 8,	/* server		   */
	ENT_TYPE_AD_MODULE	  = 9,	/* adaptor module   */
	ENT_TYPE_REGNE		  = 10	/* regist ne		*/

}ENT_TYPE;

/**
 * entity instance
 */
typedef enum
{
	ENT_PHY_NEID			= 1,	/* physical neid	*/
	ENT_LOG_NEID			= 2,	/* logical neid	 */
	ENT_DEV_ID			  = 3,	/* device id		*/
	ENT_CAMERA_ID		   = 4,	/* camera id		*/
	ENT_IP_ADDR			 = 5,	/* ip address	   */
	ENT_SYN_PORT			= 6,	/* sync port		*/
	ENT_SVR_IP			  = 7,	/* server ip addr   */
	ENT_SVR_TYPE			= 8,	/* server type	  */
	ENT_SSS_ID			  = 9,	/* pbs id		   */
	ENT_STOR_PATH		   = 10,   /* storage path	 */
	ENT_MYSQL_IP			= 11,   /* mysql ip addr	*/
	ENT_SDR_IP			  = 12,   /* sdr ip addr	  */
	ENT_DBS_IP			  = 13	/* dbs ip addr	  */
									
}ENT_INST;


/* Alarm Severity */
typedef enum
{
	ALARM_SEV_INDETERMINATE	 =   0,  /* Indeterminate	*/
	ALARM_SEV_CRITICAL		  =   1,  /* Critical		 */
	ALARM_SEV_MAJOR			 =   2,  /* Major			*/
	ALARM_SEV_MINOR			 =   3,  /* Minor			*/
	ALARM_SEV_WARNING		   =   4   /* Warning		  */

} ALARM_LEVEL;


/* Alarm condition */
typedef enum
{
	ALARM_RAISE				 =   1,  /* Alarm raise condition */
	ALARM_CLEAR				 =   2   /* Alarm clear condition */
} ALARM_COND;


/**
 * alarm type
 */
/* Alarm type - This enum is kept here only for reference */
typedef enum
{
	ALARM_TYPE_COMMUNICATION	=   2,  /* Communication alarm	  */
	ALARM_TYPE_ENVIRONMENT	  =   3,  /* Environmental alarm	  */
	ALARM_TYPE_EQUIPMEN		 =   4,  /* Equipment alarm		  */
	ALARM_TYPE_PROC_ERROR	   =   10, /* Processing error alarm   */
	ALARM_TYPE_QOS			  =   11  /* Quality of Service alarm */
} ALARM_TYPE;


/**
 * probolem cause
 */
typedef enum
{
	PROB_CAUSE_HB_LOST							  = 1,
	PROB_CAUSE_CONFDATA_INCONSISTENT				= 2,
	PROB_CAUSE_VM_WORK_ABNORMALLY				   = 3,
	PROB_CAUSE_NE_INIT_FAILED					   = 4,
	PROB_CAUSE_BAD_CELL_RED						 = 5,
	PROB_CAUSE_DEV_NO_STREAM						= 6,
	PROB_CAUSE_RING_BUFFER_OVERLOAD				 = 7,
	PROB_CAUSE_NTP_WOBBLE_THRESHOLD				 = 8,
	PROB_CAUSE_NTPCLIENT_GET_TIME_FAILED			= 9,
	PROB_CAUSE_CPU_AVE_USAGE_THRESHOLD1			 = 10,
	PROB_CAUSE_CPU_VAE_USAGE_THRESHOLD2			 = 11,
	PROB_CAUSE_CPU_CUR_USAGE_THRESHOLD1			 = 12,
	PROB_CAUSE_CPU_CUR_USAGE_THRESHOLD2			 = 13,
	PROB_CAUSE_MEM_CUR_USAGE_THRESHOLD1			 = 14,
	PROB_CAUSE_MEM_CUR_USAGE_THRESHOLD2			 = 15,
	PROB_CAUSE_STORAGE_ACCESS_FALED				 = 16,
	PROB_CAUSE_ACCESS_MYSQL_FAILED				  = 17,
	PROB_CAUSE_MYSQL_PROCESS_DOWN				   = 18,
	PROB_CAUSE_ACCESS_SSS_FAILED					= 19,
	PROB_CAUSE_ERR_GET_COMMON_CONFIG				= 20,
	PROB_CAUSE_DBS_OPERATION_FAIL				   = 21,
	PROB_CAUSE_INFORM_REG_NE_FAILED				 = 22,
	PROB_CAUSE_CONNECT_SDR_TIMEOUT_WHEN_STARTUP	 = 23,
	PROB_CAUSE_CONNECT_DBS_TIMEOUT				  = 24,
	PROB_CAUSE_CONNECT_REMOTE_SVR_FAILED			= 25,
	PROB_CAUSE_NE_CONNECTION_BROKEN				 = 26,
	PROB_CAUSE_HA_SWITCH_FAILED					 = 27,
	PROB_CAUSE_BIND_SOCKET_FAILED				   = 28,
	PROB_CAUSE_NT_DEV_ADD_FAILED					= 29,
	PROB_CAUSE_STORAGE_FAILED					   = 30,
	PROB_CAUSE_STORAGE_EXCEEDS_THRESHOLD			= 31,
	PROB_CAUSE_NVR_SVR_MOUNT_FAILED				 = 32,
	PROB_CAUSE_VM_INIT_FAILED					   = 33,
	PROB_CAUSE_CONNECT_DBS_TIMEOUT_WHEN_STARTUP	 = 34,
	PROB_CAUSE_STORAGE_FAILED_OR_NETWORK_BUSY	   = 35,
	PROB_CAUSE_NFS_NOT_INSTALL					  = 36,

													
}PROB_CAUSE;

/**
 * specific problem
 */
typedef enum
{
	SPEC_PROB_NONE								  = 1,
	SPEC_PROB_CONFDATA_INCONSISTENT_WITH_MDS		= 2,
	SPEC_PROB_CONFDATA_INCONSISTENT_BETWEEN_APPS	= 3,
	SPEC_PROB_FWRITE_FAILED						 = 4,
	SPEC_PROB_FOPEN_FAILED_FOR_BOTH_STORAGE		 = 5,
	SPEC_PROB_FAILED_ADD_FORWARD_ENTRY			  = 6,
	SPEC_PROB_FAILED_REMV_FORWARD_ENTRY			 = 7,
	SPEC_PROB_CHECK_SDR_SERVER					  = 8,
	SPEC_PROB_FAILED_READ_COMMONCFG_TABLE		   = 9,
	SPEC_PROB_REC_COUNT_COMMONCFG_NOT_EQUAL_ONE	 = 10,
	SPEC_PROB_HA_SWITCH_FAILED					  = 11,
	SPEC_PROB_RINGBUF_ALLOC_FAILED				  = 12,
	SPEC_PROB_MOUNT_FAILED						  = 13,
	SPEC_PROB_ACCESS_FAILED						 = 14,
	SPEC_PROB_VM_MODULE_LOAD_FAILED				 = 15,
	SPEC_PROB_VM_MODULE_UNLOAD_FAILED			   = 16,
	SPEC_PROB_STORAGE_EXCEEDS_THRESHOLD
  

}SPEC_PROB;

/**
 * event type
 */
typedef enum
{
	EVENT_TYPE_NE_INIT_SUCCESS	= 1,
	EVENT_TYPE_NE_BEGIN_QUIT,
}EVENT_TYPE;

/**
 * event info
 */
typedef enum
{
	EVENT_INFO_NONE   = 1,
}EVENT_INFO;


/**
 * storage used status enum
 */
typedef enum
{
	STOR_USED_STA_USING		 = 0,
	STOR_USED_STA_READY		 = 1,
	STOR_USED_STA_FAULT		 = 2

}STOR_USED_STA;


struct McConNumStats
{
	U32 nLogNeId;
	U32 nTimeStamp;
	U32 nMaxConn;
	U32 nCurConn;
};

struct McConMsgStats
{
	U32 nLogNeId;
	U32 nTimeStamp;
	U32 nSuccStartRatio;
	U32 nSuccStopRatio;
	U32 nStartMess;
	U32 nSuccStartMess;
	U32 nFailStartMess;
	U32 nParaFailStartMess;
	U32 nCamFailStartMess;
	U32 nVmcFailStartMess;
	U32 nOtherFailStartMess;
	U32 nStopMess;
	U32 nSuccStopMess;
	U32 nFailStopMess;
	U32 nParaFailStopMess;
	U32 nConnIdFailStopMess;
	U32 nVmcFailStopMess;
	U32 nOtherFailStopMess;
};


#endif  /* _EMS_ALARM_H */

