/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: 		aifg_msg.h
Description:	Definition of message structure of AIFG module
Version:		v9.0.0
Author:			Roy Jiang
Create Date:	2007-3-6

History:
2007-3-6		v9.0.0	Create
*********************************************************************/

#ifndef _WXC2_AIFG_MSG_H
#define _WXC2_AIFG_MSG_H
#include "aifg_ie.h"

#define AIFG_MAX_MSG_IE			24

/**********************************PUBLIC**********************************/
//local message id
typedef enum {
	//DTAP
	AIFG_MSG_ID_TRANSPARENT_DTAP	=	0x00,	//TRANSPARENT Dtap message at BSC side
	//RR
	AIFG_MSG_ID_PAGING_RESP			=	0x01,	//Paging response    
	AIFG_MSG_ID_RR_HO_CMD			=	0x02,	//RR Handover command	
	//MM
	AIFG_MSG_ID_IMSI_DETACH_IND		=	0x03,	//IMSI detach indication
	AIFG_MSG_ID_LU_ACCEPT		 	= 	0x04,	//Location updating accept
	AIFG_MSG_ID_LU_REJECT			=	0x05,	//Location updating reject
	AIFG_MSG_ID_LU_REQUEST			=	0x06,	//Location updating request
	AIFG_MSG_ID_AUTH_REJECT			=	0x07,	//Authentication reject
	AIFG_MSG_ID_AUTH_REQUEST		=	0x08,	//Authentication request
	AIFG_MSG_ID_AUTH_RESPONSE		=	0x09,	//Authentication response
	AIFG_MSG_ID_ID_REQUEST			=	0x0A,	//Identity request
	AIFG_MSG_ID_ID_RESPONSE			=	0x0B,	//Identity response
	AIFG_MSG_ID_TMSI_REALLOC_CMD	=	0x0C,	//TMSI reallocation command
	AIFG_MSG_ID_TMSI_REALLOC_CMP	=	0x0D,	//TMSI reallocation complete
	AIFG_MSG_ID_CM_ACCEPT			=	0x0E,	//CM service accept
	AIFG_MSG_ID_CM_REJECT			=	0x0F,	//CM service reject
	AIFG_MSG_ID_CM_ABORT			=	0x10,	//CM service abort
	AIFG_MSG_ID_CM_REQUEST			=	0x11,	//CM service request
	AIFG_MSG_ID_CM_PROMPT			=	0x12,	//CM service prompt
	AIFG_MSG_ID_CM_REEST_REQUEST	=	0x13,	//CM re-establishment request
	AIFG_MSG_ID_ABORT				=	0x14,	//Abort
	AIFG_MSG_ID_MM_NULL				=	0x15,	//MM NULL
	AIFG_MSG_ID_MM_STATUS			=	0x16,	//MM status
	AIFG_MSG_ID_MM_INFO				=	0x17,	//MM information
	//CC
	AIFG_MSG_ID_ALERTING			=	0x18,	//Alerting
	AIFG_MSG_ID_CALL_CONFIRMED		=	0x19,	//Call confirmed
	AIFG_MSG_ID_CALL_PROCEEDING		=	0x1A,	//Call proceeding
	AIFG_MSG_ID_CONNECT				=	0x1B,	//Connect
	AIFG_MSG_ID_CONNECT_ACK			=	0x1C,	//Connect ack
	AIFG_MSG_ID_EMERGENCY_SETUP		=	0x1D,	//Emergency setup
	AIFG_MSG_ID_PROGRESS			=	0x1E,	//Progress
	AIFG_MSG_ID_SETUP				=	0x1F,	//Setup
	AIFG_MSG_ID_MODIFY				=	0x20,	//Modify
	AIFG_MSG_ID_MODIFY_CMP			=	0x21,	//Modify complete
	AIFG_MSG_ID_MODIFY_REJECT		=	0x22,	//Modify reject
	AIFG_MSG_ID_USER_INFO			=	0x23,	//User information
	AIFG_MSG_ID_HOLD				=	0x24,	//Hold
	AIFG_MSG_ID_HOLD_ACK			=	0x25,	//Hold ack
	AIFG_MSG_ID_HOLD_REJECT			=	0x26,	//Hold reject
	AIFG_MSG_ID_RETRIEVE			=	0x27,	//Retrieve
	AIFG_MSG_ID_RETRIEVE_ACK		=	0x28,	//Retrieve ack
	AIFG_MSG_ID_RETRIEVE_REJECT		=	0x29,	//Retrieve reject
	AIFG_MSG_ID_DISCONNECT			=	0x2A,	//Disconnect
	AIFG_MSG_ID_RELEASE				=	0x2B,	//Release
	AIFG_MSG_ID_RELEASE_CMP			=	0x2C,	//Release complete
	AIFG_MSG_ID_CONGESTION_CTRL		=	0x2D,	//Congestion control
	AIFG_MSG_ID_NOTIFY				=	0x2E,	//Notify
	AIFG_MSG_ID_STATUS				=	0x2F,	//Status
	AIFG_MSG_ID_STATUS_ENQ			=	0x30,	//Status enquiry
	AIFG_MSG_ID_START_DTMF			=	0x31,	//Start DTMF
	AIFG_MSG_ID_STOP_DTMF			=	0x32,	//Stop DTMF
	AIFG_MSG_ID_STOP_DTMF_ACK		=	0x33,	//Stop DTMF ack
	AIFG_MSG_ID_START_DTMF_ACK		=	0x34,	//Start DTMF ack
	AIFG_MSG_ID_START_DTMF_REJECT	=	0x35,	//Start DTMF reject
	AIFG_MSG_ID_FACILITY			=	0x36,	//Facility
	//SS
	AIFG_MSG_ID_FACILITY_SS			=	0x37,	//Facility SS
	AIFG_MSG_ID_REGISTER			=	0x38,	//Register
	AIFG_MSG_ID_RELEASE_CMP_SS		=	0x39,	//Release Completed SS
	//SMS
	AIFG_MSG_ID_RP_DATA				=	0x3A,	//RP-DATA
	AIFG_MSG_ID_RP_ACK				=	0x3B,	//RP-ACK
	AIFG_MSG_ID_RP_ERROR			=	0x3C,	//RP-ERROR
	AIFG_MSG_ID_RP_SMMA				=	0x3D,	//RP-SMMA
	//BSSMAP
	//Global
	AIFG_MSG_ID_BLOCK				=	0x3E,	//Block
	AIFG_MSG_ID_BLOCK_ACK			=	0x3F,	//Blocking ack
	AIFG_MSG_ID_UNBLOCK				=	0x40,	//Unblock
	AIFG_MSG_ID_UNBLOCK_ACK			=	0x41,	//Unblocking ack
	AIFG_MSG_ID_CC_GROUP_BLK		=	0x42,	//Circuit group block
	AIFG_MSG_ID_CC_GROUP_BLK_ACK	=	0x43,	//Circuit group block ack
	AIFG_MSG_ID_CC_GROUP_UNBLK		=	0x44,	//Circuit group unblock
	AIFG_MSG_ID_CC_GROUP_UNBLK_ACK	=	0x45,	//Circuit group unblock ack
	AIFG_MSG_ID_RESRC_REQ			=	0x46,	//Resource request
	AIFG_MSG_ID_RESRC_IND			=	0x47,	//Resource indication
	AIFG_MSG_ID_RESET				=	0x48,	//Reset
	AIFG_MSG_ID_RESET_ACK			=	0x49,	//Reset ack
	AIFG_MSG_ID_PAGING				=	0x4A,	//Paging
	AIFG_MSG_ID_OVERLOAD			=	0x4B,	//Overload
	AIFG_MSG_ID_RESET_CC			=	0x4C,	//Reset circuit
	AIFG_MSG_ID_RESET_CC_ACK		=	0x4D,	//Reset circuit ack
	AIFG_MSG_ID_HO_CAN_ENQ			=	0x4E,	//Handover candidate enquire
	AIFG_MSG_ID_HO_CAN_RESP			=	0x4F,	//Handover candidate response
	//Dedicated
	AIFG_MSG_ID_ASSIGN_REQ			=	0x50,	//Assign request
	AIFG_MSG_ID_ASSIGN_CMP			=	0x51,	//Assign complete
	AIFG_MSG_ID_ASSIGN_FAIL			=	0x52,	//Assign failure
	AIFG_MSG_ID_HO_REQUEST			=	0x53,	//Handover request
	AIFG_MSG_ID_HO_REQUIRED			=	0x54,	//Handover required
	AIFG_MSG_ID_HO_REQ_ACK			=	0x55,	//Handover request ack
	AIFG_MSG_ID_HO_CMD				=	0x56,	//Handover command
	AIFG_MSG_ID_HO_CMP				=	0x57,	//Handover complete
	AIFG_MSG_ID_HO_SUC				=	0x58,	//Handover succeeded
	AIFG_MSG_ID_HO_FAIL				=	0x59,	//Handover failure
	AIFG_MSG_ID_HO_PERFORMED		=	0x5A,	//Handover performed
	AIFG_MSG_ID_HO_REQ_REJ			=	0x5B,	//Handover required reject
	AIFG_MSG_ID_HO_DETECT			=	0x5C,	//Handover detect
	AIFG_MSG_ID_CLR_CMD				=	0x5D,	//Clear command
	AIFG_MSG_ID_CLR_CMP				=	0x5E,	//Clear complete
	AIFG_MSG_ID_CLR_REQ				=	0x5F,	//Clear request
	AIFG_MSG_ID_SAPI_REJ			=	0x60,	//SAPI 'n' reject
	AIFG_MSG_ID_CONFUSION			=	0x61,	//Confusion
	AIFG_MSG_ID_SUSPEND				=	0x62,	//Suspend
	AIFG_MSG_ID_RESUME				=	0x63,	//Resume
	AIFG_MSG_ID_LOC_INFO_CMD		=	0x64,	//Location information command
	AIFG_MSG_ID_LOC_INFO_RPT		=	0x65,	//Location information report
	AIFG_MSG_ID_MSC_INVK_TRACE		=	0x66,	//MSC invoke trace
	AIFG_MSG_ID_BSC_INVK_TRACE		=	0x67,	//BSC invoke trace
	AIFG_MSG_ID_UNEQUIP_CC			=	0x68,	//Unequipped circuit
	AIFG_MSG_ID_CHANGE_CC			=	0x69,	//Change circuit
	AIFG_MSG_ID_CHANGE_CC_ACK		=	0x6A,	//Change circuit ack
	AIFG_MSG_ID_CIPHER_MODE_CMD		=	0x6B,	//Cipher mode command
	AIFG_MSG_ID_CM_UPDATE			=	0x6C,	//Classmark update
	AIFG_MSG_ID_CIPHER_MODE_CMP		=	0x6D,	//Cipher mode complete
	AIFG_MSG_ID_QUEUE_IND			=	0x6E,	//Queueing indication
	AIFG_MSG_ID_L3_INFO				=	0x6F,	//Complete layer 3 information
	AIFG_MSG_ID_CLASSMARK_REQ		=	0x70,	//Classmark request
	AIFG_MSG_ID_CIPHER_MODE_REJ		=	0x71,	//Cipher mode reject
	AIFG_MSG_ID_LOAD_IND			=	0x72,	//Load indication
	AIFG_MSG_ID_LSA_INFO			=	0x73,	//LSA INFORMATION
	AIFG_MSG_ID_IGNORED_MSG			=	0xFF,	//Ignored message, no need to process
}aifg_msg_id;

