#ifndef _CAP_HEAD
#define _CAP_HEAD

#ifndef _SRF_RELEVANT
#define _SRF_RELEVANT
#endif

#define CAP_FLAG								0x8a

#ifndef MAX_ACN_LEN
#define MAX_ACN_LEN								TCAP_ACN_LEN
#endif

#define TV_SSF									100
#define TV_Wait_Open							TV_SSF//1s
#define TV_Wait_Continue						(TV_SSF * 5)//5s
#define TV_Wait_Request							(TV_SSF * 10)//10s
#define TV_Non_User_Interaction					(TV_SSF * 30)//30s
#define TV_Reset								TV_SSF
#define TV_Interaction							(TV_SSF * 10)//10s
#define TV_TCE                                                          12*(TV_SSF*10)
#define TV_Pending								(TV_SSF * 1/2)

#define ONE_SECOND_TICKS						TV_SSF
#define WTRESPONSE_TIMER						(10*ONE_SECOND_TICKS)   // 10s
#define WTSSF_TIMER								(11*ONE_SECOND_TICKS)   // 11s

#define minAChBillingChargingLength				5
#define maxAChBillingChargingLength				177
#define minAttributesLength						2
#define maxAttributesLength						10
#define maxBearerCapabilityLength				11
#define minCallResultLength						12
#define maxCallResultLength						24
#define minCalledPartyBCDNumberLength			1
#define maxCalledPartyBCDNumberLength			41
#define minCalledPartyNumberLength				3
#define maxCalledPartyNumberLength				12
#define minCallingPartyNumberLength				2
#define maxCallingPartyNumberLength				10
#define minCauseLength							2
#define maxCauseLength							2
#define minDigitsLength							2
#define maxDigitsLength							16
#define minFCIBillingChargingDataLength			1
#define maxFCIBillingChargingDataLength			40
#define minFCIBillingChargingLength				5
#define maxFCIBillingChargingLength				49
#define minGenericNumberLength					3
#define maxGenericNumberLength					11
#define minIPSSPCapabilitiesLength				1
#define maxIPSSPCapabilitiesLength				4
#define minLocationNumberLength					2
#define maxLocationNumberLength					10
#define minMessageContentLength					1
#define maxMessageContentLength					127
#define minOriginalCalledPartyIDLength			2
#define maxOriginalCalledPartyIDLength			10
#define minRedirectingPartyIDLength				2
#define maxRedirectingPartyIDLength				10
#define minScfIDLength							2
#define maxScfIDLength							10
#define minSCIBillingChargingLength				4
#define maxSCIBillingChargingLength				69
#define minTimeAndTimezoneLength				8
#define maxTimeAndTimezoneLength				8
#define numOfBCSMEvents							10
#define numOfExtensions							10
#define numOfGenericNumbers						5
#define numOfInfoItems							4
#define numOfMessageIDs							5

#define maxIMSILength							8
#define maxISDNAddressLength					9
#define maxcallReferenceNumberLength			8
#define numOfSMSEvents							10
#define MAX_EDP_NUM								(18+1)
#define MAX_DP_NUM								32
#define CAP_CONTENT_LEN							256

//Operation Code
#define CAP_MSG_TYPE							CAP_FLAG

#define CAP_O_OPEN								0xff
#define CAP_O_END								0xfe
#define CAP_O_UABORT							0xfd
#define CAP_O_PABORT							0xfc
#define CAP_O_NOTICE							0xfb
#define CAP_O_DELIMETER						0xfa
#define CAP_O_ERROR								0xf0
#define CAP_O_LINK								0xef
#define CAP_O_REFUSE_AC						0xE0
#define CAP_O_AC_ERROR							0xE1
#define CAP_OC_Release							0xfe
#define CAP_OC_Error							0xf0

#define CAP_OC_InitialDP						0
#define CAP_OC_AssistRequestInstructions		16
#define CAP_OC_EstablishTemporaryConnection		17
#define CAP_OC_DisconnectForwardConnection		18
#define CAP_OC_ConnectToResource				19
#define CAP_OC_Connect							20
#define CAP_OC_ReleaseCall						22
#define CAP_OC_RequestReportBCSMEvent			23
#define CAP_OC_EventReportBCSM					24
#define CAP_OC_Continue							31
#define CAP_OC_ResetTimer						33
#define CAP_OC_FurnishChargingInformation		34
#define CAP_OC_ApplyCharging					35
#define CAP_OC_ApplyChargingReport				36
#define CAP_OC_CallInformationReport			44
#define CAP_OC_CallInformationRequest			45
#define CAP_OC_SendChargingInformation			46
#define CAP_OC_PlayAnnouncement					47
#define CAP_OC_PromptAndCollectUserInformation  48
#define CAP_OC_SpecializedResourceReport		49
#define CAP_OC_Cancel							53
#define CAP_OC_ActivityTest						55
#define CAP_OC_ApplyWarningTone					128     //self define
#define CAP_OC_CCF_Continue				 		129     //self define

#define CAP_OC_InitialDPSMS						60
#define CAP_OC_FurnishChargingInformationSMS	61
#define CAP_OC_ConnectSMS						62
#define CAP_OC_RequestReportSMSEvent			63
#define CAP_OC_EventReportSMS					64
#define CAP_OC_ContinueSMS						65
#define CAP_OC_ReleaseSMS						66
#define CAP_OC_ResetTimerSMS					67

#ifdef	_SRF_RELEVANT
//CAP Operation Type
#define CAP_REQUEST								0x01
#define CAP_INDICATE							0x02
#define CAP_RESPONSE							0x03
#define CAP_CONFIRM								0x04
#endif

/*      defined for VPS interface       */
#define CAP_OC_VPSOprRequest					0xb0
#ifndef _SRF_RELEVANT
#define	CAP_OC_PlayAnnouncement					0xb1
#endif

#define maxVPSCallingLen						8
#define maxVPSCalledLen							16
#define maxVPSInfoLen							64

#define CAP_ACN_VPSREQUEST						0x80

#endif
