#ifndef _M2UA_CONST__H
#define _M2UA_CONST__H

#define M2UA_MAX_LK_NUM 				256
#define M2UA_MAX_MSG_LEN				256

#define M2UA_MAX_SG_NUM					512

#define M2UA_LISTEN_SG_NUM_0		512
#define IUA_LISTEN_SG_NUM_0			513
#define IUA_PORT_0							9900 
#define M2UA_PORT_0							2904


#define M2UA_LISTEN_SG_NUM_1		514
#define IUA_LISTEN_SG_NUM_1			515
#define IUA_PORT_1							9901 
#define M2UA_PORT_1							2905


#define M2UA_MAX_SG_FSM_NUM		(512+4)//for listen m2ua*2,iua*2 


#define M2UA_MAX_M3MSG_NUM			2048
#define M2UA_MAX_M3MSG_NUM_1		2047

#define M2UA_SCTP_CMD_BUFSIZE		5*1024
#define M2UA_SCTP_DAT_BUFSIZE		5*1024

#define M2UA_FAILURE				-1
#define M2UA_SUCCESS				0

#define M2UA_CMD_IDLEW				0xEEEE

// M2UA Message Class
#define M2UA_MCLASS_MGMT			0 
#define M2UA_MCLASS_ASPSM			3 
#define M2UA_MCLASS_ASPTM			4 	
#define M2UA_MCLASS_MAUP			6 
#define M2UA_MCLASS_IIM				10 

//add by yizane
#define xUA_MCLASS_MGMT				0 
#define xUA_MCLASS_TRMSG			1 
#define xUA_MCLASS_SSNM				2 
#define xUA_MCLASS_ASPSM			3
#define xUA_MCLASS_ASPTM			4 	
#define xUA_MCLASS_QPTM				5 
#define xUA_MCLASS_MAUP				6
#define xUA_MCLASS_IIM				10 



//add by yizane

// M2UA ASPSM Message Type
#define	ASP_UP						1
#define	ASP_DOWN					2
#define	HEARTBEAT					3
#define	ASP_UP_ACK					4
#define	ASP_DOWN_ACK				5
#define	HEARTBEAT_ACK				6

// M2UA ASPSM Combined Message Type
#define	M2UA_ASPSM_ASP_UP			(M2UA_MCLASS_ASPSM << 8) + ASP_UP
#define	M2UA_ASPSM_ASP_DOWN			(M2UA_MCLASS_ASPSM << 8) + ASP_DOWN
#define	M2UA_ASPSM_HEARTBEAT		(M2UA_MCLASS_ASPSM << 8) + HEARTBEAT
#define	M2UA_ASPSM_ASP_UP_ACK		(M2UA_MCLASS_ASPSM << 8) + ASP_UP_ACK
#define	M2UA_ASPSM_ASP_DOWN_ACK		(M2UA_MCLASS_ASPSM << 8) + ASP_DOWN_ACK
#define	M2UA_ASPSM_HEARTBEAT_ACK	(M2UA_MCLASS_ASPSM << 8) + HEARTBEAT_ACK

//add by yizane
#define	xUA_ASPSM_ASP_UP					(xUA_MCLASS_ASPSM << 8) + ASP_UP
#define	xUA_ASPSM_ASP_DOWN				(xUA_MCLASS_ASPSM << 8) + ASP_DOWN
#define	xUA_ASPSM_HEARTBEAT				(xUA_MCLASS_ASPSM << 8) + HEARTBEAT
#define	xUA_ASPSM_ASP_UP_ACK			(xUA_MCLASS_ASPSM << 8) + ASP_UP_ACK
#define	xUA_ASPSM_ASP_DOWN_ACK		(xUA_MCLASS_ASPSM << 8) + ASP_DOWN_ACK
#define	xUA_ASPSM_HEARTBEAT_ACK		(xUA_MCLASS_ASPSM << 8) + HEARTBEAT_ACK
//add by yizane