typedef enum {
	AIFG_MSG_DTAP = 1,
	AIFG_MSG_BSSMAP = 0,
}aifg_msg_protocol;

typedef enum {
	//There are protocol defined, see GSM 04.08
	AIFG_PD_DTAP_MM = 0x05,
	AIFG_PD_DTAP_CC = 0x03,
	AIFG_PD_DTAP_SS = 0x0B,
	AIFG_PD_DTAP_SMS = 0x09,

	//These are module defined
	AIFG_PD_BSSMAP_GLOBAL = 0xF0,
	AIFG_PD_BSSMAP_DEDICATED = 0xF1,
}aifg_pd;

//Message struct for encode-----------------------------------------------------
//DTAP--------------------------------------------------------------------------
typedef struct{
    aifg_ie_dt_lai			   lai;
	aifg_ie_mobileId     		mobileId;
	aifg_ie_dt_followOnProceed  followOnProceed;
	aifg_ie_dt_CTSPermission	CTSPermission;
}aifg_msg_dt_luAccept;

typedef struct{
	aifg_ie_dt_rejectCause	    rejectCause;
}aifg_msg_dt_cmReject;

typedef aifg_msg_dt_cmReject    aifg_msg_dt_luReject;

typedef aifg_msg_dt_cmReject    aifg_msg_dt_abort;

typedef aifg_msg_dt_cmReject    aifg_msg_dt_mmStatus;

typedef struct{
	aifg_ie_dt_luType			luType;
	aifg_ie_dt_lai				lai;
    aifg_ie_dt_cipherKey		cipherKey;
    aifg_ie_mobileId			mobileId;
	aifg_ie_dt_cmInfo1			cmInfo1;
}aifg_msg_dt_LURequest;

typedef struct{
    aifg_ie_dt_cipherKey		cipherKey;
	aifg_ie_dt_authRAND			authRAND;
}aifg_msg_dt_authRequest;

typedef struct{
    aifg_ie_dt_authSRES			authSRES;
}aifg_msg_dt_authResp;

typedef struct{
    aifg_ie_dt_idType			idType;
}aifg_msg_dt_idRequest;

typedef struct{
    aifg_ie_mobileId			mobileId;
}aifg_msg_dt_idResp;

typedef struct{
	aifg_ie_dt_cmInfo1			cmInfo1;
	aifg_ie_mobileId			mobileId;
}aifg_msg_dt_imsiDetachInd;

typedef struct{
	aifg_ie_dt_lai				lai;
    aifg_ie_mobileId			mobileId;
}aifg_msg_dt_tmsiCmd;

typedef struct{
    aifg_ie_dt_cipherKey		cipherKey;
	aifg_ie_dt_cmInfo2			cmInfo2;
	aifg_ie_mobileId			mobileId;
	aifg_ie_dt_lai				lai;
}aifg_msg_dt_cmReEstReq;

typedef struct{
	aifg_ie_dt_cmType			cmType;
    aifg_ie_dt_cipherKey		cipherKey;
	aifg_ie_dt_cmInfo2			cmInfo2;
	aifg_ie_mobileId			mobileId;
	aifg_ie_dt_priority			priority;
}aifg_msg_dt_cmRequest;

typedef struct{
    aifg_ie_dt_nwName           fullName;
	aifg_ie_dt_nwName           shortName;
	aifg_ie_dt_timeZone			timeZone;
	aifg_ie_dt_tzTime			tzTime;
	aifg_ie_dt_lsaId			lsaId;
}aifg_msg_dt_mmInfo;

//cc
typedef struct{
    aifg_ie_dt_facility			facility;
	aifg_ie_dt_progInd			progInd;
	aifg_ie_dt_uu				uu;
}aifg_msg_dt_alert;

typedef struct{
    aifg_ie_dt_rpInd		    rpInd;
	aifg_ie_dt_bc				bc1;
	aifg_ie_dt_bc				bc2;
	aifg_ie_dt_cause			cause;
	aifg_ie_dt_ccCap			ccCap;
}aifg_msg_dt_callConfirm;

typedef struct{
    aifg_ie_dt_rpInd		    rpInd;
	aifg_ie_dt_bc				bc1;
	aifg_ie_dt_bc				bc2;
	aifg_ie_dt_facility			facility;
	aifg_ie_dt_progInd			progInd;
	aifg_ie_dt_priority			priority;
}aifg_msg_dt_callProceed;

typedef struct{
    aifg_ie_dt_facility			facility;
	aifg_ie_dt_progInd			progInd;
	aifg_ie_dt_connNum			connNum;
	aifg_ie_dt_connSubAddr		connSubAddr;
	aifg_ie_dt_uu				uu;
}aifg_msg_dt_connect;

typedef struct{
    aifg_ie_dt_bc				bc;
}aifg_msg_dt_eSetup;

typedef struct{
    aifg_ie_dt_progInd			progInd;
	aifg_ie_dt_uu				uu;
}aifg_msg_dt_progress;

