
/************************************************/
/*Title:        smsmsg.h                            */
/*Descr:        CAP-DataTypes(ETSI TS 101046 6.3)   */
/*Author:       Liang Hanxi                         */
/*Create:       2002-9-11                           */
/*Modify:                                       */

/************************************************/

#ifndef _CAP_MESSAGE
#define _CAP_MESSAGE

#ifndef _SRF_RELEVANT
#define _SRF_RELEVANT
#endif

#define check_bit(flag,pos)		((flag & (1<<pos))==(1<<pos))
#define set_bit(flag,pos)		(flag=flag | (1<<pos))

enum _CAP_ERROR
{
     CAP_ERR_TIMEOUT = 0x80,
     CAP_ERR_CANCELED = 0,
     CAP_ERR_CANCEL_FAILED = 1,
     CAP_ERR_ETC_FAILED = 3,
     CAP_ERR_IMPROPER_CALLER_RESPONSE = 4,
     CAP_ERR_MISSING_CUSTOMER_RECORD = 6,
     CAP_ERR_MISSING_PARAMETER = 7,
     CAP_ERR_PARAMETER_OUT_OF_RANGE = 8,
     CAP_ERR_REQUESTED_INFO_ERROR = 10,
     CAP_ERR_SYSTEM_FAILURE = 11,
     CAP_ERR_TASK_REFUSED = 12,
     CAP_ERR_UNAVAILABLE_RESOURCE = 13,
     CAP_ERR_UNEXPECTED_COMPONENT_SEQ = 14,
     CAP_ERR_UNEXPECTED_DATA_VALUE = 15,
     CAP_ERR_UNEXPECTED_PARAMETER = 16,
     CAP_ERR_UNKNOWN_LEGID = 17,
};
//CAP_ERROR;

enum _CAP_CAUSE
{
     UNALLOCATED_NUMBER = 0x8081,
     NO_ROUTE = 0x8083,
     NORMAL_CLEARING = 0x8090,
     USER_BUSY = 0x8091,
     NO_USER_RESPONDING = 0x8092,
     NO_ANSWER = 0x8093,
     CALL_REJECTED = 0x8095,
     NUMBER_CHANGED = 0x8096,
     DESTINATION_OUT_OF_ORDER = 0x809B,
     ADDRESS_INCOMPLETE = 0x809C,
     FACILITY_REJECTED = 0x809D,
     NORMAL_UNSPECIFIED = 0x809F,
     NO_CIRCUIT_AVAILABLE = 0x80A2,
     NETWORK_OUT_OF_ORDER = 0x80A6,
     TEMPORARY_FAILURE = 0x80A9,
     SWITCHING_EQUIPMENT_CONGESTION = 0x80AA,
     REQUESTED_CHANNEL_NOT_AVAILBALE = 0x80AC,
     RESOURCE_UNAVAILABLE = 0x80AF,
     INCOMING_CALLS_BARRED = 0x80B3,
     BEARER_CAPABILITY_NOT_AUTHORIZED = 0x80B5,
     BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 0x80B6,
     SERVICE_NOT_AVAILABLE = 0x80BF,
     BEARER_CAPABILITY_NOT_IMPLEMENTED = 0x80C1,
     SERVICE_NOT_IMPLEMENTED = 0x80CF,
     USER_NOT_MEMBER_OF_CUG = 0x80D3,
     IMCOMPATIBLE_DESTINATION = 0x80D4,
     INVALID_MESSAGE = 0x80DF,
     RECOVERY_ON_TIMER_EXPIRY = 0x80E6,
     PROTOCOL_ERROR = 0x80EF,
     INTERWORKING_UNSPECIFIED = 0x80FF,
};
//CAP_CAUSE;

/*************************************/
/*InitialDP-------------------------> */

