/*========================================*/
/* 								 	      */
/* 									      */
/* 	Author:     Zane Yi				      */
/* 	Date:       2007.02.01			      */
/* 									      */
/*========================================*/
#ifndef _ISUPSTRUCT_H_
#define _ISUPSTRUCT_H_

#include "isup_if.h"


//*****************************************************
//			ISUP Resource Structures
//*****************************************************
#define ISUP_MAX_SAP				16
#define ISUP_MAX_CG					256
#define ISUP_MAX_CIRCUIT			256
#define ISUP_MAX_PORT				8192	//=ISUP_MAX_CIRCUIT*ISUP_CIRCUIT_CIC

//#define ISUP_CG_CIRCUIT				32
#define ISUP_CIRCUIT_CIC			32  

//#define NAME_LEN					16

typedef struct _isup_cic_state 
{
	u8				call_state;
	u8				sus_state;
	u8				blo_state;	//bit0:local m-block flag bit1:remote block m-flag 
} ISUP_CIC_state;


typedef struct _isup_fsm_state 
{
	u8						cpc_state;
	u8						blr_state;
	u8						bls_state;
	u8						mgbs_state;
	u8						mgbr_state;
	u8						crs_state;
	u8						crr_state;
	u8						cgrs_state;
	u8						cgrr_state;
} ISUP_Fsm_state;


typedef struct _isup_port_struct
{
	u8						enable;
	
	u8 						reset_flag;
	
	u8 						gourp_range;
	u8 						status_field[ISUP_STATUS_LEN];

	u8 						re_cause;
	u8 						re_location;
	u8 						re_range;
	u8						re_typeInd;
	SiRangStat				re_rangStat;
	
	u16						timer_flag;

	u32						w_time;	
	u32						su_proc_id;		//for normal call
	u32						sm_proc_id;		//for maintenance
			
	u8						sprc_cmd;
	u8						primitive_cmd;
	u8						internal_cmd;
	
	ISUP_Fsm_state			fsm_state;
	ISUP_CIC_state			cic_state;
	
	int						trace_flag;
} ISUP_Port_struct;


typedef struct  _isup_attrib_struct
{
	u8						systemID;
	u8						isup_run_mode;	
	u32					  isup_remote_ip;
} ISUP_Attrib_struct;

typedef struct _isup_resource_pond
{
	ISUP_Port_struct		port_pond[ISUP_MAX_PORT];
	ISUP_Attrib_struct		attrib;
}ISUP_Resource_Pond;


typedef struct _isup_timer_struct {
	int				t1;
	int				t2;
	int				t3;
	int				t4;
	int				t5;
	int				t6;
	int				t7;
	int				t8;
	int				t9;
	int				t12;
	int				t13;
	int				t14;
	int				t15;
	int				t16;
	int				t17;
	int				t18;
	int				t19;
	int				t20;
	int				t21;
	int				t22;
	int				t23;
	int				t24;
	int				t25;
	int				t26;
	int				t27;
	int				t34;
	int				t36;
	int				t37;
	int				t38;
} ISUP_Timer_Struct;


typedef struct _isup_msg_csta {
	u32				rv_iam;
	u32				sd_iam;
	u32				rv_acm;
	u32				sd_acm;
	u32				rv_rel;
	u32				sd_rel;
	u32				rv_rlc;
	u32				sd_rlc;	
} ISUP_Msg_Csta;
#endif