#define	ASP_ACTIVE					1
#define	ASP_INACTIVE				2
#define	ASP_ACTIVE_ACK				3
#define	ASP_INACTIVE_ACK			4

#define	M2UA_ASPTM_ASP_ACTIVE				(M2UA_MCLASS_ASPTM << 8)  + ASP_ACTIVE
#define	M2UA_ASPTM_ASP_INACTIVE			(M2UA_MCLASS_ASPTM << 8)  + ASP_INACTIVE
#define	M2UA_ASPTM_ASP_ACTIVE_ACK		(M2UA_MCLASS_ASPTM << 8)  + ASP_ACTIVE_ACK
#define	M2UA_ASPTM_ASP_INACTIVE_ACK	(M2UA_MCLASS_ASPTM << 8)  + ASP_INACTIVE_ACK
//add by yizane
#define	xUA_ASPTM_ASP_ACTIVE				(xUA_MCLASS_ASPTM << 8)  + ASP_ACTIVE
#define	xUA_ASPTM_ASP_INACTIVE			(xUA_MCLASS_ASPTM << 8)  + ASP_INACTIVE
#define	xUA_ASPTM_ASP_ACTIVE_ACK		(xUA_MCLASS_ASPTM << 8)  + ASP_ACTIVE_ACK
#define	xUA_ASPTM_ASP_INACTIVE_ACK	(xUA_MCLASS_ASPTM << 8)  + ASP_INACTIVE_ACK
//add by yizane

//for MAUP
#define	DATA						1
#define	ESTABLISH_REQ				2
#define	ESTABLISH_CFM				3
#define	RELEASE_REQ					4
#define	RELEASE_CFM					5
#define	RELEASE_IND					6
#define	STATE_REQ					7
#define	STATE_CFM					8
#define	STATE_IND					9
#define	DATA_RETIEVE_REQ			10
#define	DATA_RETIEVE_CFM			11
#define	DATA_RETIEVE_IND			12
#define	DATA_RETIEVE_CMP			13
#define	CONGESTION_IND				14
#define	DATA_ACK					15

#define	M2UA_MAUP_DATA				(M2UA_MCLASS_MAUP << 8) + DATA
#define	M2UA_MAUP_ESTABLISH_REQ		(M2UA_MCLASS_MAUP << 8) + ESTABLISH_REQ
#define	M2UA_MAUP_ESTABLISH_CFM		(M2UA_MCLASS_MAUP << 8) + ESTABLISH_CFM
#define	M2UA_MAUP_RELEASE_REQ		(M2UA_MCLASS_MAUP << 8) + RELEASE_REQ
#define	M2UA_MAUP_RELEASE_CFM		(M2UA_MCLASS_MAUP << 8) + RELEASE_CFM
#define	M2UA_MAUP_RELEASE_IND		(M2UA_MCLASS_MAUP << 8) + RELEASE_IND
#define	M2UA_MAUP_STATE_REQ			(M2UA_MCLASS_MAUP << 8) + STATE_REQ
#define	M2UA_MAUP_STATE_CFM			(M2UA_MCLASS_MAUP << 8) + STATE_CFM
#define	M2UA_MAUP_STATE_IND			(M2UA_MCLASS_MAUP << 8) + STATE_IND
#define	M2UA_MAUP_DATA_RETIEVE_REQ	(M2UA_MCLASS_MAUP << 8) + DATA_RETIEVE_REQ
#define	M2UA_MAUP_DATA_RETIEVE_CFM	(M2UA_MCLASS_MAUP << 8) + DATA_RETIEVE_CFM
#define	M2UA_MAUP_DATA_RETIEVE_IND	(M2UA_MCLASS_MAUP << 8) + DATA_RETIEVE_IND
#define	M2UA_MAUP_DATA_RETIEVE_CMP	(M2UA_MCLASS_MAUP << 8) + DATA_RETIEVE_CMP
#define	M2UA_MAUP_CONGESTION_IND	(M2UA_MCLASS_MAUP << 8) + CONGESTION_IND
#define	M2UA_MAUP_DATA_ACK			(M2UA_MCLASS_MAUP << 8) + DATA_ACK