/*************************************/
typedef enum CapEventTypeBCSM
{
     capp_collectedInfo = 2,
     capp_routeSelectFailure = 4,
     capp_oBusy = 5,
     capp_oCalledPartyBusy = 5,
     capp_oNoAnswer = 6,
     capp_oAnswer = 7,
     capp_oDisconnect = 9,
     capp_oAbandon = 10,
     capp_termAttemptAuthorized = 12,
     capp_tBusy = 13,
     capp_tNoAnswer = 14,
     capp_tAnswer = 15,
     capp_tDisconnect = 17,
     capp_tAbandon = 18,
     //self define==>
     Int_Rel = 24,
     capp_activetest = 25,
     Int_TCE = 26,
     Int_ETC_Failed = 27,
     Int_TC_Released = 28,
     Int_SRFConnected = 29,
     Int_CTR_Failed = 30,
     Int_SRFReleased = 31
}
CapEventTypeBCSM;

typedef enum CapNotReachableReason
{
     capp_msPurged = 0,
     capp_imsiDetached = 1,
     capp_restrictedArea = 2,
     capp_notRegistered = 3
}
CapNotReachableReason;

typedef enum CapCriticalityType
{
     capp_ignore = 0,
     capp_abort = 1
}
CapCriticalityType;

typedef union CapBearerCapability
{                               //CAP-DataTypes
     u8   bearerCap[maxBearerCapabilityLength + 1];
}
CapBearerCapability;

typedef struct CapExtensionField
{                               //CAP-DataTypes
     u32  type;
     CapCriticalityType criticality;
     u8  *value;
}
CapExtensionField;

typedef union CapSubscriberState
{                               //MAP-MS-DataTypes
     u8   assumedIdle;
     u8   camelBusy;
     CapNotReachableReason netDetNotReachable;
     u8   notProvidedFromVLR;
}
CapSubscriberState;

typedef union CapCellIdOrLAI
{                               //MAP-CH-DataTypes                      
     u8   cellIdFixedLength[7 + 1];
     u8   laiFixedLength[5 + 1];
}
CapCellIdOrLAI;

typedef struct CapLocationInformation
{                               //MAP-MS-DataTypes
     u32  optional_flag;
     int  ageOfLocationInformation;
     u8   geographicalInformation[8 + 1];
     u8   vlr_number[maxISDNAddressLength + 1];
     u8   locationNumber[maxLocationNumberLength + 1];
     u8   cellIdOrLAI_ch;
     CapCellIdOrLAI cellIdOrLAI;
}
CapLocationInformation;

typedef union CapExt_BasicServiceCode
{                               //MAP-CommonDataTypes
     u8   ext_BearerService[5 + 1];
     u8   ext_Teleservice[5 + 1];
}
CapExt_BasicServiceCode;

typedef struct CapNACarrierInformation
{                               //CAP-DataTypes
     u8   naCarrierId[3 + 1];
     u8   naCICSelectionType;
}
CapNACarrierInformation;

typedef struct CapInitialDPArgExtension
{
     u32  optional_flag;
     CapNACarrierInformation naCarrierInformation;
     u8   gmscAddress[9 + 1];
}
CapInitialDPArgExtension;

