//=========================================
// 								 	     
// 									     
// 	Author:     Zane Yi				      
// 	Date:       2007.02.01			      
// 									      
//=========================================
#ifndef _ISUPIF_H_
#define _ISUPIF_H_

#include "../../../pal/pal.h"
#include "isup_const.h"
#include "isup_public.h"
#include "isup_msg.h"

//*****************************************************
//			ISUP Module parameter structure
//*****************************************************

typedef int f_isup_setup_ind(Pst *pst, const SiPduIAM *ptr, u8 *raw_data, u8 len);
typedef int f_isup_setup_anm_cnf(Pst *pst, const SiPduANM *ptr_anm, u8 *raw_data, u8 len);
typedef int f_isup_setup_con_cnf(Pst *pst, const SiPduCON *ptr_con, u8 *raw_data, u8 len);
typedef int f_isup_release_ind(Pst *pst, const SiPduREL *ptr, u8 *raw_data, u8 len );
typedef int f_isup_release_cnf(Pst *pst, const SiPduRLC *ptr, u8 *raw_data, u8 len );
typedef int f_isup_alert_ind(Pst *pst, const SiPduACM *ptr, u8 *raw_data, u8 len );
typedef int f_isup_info_ind(Pst *pst, const SiPduSAM *ptr, u8 *raw_data, u8 len );
typedef int f_isup_prog_ind(Pst *pst, const SiPduCPG *ptr, u8 *raw_data, u8 len );
typedef int f_isup_suspend_ind(Pst *pst, const SiPduSUS *ptr, u8 *raw_data, u8 len  );
typedef int f_isup_resume_ind(Pst *pst, const SiPduRES *ptr, u8 *raw_data, u8 len  );
typedef int f_isup_block_ind(Pst *pst, const SiPduCGB *ptr);
typedef int f_isup_block_cnf(Pst *pst, const SiPduCGBA *ptr);
typedef int f_isup_unblock_ind(Pst *pst, const SiPduCGU *ptr);
typedef int f_isup_unblock_cnf(Pst *pst, const SiPduCGUA *ptr);
typedef int f_isup_reset_ind(Pst *pst, const SiPduGRS *ptr);
typedef int f_isup_reset_cnf(Pst *pst, const SiPduGRA *ptr);
typedef int f_isup_local(Pst *pst);
typedef int f_isup_maintance_ind(Pst *pst,u8 eventType);
typedef int f_isup_data_ind(Pst *pst, u8 msgType, const SiAllPdus *ptr, u8 *raw_data, u8 len);

typedef struct _eventhandle_struct
{
	f_isup_setup_ind					*h_isup_setup_ind;
	f_isup_setup_anm_cnf			*h_isup_setup_anm_cnf;
	f_isup_setup_con_cnf			*h_isup_setup_con_cnf;
	f_isup_release_ind				*h_isup_release_ind;
	f_isup_release_cnf				*h_isup_release_cnf;
	f_isup_alert_ind					*h_isup_alert_ind;
	f_isup_info_ind						*h_isup_info_ind;
	f_isup_prog_ind						*h_isup_prog_ind;
	f_isup_suspend_ind				*h_isup_suspend_ind;
	f_isup_resume_ind					*h_isup_resume_ind;
	f_isup_block_ind					*h_isup_block_ind;
	f_isup_block_cnf					*h_isup_block_cnf;
	f_isup_unblock_ind				*h_isup_unblock_ind;
	f_isup_unblock_cnf				*h_isup_unblock_cnf;
	f_isup_reset_ind					*h_isup_reset_ind;
	f_isup_reset_cnf					*h_isup_reset_cnf;
	f_isup_local							*h_isup_reattempt_ind;
	f_isup_local							*h_isup_failure_ind;
	f_isup_maintance_ind			*h_isup_maintenance_ind;
	f_isup_local							*h_isup_startreset_ind;
	f_isup_data_ind						*h_isup_data_ind;
} EventHandle_struct;

typedef struct _sap_attrib_struct
{	
	EventHandle_struct	event_handle;
}Sap_Attrib_struct;
//*****************************************************
//				ISUP Module interface
//*****************************************************

#define ISUP_CM_OK 						1	 		/* Command request success */
#define ISUP_CM_FAILED 					0 			/* Command request failed */

//Command
extern int isup_setup_req(Pst *pst, SiPduIAM *ptr, u8 *raw_data, u8 len);
extern int isup_setup_anm_rsp(Pst *pst, SiPduANM *ptr_anm, u8 *raw_data, u8 len);
extern int isup_setup_con_rsp(Pst *pst, SiPduCON *ptr_con, u8 *raw_data, u8 len);
extern int isup_release_req(Pst *pst, SiPduREL *ptr, u8 *raw_data, u8 len);
extern int isup_release_rsp(Pst *pst, SiPduRLC *ptr, u8 *raw_data, u8 len);
extern int isup_alert_req(Pst *pst, SiPduACM *ptr, u8 *raw_data, u8 len);
extern int isup_info_req(Pst *pst, SiPduSAM *ptr, u8 *raw_data, u8 len);
extern int isup_prog_req(Pst *pst, SiPduCPG *ptr, u8 *raw_data, u8 len);
extern int isup_suspend_req(Pst *pst, SiPduSUS *ptr, u8 *raw_data, u8 len);
extern int isup_resume_req(Pst *pst, SiPduRES *ptr, u8 *raw_data, u8 len);
extern int isup_block_req(Pst *pst, SiPduCGB *ptr );
extern int isup_block_rsp(Pst *pst, SiPduCGBA *ptr);
extern int isup_unblock_req(Pst *pst, SiPduCGU *ptr );
extern int isup_unblock_rsp(Pst *pst, SiPduCGUA *ptr);
extern int isup_reset_req(Pst *pst, SiPduGRS *ptr );
extern int isup_reset_rsp(Pst *pst, SiPduGRA *ptr);
extern int isup_bls_stop_req(Pst *pst);
extern int isup_mgbs_stop_req(Pst *pst);
extern int isup_crs_stop_req(Pst *pst);
extern int isup_cgrs_stop_req(Pst *pst);
extern int isup_data_req(Pst *pst, u8 msgType, SiAllPdus *ptr, u8 *raw_data, u8 len);

//run_mode
#define ISUP_SINGLE_MODE				0	 		/* Single Plat */
#define ISUP_DUAL_MODE					1 			/* DUAL Plat  */

extern int isup_set_run_mode (u8 run_mode, u32 alter_ip);
extern int isup_inquire_cic (u16 cg_id, u32 cic);//return  -1/0/1   L3 down/L4 failed/L4 normal


//system interface
extern void isup_init(u8 systemID, u32 interval_ms);
extern void isup_timer();
#endif

