This commit is contained in:
zhangsz
2025-03-03 11:01:26 +08:00
parent 5f1710dc22
commit dae6fc93f7
1057 changed files with 519829 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
/* CAP message coding/decoding head file */
/* Written by Liu Zhiguo 2003-08-26 */
/* Version 1.0 */
/* ------------------------------------- */
#ifndef _CAP_CODING
#define _CAP_CODING
#ifndef _SRF_RELEVANT
#define _SRF_RELEVANT
#endif
int encSubscriberState(u_char sel, char *tagprefix, CapSubscriberState arg, ASN_BUF * asnbuf);
int decSubscriberState(char *tagprefix, CapSubscriberState * parg, ASN_BUF * asnbuf);
int encExt_BasicServiceCode(u_char sel, char *tagprefix, CapExt_BasicServiceCode arg, ASN_BUF * asnbuf);
int decExt_BasicServiceCode(char *tagprefix, CapExt_BasicServiceCode * parg, ASN_BUF * asnbuf);
int encLocationInformation(char *tagprefix, CapLocationInformation arg, ASN_BUF * asnbuf);
int decLocationInformation(char *tagprefix, CapLocationInformation * parg, ASN_BUF * asnbuf);
int encACBCC(struct CapACBCC arg, char *msgbuf, int maxlen);
int decACBCC(char *msgbuf, int msglen, CapACBCC * parg);
int encLegID(u_char sel, char *tagprefix, CapLegID arg, ASN_BUF * asnbuf);
int decLegID(char *tagprefix, CapLegID * parg, ASN_BUF * asnbuf);
int encESIBCSM(char *tagprefix, CapESIBCSM arg, ASN_BUF * asnbuf);
int decESIBCSM(char *tagprefix, CapESIBCSM * parg, ASN_BUF * asnbuf);
int encLocationInformationGPRS(char *tagprefix, CapLocationInformationGPRS arg, ASN_BUF * asnbuf);
int decLocationInformationGPRS(char *tagprefix, CapLocationInformationGPRS * parg, ASN_BUF * asnbuf);
int encESISMS(char *tagprefix, CapESISMS arg, ASN_BUF * asnbuf);
int decESISMS(char *tagprefix, CapESISMS * parg, ASN_BUF * asnbuf);
#ifdef _SRF_RELEVANT
int encServiceInteractionIndicatorsTwo(char *tagprefix, CapServiceInteractionIndicatorsTwo arg, ASN_BUF * asnbuf);
int decServiceInteractionIndicatorsTwo(char *tagprefix, CapServiceInteractionIndicatorsTwo * parg, ASN_BUF * asnbuf);
int encInformationToSend(char *tagprefix, CapInformationToSend arg, ASN_BUF * asnbuf);
int decInformationToSend(char *tagprefix, CapInformationToSend * parg, ASN_BUF * asnbuf);
int encCollectedInfo(char *tagprefix, CapCollectedInfo arg, ASN_BUF * asnbuf);
int decCollectedInfo(char *tagprefix, CapCollectedInfo * parg, ASN_BUF * asnbuf);
#endif
#endif

View File

@@ -0,0 +1,151 @@
#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