typedef struct CapInitialDP     //V1 GSM 09.78 18 TS 101 046 V5.0.1 Page 19 //GSM 09.78 version 7.1.0 (2000-07) Page 37
{
     int  serviceKey;           /*tag 0 */
     u32  optional_flag;
     u8   calledPartyNumber[maxCalledPartyNumberLength + 1];    /*Version 1 0[0x01],2 *//*Version 2 *//*0 */
     u8   callingPartyNumber[maxCallingPartyNumberLength + 1];  /*Version 1 1[0x02],3 *//*Version 2 *//*1 */
     u8   callingPartysCategory;        /*Version 1 2[0x04],5 *//*Version 2 *//*2 */
     u8   iPSSPCapabilities[maxIPSSPCapabilitiesLength + 1];    /*Version 2 *//*3 */
     u8   locationNumber[maxLocationNumberLength + 1];  /*Version 1 3[0x08],10 *//*Version 2 *//*4 */
     u8   originalCalledPartyID[maxOriginalCalledPartyIDLength + 1];    /*Version 1 4[0x10],12 *//*Version 2 *//*5 */
     //      CapExtensionField                       extensions[numOfExtensions];                    /*Version 1 5[0x20],15*/                /*Version 2*//*6*/
     u8   highLayerCompatibility[2 + 1];        /*Version 1 6[0x40],23 *//*Version 2 *//*7 */
     u8   additionalCallingPartyNumber[maxDigitsLength + 1];    /*Version 1 7[0x80],25 *//*Version 2 *//*8 */
     CapBearerCapability bearerCapability;      /*Version 1 8[0x100],27 *//*Version 2 *//*9 */
     CapEventTypeBCSM eventTypeBCSM;    /*Version 1 9[0x200],28 *//*Version 2 *//*10 */
     u8   redirectingPartyID[maxRedirectingPartyIDLength + 1];  /*Version 1 10[0x400],29 *//*Version 2 *//*11 */
     u8   redirectionInformation[2 + 1];        /*Version 1 11[0x800],30 *//*Version 2 *//*12 */
     u8   iMSI[maxIMSILength + 1];      /*Version 1 12[0x1000],50 *//*Version 2 *//*13 */
     u8   subscriberState_ch;
     CapSubscriberState subscriberState;        /*Version 1 13[0x2000],51 *//*Version 2 *//*14 */
     CapLocationInformation locationInformation;        /*Version 1 14[0x4000],52 *//*Version 2 *//*15 */
     u8   ext_basicServiceCode_ch;
     CapExt_BasicServiceCode ext_basicServiceCode;      /*Version 1 15[0x8000],53 *//*Version 2 *//*16 */
     u8   callReferenceNumber[maxcallReferenceNumberLength + 1];        /*Version 1 16[0x10000],54 *//*Version 2 *//*17 */
     
     u8   mscAddress[maxISDNAddressLength + 1]; /*Version 2 *//*18 */
     u8   calledPartyBCDNumber[maxCalledPartyBCDNumberLength + 1];      /*Version 2 *//*19 */
     u8   timeAndTimezone[maxTimeAndTimezoneLength + 1];        /*Version 2 *//*20 */
     u8   gsm_ForwardingPending;        /*Version 2 *//*21 */
     CapInitialDPArgExtension initialDPArgExtension;    /*Version 2 *//*22 */
}
CapInitialDP, *PCapInitialDP;

/*++++++++++++++++++++++++++    */
/*Cancel-------------->                 */
/*++++++++++++++++++++++++++    */
typedef struct CapCancel
{
     u8   ch;                   //ch=0:invokeID;ch=1:allRequest
     u8   invokeID;             //ch=0
     u8   allRequest;           //ch=1
}
CapCancel, *PCapCancel;

/*++++++++++++++++++++++++++++++++++++++ */
/*ApplyCharging-------------->          */
/*++++++++++++++++++++++++++++++++++++++ */
typedef struct CapReleaseIfDurationExceeded
{
     u8   tone;
}
CapReleaseIfDurationExceeded;

typedef struct CapACBCC
{                               //aChbillingChargingCharacteristics
     int  maxCallPeriodDuration;
     u32  optional_flag;
     CapReleaseIfDurationExceeded releaseIfdurationExceeded;    /*0 */
     int  tariffSwitchInterval; /*1 */
}
CapACBCC;

typedef struct CapApplyCharging
{
     u8   partyToCharge;
     CapACBCC ACBCC;
}
CapApplyCharging, *PCapApplyCharging;

/*************************************/
/*Apply Charging Report-------------> */

/*************************************/
typedef struct CapTimeIfTariffSwitch
{
     int  timeSinceTariffSwitch;
     int  tariffSwitchInterval;
}
CapTimeIfTariffSwitch;

typedef union CAP_TimeInformation
{
     int  timeIfNoTariffSwitch;
     CapTimeIfTariffSwitch timeIfTariffSwitch;
}
CapTimeInformation;