typedef struct{
    aifg_ie_dt_rpInd		    bc_rpInd;
	aifg_ie_dt_bc				bc1;
	aifg_ie_dt_bc				bc2;
	aifg_ie_dt_facility			facility;
	aifg_ie_dt_progInd			progInd;
	aifg_ie_dt_signal			signal;
	aifg_ie_dt_callingNum		callingNum;
	aifg_ie_dt_callingSubAddr	callingSubAddr;
	aifg_ie_dt_calledNum		calledNum;
	aifg_ie_dt_calledSubAddr	calledSubAddr;
	aifg_ie_dt_redirNum			redirNum;
	aifg_ie_dt_redirSubAddr		redirSubAddr;
	aifg_ie_dt_rpInd		    llc_rpInd;
	aifg_ie_dt_loComp			loComp1;
	aifg_ie_dt_loComp			loComp2;
	aifg_ie_dt_rpInd		    hlc_rpInd;
	aifg_ie_dt_hiComp			hiComp1;
	aifg_ie_dt_hiComp			hiComp2;
	aifg_ie_dt_uu				uu;
	aifg_ie_dt_priority			priority;
	aifg_ie_dt_alertPattern		alertPattern;
}aifg_msg_dt_setup;

typedef struct{
    aifg_ie_dt_bc				bc;
	aifg_ie_dt_loComp			loComp;
	aifg_ie_dt_hiComp			hiComp;
	aifg_ie_dt_revCallDir		revCallDir;
}aifg_msg_dt_modify;

typedef aifg_msg_dt_modify aifg_msg_dt_modifyCmp;

typedef struct{
    aifg_ie_dt_bc				bc;
	aifg_ie_dt_cause			cause;
	aifg_ie_dt_loComp			loComp;
	aifg_ie_dt_hiComp			hiComp;
}aifg_msg_dt_modifyRej;

typedef struct{
    aifg_ie_dt_uu				uu;
	aifg_ie_dt_moreData			moreData;
}aifg_msg_dt_userInfo;

typedef struct{
    aifg_ie_dt_cause	cause;
}aifg_msg_dt_holdRej;

typedef aifg_msg_dt_holdRej aifg_msg_dt_retrieveRej;

typedef struct{
    aifg_ie_dt_cause			cause;
	aifg_ie_dt_facility			facility;
	aifg_ie_dt_progInd			progInd;
	aifg_ie_dt_uu				uu;
	aifg_ie_dt_ssVer			ssVer;
}aifg_msg_dt_disconnect;

typedef struct{
    aifg_ie_dt_cause			cause1;
	aifg_ie_dt_cause			cause2;
	aifg_ie_dt_facility			facility;
	aifg_ie_dt_uu				uu;
}aifg_msg_dt_release;

typedef struct{
    aifg_ie_dt_cause			cause;
	aifg_ie_dt_facility			facility;
	aifg_ie_dt_uu				uu;
}aifg_msg_dt_releaseCmp;

typedef struct{
	aifg_ie_dt_congestLevel		congestLevel;
    aifg_ie_dt_cause			cause;
}aifg_msg_dt_congestCtrl;

typedef struct{
	aifg_ie_dt_notificationInd	notificationInd;
}aifg_msg_dt_notify;

typedef struct{
    aifg_ie_dt_cause			cause;
	aifg_ie_dt_callStat			callStat;
	aifg_ie_dt_auxStat			auxStat;
}aifg_msg_dt_status;

typedef struct{
    aifg_ie_dt_keypad			keypad;
}aifg_msg_dt_startDTMF;

typedef aifg_msg_dt_startDTMF aifg_msg_dt_startDTMF_ack;

typedef aifg_msg_dt_holdRej   aifg_msg_dt_startDTMF_rej;

typedef struct{
    aifg_ie_dt_facility			facility;
}aifg_msg_dt_facility;

typedef struct{
	aifg_ie_dt_cipherKey	cipherKey;
	aifg_ie_dt_cmInfo2		cmInfo2;
	aifg_ie_mobileId		mobileId;
}aifg_msg_dt_pagingResp;

typedef struct{
	aifg_ie_dt_cause	cause;
	aifg_ie_dt_facility	facility;
}aifg_msg_dt_releaseCompSS;

typedef struct{	
	aifg_ie_dt_facility	facility;
	aifg_ie_dt_ssVer	ssVer;
}aifg_msg_dt_register;

typedef struct{
	aifg_ie_dt_facility	facility;	
}aifg_msg_dt_facilitySS;

typedef struct{
	BYTE				ref;
	aifg_ie_dt_rpAddr	moAddr;
	aifg_ie_dt_rpAddr	mtAddr;
	aifg_ie_dt_rpUD		data;
}aifg_msg_dt_rpData;

typedef struct{
	BYTE	ref;
}aifg_msg_dt_rpSMMA;

typedef struct{
	BYTE				ref;
	aifg_ie_dt_rpUD		data;
}aifg_msg_dt_rpAck;

typedef struct{
	BYTE				ref;
	aifg_ie_dt_rpCause	cause;
	aifg_ie_dt_rpUD		data;
}aifg_msg_dt_rpError;

//BSSMAP----------------------------------------------------------------------
typedef struct{
	BYTE id;	//message id
	union{
		aifg_msg_dt_LURequest		luRequest;
		aifg_msg_dt_cmRequest		cmRequest;
		aifg_msg_dt_cmReEstReq		cmReEstReq;		
		aifg_msg_dt_imsiDetachInd	imsiDetachInd;
		aifg_msg_dt_pagingResp		pagingResp;
	}msg;
}aifg_msg_bm_l3msg;

typedef struct {
	aifg_ie_bm_channelType		channelType;
	aifg_ie_bm_L3HeaderInfo		l3HeaderInfo;
	aifg_ie_bm_priority			priority;
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_dtx				dtxFlag;
	aifg_ie_bm_bandUsed			bandUsed;
	aifg_ie_bm_cmInfo2			cm2;
	aifg_ie_bm_groupRef			groupRef;
	aifg_ie_bm_talkerFlag		talkerFlag;
	aifg_ie_bm_cfgEvoInd		cfgEvoInd;	
}aifg_msg_bm_assignReq;

typedef struct {
	aifg_ie_bm_rrCause			rrCause;
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_cellId			cellId;
	aifg_ie_bm_chosenChannel	chosenChannel;
	aifg_ie_bm_chosenEncrypt	chosenEncrypt;
	aifg_ie_bm_circuitPool		circuitPool;
	aifg_ie_bm_speechVer		speechVer;
	aifg_ie_bm_lsaId			lsaId;
}aifg_msg_bm_assignComplete;

typedef struct {
	aifg_ie_bm_rrCause			rrCause;
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_circuitPool		circuitPool;
	aifg_ie_bm_circuitPoolList	circuitPoolList;
}aifg_msg_bm_assignFailure;

typedef struct {
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_connRelReq		connRelReq;
}aifg_msg_bm_block;

typedef struct {
	aifg_ie_bm_cic				cic;
}aifg_msg_bm_blockAck;

typedef aifg_msg_bm_blockAck aifg_msg_bm_unblock;

typedef aifg_msg_bm_blockAck aifg_msg_bm_unblockAck;

typedef struct {
	aifg_ie_bm_channelType		channelType;
	aifg_ie_bm_encryptInfo		encryptInfo;
	union{
		BYTE					ind;
		aifg_ie_bm_cmInfo1		cm1;
		aifg_ie_bm_cmInfo2		cm2;
	}cmInfo;
	aifg_ie_bm_cellId			servingCellId;
	aifg_ie_bm_priority			priority;
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_dtx				dtxFlag;
	aifg_ie_bm_cellId			targetCellId;
	aifg_ie_bm_bandUsed			bandUsed;
	aifg_ie_bm_cause			cause;
//	aifg_ie_bm_cmInfo3			cm3;
	aifg_ie_bm_curChannelType1	curChannelType1;
	aifg_ie_bm_speechVer		speechVer;
	aifg_ie_bm_groupRef			gourpRef;
	aifg_ie_bm_talkerFlag		talkerFlag;
	aifg_ie_bm_cfgEvoInd		cfgEvoInd;	
	aifg_ie_bm_chosenEncrypt	chosenEncrypt;
	aifg_ie_bm_bssOldtoNew		bssOldtoNew;
	aifg_ie_bm_lsaInfo			lsaInfo;
}aifg_msg_bm_HORequest;

typedef struct {
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_respReq			respReq;
	aifg_ie_bm_cidList			prefer_cidList;
	aifg_ie_bm_circuitPoolList	circuitPoolList;
	aifg_ie_bm_curChannelType1	curChannelType1;	
	aifg_ie_bm_speechVer		speechVer;
	aifg_ie_bm_queuingInd		queuingInd;
	aifg_ie_bm_bssOldtoNew		bssOldtoNew;	
}aifg_msg_bm_HORequired;