//add by yizane
//for QPTM
#define	IUA_DATA_REQ						1
#define	IUA_DATA_IND						2
#define	IUA_UDATA_REQ						3
#define	IUA_UDATA_IND						4
#define	IUA_ESTABLISH_REQ				5
#define	IUA_ESTABLISH_CFM				6
#define	IUA_ESTABLISH_IND				7
#define	IUA_RELEASE_REQ					8
#define	IUA_RELEASE_CFM					9
#define	IUA_RELEASE_IND					10

#define	IUA_QPTM_DATA_REQ					(xUA_MCLASS_QPTM << 8) + IUA_DATA_REQ
#define	IUA_QPTM_DATA_IND					(xUA_MCLASS_QPTM << 8) + IUA_DATA_IND
#define	IUA_QPTM_UDATA_REQ				(xUA_MCLASS_QPTM << 8) + IUA_UDATA_REQ
#define	IUA_QPTM_UDATA_IND				(xUA_MCLASS_QPTM << 8) + IUA_UDATA_IND
#define	IUA_QPTM_ESTABLISH_REQ		(xUA_MCLASS_QPTM << 8) + IUA_ESTABLISH_REQ
#define	IUA_QPTM_ESTABLISH_CFM		(xUA_MCLASS_QPTM << 8) + IUA_ESTABLISH_CFM
#define	IUA_QPTM_ESTABLISH_IND		(xUA_MCLASS_QPTM << 8) + IUA_ESTABLISH_IND
#define	IUA_QPTM_RELEASE_REQ			(xUA_MCLASS_QPTM << 8) + IUA_RELEASE_REQ
#define	IUA_QPTM_RELEASE_CFM			(xUA_MCLASS_QPTM << 8) + IUA_RELEASE_CFM
#define	IUA_QPTM_RELEASE_IND			(xUA_MCLASS_QPTM << 8) + IUA_RELEASE_IND
//add by yizane

#define	ERROR								0
#define	NOTIFY							1
//add by yizane
#define	TEI_S_REQ						2
#define	TEI_S_CFM						3
#define	TEI_S_IND						4
//add by yizane

#define	M2UA_MGMT_ERROR				(M2UA_MCLASS_MGMT << 8) + ERROR
#define	M2UA_MGMT_NOTIFY			(M2UA_MCLASS_MGMT << 8) + NOTIFY

//add by yizane
#define	xUA_MGMT_ERROR				(xUA_MCLASS_MGMT << 8) + ERROR
#define	xUA_MGMT_NOTIFY				(xUA_MCLASS_MGMT << 8) + NOTIFY
#define	xUA_MGMT_TEI_S_REQ		(xUA_MCLASS_MGMT << 8) + TEI_S_REQ
#define	xUA_MGMT_TEI_S_CFM		(xUA_MCLASS_MGMT << 8) + TEI_S_CFM
#define	xUA_MGMT_TEI_S_IND		(xUA_MCLASS_MGMT << 8) + TEI_S_IND
//add by yizane

#define	M2UA_IIM_REG_REQ			1
#define	M2UA_IIM_REG_RSP			2
#define	M2UA_IIM_DEREG_REQ			3
#define	M2UA_IIM_DEREG_RSP			4

#define M2UA_PAR_INTERFACE_ID_INT	0x0001
#define M2UA_PAR_INTERFACE_ID_TXT	0x0003
#define M2UA_PAR_TRAFFIC_MODE		0x000B
#define M2UA_PAR_ASP_IDENTIFIER		0x0011
#define M2UA_PAR_PROTO_DATA_1		0x0300
#define M2UA_PAR_CORRELATION_ID		0x0013
#define M2UA_PAR_STATE				0x0302
#define M2UA_PAR_STATUS				0x000D
#define M2UA_PAR_ERR_CODE			0x000C
//add by yizane
#define xUA_PAR_DLCI						0x0005
#define xUA_PAR_PROTOCOL_DATA		0x000E
#define xUA_PAR_REL_REASON			0x000F
#define xUA_PAR_TEI_STATUS			0x0010