typedef struct CAMEL_CallResult
{
     u8   partyToCharge;
     u8   timeInformation_ch;
     CapTimeInformation timeInformation;
     u8   callActive;
}
CAMEL_CallResult;

typedef CAMEL_CallResult CapApplyChargingReport;
typedef CAMEL_CallResult *PCapApplyChargingReport;

/*************************************/
/*Request Report BCSM Event---------> */

/*************************************/
typedef enum CapMonitorMode
{
     capp_interrupted = 0,
     capp_notifyAndContinue = 1,
     capp_transparent = 2
}
CapMonitorMode;

typedef union CapLegID
{
     u8   sendingSideID;
     u8   receivingSideID;
}
CapLegID;

typedef union CapDPSpecificCriteria
{
     int  applicationTimer;
}
CapDPSpecificCriteria;

typedef struct CapBCSMEvent
{
     CapEventTypeBCSM eventTypeBCSM;
     CapMonitorMode monitorMode;
     u32  optional_flag;
     u8   legID_ch;
     CapLegID legID;
     CapDPSpecificCriteria dPSpecificCriteria;
}
CapBCSMEvent;

typedef struct CapRequestReportBCSMEvent
{
     u8   bcsmEvents_num;
     CapBCSMEvent bcsmEvents[numOfBCSMEvents];
     //      ExtensionField                  extensions[numOfExtensions];
}
CapRequestReportBCSMEvent, *PCapRequestReportBCSMEvent;

/*************************************/
/*Event Report BCSM-----------------> */

/*************************************/
typedef struct CapESIBCSM
{                               //EventSpecificInformationBCSM
     u8   infotype;
     //2:route select failure
     //3:oCalledPartyBusy
     //4:oNoAnswer
     //5:oAnswer
     //7:oDisconnect
     //8:tBusy
     //9:tNoAnswer
     //10:tAnswer
     //12:tDisconnect
     u8   cause[maxCauseLength + 1];
     //cause[0] as length,if no cause is provided,cause[0]=0,or cause[0]=maxCauseLength(2)
     u8   callForwarded;
     //Boolean value(1/0)
}
CapESIBCSM;

typedef union CapMiscCallInfo
{
     enum
     {
          capp_request = 0,
          capp_notification = 1
     }
     messageType;
}
CapMiscCallInfo;

typedef struct CapEventReportBCSM
{
     CapEventTypeBCSM eventTypeBCSM;
     u_int optional_flag;
     u8   legID;                /*0 */
     CapESIBCSM eventSpecificInformationBCSM;   /*1 */
     CapMiscCallInfo miscCallInfo;      /*2 */
}
CapEventReportBCSM, *PCapEventReportBCSM;

/*************************************/
/*Furnish Charging Information------> */

/*************************************/
//FCIBCC<==>FCIBillingChargingCharacteristics
typedef struct CAP_CAMEL_FCIBCC
{
     u8   freeFormatData[maxFCIBillingChargingDataLength];
     u8   partyToCharge;
}
CAMEL_FCIBCC;

//CAMEL_FCIBCC FurnishChargingInformationArg;

/*************************************/
/*ReleaseCall-----------------------> */

/*************************************/
typedef struct CapReleaseCall
{
     u8   cause[maxCauseLength + 1];
}
CapReleaseCall, *PCapReleaseCall;

/*************************************/
/*InitialDPSMS----------------------> */

/*************************************/
typedef enum CapEventTypeSMS
{
     capp_smsCollectedInfo = 1,
     capp_osmsFailure = 2,
     capp_osmsSubmitted = 3,
}
CapEventTypeSMS;

typedef struct CapLocationInformationGPRS
{                               //MAP-MS-DataTypes
     u32  optional_flag;
     u8   cellGlobalIdOrServiceAreaIdOrLAI[7 + 1];
     u8   routeingAreaIdentity[7 + 1];
     u8   geographicalInformation[8 + 1];
     u8   sgsn_Number[maxISDNAddressLength + 1];
     u8   selectedLSAIdentity[3 + 1];
     u8   sai_Present;
}
CapLocationInformationGPRS;