typedef struct {
	struct{
		BYTE	*ptr;
		BYTE	len;
	}l3Info;
	aifg_ie_bm_chosenChannel	chosenChannel;
	aifg_ie_bm_chosenEncrypt	chosenEncrypt;
	aifg_ie_bm_circuitPool		circuitPool;
	aifg_ie_bm_speechVer		speechVer;
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_lsaId			lsaId;
}aifg_msg_bm_HORequestAck;

typedef struct {
	struct{
		BYTE	*ptr;
		BYTE	len;
	}l3Info;
	aifg_ie_bm_cellId			cellId;
}aifg_msg_bm_HOCmd;

typedef struct {
	aifg_ie_bm_rrCause			rrCause;
}aifg_msg_bm_HOComplete;

typedef struct {
	aifg_ie_bm_msNum			msNum;
	aifg_ie_bm_cidList			cidList;
	aifg_ie_bm_cellId			cellId;
}aifg_msg_bm_HOCandidateEnq;

typedef struct {
	aifg_ie_bm_msNum			msNum;
	aifg_ie_bm_cellId			cellId;
}aifg_msg_bm_HOCandidateResp;

typedef struct {
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_rrCause			rrCause;
	aifg_ie_bm_circuitPool		circuitPool;
	aifg_ie_bm_circuitPoolList	circuitPoolList;
}aifg_msg_bm_HOFailure;

typedef struct {
	aifg_ie_bm_periodicity		periodicity;
	aifg_ie_bm_resrcIndMethod	resrcIndMethod;
	aifg_ie_bm_cellId			cellId;
	aifg_ie_bm_extResourceInd	extResrcInd;
}aifg_msg_bm_resrcReq;

typedef struct {
	aifg_ie_bm_resrcIndMethod	resrcIndMethod;
	aifg_ie_bm_resrcAvail		resrcAvail;	
	aifg_ie_bm_cellId			cellId;
	aifg_ie_bm_totalResrc		totalResrc;
}aifg_msg_bm_resrcInd;

typedef struct {
	aifg_ie_bm_imsi				imsi;
	aifg_ie_bm_tmsi				tmsi;
	aifg_ie_bm_cidList			cidList;
	aifg_ie_bm_channelNeeded	channelNeeded;
	aifg_ie_bm_eMLPP			eMLPP;
}aifg_msg_bm_paging;

typedef struct {
	aifg_ie_bm_cause			cause;
}aifg_msg_bm_clearReq;

typedef struct {
	aifg_ie_bm_L3HeaderInfo		l3HeaderInfo;
	aifg_ie_bm_cause			cause;	
}aifg_msg_bm_clearCmd;

typedef aifg_msg_bm_clearReq aifg_msg_bm_reset;

typedef struct {
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_cellId			cellId;
	aifg_ie_bm_chosenChannel	chosenChannel;
	aifg_ie_bm_chosenEncrypt	chosenEncrypt;
	aifg_ie_bm_speechVer		speechVer;
	aifg_ie_bm_lsaId			lsaId;
}aifg_msg_bm_HOPerformed;

typedef struct {
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_cellId			cellId;
}aifg_msg_bm_overload;

typedef struct {
	aifg_ie_bm_traceType		traceType;
	aifg_ie_bm_triggerId		tiggerId;
	aifg_ie_bm_traceRef			traceRef;
	aifg_ie_bm_transId			transId;
	aifg_ie_mobileId			mobileId;
	aifg_ie_bm_omcId			omcId;
}aifg_msg_bm_mscInvokeTrace;

typedef struct {
	aifg_ie_bm_traceType		traceType;
	aifg_ie_bm_fowardInd		forwardInd;
	aifg_ie_bm_triggerId		tiggerId;
	aifg_ie_bm_traceRef			traceRef;
	aifg_ie_bm_transId			transId;
	aifg_ie_bm_omcId			omcId;
}aifg_msg_bm_bscInvokeTrace;

typedef struct {
	aifg_ie_bm_cmInfo2			cm2;
//	aifg_ie_bm_cmInfo3			cm3;
}aifg_msg_bm_cmUpdate;

typedef struct {
	aifg_ie_bm_L3HeaderInfo		l3HeaderInfo;
	aifg_ie_bm_encryptInfo		encryptInfo;
	aifg_ie_bm_cipherRespMode	cipherRespMode;	
}aifg_msg_bm_cipherModeCmd;

typedef struct {
	struct{
		BYTE	flag;
		BYTE	*ptr;
		BYTE	len;
	}l3Info;
	aifg_ie_bm_chosenEncrypt	chosenEncrypt;
}aifg_msg_bm_cipherModeComplete;

typedef struct {
	struct{
		BYTE	*ptr;
		BYTE	len;
	}l3Info;
//	aifg_msg_bm_l3msg			l3Info;
	aifg_ie_bm_cellId			cellId;
	aifg_ie_bm_chosenChannel	chosenChannel;
	aifg_ie_bm_lsaIdList		lsaIdList;
	aifg_ie_bm_locInfo			locInfo;
}aifg_msg_bm_completeL3Info;

typedef struct {
	aifg_ie_bm_dlci				dlci;
	aifg_ie_bm_cause			cause;
}aifg_msg_bm_SAPI_n_Reject;

typedef aifg_msg_bm_clearReq aifg_msg_bm_HOReject;

typedef struct {
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_cause			cause;
}aifg_msg_bm_resetCircuit;

typedef struct {
	aifg_ie_bm_cic				cic;
}aifg_msg_bm_resetCircuitAck;

typedef struct {
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_cicList			cicList;
}aifg_msg_bm_circuitGrpBlk;

typedef struct {
	aifg_ie_bm_cic				cic;
	aifg_ie_bm_cicList			cicList;
}aifg_msg_bm_circuitGrpBlkAck;

typedef aifg_msg_bm_circuitGrpBlkAck	aifg_msg_bm_circuitGrpUnblk;

typedef aifg_msg_bm_circuitGrpBlkAck	aifg_msg_bm_circuitGrpUnblkAck;

typedef struct {
	aifg_ie_bm_cause			cause;
	aifg_ie_bm_diagnostics		diagnostics;
}aifg_msg_bm_confusion;

typedef aifg_msg_bm_circuitGrpBlkAck	aifg_msg_bm_unequippedCircuit;

typedef aifg_msg_bm_clearReq aifg_msg_bm_cipherModeReject;

typedef struct {
	aifg_ie_bm_timeId			timeInd;
	aifg_ie_bm_cellId			cellId;
	aifg_ie_bm_cidList			cidList;
	aifg_ie_bm_resrcSit			resrcSit;
	aifg_ie_bm_cause			cause;
}aifg_msg_bm_loadIndication;

typedef struct {
	aifg_ie_bm_dlci				dlci;
}aifg_msg_bm_suspend;

typedef aifg_msg_bm_suspend aifg_msg_bm_resume;

typedef aifg_msg_bm_clearReq aifg_msg_bm_changeCircuit;

typedef aifg_msg_bm_resetCircuitAck aifg_msg_bm_changeCircuitAck;

typedef struct {
	aifg_ie_bm_lsaInfo			lsaInfo;
}aifg_msg_bm_lsaInfo;

typedef struct {
	aifg_ie_bm_locInfo			locInfo;
}aifg_msg_bm_locCmd;

typedef struct {
	aifg_ie_bm_locInfo			locInfo;
	aifg_ie_bm_cause			cause;
}aifg_msg_bm_locReport;