1520
plat/xapp/src/capp/cap_msg.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,876 @@
/************************************************/
/*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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,497 @@
/* CAP public function c file */
/* Written by Liu Zhiguo 2003-08-26 */
/* Version 1.0 */
/* -------------------------------- */
#include "../../../public/src/include/pub_include.h"
#include "../../../sccp/src/include/sccp.h"
#include "../mapp/map_const.h"
#include "../mapp/map_code.h"
#include "../mapp/map_struct.h"
#include "cap_head.h"
void cap_get_sccpadd(struct SCCP_ADDRESS *add_ptr, u8 * data)
{
u8 temp_len;
add_ptr->ip = (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3];
add_ptr->DPC = (data[4] << 24) + (data[5] << 16) + (data[6] << 8) + data[7];
add_ptr->NetID = data[8];
add_ptr->SSN = data[9];
add_ptr->RI = data[10];
add_ptr->GTI = data[11];
add_ptr->TT = data[12];
add_ptr->NP = data[13];
add_ptr->ES = data[14];
add_ptr->NAI = data[15];
add_ptr->len = data[16];
temp_len = (data[16] + 1) / 2;
memcpy(add_ptr->GTAI, data + 17, temp_len);
}
void cap_set_sccpadd(struct SCCP_ADDRESS *add_ptr, u8 * data)
{
u8 temp_len;
data[0] = add_ptr->ip >> 24;
data[1] = add_ptr->ip >> 16;
data[2] = add_ptr->ip >> 8;
data[3] = add_ptr->ip;
data[4] = add_ptr->DPC >> 24;
data[5] = add_ptr->DPC >> 16;
data[6] = add_ptr->DPC >> 8;
data[7] = add_ptr->DPC;
data[8] = add_ptr->NetID;
data[9] = add_ptr->SSN;
data[10] = add_ptr->RI;
data[11] = add_ptr->GTI;
data[12] = add_ptr->TT;
data[13] = add_ptr->NP;
data[14] = add_ptr->ES;
data[15] = add_ptr->NAI;
data[16] = add_ptr->len;
temp_len = (add_ptr->len + 1) / 2;
memcpy(data + 17, add_ptr->GTAI, temp_len);
}
u8 cap_com_ftos(struct MapComSrv_struct *map_com, u8 * data_flow)
{ // common service data flow to structure
u32 aa;
u32 len;
u8 ii;
u8 delimiter_flag = 0;
struct MapOpen_Arg *open_arg;
struct MapOpen_Res *open_res;
struct MapClose_Arg *close_ptr;
struct MapUAbort_Arg *uabrt_ptr;
struct MapPAbort_Arg *pabrt_ptr;
len = (data_flow[0] << 8) + data_flow[1];
if(len < 9) // data flow is too short
return 0;
if(data_flow[2] != CAP_FLAG)
return 0;
map_com->port_id = (data_flow[3] << 8) + data_flow[4];
map_com->dialogue_id = (data_flow[6] << 8) + data_flow[7];
map_com->message_type = data_flow[9];
map_com->message_flag = data_flow[10];
switch (map_com->message_type)
{
case MAP_OPEN:
if(map_com->message_flag == MAP_REQUEST || map_com->message_flag == MAP_INDICATE)
{
open_arg = (MapOpen_Arg *) & map_com->dlg_list.open_arg;
open_arg->acn_data.acn = data_flow[11];
open_arg->acn_data.acn_ver = data_flow[12];
cap_get_sccpadd(&open_arg->peer_add, data_flow + 13);
cap_get_sccpadd(&open_arg->local_add, data_flow + 41);
open_arg->param_flag = 0x0b;
aa = 70;
for(ii = 0; ii < 3; ii++)
{
if(data_flow[aa] == 0x00)
break;
else if(data_flow[aa] == 0x01) // peer reference
{
len = data_flow[aa + 1];
if(len > ISDN_LEN)
return 0;
open_arg->peerref_len = len;
memcpy(open_arg->peer_reference, &data_flow[aa + 2], len);
aa += len + 2;
open_arg->param_flag |= 0x04;
}
else if(data_flow[aa] == 0x02) // local reference
{
len = data_flow[aa + 1];
if(len > ISDN_LEN)
return 0;
open_arg->localref_len = len;
memcpy(open_arg->local_reference, &data_flow[aa + 2], len);
aa += len + 2;
open_arg->param_flag |= 0x10;
}
else if(data_flow[aa] == 0x03) // specific info
{
len = data_flow[aa + 1];
if(len >= MAX_SPCINFO_LEN)
return 0;
open_arg->specific_info.info_len = len;
memcpy(open_arg->specific_info.info_data, &data_flow[aa + 2], len);
open_arg->param_flag |= 0x20;
aa += 2 + len;
}
else if(data_flow[aa] == 0x10)
{
delimiter_flag = 1;
aa += 2;
}
}
}
else if(map_com->message_flag == MAP_RESPONSE || map_com->message_flag == MAP_CONFIRM)
{
open_res = (MapOpen_Res *) & map_com->dlg_list.open_res;
open_res->result = data_flow[11];
open_res->param_flag = 0x08;
aa = 13;
for(ii = 0; ii < 4; ii++)
{
if(data_flow[aa] == 0x00)
break;
else if(data_flow[aa] == 0x01) // acn
{
open_res->acn_data.acn = data_flow[aa + 2];
open_res->acn_data.acn_ver = data_flow[aa + 3];
aa += 4;
open_res->param_flag |= 0x01;
}
else if(data_flow[aa] == 0x02) // specific info
{
len = data_flow[aa + 1];
if(len >= MAX_SPCINFO_LEN)
return 0;
open_res->specific_info.info_len = len;
memcpy(open_res->specific_info.info_data, &data_flow[aa + 2], len);
open_res->param_flag |= 0x02;
aa += 2 + len;
}
else if(data_flow[aa] == 0x03) // refuse reason
{
open_res->refuse_reason = data_flow[aa + 2];
open_res->param_flag |= 0x10;
aa += 3;
}
else if(data_flow[aa] == 0x04) // provider error
{
open_res->provider_error = data_flow[aa + 2];
open_res->param_flag |= 0x20;
aa += 3;
}
else if(data_flow[aa] == 0x10)
{
delimiter_flag = 1;
aa += 2;
}
}
}
else
return 0;
break;
case MAP_CLOSE:
close_ptr = (MapClose_Arg *) & map_com->dlg_list.close_arg;
close_ptr->release_method = data_flow[11];
close_ptr->param_flag = 0x01;
if(data_flow[13] == 0x01)
{
len = data_flow[14];
if(len >= MAX_SPCINFO_LEN)
return 0;
close_ptr->specific_info.info_len = len;
memcpy(close_ptr->specific_info.info_data, &data_flow[15], len);
close_ptr->param_flag |= 0x02;
}
break;
case MAP_U_ABORT:
uabrt_ptr = (MapUAbort_Arg *) & map_com->dlg_list.uabort_arg;
uabrt_ptr->user_reason = data_flow[11];
uabrt_ptr->param_flag = 0x01;
aa = 13;
for(ii = 0; ii < 2; ii++)
{
if(data_flow[aa] == 0)
break;
else if(data_flow[aa] == 0x01) // diagnostic flag
{
uabrt_ptr->diag_info = data_flow[aa + 2];
uabrt_ptr->param_flag |= 0x02;
aa += 3;
}
else if(data_flow[aa] == 0x02) // specific info
{
len = data_flow[aa + 1];
if(len >= MAX_SPCINFO_LEN)
return 0;
uabrt_ptr->specific_info.info_len = len;
memcpy(uabrt_ptr->specific_info.info_data, &data_flow[aa + 2], len);
uabrt_ptr->param_flag |= 0x04;
aa += 2 + len;
}
}
break;
case MAP_P_ABORT:
pabrt_ptr = (MapPAbort_Arg *) & map_com->dlg_list.pabort_arg;
pabrt_ptr->provider_reason = data_flow[11];
pabrt_ptr->source = data_flow[12];
pabrt_ptr->param_flag = 0x03;
break;
case MAP_NOTICE:
map_com->dlg_list.notice_arg.problem = data_flow[11];
map_com->dlg_list.notice_arg.param_flag = 0x01;
break;
case MAP_DELIMITER:
case MAP_LINK:
break;
default:
return 0;
break;
}
if(delimiter_flag == 1)
return 2;
else
return 1;
}
void cap_com_stof(struct MapComSrv_struct *com_ptr, u8 * data_flow, u8 delimiter_flag)
{ // transfer common structure to data flow
u32 ii;
u32 len;
struct MapOpen_Arg *open_arg;
struct MapOpen_Res *open_res;
struct MapClose_Arg *close_arg;
struct MapUAbort_Arg *uabrt_arg;
data_flow[2] = CAP_FLAG;
data_flow[3] = com_ptr->port_id >> 8;
data_flow[4] = com_ptr->port_id;
data_flow[6] = com_ptr->dialogue_id >> 8;
data_flow[7] = com_ptr->dialogue_id;
data_flow[9] = com_ptr->message_type;
data_flow[10] = com_ptr->message_flag;
ii = 11;
switch (com_ptr->message_type)
{
case MAP_OPEN:
if(com_ptr->message_flag == MAP_INDICATE || com_ptr->message_flag == MAP_REQUEST)
{
open_arg = (MapOpen_Arg *) & com_ptr->dlg_list.open_arg;
data_flow[ii++] = open_arg->acn_data.acn;
data_flow[ii++] = open_arg->acn_data.acn_ver;
cap_set_sccpadd(&open_arg->peer_add, data_flow + ii);
ii += 28;
cap_set_sccpadd(&open_arg->local_add, data_flow + ii);
ii += 28;
data_flow[ii++] = 1; // optional point
if((open_arg->param_flag & 0x04)) // has peer reference address
{
data_flow[ii++] = 0x01;
len = open_arg->peerref_len;
data_flow[ii++] = len;
memcpy(data_flow + ii, open_arg->peer_reference, len);
ii += len;
}
if((open_arg->param_flag & 0x10)) // has local reference address
{
data_flow[ii++] = 0x02;
len = open_arg->localref_len;
data_flow[ii++] = len;
memcpy(data_flow + ii, open_arg->local_reference, len);
ii += len;
}
if((open_arg->param_flag & 0x20))
{
data_flow[ii++] = 0x03;
len = open_arg->specific_info.info_len;
data_flow[ii++] = len;
memcpy(data_flow + ii, open_arg->specific_info.info_data, len);
ii += len;
}
if(delimiter_flag == 1)
{
data_flow[ii++] = 0x10;
data_flow[ii++] = 0x00;
}
data_flow[ii++] = 0x00;
}
else if(com_ptr->message_flag == MAP_RESPONSE || com_ptr->message_flag == MAP_CONFIRM)
{
open_res = (MapOpen_Res *) & com_ptr->dlg_list.open_res;
data_flow[ii++] = open_res->result;
data_flow[ii++] = 0x01; // optional point
if((open_res->param_flag & 0x01)) // has ACN
{
data_flow[ii++] = 0x01;
data_flow[ii++] = 2;
data_flow[ii++] = open_res->acn_data.acn;
data_flow[ii++] = open_res->acn_data.acn_ver;
}
if((open_res->param_flag & 0x02)) // has specific info
{
data_flow[ii++] = 0x02;
len = open_res->specific_info.info_len;
data_flow[ii++] = len;
memcpy(data_flow + ii, open_res->specific_info.info_data, len);
ii += len;
}
if((open_res->param_flag & 0x10)) // has refuse reason
{
data_flow[ii++] = 0x03;
data_flow[ii++] = 1;
data_flow[ii++] = open_res->refuse_reason;
}
if((open_res->param_flag & 0x20)) // has provider error
{
data_flow[ii++] = 0x04;
data_flow[ii++] = 1;
data_flow[ii++] = open_res->provider_error;
}
if(delimiter_flag == 1)
{
data_flow[ii++] = 0x10;
data_flow[ii++] = 0x00;
}
data_flow[ii++] = 0x00;
}
break;
case MAP_CLOSE:
close_arg = (MapClose_Arg *) & com_ptr->dlg_list.close_arg;
data_flow[ii++] = close_arg->release_method;
data_flow[ii++] = 0x01; // optional point
if((close_arg->param_flag & 0x02)) // has specific info
{
data_flow[ii++] = 0x01;
len = close_arg->specific_info.info_len;
data_flow[ii++] = len;
memcpy(data_flow + ii, close_arg->specific_info.info_data, len);
ii += len;
}
data_flow[ii++] = 0x00;
break;
case MAP_U_ABORT:
uabrt_arg = (MapUAbort_Arg *) & com_ptr->dlg_list.uabort_arg;
data_flow[ii++] = uabrt_arg->user_reason;
data_flow[ii++] = 0x01; // optional point
if((uabrt_arg->param_flag & 0x02))
{
data_flow[ii++] = 0x01;
data_flow[ii++] = 1;
data_flow[ii++] = uabrt_arg->diag_info;
}
if((uabrt_arg->param_flag & 0x04)) // has specific info
{
data_flow[ii++] = 0x02;
len = uabrt_arg->specific_info.info_len;
data_flow[ii++] = len;
memcpy(data_flow + ii, uabrt_arg->specific_info.info_data, len);
ii += len;
}
data_flow[ii++] = 0x00;
break;
case MAP_P_ABORT:
data_flow[ii++] = com_ptr->dlg_list.pabort_arg.provider_reason;
data_flow[ii++] = com_ptr->dlg_list.pabort_arg.source;
break;
case MAP_NOTICE:
data_flow[ii++] = com_ptr->dlg_list.notice_arg.problem;
break;
default:
break;
}
ii -= 2;
data_flow[0] = ii >> 8;
data_flow[1] = ii;
}
u8 cap_opr_ftos(struct MapOprData_struct *opr_ptr, u8 * data_flow)
{ // transfer opration data flow to structure
u32 aa;
u32 len;
u8 ii;
u8 delimiter_flag = 0;
len = (data_flow[0] << 8) + data_flow[1];
if(len < 10)
return 0;
if(data_flow[2] != CAP_FLAG)
return 0;
opr_ptr->port_id = (data_flow[3] << 8) + data_flow[4];
opr_ptr->dialogue_id = (data_flow[6] << 8) + data_flow[7];
opr_ptr->message_type = data_flow[9];
opr_ptr->message_flag = data_flow[10];
opr_ptr->invoke_id = data_flow[11];
opr_ptr->param_flag = 0x1f;
opr_ptr->param_len = 0;
aa = 13;
for(ii = 0; ii < 2; ii++)
{
if(data_flow[aa] == 0x00)
break;
else if(data_flow[aa] == 0x01) // parameter
{
len = (data_flow[aa + 1] << 8) + data_flow[aa + 2];
if(len > MAX_MAPPOPR_LEN)
return 0;
opr_ptr->param_len = len;
memcpy(opr_ptr->param, &data_flow[aa + 3], len);
aa += len + 3;
opr_ptr->param_flag |= 0x20;
}
else if(data_flow[aa] == 0x02) // user error
{
opr_ptr->user_error = data_flow[aa + 2];
opr_ptr->param_flag |= 0x40;
aa += 3;
}
else if(data_flow[aa] == 0x03) // provider error
{
opr_ptr->provider_error = data_flow[aa + 2];
opr_ptr->param_flag |= 0x80;
aa += 3;
}
else if(data_flow[aa] == 0x10)
{
delimiter_flag = 1;
aa += 2;
}
}
if(delimiter_flag == 1)
return 2;
else
return 1;
}
void cap_opr_stof(struct MapOprData_struct *opr_ptr, u8 * data_flow, u8 delimiter_flag)
{ // transfer opration structure to data flow
u32 ii;
u32 len;
data_flow[2] = CAP_FLAG;
data_flow[3] = opr_ptr->port_id >> 8;
data_flow[4] = opr_ptr->port_id;
data_flow[6] = opr_ptr->dialogue_id >> 8;
data_flow[7] = opr_ptr->dialogue_id;
data_flow[9] = opr_ptr->message_type;
data_flow[10] = opr_ptr->message_flag;
data_flow[11] = opr_ptr->invoke_id;
data_flow[12] = 1;
ii = 13;
if((opr_ptr->param_flag & 0x20)) // has component
{
data_flow[ii++] = 0x01;
len = opr_ptr->param_len;
data_flow[ii++] = len >> 8;
data_flow[ii++] = len;
memcpy(data_flow + ii, opr_ptr->param, len);
ii += len;
}
if((opr_ptr->param_flag & 0x40)) // has user error
{
data_flow[ii++] = 0x02;
data_flow[ii++] = 1;
data_flow[ii++] = opr_ptr->user_error;
}
if((opr_ptr->param_flag & 0x80)) // has provider error
{
data_flow[ii++] = 0x03;
data_flow[ii++] = 1;
data_flow[ii++] = opr_ptr->provider_error;
}
if(delimiter_flag == 1)
{
data_flow[ii++] = 0x10;
data_flow[ii++] = 0x00;
}
data_flow[ii++] = 0;
ii -= 2;
data_flow[0] = ii >> 8;
data_flow[1] = ii;
}