typedef struct CapInitialDPSMS
{
     int  serviceKey;
     u32  optional_flag;
     u8   destinationSubscriberNumber[maxCalledPartyBCDNumberLength + 1];       /*0 */
     u8   callingPartyNumber[maxISDNAddressLength + 1]; /*1 */
     CapEventTypeSMS eventTypeSMS;      /*2 */
     u8   iMSI[maxIMSILength + 1];      /*3 */
     CapLocationInformation locationInformation;        /*4 */
     CapLocationInformationGPRS locationInformationGPRS;        /*5 */
     u8   sMSCAddress[maxISDNAddressLength + 1];        /*6 */
     u8   timeAndTimezone[maxTimeAndTimezoneLength + 1];        /*7 */
     u8   tPShortMessageSubmissionInfo; /*8 */
     u8   tPProtocolIdentifier; /*9 */
     u8   tPDataCodingScheme;   /*10 */
     u8   tPValidityPeriod[7 + 1];      /*11 */
}
CapInitialDPSMS, *PCapInitialDPSMS;

/*************************************/
/*Request Report SMS Event---------> */

/*************************************/
typedef struct CapSMSEvent
{
     CapEventTypeSMS eventTypeSMS;
     CapMonitorMode monitorMode;
}
CapSMSEvent;

typedef struct CapRequestReportSMSEvent
{
     u8   sMSEvents_num;
     CapSMSEvent sMSEvents[numOfSMSEvents];
}
CapRequestReportSMSEvent, *PCapRequestReportSMSEvent;

/*************************************/
/*Event Report SMS------------------> */

/*************************************/
typedef enum CapSMSCause
{
     capp_systemFailure = 0,
     capp_unexpectedDataValue = 1,
     capp_facilityNotSupported = 2,
     capp_sMDeliveryFailure = 3,
     releaseFromRadioInterface = 4,
}
CapSMSCause;

typedef struct CapESISMS
{                               //EventSpecificInformationSMS
     u8   infotype;             //0:o-smsFailureSpecificInfo 1:o-smsSubmittedSpecificInfo
     u8   cause_flag;
     CapSMSCause cause;
}
CapESISMS;

typedef struct CapEventReportSMS
{
     CapEventTypeSMS eventTypeSMS;
     u32  optional_flag;
     CapESISMS eventSpecificInformationSMS;     /*0 */
     CapMiscCallInfo miscCallInfo;      /*1 */
}
CapEventReportSMS, *PCapEventReportSMS;

/*************************************/
/*ReleaseSMS------------------------> */

/*************************************/
typedef struct CapReleaseSMS
{
     u8   cause;
}
CapReleaseSMS, *PCapReleaseSMS;

/*************************************/
/*ResetTimerSMS------> */

/*************************************/
typedef enum CapTimerID
{
     Cap_Tssf = 0,
}
CapTimerID;

typedef struct CapResetTimerSMS
{
     CapTimerID timerID;
     u_int timerValue;
}
CapResetTimerSMS;

typedef struct CapVPSRequest
{
     u8   calling_num[maxVPSCallingLen];
     u8   called_num[maxVPSCalledLen];
}
CapVPSRequest;

typedef struct CapVPSPlayAnnounce
{
     u8   info_len;
     u8   send_info[maxVPSInfoLen];
}
CapVPSPlayAnnounce;

/******************************************/

/************** SRF Relevant **************/

/******************************************/
#ifdef _SRF_RELEVANT

/************************/

/**  Common Data Type  **/

/************************/
#if 0
typedef struct CapNACarrierInformation
{
     u32  optional_flag;
     u8   naCarrierId[3];       /*0 */
     u8   naCICSelectionType;   /*1 */
}
CapNACarrierInformation;

typedef struct CapNA_Info
{
     u32  optional_flag;
     CapNACarrierInformation naCarrierInformation;      /*0 */
     u8   naOliInfo;            /*1 */
     u8   naChargeNumber[7 + 1];        /*2 */
}
CapNA_Info;