typedef struct {
	aifg_msg_id	id;
	aifg_pd		pd;
	int			app_port;
	int			aif_port;
	int			trace_flag;	//0 - off, 1 - on
	union{
		//BSSMAP
		aifg_msg_bm_assignReq			assignReq;
		aifg_msg_bm_assignComplete		assignComplete;
		aifg_msg_bm_assignFailure		assignFailure;
		aifg_msg_bm_block				block;
		aifg_msg_bm_blockAck			blockAck;
		aifg_msg_bm_unblock				unblock;
		aifg_msg_bm_unblockAck			unblockAck;
		aifg_msg_bm_HORequired			HORequired;
		aifg_msg_bm_HORequest			HORequest;
		aifg_msg_bm_HORequestAck		HORequestAck;
		aifg_msg_bm_HOCmd				HOCmd;
		aifg_msg_bm_HOComplete			HOComplete;
		aifg_msg_bm_HOCandidateEnq		HOCandidateEnq;
		aifg_msg_bm_HOCandidateResp		HOCandidateResp;
		aifg_msg_bm_HOFailure			HOFailure;
		aifg_msg_bm_HOPerformed			HOPerformed;
		aifg_msg_bm_HOReject			HOReject;
		aifg_msg_bm_resrcReq			resourceReq;
		aifg_msg_bm_resrcInd			resourceInd;
		aifg_msg_bm_paging				paging;
		aifg_msg_bm_clearReq			clearReq;
		aifg_msg_bm_clearCmd			clearCmd;
		aifg_msg_bm_reset				reset;
		aifg_msg_bm_overload			overload;
		aifg_msg_bm_mscInvokeTrace		mscInvokeTrace;
		aifg_msg_bm_bscInvokeTrace		bscInvokeTrace;
		aifg_msg_bm_cmUpdate			cmUpdate;
		aifg_msg_bm_cipherModeCmd		cipherModeCmd;
		aifg_msg_bm_cipherModeComplete	cipherModeComplete;
		aifg_msg_bm_cipherModeReject	cipherModeReject;
		aifg_msg_bm_completeL3Info		completeL3Info;
		aifg_msg_bm_SAPI_n_Reject		SAPI_n_Reject;
		aifg_msg_bm_resetCircuit		resetCircuit;
		aifg_msg_bm_resetCircuitAck		resetCircuitAck;
		aifg_msg_bm_circuitGrpBlk		ccGroupBlock;
		aifg_msg_bm_circuitGrpBlkAck	ccGroupBlockAck;
		aifg_msg_bm_circuitGrpUnblk		ccGroupUnblock;
		aifg_msg_bm_circuitGrpUnblkAck	ccGroupUnblockAck;
		aifg_msg_bm_confusion			confusion;
		aifg_msg_bm_unequippedCircuit	unequippedCircuit;
		aifg_msg_bm_loadIndication		loadInd;
		aifg_msg_bm_suspend				suspend;
		aifg_msg_bm_resume				resume;
		aifg_msg_bm_changeCircuit		changeCircuit;
		aifg_msg_bm_changeCircuitAck	changeCircuitAck;
		aifg_msg_bm_lsaInfo				lsaInfo;
		aifg_msg_bm_locCmd				locCmd;
		aifg_msg_bm_locReport			locReport;

		//DTAP
		aifg_msg_dt_luAccept            luAccept;
		aifg_msg_dt_cmReject            cmReject;
		aifg_msg_dt_luReject            luReject;
		aifg_msg_dt_abort               abort;
		aifg_msg_dt_mmStatus            mmStatus;
		aifg_msg_dt_LURequest           luRequest;
		aifg_msg_dt_authRequest         authRequest;
		aifg_msg_dt_authResp            authResp;
		aifg_msg_dt_idRequest           idRequest;
		aifg_msg_dt_idResp              idResp;
		aifg_msg_dt_imsiDetachInd		IMSI_ind;
		aifg_msg_dt_tmsiCmd             tmsiCmd;
		aifg_msg_dt_cmReEstReq     		cmReEst_Request;
		aifg_msg_dt_cmRequest           cmRequest;
		aifg_msg_dt_mmInfo              mmInfo;
		aifg_msg_dt_alert               alert;
		aifg_msg_dt_callConfirm         callConfirm;
		aifg_msg_dt_callProceed         callProceed;
		aifg_msg_dt_connect             connect;
		aifg_msg_dt_eSetup        	  	eSetup;
		aifg_msg_dt_progress            progress;
		aifg_msg_dt_setup               setup;
		aifg_msg_dt_modify              modify;
		aifg_msg_dt_modifyCmp           modifyCmp;
		aifg_msg_dt_modifyRej           modifyRej;
		aifg_msg_dt_userInfo            userInfo;
		aifg_msg_dt_holdRej             holdRej;
		aifg_msg_dt_retrieveRej         retrieveRej;
		aifg_msg_dt_disconnect          disconnect;
		aifg_msg_dt_release             release;
		aifg_msg_dt_releaseCmp          releaseCmp;
		aifg_msg_dt_congestCtrl         congestCtrl;
		aifg_msg_dt_notify              notify;
		aifg_msg_dt_status              status;
		aifg_msg_dt_startDTMF           startDTMF;
		aifg_msg_dt_startDTMF_ack       startDTMF_ack;
		aifg_msg_dt_startDTMF_rej       startDTMF_rej;
		aifg_msg_dt_facility            facility;
		aifg_msg_dt_facilitySS			facilitySS;
		aifg_msg_dt_register			registerSS;
		aifg_msg_dt_releaseCompSS		releaseCompSS;
		aifg_msg_dt_rpData				rpData;
		aifg_msg_dt_rpSMMA				rpSMMA;
		aifg_msg_dt_rpAck				rpAck;
		aifg_msg_dt_rpError				rpError;

		//for transparently DTAP message transfer in BSC
		struct {
			BYTE	*ptr;			
			BYTE	len;
		}dtap_msg;
	}msg;	
}aifg_msg_t;

//Message struct for decode-----------------------------------------------------
enum{AIFG_LOW_BITS = 0, AIFG_HIGH_BITS};

typedef struct
{
	BYTE iei;
	BYTE *ptr;
	BYTE hi_lo_flag;
}aifg_ie_ptr;

//DTAP-------------------------------------
typedef struct 
{
	aifg_ie_ptr cipherKeySeq;
	aifg_ie_ptr authParamRAND;
}aifg_msg_predecode_dt_authReq;

typedef struct 
{
	aifg_ie_ptr authParamSRES;
}aifg_msg_predecode_dt_authResp;

typedef struct 
{
	aifg_ie_ptr cipherKeySeq;
	aifg_ie_ptr cm2;
	aifg_ie_ptr mobileId;
	aifg_ie_ptr lai;
	aifg_ie_ptr id;
}aifg_msg_predecode_dt_cmReEstReq;

typedef struct 
{
	aifg_ie_ptr rejCause;
}aifg_msg_predecode_dt_cmRej;

typedef struct 
{
	aifg_ie_ptr rejCause;
}aifg_msg_predecode_dt_abort;

typedef struct 
{
	aifg_ie_ptr type;
	aifg_ie_ptr cipherKeySeq;
	aifg_ie_ptr cm2;
	aifg_ie_ptr mobileId;
	aifg_ie_ptr priority;
}aifg_msg_predecode_dt_cmReq;

typedef struct 
{
	aifg_ie_ptr type;
}aifg_msg_predecode_dt_idReq;

typedef struct 
{
	aifg_ie_ptr mobileId;
}aifg_msg_predecode_dt_idResp;

typedef struct 
{
	aifg_ie_ptr cm1;
	aifg_ie_ptr mobileId;
}aifg_msg_predecode_dt_imsiDetachInd;

typedef struct 
{
	aifg_ie_ptr lai;
	aifg_ie_ptr mobileId;
	aifg_ie_ptr followOnProc;
	aifg_ie_ptr ctsPerm;
}aifg_msg_predecode_dt_luAccept;

typedef struct 
{
	aifg_ie_ptr rejCause;
}aifg_msg_predecode_dt_luReject;

typedef struct 
{
	aifg_ie_ptr type;
	aifg_ie_ptr cipherKeySeq;
	aifg_ie_ptr lai;
	aifg_ie_ptr cm1;
	aifg_ie_ptr mobileId;
}aifg_msg_predecode_dt_LURequest;

typedef struct 
{
	aifg_ie_ptr fullNetworkName;
	aifg_ie_ptr shortNetworkName;
	aifg_ie_ptr timeZone;
	aifg_ie_ptr timeZoneAndTime;
	aifg_ie_ptr lsaId;
}aifg_msg_predecode_dt_mmInfo;

typedef struct 
{
	aifg_ie_ptr rejCause;
}aifg_msg_predecode_dt_mmStatus;

typedef struct 
{
	aifg_ie_ptr lai;
	aifg_ie_ptr mobileId;
}aifg_msg_predecode_dt_tmsiReallocCmd;

typedef struct 
{
	aifg_ie_ptr facility;
	aifg_ie_ptr progressInd;
	aifg_ie_ptr user_user;
	aifg_ie_ptr ssVer;
}aifg_msg_predecode_dt_alert;