//add by yizane

#define M2UA_STATUS_LPO_SET			0x0
#define M2UA_STATUS_LPO_CLEAR       0x1
#define M2UA_STATUS_EMER_SET        0x2
#define M2UA_STATUS_EMER_CLEAR      0x3
#define M2UA_STATUS_FLUSH_BUFFERS   0x4
#define M2UA_STATUS_CONTINUE        0x5
#define M2UA_STATUS_CLEAR_RTB       0x6
#define M2UA_STATUS_AUDIT           0x7
#define M2UA_STATUS_CONG_CLEAR      0x8
#define M2UA_STATUS_CONG_ACCEPT     0x9
#define M2UA_STATUS_CONG_DISCARD    0xa

#define M2UA_STATUS_TYPE_AS_STATE_CHG	   	1
#define M2UA_STATUS_TYPE_OTHER				2

#define M2UA_STATUS_INFO_AS_RESERVED		1
#define M2UA_STATUS_INFO_AS_INACTIVE		2
#define M2UA_STATUS_INFO_AS_ACTIVE			3
#define M2UA_STATUS_INFO_AS_PENDING			4

#define M2UA_ERR_INVALID_VERSION            0x1
#define M2UA_ERR_INVALID_IID           		0x2
#define M2UA_ERR_UNSUPPORTED_MSG_CLASS      0x3
#define M2UA_ERR_UNSUPPORTED_MSG_TYPE       0x4
#define M2UA_ERR_UNSUPPORTED_TRA_HDL_MODE   0x5
#define M2UA_ERR_UNEXPECTED_MSG             0x6
#define M2UA_ERR_PROTOCOL_ERROR             0x7
#define M2UA_ERR_UNSUPPORTED_IIT  			0x8
#define M2UA_ERR_INVALID_SID              	0x9
#define M2UA_ERR_REFUSED_MGMT_BLOCK         0xd
#define M2UA_ERR_ASP_ID_REQUIRED            0xe
#define M2UA_ERR_INVALID_ASP_ID             0xf
#define M2UA_ERR_ASP_ACTIVE_FOR_IID 		0x10
#define M2UA_ERR_INVALID_PARA_VAL           0x11
#define M2UA_ERR_PARA_FIELD_ERROR           0x12
#define M2UA_ERR_UNEXPECTED_PARA            0x13
#define M2UA_ERR_MISSING_PARA               0x16

//add by yizane
#define IUA_TEI_ASSIGNED     	0x0
#define IUA_TEI_UNASSIGNED   	0x1

#define IUA_RELEASE_MGMT			0x00
#define IUA_RELEASE_PHYS 			0x01
#define IUA_RELEASE_DM				0x02
#define IUA_RELEASE_OTHER  		0x03
//add by yizane
      
#define M2UA_TRAFFIC_MODE_OVERRIDE	1
#define M2UA_TRAFFIC_MODE_LOADSHARE	2
#define M2UA_TRAFFIC_MODE_BROADCAST	3

#define M2UA_LK_IDLE				0
#define M2UA_LK_DOWN			1
#define M2UA_LK_UP					5
#define M2UA_LK_PO					6

#define	M2UA_MCLASS_MTP3			1
#define 	M2UA_MCLASS_LM				2

#define	M2UA_MTP3_SIO_CMD			0xFF
#define 	M2UA_SIO_CMD						0xEF
#define	M2UA_MTP3_SIO_MSG			0x80


#define M2UA_LK_ATTR_SIGTRAN					1
#define M2UA_MTP3_MAX_LS_NUM				128

#define	M2UA_MTP3_CMD_ACTIVE_LK			1
#define	M2UA_MTP3_CMD_DEACTIVE_LK	2
#define 	M2UA_MTP3_CMD_STOP_L2			3
#define 	M2UA_MTP3_CMD_EMERG_ALIGN	4