typedef struct CapResourceAddress
{
     u8   choice_id;
     u8   ipRoutingAddress[maxCalledPartyNumberLength + 1];     /*0,0 */
     u8   none;                 /*1,3 */
}
CapResourceAddress;
#endif

typedef struct CapServiceInteractionIndicatorsTwo
{
     u32  optional_flag;
     u8   bothwayThroughConnectionInd;  /*0,2 */
}
CapServiceInteractionIndicatorsTwo;

typedef struct CapVariablePart
{
     u32  choice_id;
     u32  integer;              /*0,0 */
     u8   number[maxDigitsLength + 1];  /*1,1 */
     u8   time[2];              /*2,2 */
     u8   date[4];              /*3,3 */
     u8   price[4];             /*4,4 */
     u8   signSymbol;	   /*5,,5*/
}
CapVariablePart;

#define MAX_VAR_NUMS	10

typedef struct CapMessageID
{
     u8   choice_id;
     u32  elementaryMessageID;  /*0,0 */
     //      text                                                                            /*1,1*/
     struct CapElementaryMessageIDs
     {
          u8   num;
          u32  elementaryMessageID[numOfMessageIDs];
     }
     elementaryMessageIDs;      /*2,29 */
     struct CapVariableMessage
     {

          u32  elementaryMessageID;                                             /*-,0*/
          struct CapVariableParts
          {
               u8   num;
               CapVariablePart variablePart[MAX_VAR_NUMS];
          }

          variableParts;                                                                /*-,1*/
     }
     variableMessage;           /*3,30 */
}
CapMessageID;

typedef struct CapInbandInfo
{

     CapMessageID messageID;                                    /*-,0*/
     u32  optional_flag;
     int  numberOfRepetitions;  /*0,1 */
     int  duration;             /*1,2 */
     int  interval;             /*2,3 */
}
CapInbandInfo;

typedef struct CapTone
{

     u32  toneID;                                       /*-,0*/
     u32  optional_flag;
     u32  duration;             /*0,1 */
}
CapTone;

typedef struct CapInformationToSend
{
     u8   choice_id;
     CapInbandInfo inbandInfo;  /*0,0 */
     CapTone tone;              /*1,1 */
}
CapInformationToSend;

typedef enum CapErrorTreatment
{
     stdErrorAndInfo = 0,
     help = 1,
     repeatPrompt = 2,
}
CapErrorTreatment;

typedef struct CapCollectedDigits
{

     u8   minimumNbOfDigits;                                                    /*-,0*/

     u8   maximumNbOfDigits;                                                    /*-,1*/
     u32  optional_flag;
     u8   endOfReplyDigit[2 + 1];       /*0,2 */
     u8   cancelDigit[2 + 1];   /*1,3 */
     u8   startDigit[2 + 1];    /*2,4 */
     u8   firstDigitTimeOut;    /*3,5 */
     u8   interDigitTimeOut;    /*4,6 */
     CapErrorTreatment errorTreatment;  /*5,7 */
     u8   interruptableAnnInd;  /*6,8 */
     u8   voiceInformation;     /*7,9 */
     u8   voiceBack;            /*8,10 */
}
CapCollectedDigits;

typedef struct CapCollectedInfo
{
     u8   choice_id;
     CapCollectedDigits collectedDigits;        /*0,0 */
}
CapCollectedInfo;

/************************/

/** Argument Data Type **/

/************************/
typedef struct CapAssistRequestInstructions
{

     u8   correlationID[maxDigitsLength + 1];                                                   /*-,0*/

     u8   iPSSPCapabilities[maxIPSSPCapabilitiesLength + 1];                    /*-,2*/
}
CapAssistRequestInstructions, *PCapAssistRequestInstructions;