typedef struct 
{
	aifg_ie_ptr reptInd;
	aifg_ie_ptr bearCap1;
	aifg_ie_ptr bearCap2;
	aifg_ie_ptr cause;
	aifg_ie_ptr ccCap;
}aifg_msg_predecode_dt_callConfirm;

typedef struct 
{
	aifg_ie_ptr reptInd;
	aifg_ie_ptr bearCap1;
	aifg_ie_ptr bearCap2;
	aifg_ie_ptr facility;
	aifg_ie_ptr progressInd;
	aifg_ie_ptr priority;
}aifg_msg_predecode_dt_callProceed;

typedef struct 
{
	aifg_ie_ptr congestLev;
	aifg_ie_ptr cause;
}aifg_msg_predecode_dt_congestCtrl;

typedef struct 
{
	aifg_ie_ptr facility;
	aifg_ie_ptr progressInd;
	aifg_ie_ptr connNum;
	aifg_ie_ptr connSubaddr;
	aifg_ie_ptr user_user;
	aifg_ie_ptr	ssVer;
}aifg_msg_predecode_dt_connect;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr facility;
	aifg_ie_ptr progressInd;
	aifg_ie_ptr user_user;
	aifg_ie_ptr allowAct;
	aifg_ie_ptr ssVer;
}aifg_msg_predecode_dt_disconnect;

typedef struct 
{
	aifg_ie_ptr bearCap;
}aifg_msg_predecode_dt_emergSetup;

typedef struct 
{
	aifg_ie_ptr facility;
	aifg_ie_ptr ssVer;
}aifg_msg_predecode_dt_facility;

typedef struct 
{
	aifg_ie_ptr bearCap;
	aifg_ie_ptr lowLComp;
	aifg_ie_ptr highLComp;
	aifg_ie_ptr revCallSetDir;
}aifg_msg_predecode_dt_modify;

typedef aifg_msg_predecode_dt_modify aifg_msg_predecode_dt_modifyComp;

typedef struct 
{
	aifg_ie_ptr bearCap;
	aifg_ie_ptr cause;
	aifg_ie_ptr lowLComp;
	aifg_ie_ptr highLComp;
}aifg_msg_predecode_dt_modifyRej;

typedef struct 
{
	aifg_ie_ptr progressInd;
	aifg_ie_ptr user_user;
}aifg_msg_predecode_dt_progress;

typedef struct 
{
	aifg_ie_ptr cause1;
	aifg_ie_ptr cause2;
	aifg_ie_ptr facility;
	aifg_ie_ptr user_user;
	aifg_ie_ptr ssVer;
}aifg_msg_predecode_dt_release;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr facility;
	aifg_ie_ptr user_user;
	aifg_ie_ptr	ssVer;
}aifg_msg_predecode_dt_releaseComp;

typedef struct 
{
	aifg_ie_ptr reptInd_bc;
	aifg_ie_ptr bearCap1;
	aifg_ie_ptr bearCap2;
	aifg_ie_ptr facility;
	aifg_ie_ptr progressInd;
	aifg_ie_ptr signal;
	aifg_ie_ptr callingBCD;
	aifg_ie_ptr callingSubaddr;
	aifg_ie_ptr calledBCD;
	aifg_ie_ptr calledSubaddr;
	aifg_ie_ptr redirBCD;
	aifg_ie_ptr redirSubaddr;
	aifg_ie_ptr reptInd_llc;
	aifg_ie_ptr lowLComp1;
	aifg_ie_ptr lowLComp2;
	aifg_ie_ptr reptInd_hlc;
	aifg_ie_ptr highLComp1;
	aifg_ie_ptr highLComp2;
	aifg_ie_ptr user_user;
	aifg_ie_ptr priority;
	aifg_ie_ptr alert;
	aifg_ie_ptr ssVer;
	aifg_ie_ptr clirSuppr;
	aifg_ie_ptr clirInvo;
	aifg_ie_ptr ccCap;
}aifg_msg_predecode_dt_setup;

typedef struct 
{
	aifg_ie_ptr keypadFacility;
}aifg_msg_predecode_dt_startDTMF;

typedef aifg_msg_predecode_dt_startDTMF aifg_msg_predecode_dt_startDTMFAck;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr callState;
	aifg_ie_ptr auxState;
}aifg_msg_predecode_dt_status;

typedef struct 
{
	aifg_ie_ptr user_user;
	aifg_ie_ptr moreDate;
}aifg_msg_predecode_dt_userInfo;

typedef struct
{
	aifg_ie_ptr cause;
}aifg_msg_predecode_dt_holdRej;

typedef aifg_msg_predecode_dt_holdRej aifg_msg_predecode_dt_retieveRej;
typedef aifg_msg_predecode_dt_holdRej aifg_msg_predecode_dt_startDTMFRej;

typedef struct
{
	aifg_ie_ptr notifyInd;
}aifg_msg_predecode_dt_notify;

typedef struct
{
	aifg_ie_ptr cipherKeySeq;
	aifg_ie_ptr cm2;
	aifg_ie_ptr mobileId;
}aifg_msg_predecode_dt_pagingResp;

typedef struct
{
	aifg_ie_ptr facility;
}aifg_msg_predecode_dt_facilitySS;

typedef struct
{
	aifg_ie_ptr facility;
	aifg_ie_ptr ssVer;
}aifg_msg_predecode_dt_register;

typedef struct
{
	aifg_ie_ptr cause;
	aifg_ie_ptr facility;
}aifg_msg_predecode_dt_releaseCompSS;

typedef struct{
	BYTE			ref;
	aifg_ie_ptr		moAddr;
	aifg_ie_ptr		mtAddr;
	aifg_ie_ptr		data;
}aifg_msg_predecode_dt_rpData;

typedef struct{
	BYTE			ref;
}aifg_msg_predecode_dt_rpSMMA;

typedef struct{
	BYTE			ref;
	aifg_ie_ptr		data;
}aifg_msg_predecode_dt_rpAck;

typedef struct{
	BYTE			ref;
	aifg_ie_ptr		cause;
	aifg_ie_ptr		data;
}aifg_msg_predecode_dt_rpError;

//BSSMAP
typedef struct
{
	BYTE id;	//message id
	union{
		aifg_msg_predecode_dt_LURequest 	luRequest;
		aifg_msg_predecode_dt_cmReq			cmRequest;
		aifg_msg_predecode_dt_cmReEstReq	cmReEstReq;
		aifg_msg_predecode_dt_imsiDetachInd	imsiDetachInd;
		aifg_msg_predecode_dt_pagingResp	pagingResp;
	}msg;
}aifg_msg_predecode_l3msg;

typedef struct
{
	aifg_ie_ptr	channelType;
	aifg_ie_ptr l3HeaderInfo;
	aifg_ie_ptr priority;
	aifg_ie_ptr cic;
	aifg_ie_ptr dtxFlag;
	aifg_ie_ptr bandUsed;
	aifg_ie_ptr cmInfo2;
	aifg_ie_ptr groupRef;
	aifg_ie_ptr talkerFlag;
	aifg_ie_ptr cfgEvoInd;
}aifg_msg_predecode_bm_assignReq;

 typedef struct 
 {
	aifg_ie_ptr rrcause;
	aifg_ie_ptr cic;
	aifg_ie_ptr cellId;
	aifg_ie_ptr chosenChannel;
	aifg_ie_ptr chosenEncrypt;
	aifg_ie_ptr circuitPool;
	aifg_ie_ptr speechVer;
	aifg_ie_ptr lsaId;
 }aifg_msg_predecode_bm_assignComp;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr rrcause;
	aifg_ie_ptr circuitPool;
	aifg_ie_ptr circuitPoolList;
}aifg_msg_predecode_bm_assignFail;

typedef struct 
{
	aifg_ie_ptr cic;
	aifg_ie_ptr cause;
	aifg_ie_ptr connectionRelReq;
}aifg_msg_predecode_bm_block;

typedef struct 
{
	aifg_ie_ptr cic;
}aifg_msg_predecode_bm_blockAck;

typedef aifg_msg_predecode_bm_blockAck aifg_msg_predecode_bm_unBlock;

typedef aifg_msg_predecode_bm_blockAck aifg_msg_predecode_bm_unBlockAck;