#define M2UA_T_ACK							100		// 2 seconds = 100 * 20ms
#define M2UA_T_R								100		// 2 seconds
#define M2UA_T_LK_ESTAB				4			// 10 seconds = 4 * 2.56s
#define M2UA_T_SG_ESTAB_1			500		// 10 seconds
#define M2UA_T_SG_ESTAB_2			6000	// 120 seconds
#define M2UA_T_SG_ESTAB_3			1500	// 30 seconds
#define M2UA_T_SG_WAIT				100		// 2 seconds

#define M2UA_CMD_IDLE					0
#define M2UA_CMD_PARA_SAVE		1
#define M2UA_CMD_PARA_INIT			2
#define M2UA_CMD_STATUS_INIT		3

#define M2UA_MGMT_CMD_LK_LOCK		1
//add by yizane
#define IUA_MGMT_CMD_LK_LOCK			2
//add by yizane

#define MAX_ASCIIIN_LEN					4096
#define MAX_ASCIIOUT_LEN				4096
#define MAX_ASCITMP_LEN				4096

#define	MONITOR_NONE				0x0000
#define	MONITOR_MTP3				0x0001
#define	MONITOR_M2UA				0x0002
#define	MONITOR_MAUP				0x0004
#define	MONITOR_SCTP				0x0008
#define	MONITOR_ERROR				0x0010
#define	MONITOR_ALL					0xffff

#define M2UA_MAX_RETRANS			10

#define M2UA_STOP_M2UA_LINK			6
#define M2UA_ENABLE_M2UA_LINK		7
//add by yizane
#define xUA_STOP_xUA_LINK			6
#define xUA_ENABLE_xUA_LINK		7
//add by yizane

#define M2UA_LKSCTP_ASSOC_CHANGE_COMM_UP				((SCTP_ASSOC_CHANGE << 16) | (SCTP_COMM_UP & 0xFFFF))
#define M2UA_LKSCTP_ASSOC_CHANGE_COMM_LOST				((SCTP_ASSOC_CHANGE << 16) | (SCTP_COMM_LOST & 0xFFFF))
#define M2UA_LKSCTP_ASSOC_CHANGE_SHUTDOWN_COMP			((SCTP_ASSOC_CHANGE << 16) | (SCTP_SHUTDOWN_COMP & 0xFFFF))
#define M2UA_LKSCTP_ASSOC_CHANGE_RESTART				((SCTP_ASSOC_CHANGE << 16) | (SCTP_RESTART & 0xFFFF))
#define M2UA_LKSCTP_ASSOC_CHANGE_CANT_STR_ASSOC			((SCTP_ASSOC_CHANGE << 16) | (SCTP_CANT_STR_ASSOC & 0xFFFF))

#define M2UA_LKSCTP_SEND_FAILED							(SCTP_SEND_FAILED << 16)
#define M2UA_LKSCTP_PEER_ADDR_CHANGE					(SCTP_PEER_ADDR_CHANGE << 16)
#define M2UA_LKSCTP_REMOTE_ERROR						(SCTP_REMOTE_ERROR << 16)
#define M2UA_LKSCTP_SHUTDOWN_EVENT						(SCTP_SHUTDOWN_EVENT << 16)

#define M2UA_LKSCTP_DATA_IND							0x7FFFFFFE
#define M2UA_LKSCTP_UNKNOWN_EVENT						0x7FFFFFFF

#define M2UA_ALARM_CODE_NORMAL							0
#define M2UA_ALARM_CODE_SCTP_FAILURE					1
#define M2UA_ALARM_CODE_REMOTE_AS_DOWN					2
#define M2UA_ALARM_CODE_REMOTE_LINK_RELEASE				3
#define M2UA_ALARM_CODE_LOCAL_MTP3_REQUEST_LINK_DOWN	4
#define M2UA_ALARM_CODE_LOCAL_SG_MAINTENANCE			5
#define M2UA_ALARM_CODE_LOCAL_LINK_MAINTENANCE			6

#endif