typedef struct CapConnect
{
     u8   destinationRoutingAddress[maxCalledPartyNumberLength + 1];                            /*-,0*/
     u32  optional_flag;
     u8   alertingPattern[3];   /*Versinon2 0[0x01],1 */
     u8   originalCalledPartyID[maxOriginalCalledPartyIDLength + 1];    /*Versinon 1 0[0x01],6 *//*Versinon2 1[0x02],6 */
     //      CapExtensionField       extensions[numOfExtensions];                                    /*Versinon 1 1[0x02],10*/                       /*Versinon2 2[0x04],10*/
     u8   callingPartysCategory;        /*Versinon 1 4[0x10],28 *//*Versinon2 3[0x08],28 */
     u8   redirectingPartyID[maxRedirectingPartyIDLength + 1];  /*Versinon 1 5[0x20],29 *//*Versinon2 4[0x10],29 */
     u8   redirectionInformation[2 + 1];        /*Versinon 1 6[0x40],30 *//*Versinon2 5[0x20],30 */
     struct
     {
          u8   num;
          u8   genericNumber[numOfGenericNumbers][maxGenericNumberLength + 1];
     }
     genericNumbers;            /*Versinon2 6[0x40],14 */
     u8   suppressionOfAnnouncement;    /*Versinon 1 7[0x80],55 *//*Versinon2 7[0x80],14 */
     u8   oCSIApplicable;       /*Versinon 1 8[0x100],56 *//*Versinon2 8[0x100],14 */
     //CapNA_Info    na_Info; 
     struct
     {     
	     u8   callingpartyNmuber_len;
	     u8   callingPartyNumber[maxCallingPartyNumberLength];      /*Versinon 1 3[0x08],27 */ 
     }   
     callingpartynum;                                                                                                                                                             /*Versinon2 9[0x200],57*/
}CapConnect, *PCapConnect;

typedef struct CapConnectToResource
{
     //      CapResourceAddress              resourceAddress;                        
     struct
     {
          u8   choice_id;
          u8   ipRoutingAddress[maxCalledPartyNumberLength + 1];        /*0,0 */
          u8   none;            /*1,3 */
     }
     resourceAddress;
     u32  optional_flag;
     //      CapExtensionField       extensions[numOfExtensions];                                            /*0,4*/
     CapServiceInteractionIndicatorsTwo serviceInteractionIndicatorsTwo;        /*1,7 */
}
CapConnectToResource, *PCapConnectToResource;

typedef struct CapDisconnectForwardConnection
{
}
CapDisconnectForwardConnection, *PCapDisconnectForwardConnection;

typedef struct CapEstablishTemporaryConnection
{

     u8   assistingSSPIPRoutingAddress[maxDigitsLength + 1];                                            /*-,0*/
     u32  optional_flag;
     u8   correlationID[maxDigitsLength + 1];   /*0,1 */
     u8   scfID[maxScfIDLength + 1];    /*1,3 */
     //      CapExtensionField       extensions[numOfExtensions];                                            /*2,4*/
     CapServiceInteractionIndicatorsTwo serviceInteractionIndicatorsTwo;        /*3,7 */
     //      CapNA_Info      na_Info;                                                                                                        /*4,50*/
}
CapEstablishTemporaryConnection, *PCapEstablishTemporaryConnection;

typedef struct CapPlayAnnouncement
{

     CapInformationToSend informationToSend;                                    /*-,0*/
     u32  optional_flag;
     u8   disconnectFromIPForbidden;    /*0,1 */
     u8   requestAnnouncementComplete;  /*1,2 */
     //      CapExtensionField       extensions[numOfExtensions];            /*2,3*/
}
CapPlayAnnouncement, *PCapPlayAnnouncement;

typedef struct CapPromptAndCollectUserInformation
{

     CapCollectedInfo collectedInfo;                                            /*-,0*/
     u32  optional_flag;
     u8   disconnectFromIPForbidden;    /*0,1 */
     CapInformationToSend informationToSend;    /*1,2 */
     //      CapExtensionField       extensions[numOfExtensions];    /*2,3*/

     u8   choice_id;

     u8   digitsResponse[maxDigitsLength + 1];  /*-,0*///CapReceivedInformation
}
CapPromptAndCollectUserInformation, *PCapPromptAndCollectUserInformation;

