FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/psa_sss.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : PSA_SSS | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module defines the signalling functions of the | |
18 | protocol stack adapter for supplementary services. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef PSA_SSS_C | |
23 #define PSA_SSS_C | |
24 #endif | |
25 | |
26 #include "config.h" | |
27 #include "fixedconf.h" | |
28 #include "condat-features.h" | |
29 #include "aci_conf.h" | |
30 | |
31 #include "aci_all.h" | |
32 | |
33 /*==== INCLUDES ===================================================*/ | |
34 #include "aci_cmh.h" | |
35 #include "ati_cmd.h" | |
36 #include "aci_cmd.h" | |
37 | |
38 #include "ksd.h" | |
39 | |
40 #include "aci.h" | |
41 #include "psa.h" | |
42 #include "psa_ss.h" | |
43 #include "cmh_ss.h" | |
44 | |
45 #ifdef SIM_TOOLKIT | |
46 #include "psa_cc.h" | |
47 #include "psa_sat.h" | |
48 #endif /* of SIM_TOOLKIT */ | |
49 | |
50 | |
51 /*==== CONSTANTS ==================================================*/ | |
52 | |
53 | |
54 /*==== TYPES ======================================================*/ | |
55 | |
56 | |
57 /*==== EXPORT =====================================================*/ | |
58 | |
59 | |
60 /*==== VARIABLES ==================================================*/ | |
61 | |
62 EXTERN T_PCEER causeMod; | |
63 EXTERN SHORT causeCeer; | |
64 | |
65 /*==== FUNCTIONS ==================================================*/ | |
66 static UBYTE inv_opcode; | |
67 | |
68 | |
69 LOCAL BOOL psaSS_FillPrimForTrns ( T_SS_SRV_TBL *pStbNtry, | |
70 T_fac_inf *fac_inf, | |
71 T_VOID_STRUCT *mnss_req, | |
72 BOOL end_trns); | |
73 | |
74 /* | |
75 +-------------------------------------------------------------------+ | |
76 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
77 | ROUTINE : psaSS_NewTrns | | |
78 +-------------------------------------------------------------------+ | |
79 | |
80 PURPOSE : start a new SS transaction | |
81 | |
82 */ | |
83 | |
84 GLOBAL SHORT psaSS_NewTrns ( SHORT sId ) | |
85 { | |
86 T_SS_SRV_TBL * pStbNtry; /* holds pointer to service table entry */ | |
87 BYTE ccdRet; /* holds CCD return value */ | |
88 | |
89 TRACE_FUNCTION ("psaSS_NewTrns()"); | |
90 | |
91 /* | |
92 *------------------------------------------------------------------- | |
93 * get a valid ti for a MOS, otherwise return | |
94 *------------------------------------------------------------------- | |
95 */ | |
96 if( psaSS_getMOSTi( sId ) < 0 ) return ( -1 ); | |
97 | |
98 causeMod = P_CEER_mod; /* Clear module which was set for ceer */ | |
99 causeCeer = CEER_NotPresent; /* Clear extended error cause */ | |
100 | |
101 /* | |
102 *------------------------------------------------------------------- | |
103 * create and send primitive | |
104 *------------------------------------------------------------------- | |
105 */ | |
106 { | |
107 PALLOC (mnss_begin_req, MNSS_BEGIN_REQ); | |
108 | |
109 /* | |
110 * fill in primitive parameter: begin request | |
111 */ | |
112 pStbNtry = &ssShrdPrm.stb[sId]; | |
113 | |
114 mnss_begin_req -> ti = pStbNtry -> ti; | |
115 | |
116 if( pStbNtry -> SSver NEQ NOT_PRESENT_8BIT ) | |
117 { | |
118 mnss_begin_req -> ss_ver.len = 1; | |
119 mnss_begin_req -> ss_ver.ver[0] = pStbNtry -> SSver; | |
120 } | |
121 else | |
122 | |
123 mnss_begin_req -> ss_ver.len = 0; | |
124 | |
125 { | |
126 MCAST( com, COMPONENT ); | |
127 | |
128 memset( com, 0, sizeof( T_COMPONENT )); | |
129 switch( ssShrdPrm.cmpType ) | |
130 { | |
131 case( CT_INV ): | |
132 com -> v_inv_comp = TRUE; | |
133 com -> inv_comp.v_inv_id = TRUE; | |
134 com -> inv_comp.inv_id = pStbNtry -> iId | |
135 = ssShrdPrm.iIdNxt++; | |
136 com -> inv_comp.v_op_code = TRUE; | |
137 com -> inv_comp.op_code = pStbNtry -> opCode | |
138 = ssFIECodeBuf.buf[0]; | |
139 | |
140 inv_opcode = com->inv_comp.op_code; | |
141 | |
142 com -> inv_comp.v_params = TRUE; | |
143 com -> inv_comp.params.l_params = ssFIECodeBuf.l_buf-8; | |
144 com -> inv_comp.params.o_params = 8; | |
145 memcpy( com -> inv_comp.params.b_params, | |
146 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf>>3 ); | |
147 break; | |
148 case( CT_RET_RSLT ): | |
149 break; | |
150 case( CT_RET_ERR ): | |
151 break; | |
152 case( CT_RET_REJ ): | |
153 break; | |
154 } | |
155 mnss_begin_req -> fac_inf.l_fac = MNCC_FACILITY_LEN<<3; | |
156 mnss_begin_req -> fac_inf.o_fac = 0; | |
157 ccdRet = ccd_codeMsg (CCDENT_FAC, | |
158 UPLINK, | |
159 (T_MSGBUF *) &mnss_begin_req -> fac_inf, | |
160 (UBYTE *) _decodedMsg, | |
161 COMPONENT); | |
162 | |
163 if( ccdRet NEQ ccdOK ) | |
164 { | |
165 /* Implements Measure#32: Row 1316 */ | |
166 TRACE_EVENT_P1("CCD Coding Error: %d",ccdRet ); | |
167 PFREE( mnss_begin_req ); | |
168 return( -1 ); | |
169 } | |
170 } | |
171 | |
172 pStbNtry -> srvType = ST_MOS; | |
173 | |
174 psaSS_DumpFIE ( &mnss_begin_req -> fac_inf ); | |
175 #ifdef TI_PS_FF_AT_P_CMD_CSCN | |
176 cmhSS_sendFie ( CSCN_FACILITY_DIRECTION_OUT, | |
177 CSCN_FACILITY_TRANS_TYPE_BEGIN, | |
178 &mnss_begin_req -> fac_inf ); | |
179 #endif /* TI_PS_FF_AT_P_CMD_CSCN */ | |
180 | |
181 if ( ssShrdPrm.mltyTrnFlg EQ 0 ) | |
182 { | |
183 PSENDX (SS, mnss_begin_req); /* send primitive */ | |
184 } | |
185 else | |
186 pStbNtry -> save_prim = mnss_begin_req; /* already one transaction in process */ | |
187 | |
188 | |
189 /* | |
190 * update service status | |
191 */ | |
192 pStbNtry -> srvStat = SSS_ACT; | |
193 } | |
194 | |
195 return 0; | |
196 } | |
197 | |
198 /* | |
199 +-------------------------------------------------------------------+ | |
200 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
201 | ROUTINE : psaSS_EndTrns | | |
202 +-------------------------------------------------------------------+ | |
203 | |
204 PURPOSE : stop an existing SS transaction | |
205 | |
206 */ | |
207 | |
208 GLOBAL SHORT psaSS_EndTrns ( SHORT sId ) | |
209 { | |
210 T_SS_SRV_TBL * pStbNtry; /* holds pointer to service table entry */ | |
211 | |
212 TRACE_FUNCTION ("psaSS_EndTrns()"); | |
213 | |
214 /* | |
215 *------------------------------------------------------------------- | |
216 * create and send primitive | |
217 *------------------------------------------------------------------- | |
218 */ | |
219 { | |
220 PALLOC (mnss_end_req, MNSS_END_REQ); | |
221 | |
222 /* | |
223 * fill in primitive parameter: end request | |
224 */ | |
225 pStbNtry = &ssShrdPrm.stb[sId]; | |
226 | |
227 mnss_end_req -> ti = pStbNtry -> ti; | |
228 | |
229 /* Implements Measure# 103 */ | |
230 if ( psaSS_FillPrimForTrns ( pStbNtry, &(mnss_end_req -> fac_inf), | |
231 (T_VOID_STRUCT *)mnss_end_req, TRUE)) | |
232 { | |
233 return(-1); | |
234 } | |
235 | |
236 psaSS_DumpFIE ( &mnss_end_req -> fac_inf ); | |
237 #ifdef TI_PS_FF_AT_P_CMD_CSCN | |
238 cmhSS_sendFie ( CSCN_FACILITY_DIRECTION_OUT, | |
239 CSCN_FACILITY_TRANS_TYPE_END, | |
240 &mnss_end_req -> fac_inf ); | |
241 #endif /* TI_PS_FF_AT_P_CMD_CSCN */ | |
242 | |
243 PSENDX (SS, mnss_end_req); | |
244 | |
245 #ifdef SIM_TOOLKIT | |
246 if ( sId EQ satShrdPrm.SentUSSDid AND | |
247 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_USSD ) | |
248 { | |
249 satShrdPrm.USSDterm = TRUE; | |
250 } | |
251 #endif | |
252 | |
253 /* | |
254 * update call status | |
255 */ | |
256 pStbNtry -> srvStat = SSS_IDL; | |
257 | |
258 } | |
259 | |
260 psaSS_retMOSTi (sId); | |
261 | |
262 return 0; | |
263 } | |
264 | |
265 /* | |
266 +-------------------------------------------------------------------+ | |
267 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
268 | ROUTINE : psaSS_CntTrns | | |
269 +-------------------------------------------------------------------+ | |
270 | |
271 PURPOSE : continue with an existing SS transaction | |
272 | |
273 */ | |
274 | |
275 GLOBAL SHORT psaSS_CntTrns ( SHORT sId ) | |
276 { | |
277 T_SS_SRV_TBL * pStbNtry; /* holds pointer to service table entry */ | |
278 | |
279 TRACE_FUNCTION ("psaSS_CntTrns()"); | |
280 | |
281 /* | |
282 *------------------------------------------------------------------- | |
283 * create and send primitive | |
284 *------------------------------------------------------------------- | |
285 */ | |
286 { | |
287 PALLOC (mnss_facility_req, MNSS_FACILITY_REQ); | |
288 | |
289 /* | |
290 * fill in primitive parameter: facility request | |
291 */ | |
292 pStbNtry = &ssShrdPrm.stb[sId]; | |
293 | |
294 mnss_facility_req -> ti = pStbNtry -> ti; | |
295 | |
296 /* Implements Measure# 103 */ | |
297 if ( psaSS_FillPrimForTrns ( pStbNtry, &(mnss_facility_req -> fac_inf), | |
298 (T_VOID_STRUCT *)mnss_facility_req, FALSE)) | |
299 { | |
300 return(-1); | |
301 } | |
302 | |
303 psaSS_DumpFIE ( &mnss_facility_req -> fac_inf ); | |
304 #ifdef TI_PS_FF_AT_P_CMD_CSCN | |
305 cmhSS_sendFie ( CSCN_FACILITY_DIRECTION_OUT, | |
306 CSCN_FACILITY_TRANS_TYPE, | |
307 &mnss_facility_req -> fac_inf ); | |
308 #endif /* TI_PS_FF_AT_P_CMD_CSCN */ | |
309 | |
310 PSENDX (SS, mnss_facility_req); | |
311 } | |
312 | |
313 return 0; | |
314 } | |
315 | |
316 /* Implements Measure# 103 */ | |
317 /* | |
318 +-------------------------------------------------------------------+ | |
319 | PROJECT : GSM-PS (6147) MODULE : PSA_SSS | | |
320 | ROUTINE : psaSS_CntTrns | | |
321 +-------------------------------------------------------------------+ | |
322 | |
323 PURPOSE : End Or continue with an existing SS transaction | |
324 | |
325 */ | |
326 LOCAL BOOL psaSS_FillPrimForTrns ( T_SS_SRV_TBL *pStbNtry, | |
327 T_fac_inf *fac_inf, | |
328 T_VOID_STRUCT *mnss_req, | |
329 BOOL end_trns) | |
330 { | |
331 TRACE_FUNCTION ("psaSS_FillPrimForTrns()"); | |
332 { | |
333 UBYTE ccdRet; | |
334 MCAST( com, COMPONENT ); | |
335 | |
336 memset( com, 0, sizeof( T_COMPONENT )); | |
337 switch( ssShrdPrm.cmpType ) | |
338 { | |
339 case( CT_RET_RSLT ): | |
340 com -> v_res_comp = TRUE; | |
341 com -> res_comp.v_inv_id = TRUE; | |
342 com -> res_comp.inv_id = pStbNtry -> iId; | |
343 /* patch for FTA 31.9.2.1: | |
344 * When empty facility should be returned, then message | |
345 * should contain ONLY the invoke id. CLB 061201 | |
346 */ | |
347 if( ssFIECodeBuf.l_buf NEQ 8 OR end_trns) | |
348 /* means there actually are parameters */ | |
349 { | |
350 com -> res_comp.v_sequence = TRUE; | |
351 com -> res_comp.sequence.v_op_code = TRUE; | |
352 com -> res_comp.sequence.op_code = pStbNtry -> opCode; | |
353 | |
354 if (!end_trns) | |
355 { | |
356 pStbNtry -> opCode = inv_opcode; | |
357 } | |
358 | |
359 com -> res_comp.sequence.v_params = TRUE; | |
360 com -> res_comp.sequence.params.l_params = ssFIECodeBuf.l_buf-8; | |
361 com -> res_comp.sequence.params.o_params = 8; | |
362 memcpy( com -> res_comp.sequence.params.b_params, | |
363 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf>>3 ); | |
364 } | |
365 break; | |
366 case( CT_RET_ERR ): | |
367 com -> v_err_comp = TRUE; | |
368 com -> err_comp.v_inv_id = TRUE; | |
369 com -> err_comp.inv_id = pStbNtry -> iId; | |
370 com -> err_comp.v_err_code = TRUE; | |
371 com -> err_comp.err_code = pStbNtry -> errCd; | |
372 break; | |
373 case( CT_RET_REJ ): | |
374 break; | |
375 } | |
376 fac_inf->l_fac = FACILITY_LEN<<3; | |
377 fac_inf->o_fac = 0; | |
378 ccdRet = ccd_codeMsg (CCDENT_FAC, | |
379 UPLINK, | |
380 (T_MSGBUF *) fac_inf, | |
381 (UBYTE *) _decodedMsg, | |
382 COMPONENT); | |
383 | |
384 if( ccdRet NEQ ccdOK ) | |
385 { | |
386 TRACE_EVENT_P1 ("CCD Coding Error: %d",ccdRet); | |
387 PFREE( mnss_req ); | |
388 return( TRUE ); | |
389 } | |
390 } | |
391 return ( FALSE ); | |
392 } | |
393 | |
394 /*==== EOF ========================================================*/ | |
395 |