typedef struct 
{
	aifg_ie_ptr channelType;
	aifg_ie_ptr encryptInfo;
	aifg_ie_ptr cmInfo1;
	aifg_ie_ptr cmInfo2;
	aifg_ie_ptr serving_cellId;
	aifg_ie_ptr priority;
	aifg_ie_ptr cic;
	aifg_ie_ptr dtxFlag;
	aifg_ie_ptr target_cellId;
	aifg_ie_ptr bandUsed;
	aifg_ie_ptr cause;
	aifg_ie_ptr cmInfo3;
	aifg_ie_ptr curChanneltype1;
	aifg_ie_ptr speechVer;
	aifg_ie_ptr groupCallRef;
	aifg_ie_ptr talkerFlag;
	aifg_ie_ptr cfgEvoInd;
	aifg_ie_ptr chosenEncrypt;
	aifg_ie_ptr oldBssToNew;
	aifg_ie_ptr lsaInfo;
}aifg_msg_predecode_bm_HORequest;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr respReq;
	aifg_ie_ptr cellIdList;
	aifg_ie_ptr circuitPoolList;
	aifg_ie_ptr curChannelType1;
	aifg_ie_ptr speechVer;
	aifg_ie_ptr queInd;
	aifg_ie_ptr oldBssToNew;
}aifg_msg_predecode_bm_HORequired;

typedef struct 
{
	struct{
		BYTE	*ptr;
		BYTE	len;
	}l3Info;
	aifg_ie_ptr chosenChannel;
	aifg_ie_ptr chosenEncrypt;
	aifg_ie_ptr circuitPool;
	aifg_ie_ptr speechVer;
	aifg_ie_ptr cic;
	aifg_ie_ptr lsaId;
}aifg_msg_predecode_bm_HORequestAck;

typedef struct 
{
	aifg_msg_predecode_l3msg	l3msg;
	aifg_ie_ptr cellId;
}aifg_msg_predecode_bm_HOCmd;

typedef struct 
{
	aifg_ie_ptr rrcause;
}aifg_msg_predecode_bm_HOComp;


typedef struct 
{
	aifg_ie_ptr msNum;
	aifg_ie_ptr cellIdList;
	aifg_ie_ptr cellId;
}aifg_msg_predecode_bm_HOCandEnq;

typedef struct 
{
	aifg_ie_ptr msNum;
	aifg_ie_ptr cellId;
}aifg_msg_predecode_bm_HOCandResp;

typedef aifg_msg_predecode_bm_assignFail aifg_msg_predecode_bm_HOFail;

typedef struct 
{
	aifg_ie_ptr periodicity;
	aifg_ie_ptr resrcIndMethod;
	aifg_ie_ptr cellId;
	aifg_ie_ptr extResrcInd;
}aifg_msg_predecode_bm_resrcReq;

typedef struct 
{
	aifg_ie_ptr resrcIndMethod;
	aifg_ie_ptr resrcAvail;
	aifg_ie_ptr cellId;
	aifg_ie_ptr totalResrc;
}aifg_msg_predecode_bm_resrcInd;

typedef struct 
{
	aifg_ie_ptr imsi;
	aifg_ie_ptr tmsi;
	aifg_ie_ptr cellIdList;
	aifg_ie_ptr channelNeeded;
	aifg_ie_ptr eMLPPpri;
}aifg_msg_predecode_bm_paging;