/*typedef union CapReceivedInformation
   {
   u8           digitsResponse[maxDigitsLength+1];
   }CapReceivedInformation; */

typedef struct CapSpecializedResourceReport
{
}
CapSpecializedResourceReport, *PCapSpecializedResourceReport;

#endif

/*************************************/
/*Cap Structure---------------------> */

/*************************************/
typedef struct CapArg
{
     u8   ocode;
     u8   message_flag;
     u16  port_id;
     u16  dialogue_id;
     u8   invoke_id;
     u8   version;
     union
     {
          CapInitialDP initialDPArg;
          CapApplyCharging applyChargingArg;
          CapApplyChargingReport applyChargingReportArg;
          CapRequestReportBCSMEvent requestReportBCSMEventArg;
          CapCancel cancelArg;
          CapEventReportBCSM eventReportBCSMArg;
          CapReleaseCall releaseCallArg;
          CapInitialDPSMS initialDPSMSArg;
          CapRequestReportSMSEvent requestReportSMSEventArg;
          CapEventReportSMS eventReportSMSArg;
          CapReleaseSMS releaseSMSArg;
          CapResetTimerSMS resetTimerArg;
          CapVPSRequest vpsRequest;
          CapVPSPlayAnnounce vpsPlayAnnounce;
          CapAssistRequestInstructions assistRequestInstructionsArg;
          CapConnect connectArg;
          //CapConnect_v1 connectArg_v1;
          CapConnectToResource connectToResourceArg;
          CapDisconnectForwardConnection disconnectForwardConnectionArg;
          CapEstablishTemporaryConnection establishTemporaryConnectionArg;
          CapPlayAnnouncement playAnnouncementArg;
          CapPromptAndCollectUserInformation promptAndCollectUserInformationArg;
          //CapReceivedInformation  receivedInformationArg; // RR of P&C
          CapSpecializedResourceReport specializedResourceReportArg;
     }
     msg_list;
}
CapArg, *PCapArg;

/*
   typedef struct _CAP_Message
   {
   u8                   msgLength[2];           // u80 is the higher part
   u8                   msgServiceCode;         // fixed as 0xAF
   u8                   port_id[3];                     // u8 0 is the higher part,u8 1 is the lower part ,and u8 2 is reserved
   u8                   dialogue_id[3];
   u8                   msgOperaCode;           // message type code ,e.g , InitialDP = 0x00
   u8                   msgOperaType;           // 1/2/3/4 = request, indicate, response, confirm
   u8                   msgContent[CAP_CONTENT_LEN];
   // if the message if cap operation ,then the first u8 of msgContent is invoke id
   }CAP_Message, *PCAP_Message;

   typedef struct DestCriteria
   {
   u8                   DestNumber[maxISDNAddressLength+1];
   u8                   Type;           //0:unknown  1:enable  2:inhibit
   }DestCriteria;

   typedef struct CapCSI
   {
   int                  ServiceKey;
   u8                   SCFAddress[maxISDNAddressLength+1];     
   u8                   DefaultHandle;  //The Default Call Handling indicates whether the call shall be released or 
   //continued as requested in case of error in the gsmSSF to gsmSCF dialogue.
   //0:release 1:continue
   CapEventTypeBCSM     TDP;                    //TDP_R
   //O-CSI:capp_collectedInfo = 2,
   //T-CSI:capp_termAttemptAuthorized = 12,
   u8                   DstNum;
   DestCriteria         DstList[10];    //The DP criteria indicate whether the gsmSSF shall request the gsmSCF for instructions.
   u8                   BSNum;
   u32                  BSCode[5];              //Basic service triggering criteria
   u8                   FWCriteria;             //Forwarding triggering criteria
   //1:enabling 0:inhibiting
   }CapCSI;
 */

#endif