View File

@@ -0,0 +1,14 @@
/* CAP public function head file */
/* Written by Liu Zhiguo 2003-08-26 */
/* Version 1.0 */
/* -------------------------------- */
#ifndef _CAP_PUBLIC
#define _CAP_PUBLIC
u8 cap_com_ftos(struct MapComSrv_struct *map_com, u8 * data_flow);
void cap_com_stof(struct MapComSrv_struct *com_ptr, u8 * data_flow, u8 delimiter_flag);
u8 cap_opr_ftos(struct MapOprData_struct *opr_ptr, u8 * data_flow);
void cap_opr_stof(struct MapOprData_struct *opr_ptr, u8 * data_flow, u8 delimiter_flag);
#endif

20
plat/xapp/src/capp/icap.h Normal file
View File

@@ -0,0 +1,20 @@
/* CAP message interface head file */
/* Written by Liu Zhiguo 2003-08-26 */
/* Version 1.0 */
/* -------------------------------- */
#ifndef _CAP_INTERFACE
#define _CAP_INTERFACE
#include "cap_head.h"
#include "cap_msg.h"
int encode_capmsg(struct CapArg caparg, u8 * msgbuf, u16 maxlen);
#ifdef _SRF_RELEVANT
int decode_capmsg(char *msgbuf, u16 msglen, u8 ocode, u8 otype, struct CapArg *pcaparg);
#else
int decode_capmsg(char *msgbuf, u16 msglen, u8 ocode, struct CapArg *pcaparg);
#endif
#endif