typedef struct 
{ 
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_clearReq;

typedef struct 
{
	aifg_ie_ptr l3HeaderInfo;
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_clearCmd;

typedef struct 
{
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_reset;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr cellId;
	aifg_ie_ptr chosenChannel;
	aifg_ie_ptr chosenEncrypt;
	aifg_ie_ptr speechVer;
	aifg_ie_ptr lsaId;
}aifg_msg_predecode_bm_HOPreformed;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr cellId;
}aifg_msg_predecode_bm_overload;

typedef struct 
{
	aifg_ie_ptr traceType;
	aifg_ie_ptr triggerId;
	aifg_ie_ptr traceRef;
	aifg_ie_ptr transId;
	aifg_ie_ptr mobileId;
	aifg_ie_ptr omcId;
}aifg_msg_predecode_bm_mscInvokeTrace;

typedef struct 
{
	aifg_ie_ptr traceType;
	aifg_ie_ptr forwardInd;
	aifg_ie_ptr triggerId;
	aifg_ie_ptr traceRef;
	aifg_ie_ptr transId;
	aifg_ie_ptr omcId;
}aifg_msg_predecode_bm_bscInvokeTrace;

typedef struct 
{
	aifg_ie_ptr cmInfo2;
	aifg_ie_ptr cmInfo3;
}aifg_msg_predecode_bm_cmUpdate;

typedef struct 
{
	aifg_ie_ptr l3HeaderInfo;
	aifg_ie_ptr encryptInfo;
	aifg_ie_ptr cipherRespMode;
}aifg_msg_predecode_bm_cipherModeCmd;

typedef struct 
{
    aifg_ie_ptr l3MsgCont;
	aifg_ie_ptr chosenEncrypt;
}aifg_msg_predecode_bm_cipherModeComp;

typedef struct 
{
	aifg_ie_ptr cellId;
	aifg_msg_predecode_l3msg l3msg;
	aifg_ie_ptr chosenChannel;
	aifg_ie_ptr lsaIdList;
	aifg_ie_ptr locInfo;
}aifg_msg_predecode_bm_completeL3Info;

typedef struct 
{
	aifg_ie_ptr dlci;
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_sapi_n_rej;

typedef struct 
{
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_HORequiredRej;

typedef struct 
{
	aifg_ie_ptr cic;
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_resetCircuit;

typedef struct 
{
	aifg_ie_ptr cic;
}aifg_msg_predecode_bm_resetCircuitAck;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr cic;
	aifg_ie_ptr cicList;
}aifg_msg_predecode_bm_circuitGrpBlk;

typedef struct 
{
	aifg_ie_ptr cic;
	aifg_ie_ptr cicList;
}aifg_msg_predecode_bm_circuitGrpBlkAck;

typedef struct 
{
	aifg_ie_ptr cic;
	aifg_ie_ptr cicList;
}aifg_msg_predecode_bm_circuitGrpUnblk;

typedef struct 
{
	aifg_ie_ptr cic;
	aifg_ie_ptr cicList;
}aifg_msg_predecode_bm_circuitGrpUnblkAck;

typedef struct 
{
	aifg_ie_ptr cause;
	aifg_ie_ptr diagnostics;
}aifg_msg_predecode_bm_confusion;

typedef struct 
{
	aifg_ie_ptr cic;
	aifg_ie_ptr cicList;
}aifg_msg_predecode_bm_unequipCircuit;

typedef struct 
{
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_cipherModeRej;

typedef struct 
{
	aifg_ie_ptr timeInd;
	aifg_ie_ptr cellId;
	aifg_ie_ptr cellIdList;
	aifg_ie_ptr resrcSit;
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_loadInd;

typedef struct 
{
	aifg_ie_ptr dlci;
}aifg_msg_predecode_bm_suspend;

typedef struct 
{
	aifg_ie_ptr dlci;
}aifg_msg_predecode_bm_resume;

typedef struct 
{
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_changeCircuit;

typedef struct 
{
    aifg_ie_ptr circuitId;
}aifg_msg_predecode_bm_changeCircuitAck;

typedef struct 
{
	aifg_ie_ptr lsaInfo;
}aifg_msg_predecode_bm_lsaInfo;

typedef struct 
{
	aifg_ie_ptr locInfo;
}aifg_msg_predecode_bm_locInfoCmd;

typedef struct 
{
	aifg_ie_ptr locInfo;
	aifg_ie_ptr cause;
}aifg_msg_predecode_bm_locInfoRep;


typedef struct{
	aifg_msg_id			id;
	int					ti;		//ti of the message. used only in dtap message
	aifg_pd				pd;		//Protocol discriminator
	int					aif_port;
	int					app_port;	//port number of upper layer application
	int					cause;	//for release indication
	int					trace_flag; //0 - off, 1 - on
	int					tg_id;	//trunk group id

	union{
		//BSSMAP
		aifg_msg_predecode_bm_assignReq				assignReq;			//assign request
		aifg_msg_predecode_bm_assignComp			assignComplete;		//assign complete
		aifg_msg_predecode_bm_assignFail			assignFailure;		//assign failure
		aifg_msg_predecode_bm_block					block;				//block
		aifg_msg_predecode_bm_blockAck				blockAck;			//block ack
		aifg_msg_predecode_bm_unBlock				unblock;			//unblock
		aifg_msg_predecode_bm_unBlockAck			unBlockAck;			//unblock ack
		aifg_msg_predecode_bm_HORequest				HORequest;			//Handover request
		aifg_msg_predecode_bm_HORequired			HORequired;			//HANDOVER REQUIRED
		aifg_msg_predecode_bm_HORequestAck			HORequestAck;		//Handover request ack
		aifg_msg_predecode_bm_HOCmd					HOCmd;				//HANDOVER COMMAND
		aifg_msg_predecode_bm_HOComp				HOComplete;			//HANDOVER COMPLETE
		aifg_msg_predecode_bm_HOCandEnq				HOCandEnq;			//HANDOVER CANDIDATE ENQUIRE
		aifg_msg_predecode_bm_HOCandResp			HOCandResp;			//HANDOVER CANDIDATE RESPONSE
		aifg_msg_predecode_bm_HOFail				HOFailure;			//HANDOVER FAILURE
		aifg_msg_predecode_bm_resrcReq				resrcReq;			//RESOURCE REQUEST
		aifg_msg_predecode_bm_resrcInd				resrcInd;			//RESOURCE INDICATION
		aifg_msg_predecode_bm_paging				paging;				//PAGING
		aifg_msg_predecode_bm_clearReq				clearReq;			//CLEAR REQUEST
		aifg_msg_predecode_bm_clearCmd				clearCmd;			//CLEAR COMMAND
		aifg_msg_predecode_bm_reset					reset;				//RESET
		aifg_msg_predecode_bm_HOPreformed			HOPerformed;		//HANDOVER PERFORMED
		aifg_msg_predecode_bm_overload				overload;			//OVERLOAD
		aifg_msg_predecode_bm_mscInvokeTrace		mscTrace;			//MSC INVOKE TRACE
		aifg_msg_predecode_bm_bscInvokeTrace		bscTrace;			//BSC INVOKE TRACE
		aifg_msg_predecode_bm_cmUpdate				cmUpdate;			//CLASSMARK UPDATE
		aifg_msg_predecode_bm_cipherModeCmd			cipherModeCmd;		//CIPHER MODE COMMAND
		aifg_msg_predecode_bm_cipherModeComp		cipherModeComp;		//CIPHER MODE COMPLETE
		aifg_msg_predecode_bm_completeL3Info		completeL3Info;		//COMPLETE LAYER 3 INFORMATION
		aifg_msg_predecode_bm_sapi_n_rej			sapi_n_rej;			//SAPI "n" REJECT
		aifg_msg_predecode_bm_HORequiredRej			HORequiredRej;		//HANDOVER REQUIRED REJECT
		aifg_msg_predecode_bm_resetCircuit			resetCircuit;		//RESET CIRCUIT
		aifg_msg_predecode_bm_resetCircuitAck		resetCircuitAck;	//RESET CIRCUIT ACK
		aifg_msg_predecode_bm_circuitGrpBlk			ccGroupBlock;		//CIRCUIT GROUP BLOCK
		aifg_msg_predecode_bm_circuitGrpBlkAck		ccGroupBlockAck;	//CIRCUIT GROUP BLOCK ACK
		aifg_msg_predecode_bm_circuitGrpUnblk		ccGroupUnblock;		//CIRCUIT GROUP UNBLOCK
		aifg_msg_predecode_bm_circuitGrpUnblkAck	ccGroupUnblockAck;	//CIRCUIT GROUP UNBLOCK ACK
		aifg_msg_predecode_bm_confusion				confusion;			//CONFUSION
		aifg_msg_predecode_bm_unequipCircuit		upequipCircuit;		//UNEQUIPPED CIRCUIT
		aifg_msg_predecode_bm_cipherModeRej			cipherModeRej;		//CIPHER MODE REJECT
		aifg_msg_predecode_bm_loadInd				loadInd;			//LOAD INDICATION
		aifg_msg_predecode_bm_suspend				suspend;			//SUSPEND
		aifg_msg_predecode_bm_resume				resume;				//RESUME
		aifg_msg_predecode_bm_changeCircuit			changeCC;			//CHANGE CIRCUIT
		aifg_msg_predecode_bm_changeCircuitAck		changeCCAck;		//CHANGE CIRCUIT ACK		
		aifg_msg_predecode_bm_lsaInfo				lsaInfo;			//LSA INFORMATION
		aifg_msg_predecode_bm_locInfoCmd			locInfoCmd;			//Location Information Command
		aifg_msg_predecode_bm_locInfoRep			locInfoReport;		//Location Information Report

		//DTAP
		aifg_msg_predecode_dt_authReq				authReq;			//Authentication request
		aifg_msg_predecode_dt_authResp				authResp;			//Authentication response
		aifg_msg_predecode_dt_cmReEstReq			cmReEstReq;			//CM Re-establishment request
		aifg_msg_predecode_dt_cmRej					cmRej;				//CM service reject
		aifg_msg_predecode_dt_abort					abort;				//Abort
		aifg_msg_predecode_dt_cmReq					cmReq;				//CM service request
		aifg_msg_predecode_dt_idReq					idReq;				//Identity request
		aifg_msg_predecode_dt_idResp				idResp;				//Identity response
		aifg_msg_predecode_dt_imsiDetachInd			imsiDetach;			//IMSI detach indication
		aifg_msg_predecode_dt_luAccept				luAccept;			//Location updating accept
		aifg_msg_predecode_dt_luReject				luReject;			//Location updating reject
		aifg_msg_predecode_dt_LURequest				luRequest;			//Location updating request
		aifg_msg_predecode_dt_mmInfo				mmInfo;				//MM information
		aifg_msg_predecode_dt_mmStatus				mmStatus;			//MM Status
		aifg_msg_predecode_dt_tmsiReallocCmd		tmsiReallocCmd;		//TMSI reallocation command
		aifg_msg_predecode_dt_alert					alert;				//Alert
		aifg_msg_predecode_dt_callConfirm			callConfirm;		//Call confirmed
		aifg_msg_predecode_dt_callProceed			callProceed;		//Call proceeding
		aifg_msg_predecode_dt_congestCtrl			congestCtrl;		//Congestion control
		aifg_msg_predecode_dt_connect				connect;			//Connect
		aifg_msg_predecode_dt_disconnect			disconnect;			//Disconnect
		aifg_msg_predecode_dt_emergSetup			eSetup;				//Emergency Setup
		aifg_msg_predecode_dt_facility				facility;			//Facility
		aifg_msg_predecode_dt_holdRej				holdRej;			//Hold Reject
		aifg_msg_predecode_dt_modify				modify;				//Modify
		aifg_msg_predecode_dt_modifyComp			modifyComplete;		//Modify complete
		aifg_msg_predecode_dt_modifyRej				modifyRej;			//Modify Reject
		aifg_msg_predecode_dt_notify				notify;				//Notify
		aifg_msg_predecode_dt_progress				progress;			//Progress
		aifg_msg_predecode_dt_release				release;			//Release
		aifg_msg_predecode_dt_releaseComp			releaseComp;		//Release complete
		aifg_msg_predecode_dt_retieveRej			retrieveRej;		//Retrieve Reject
		aifg_msg_predecode_dt_setup					setup;				//Setup
		aifg_msg_predecode_dt_startDTMF				startDTMF;			//Start DTMF
		aifg_msg_predecode_dt_startDTMFAck			startDTMFAck;		//Start DTMF Ack
		aifg_msg_predecode_dt_startDTMFRej			startDTMFRej;		//Start DTMF Rej
		aifg_msg_predecode_dt_status				status;				//Status
		aifg_msg_predecode_dt_userInfo				userInfo;			//User information
		aifg_msg_predecode_dt_facilitySS			facilitySS;			//Facility SS
		aifg_msg_predecode_dt_register				registerSS;			//Register
		aifg_msg_predecode_dt_releaseCompSS			releaseCompSS;		//Release complete SS
		aifg_msg_predecode_dt_rpData				rpData;				//RP DATA
		aifg_msg_predecode_dt_rpSMMA				rpSMMA;				//RP SMMA
		aifg_msg_predecode_dt_rpAck					rpAck;				//RP ACK
		aifg_msg_predecode_dt_rpError				rpError;			//RP ERROR

		//for transparently DTAP message transfer in BSC
		struct {
			BYTE	*ptr;
			BYTE	len;
		}dtap_msg;
	}msg;
}aifg_msg_pre_decoded;

#endif

