comparison gsm-fw/g23m-aci/aci/psa_sss.c @ 775:eedbf248bac0

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