comparison g23m-aci/aci/psa_ssf.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_SSF
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 functions for the protocol
18 | stack adapter for supplementary services.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef PSA_SSF_C
23 #define PSA_SSF_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 #undef TRACING
34
35 /*==== INCLUDES ===================================================*/
36 #include "aci_cmh.h"
37 #include "ati_cmd.h"
38 #include "aci_cmd.h"
39
40 #include "ksd.h"
41 #include "aci.h"
42 #include "psa.h"
43 #include "psa_ss.h"
44 #include "psa_util.h"
45 #include "cmh_ss.h"
46 #include "cmh.h"
47
48 /*==== CONSTANTS ==================================================*/
49 #define MAX_MOSTI_NR (7) /* max number of ti's for MOS */
50
51 #define MAX_ITM (5) /* max number of items per line */
52 #define ITM_WDT (14) /* item width in chars */
53 #define HDR_WDT (10) /* header width in chars */
54
55 /*==== TYPES ======================================================*/
56
57
58 /*==== EXPORT =====================================================*/
59
60 /*==== VARIABLES ==================================================*/
61 LOCAL UBYTE tiPool = 0xFF; /* holds pool of transaction identifiers */
62
63 /*==== FUNCTIONS ==================================================*/
64
65 LOCAL void psaSS_asmSSForBS ( UBYTE ssCode, UBYTE bscSrvType,
66 UBYTE bscSrv, T_ssForBS *ssForBS);
67
68 /*
69 +-------------------------------------------------------------------+
70 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
71 | ROUTINE : psaSS_asmEmptyRslt |
72 +-------------------------------------------------------------------+
73
74 PURPOSE : assemble an empty return result facility information
75 element.
76
77 */
78
79 GLOBAL void psaSS_asmEmptyRslt ( void )
80 {
81 TRACE_FUNCTION("psaSS_asmEmptyRslt");
82
83 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
84
85 ssFIECodeBuf.l_buf = 8;
86
87 ssShrdPrm.cmpType = CT_RET_RSLT;
88 }
89
90 /*
91 +-------------------------------------------------------------------+
92 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
93 | ROUTINE : psaSS_asmErrorRslt |
94 +-------------------------------------------------------------------+
95
96 PURPOSE : assemble an return error facility information
97 element.
98
99 */
100
101 GLOBAL void psaSS_asmErrorRslt ( SHORT sId, UBYTE err )
102 {
103 TRACE_FUNCTION("psaSS_asmErrorRslt");
104
105 ssShrdPrm.stb[sId].failType = SSF_SS_ERR;
106 ssShrdPrm.stb[sId].errCd = err;
107 ssShrdPrm.cmpType = CT_RET_ERR;
108 }
109
110 /*
111 +-------------------------------------------------------------------+
112 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
113 | ROUTINE : psaSS_asmInterrogateSS |
114 +-------------------------------------------------------------------+
115
116 PURPOSE : assemble the interrogate SS facility information element.
117
118 */
119
120 GLOBAL void psaSS_asmInterrogateSS ( UBYTE ssCode,
121 UBYTE bscSrvType,
122 UBYTE bscSrv )
123 {
124 MCAST( irgtSS, INTERROGATE_SS_INV );
125
126 TRACE_FUNCTION("psaSS_asmInterrogateSS");
127
128 memset( irgtSS, 0, sizeof( T_INTERROGATE_SS_INV ));
129
130 /* set basic settings */
131 irgtSS->msg_type = INTERROGATE_SS_INV;
132 irgtSS->v_ssForBS = TRUE;
133
134 /* set service code */
135 irgtSS->ssForBS.v_ssCode = TRUE;
136 irgtSS->ssForBS.ssCode = ssCode;
137
138 /* set basic service type */
139 switch( bscSrvType )
140 {
141 case( BS_BEAR_SRV ):
142
143 irgtSS->ssForBS.basicService.v_bearerService = TRUE;
144 irgtSS->ssForBS.basicService.bearerService = bscSrv;
145 break;
146
147 case( BS_TELE_SRV ):
148
149 irgtSS->ssForBS.basicService.v_teleservice = TRUE;
150 irgtSS->ssForBS.basicService.teleservice = bscSrv;
151 break;
152
153 default:
154 irgtSS->ssForBS.basicService.v_bearerService = FALSE;
155 irgtSS->ssForBS.basicService.v_teleservice = FALSE;
156 }
157
158 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
159 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
160 ccd_codeMsg (CCDENT_FAC, UPLINK,
161 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
162 NOT_PRESENT_8BIT);
163
164 ssShrdPrm.cmpType = CT_INV;
165 }
166
167 /*
168 +-------------------------------------------------------------------+
169 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
170 | ROUTINE : psaSS_asmRegisterSS |
171 +-------------------------------------------------------------------+
172
173 PURPOSE : assemble the register SS facility information element.
174
175 */
176
177 GLOBAL void psaSS_asmRegisterSS ( UBYTE ssCode, UBYTE bscSrvType,
178 UBYTE bscSrv, UBYTE ton, UBYTE npi,
179 UBYTE *num, UBYTE tos, UBYTE oe,
180 UBYTE *sub, UBYTE time )
181 {
182 MCAST( regSS, REGISTER_SS_INV );
183
184 TRACE_FUNCTION("psaSS_asmRegisterSS");
185
186 memset( regSS, 0, sizeof( T_REGISTER_SS_INV ));
187
188 /* set basic settings */
189 regSS->msg_type = REGISTER_SS_INV;
190 regSS->v_registerSSArg = TRUE;
191
192 /* set service code */
193 regSS->registerSSArg.v_ssCode = TRUE;
194 regSS->registerSSArg.ssCode = ssCode;
195
196 /* set basic service type */
197 switch( bscSrvType )
198 {
199 case( BS_BEAR_SRV ):
200
201 regSS->registerSSArg.basicService.v_bearerService = TRUE;
202 regSS->registerSSArg.basicService.bearerService = bscSrv;
203 break;
204
205 case( BS_TELE_SRV ):
206
207 regSS->registerSSArg.basicService.v_teleservice = TRUE;
208 regSS->registerSSArg.basicService.teleservice = bscSrv;
209 break;
210 }
211
212 /* set forwarded to number */
213 if( num NEQ NULL )
214 {
215 regSS->registerSSArg.v_forwardedToNumber = TRUE;
216 regSS->registerSSArg.forwardedToNumber.c_bcdDigit
217 = (UBYTE)utl_dialStr2BCD((char *) num,
218 regSS->registerSSArg.forwardedToNumber.bcdDigit,
219 MAX_PARTY_NUM);
220
221 if(ton NEQ MNCC_TON_NOT_PRES AND
222 npi NEQ MNCC_NPI_NOT_PRES)
223 {
224 regSS->registerSSArg.forwardedToNumber.v_noa = TRUE;
225 regSS->registerSSArg.forwardedToNumber.noa = ton;
226
227 regSS->registerSSArg.forwardedToNumber.v_npi = TRUE;
228 regSS->registerSSArg.forwardedToNumber.npi = npi;
229 }
230 }
231
232 /* set forwarded to subaddress */
233 if( sub NEQ NULL )
234 {
235 regSS->registerSSArg.v_forwardedToSubaddress = TRUE;
236 regSS->registerSSArg.forwardedToSubaddress.c_subadr_str
237 = (UBYTE)utl_dialStr2BCD((char *) sub,
238 regSS->registerSSArg.forwardedToSubaddress.subadr_str,
239 MAX_SUBADDR_NUM);
240
241 regSS->registerSSArg.forwardedToSubaddress.v_tos = TRUE;
242 regSS->registerSSArg.forwardedToSubaddress.tos = tos;
243
244 regSS->registerSSArg.forwardedToSubaddress.v_oei = TRUE;
245 regSS->registerSSArg.forwardedToSubaddress.oei = oe;
246 }
247
248 /* set no reply timer */
249 //TISH, patch for OMAPS00130690
250 #if 0
251 if( ssCode EQ SS_CD_CFNRY AND time NEQ KSD_TIME_NONE )
252 #else
253 if( ((ssCode EQ SS_CD_CFNRY) OR (ssCode EQ SS_CD_ALL_FWSS) OR (ssCode EQ SS_CD_ALL_CFWSS)) AND time NEQ KSD_TIME_NONE )
254 #endif
255 //end
256 {
257 regSS->registerSSArg.v_noReplyConditionTime = TRUE;
258 regSS->registerSSArg.noReplyConditionTime = time;
259 }
260
261 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
262 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
263 ccd_codeMsg (CCDENT_FAC, UPLINK,
264 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
265 NOT_PRESENT_8BIT);
266
267 ssShrdPrm.cmpType = CT_INV;
268 }
269
270 /*
271 +-------------------------------------------------------------------+
272 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
273 | ROUTINE : psaSS_asmEraseSS |
274 +-------------------------------------------------------------------+
275
276 PURPOSE : assemble the erase SS facility information element.
277
278 */
279
280 GLOBAL void psaSS_asmEraseSS ( UBYTE ssCode, UBYTE bscSrvType,
281 UBYTE bscSrv )
282 {
283 MCAST( ersSS, ERASE_SS_INV );
284
285 TRACE_FUNCTION("psaSS_asmEraseSS");
286
287 memset( ersSS, 0, sizeof( T_ERASE_SS_INV ));
288
289 /* set basic settings */
290 ersSS->msg_type = ERASE_SS_INV;
291 ersSS->v_ssForBS = TRUE;
292
293 /* Implements Measure # 194 */
294 psaSS_asmSSForBS ( ssCode, bscSrvType, bscSrv, &(ersSS->ssForBS));
295
296 }
297
298 /*
299 +-------------------------------------------------------------------+
300 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
301 | ROUTINE : psaSS_asmActivateSS |
302 +-------------------------------------------------------------------+
303
304 PURPOSE : assemble the interrogate SS facility information element.
305
306 */
307
308 GLOBAL void psaSS_asmActivateSS ( UBYTE ssCode, UBYTE bscSrvType,
309 UBYTE bscSrv )
310 {
311 MCAST( actSS, ACTIVATE_SS_INV );
312
313 TRACE_FUNCTION("psaSS_asmActivateSS");
314
315 memset( actSS, 0, sizeof( T_ACTIVATE_SS_INV ));
316
317 /* set basic settings */
318 actSS->msg_type = ACTIVATE_SS_INV;
319 actSS->v_ssForBS = TRUE;
320
321 /* Implements Measure # 194 */
322 psaSS_asmSSForBS ( ssCode, bscSrvType, bscSrv, &(actSS->ssForBS));
323
324 }
325
326 /*
327 +-------------------------------------------------------------------+
328 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
329 | ROUTINE : psaSS_asmDeactivateSS |
330 +-------------------------------------------------------------------+
331
332 PURPOSE : assemble the deactivate SS facility information element.
333
334 */
335
336 GLOBAL void psaSS_asmDeactivateSS ( UBYTE ssCode, UBYTE bscSrvType,
337 UBYTE bscSrv )
338 {
339 MCAST( deactSS, DEACTIVATE_SS_INV );
340
341 TRACE_FUNCTION("psaSS_asmDeactivateSS");
342
343 memset( deactSS, 0, sizeof( T_DEACTIVATE_SS_INV ));
344
345 /* set basic settings */
346 deactSS->msg_type = DEACTIVATE_SS_INV;
347 deactSS->v_ssForBS = TRUE;
348
349 /* Implements Measure # 195 */
350 psaSS_asmSSForBS ( ssCode, bscSrvType, bscSrv, &(deactSS->ssForBS));
351
352 }
353
354 /*
355 +-------------------------------------------------------------------+
356 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
357 | ROUTINE : psaSS_asmRegisterPWD |
358 +-------------------------------------------------------------------+
359
360 PURPOSE : assemble the register password facility information
361 element.
362
363 */
364
365 GLOBAL void psaSS_asmRegisterPWD ( UBYTE ssCode )
366 {
367 MCAST( regPWD, REGISTER_PWD_INV );
368
369 TRACE_FUNCTION("psaSS_asmRegisterPWD");
370
371 memset( regPWD, 0, sizeof( T_REGISTER_PWD_INV ));
372
373 /* set service code */
374 regPWD->v_ssCode = TRUE;
375 regPWD->ssCode = ssCode;
376 regPWD->msg_type = REGISTER_PWD_INV;
377
378 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
379 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
380 ccd_codeMsg (CCDENT_FAC, UPLINK,
381 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
382 NOT_PRESENT_8BIT);
383
384 ssShrdPrm.cmpType = CT_INV;
385
386 }
387
388 /*
389 +-------------------------------------------------------------------+
390 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
391 | ROUTINE : psaSS_asmVerifyPWD |
392 +-------------------------------------------------------------------+
393
394 PURPOSE : assemble the verify password facility information
395 element.
396
397 */
398
399 GLOBAL void psaSS_asmVerifyPWD ( UBYTE *pwd )
400 {
401 MCAST( vrfPWD, GET_PWD_RES );
402
403 TRACE_FUNCTION("psaSS_asmVerifyPWD");
404
405 memset( vrfPWD, 0, sizeof( T_GET_PWD_RES ));
406
407 /* set service code */
408 vrfPWD->v_currPassword = TRUE;
409 vrfPWD->msg_type = GET_PWD_RES;
410
411 strncpy( (char *) vrfPWD->currPassword.digit, (char *) pwd, MAX_PWD_NUM );
412
413 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
414 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
415 ccd_codeMsg (CCDENT_FAC, UPLINK,
416 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
417 NOT_PRESENT_8BIT);
418
419 ssShrdPrm.cmpType = CT_RET_RSLT;
420
421 }
422
423 /*
424 +-------------------------------------------------------------------+
425 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
426 | ROUTINE : psaSS_asmProcUSSDReq |
427 +-------------------------------------------------------------------+
428
429 PURPOSE : assemble the process USSD request facility information
430 element.
431
432 */
433
434 GLOBAL void psaSS_asmProcUSSDReq ( UBYTE dcs, UBYTE *ussd, UBYTE len )
435 {
436 /* UBYTE cmpLen;*/
437
438 MCAST( ussdReq, PROCESS_USSD_REQ_INV );
439
440 TRACE_FUNCTION("psaSS_asmProcUSSDReq");
441
442 memset( ussdReq, 0, sizeof( T_PROCESS_USSD_REQ_INV ));
443
444 /* set service code */
445 ussdReq->v_ussdArg = TRUE;
446 ussdReq->msg_type = PROCESS_USSD_REQ_INV;
447
448 /* set data coding scheme */
449 ussdReq->ussdArg.v_ussdDataCodingScheme = TRUE;
450 ussdReq->ussdArg.ussdDataCodingScheme = dcs;
451
452 /* set ussd response string */
453 /* if( utl_getAlphabetCb( dcs ) EQ 0 ) *//* 7bit alphabet */
454 /* cmpLen = utl_cvt8To7( ussd, (UBYTE)MINIMUM( MAX_USSD_STRING, len),
455 ussdReq->ussdArg.ussdString.b_ussdString, 0 );
456 else*/
457 {
458 /* cmpLen = len;*/
459 memcpy( ussdReq->ussdArg.ussdString.b_ussdString, ussd,
460 MINIMUM( MAX_USSD_STRING, len));
461 }
462
463 ussdReq->ussdArg.v_ussdString = TRUE;
464 ussdReq->ussdArg.ussdString.o_ussdString = 0;
465 ussdReq->ussdArg.ussdString.l_ussdString = len<<3; /*cmpLen<<3;*/
466
467 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
468 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
469 ccd_codeMsg (CCDENT_FAC, UPLINK,
470 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
471 NOT_PRESENT_8BIT);
472
473 ssShrdPrm.cmpType = CT_INV;
474 }
475
476 /*
477 +-------------------------------------------------------------------+
478 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
479 | ROUTINE : psaSS_asmCnfUSSDReq |
480 +-------------------------------------------------------------------+
481
482 PURPOSE : assemble the confirm USSD request facility information
483 element.
484 */
485
486 GLOBAL void psaSS_asmCnfUSSDReq ( UBYTE dcs, UBYTE *ussd, UBYTE len )
487 {
488 UBYTE cmpLen;
489 UBYTE src_len;
490
491 MCAST( ussdReq, USSD_REQ_RES );
492
493 TRACE_FUNCTION("psaSS_asmCnfUSSDReq");
494
495 memset( ussdReq, 0, sizeof( T_USSD_REQ_RES ));
496
497 /* set service code */
498 ussdReq->v_ussdRes = TRUE;
499 ussdReq->msg_type = USSD_REQ_RES;
500
501 /* set data coding scheme */
502 ussdReq->ussdRes.v_ussdDataCodingScheme = TRUE;
503 ussdReq->ussdRes.ussdDataCodingScheme = dcs;
504
505 /* set ussd response string */
506 /* Implements Measure 25 */
507 /* This function is more correct than utl_getAlphabetCb as it takes care
508 of reserved codings */
509 if( cmh_getAlphabetCb( dcs ) EQ 0 ) /* 7bit alphabet */
510 {
511 src_len = (UBYTE)MINIMUM( MAX_USSD_STRING, len);
512 cmpLen = utl_cvt8To7( ussd, src_len,
513 ussdReq->ussdRes.ussdString.b_ussdString, 0 );
514 /* According to spec 23.038 section 6.1.2.3 for USSD packing, for bytes end with
515 * (8*n)-1 i.e where n is 1,2,3....i.e byte 7, 15, 23 ... to be padded
516 * with carriage return <CR>(0xD)
517 */
518 if ((src_len+1)%8 EQ 0)
519 {
520 ussdReq->ussdRes.ussdString.b_ussdString[cmpLen-1] |= (0xD << 1);
521 }
522 }
523 else
524 {
525 cmpLen = len;
526 memcpy( ussdReq->ussdRes.ussdString.b_ussdString, ussd,
527 MINIMUM( MAX_USSD_STRING, len));
528 }
529
530 ussdReq->ussdRes.v_ussdString = TRUE;
531 ussdReq->ussdRes.ussdString.o_ussdString = 0;
532 ussdReq->ussdRes.ussdString.l_ussdString = cmpLen<<3;
533
534 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
535 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
536 ccd_codeMsg (CCDENT_FAC, UPLINK,
537 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
538 NOT_PRESENT_8BIT);
539
540 ssShrdPrm.cmpType = CT_RET_RSLT;
541 }
542
543 /*
544 +-------------------------------------------------------------------+
545 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
546 | ROUTINE : psaSS_USSDProt1 |
547 +-------------------------------------------------------------------+
548
549 PURPOSE : send USSD according to protocol version 1.
550 */
551
552 GLOBAL BOOL psaSS_asmUSSDProt1 ( SHORT sId )
553 {
554 UBYTE ussdBuf8Bit[MAX_USSD_STRING]; /* buffers 8 bit ussd string */
555 USHORT ussdLen8Bit;
556
557 TRACE_FUNCTION("psaSS_asmUSSDProt1");
558
559 if( ssShrdPrm.ussdLen AND
560 ssShrdPrm.stb[sId].SSver NEQ NOT_PRESENT_8BIT )
561 {
562 MCAST( ussdData, PROCESS_USSD_INV );
563
564 memset( ussdData, 0, sizeof( T_PROCESS_USSD_INV ));
565
566 /* set service code */
567 ussdData->v_ssUserData = TRUE;
568 ussdData->msg_type = PROCESS_USSD_INV;
569
570 /* GSM data must be 8-bit coded */
571 if (ssShrdPrm.ussdDcs EQ 0x0F)
572 {
573 ussdLen8Bit = utl_cvt7To8 (ssShrdPrm.ussdBuf, ssShrdPrm.ussdLen, ussdBuf8Bit, 0);
574 }
575 else
576 {
577 memcpy ( ussdBuf8Bit, ssShrdPrm.ussdBuf, ssShrdPrm.ussdLen);
578 ussdLen8Bit = ssShrdPrm.ussdLen;
579 }
580
581 /* set ussd data string, if convertible */
582 if( !utl_cvtGsmIra ( ussdBuf8Bit,
583 ussdLen8Bit,
584 ussdData->ssUserData.b_ssUserData,
585 MAX_USSD_DATA,
586 CSCS_DIR_GsmToIra ) )
587 {
588 return( FALSE );
589 }
590
591 ussdData->ssUserData.o_ssUserData = 0;
592 ussdData->ssUserData.l_ssUserData = ssShrdPrm.ussdLen<<3;
593
594 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
595 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
596 ccd_codeMsg (CCDENT_FAC, UPLINK,
597 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
598 NOT_PRESENT_8BIT);
599
600 ssShrdPrm.cmpType = CT_INV;
601
602 /* skip SS version indicator */
603 ssShrdPrm.stb[sId].SSver = NOT_PRESENT_8BIT;
604
605 /* repeat USSD string */
606 psaSS_NewTrns(sId);
607
608 return( TRUE );
609 }
610
611 return( FALSE );
612 }
613
614
615 /*
616 +-------------------------------------------------------------------+
617 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
618 | ROUTINE : psaSS_asmDeactivateCCBS |
619 +-------------------------------------------------------------------+
620
621 PURPOSE : assemble the deactivate CCBS facility information
622 element.
623
624 */
625
626 GLOBAL void psaSS_asmDeactivateCCBS ( UBYTE idx )
627 {
628 MCAST( ersCCBS, ERASE_CC_ENTRY_INV );
629
630 TRACE_FUNCTION("psaSS_asmDeactivateCCBS");
631
632 memset( ersCCBS, 0, sizeof( T_ERASE_CC_ENTRY_INV ));
633
634 /* set service code */
635 ersCCBS->v_eraseCCEntryArg = TRUE;
636 ersCCBS->msg_type = ERASE_CC_ENTRY_INV;
637
638 ersCCBS->eraseCCEntryArg.v_ssCode = TRUE;
639 ersCCBS->eraseCCEntryArg.ssCode = SS_CD_CCBS;
640
641 if( idx NEQ KSD_IDX_NONE )
642 {
643 ersCCBS->eraseCCEntryArg.v_ccbsIndex = TRUE;
644 ersCCBS->eraseCCEntryArg.ccbsIndex = idx;
645 }
646
647 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
648 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
649 ccd_codeMsg (CCDENT_FAC, UPLINK,
650 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
651 NOT_PRESENT_8BIT);
652
653 ssShrdPrm.cmpType = CT_INV;
654 }
655
656 /*
657 +-------------------------------------------------------------------+
658 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
659 | ROUTINE : psaSS_dasmInvokeCmp |
660 +-------------------------------------------------------------------+
661
662 PURPOSE : disassemble the result component.
663 */
664
665 GLOBAL void psaSS_dasmInvokeCmp ( SHORT sId, T_inv_comp *invCmp )
666 {
667 USHORT ivId; /* holds invoke Id */
668 UBYTE opCode; /* holds operation code */
669
670 TRACE_FUNCTION("psaSS_dasmInvokeCmp");
671
672 if( invCmp -> v_inv_id )
673 ivId = invCmp -> inv_id;
674 else
675 ivId = NOT_PRESENT_16BIT;
676
677 if( invCmp -> v_op_code )
678 opCode = invCmp -> op_code;
679 else
680 opCode = NOT_PRESENT_8BIT;
681
682 /* store op code and invoke id for result */
683 ssShrdPrm.stb[sId].iId = (UBYTE)ivId;
684 ssShrdPrm.stb[sId].opCode = opCode;
685
686 if( invCmp -> params.l_params )
687 {
688 UBYTE ccdRet;
689
690 memcpy( ssFIEDecodeBuf, &invCmp -> params, MNCC_FACILITY_LEN );
691
692 ccdRet = ccd_decodeMsg (CCDENT_FAC,
693 DOWNLINK,
694 (T_MSGBUF *) ssFIEDecodeBuf,
695 (UBYTE *) _decodedMsg,
696 opCode);
697
698 if( ccdRet NEQ ccdOK )
699 {
700 TRACE_EVENT_P1("CCD Decoding Error: %d",ccdRet );
701 ssShrdPrm.stb[sId].failType = SSF_CCD_DEC;
702 cmhSS_TransFail(sId);
703 }
704 }
705 else
706 memset( ssFIEDecodeBuf, 0, MNCC_FACILITY_LEN ); /* put all valid flags to FALSE */
707
708 switch( opCode )
709 {
710 case( OPC_GET_PASSWORD ):
711 {
712 MCAST( getPWD, GET_PWD_INV );
713
714 cmhSS_getPassword( sId, getPWD );
715 }
716 break;
717
718 case( OPC_UNSTRUCT_SS_NOTIFY ):
719 {
720 MCAST( ussdNtfy, USSD_NOTIFY_INV );
721
722 cmhSS_USSDNotify( sId, ussdNtfy );
723 }
724 break;
725
726 case( OPC_UNSTRUCT_SS_REQ ):
727 {
728 MCAST( ussdReq, USSD_REQ_INV );
729
730 cmhSS_USSDRequest( sId, ussdReq );
731 }
732 break;
733
734 case( OPC_FWD_CHECK_SS_IND ):
735 {
736 cmhSS_FwdChckSS( sId );
737 }
738 break;
739 }
740 }
741
742 /*
743 +-------------------------------------------------------------------+
744 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
745 | ROUTINE : psaSS_dasmResultCmp |
746 +-------------------------------------------------------------------+
747
748 PURPOSE : disassemble the result component.
749 */
750
751 GLOBAL void psaSS_dasmResultCmp ( SHORT sId, T_res_comp *resCmp )
752 {
753 UBYTE opCode; /* holds operation code */
754
755 TRACE_FUNCTION("psaSS_dasmResultCmp");
756
757 /* get operation code of the result */
758 if( resCmp -> v_sequence AND
759 resCmp -> sequence.v_op_code )
760 {
761 opCode = resCmp -> sequence.op_code;
762 }
763 else
764 opCode = ssShrdPrm.stb[sId].opCode;
765
766 /* decode additional parameters of result */
767 if( resCmp -> v_sequence AND
768 resCmp -> sequence.params.l_params )
769 {
770 UBYTE ccdRet;
771
772 memcpy( ssFIEDecodeBuf, &resCmp -> sequence.params, MNCC_FACILITY_LEN);
773
774 ccdRet = ccd_decodeMsg (CCDENT_FAC,
775 DOWNLINK,
776 (T_MSGBUF *) ssFIEDecodeBuf,
777 (UBYTE *) _decodedMsg,
778 opCode);
779
780 if( ccdRet NEQ ccdOK )
781 {
782 /* Implements Measure#32: Row 1310 */
783 TRACE_EVENT_P1("CCD Decoding Error: %d", ccdRet );
784 cmhSS_SSResultFailure( sId );
785 return;
786 }
787 }
788
789 /* determine to which operation the result belongs to */
790 switch( opCode )
791 {
792 case( OPC_REGISTER_SS ):
793 {
794 MCAST( regSS, REGISTER_SS_RES );
795
796 cmhSS_SSRegistrated( sId, regSS );
797 }
798 break;
799
800 case( OPC_ERASE_SS ):
801 {
802 MCAST( ersSS, ERASE_SS_RES );
803
804 cmhSS_SSErased( sId, ersSS );
805 }
806 break;
807
808 case( OPC_ACTIVATE_SS ):
809 {
810 MCAST( actSS, ACTIVATE_SS_RES );
811
812 if( !(resCmp -> v_sequence) OR !(resCmp -> sequence.params.l_params) )
813 {
814 memset(actSS, 0, sizeof(T_ACTIVATE_SS_RES));
815 }
816 cmhSS_SSActivated( sId, actSS );
817 }
818 break;
819
820 case( OPC_DEACTIVATE_SS ):
821 {
822 MCAST( deactSS, DEACTIVATE_SS_RES );
823
824 cmhSS_SSDeactivated( sId, deactSS );
825 }
826 break;
827
828 case( OPC_INTERROGATE_SS ):
829 {
830 MCAST( irgtSS, INTERROGATE_SS_RES );
831
832 cmhSS_SSInterrogated( sId, irgtSS );
833 }
834 break;
835
836 case( OPC_REGISTER_PASSWORD ):
837 {
838 MCAST( regPWD, REGISTER_PWD_RES );
839
840 cmhSS_SSPWDRegistrated( sId, regPWD );
841 }
842 break;
843
844 case( OPC_PROC_UNSTRUCT_SS_DATA ):
845 {
846 MCAST( prcUSSDDat, PROCESS_USSD_RES );
847
848 cmhSS_USSDDatProcessed( sId, prcUSSDDat );
849 }
850 break;
851
852 case( OPC_PROC_UNSTRUCT_SS_REQ ):
853 {
854 MCAST( prcUSSDReq, PROCESS_USSD_REQ_RES );
855
856 cmhSS_USSDReqProcessed( sId, prcUSSDReq );
857 }
858 break;
859
860 case( OPC_ERASE_CC_ENTRY ):
861 {
862 MCAST( ersCCNtry, ERASE_CC_ENTRY_RES );
863
864 cmhSS_CCNtryErased( sId, ersCCNtry );
865 }
866 break;
867 }
868 }
869
870 /*
871 +-------------------------------------------------------------------+
872 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
873 | ROUTINE : psaSS_dasmErrorCmp |
874 +-------------------------------------------------------------------+
875
876 PURPOSE : disassemble the error component.
877 */
878
879 GLOBAL T_ACI_RETURN psaSS_dasmErrorCmp ( SHORT sId, T_err_comp *errCmp, BOOL is_fac_ussd )
880 {
881 TRACE_EVENT_P1("psaSS_dasmErrorCmp: errCmp: %02x",errCmp -> err_code);
882
883 if( errCmp -> v_err_code )
884 {
885 ssShrdPrm.stb[sId].failType = SSF_SS_ERR;
886 ssShrdPrm.stb[sId].errCd = errCmp -> err_code;
887
888
889 switch(errCmp -> err_code)
890 {
891 case ERR_PWD_REG_FAIL:
892 if( errCmp -> v_params AND errCmp -> params.l_params )
893 {
894 T_PW_REGISTRATION_FAILURE_ERR *pwRegFail;
895
896 pwRegFail = (T_PW_REGISTRATION_FAILURE_ERR *)errCmp -> params.b_params;
897
898 TRACE_EVENT_P1("VGK:Error reported %d", errCmp -> err_code);
899 TRACE_EVENT_P1("VGK:Error params %d", pwRegFail->pwRegistrationFailureCause);
900
901 if (pwRegFail->v_pwRegistrationFailureCause)
902 ssShrdPrm.stb[sId].errPrms = pwRegFail->pwRegistrationFailureCause;
903 }
904 break;
905
906 default:
907 break;
908 }
909
910 /* check for protocol incompatibility for USSD */
911 if( is_fac_ussd AND
912 errCmp -> err_code EQ ERR_FAC_NOT_SUPPORTED )
913 {
914 if( psaSS_asmUSSDProt1(sId) )
915 {
916 return( AT_CMPL );
917 }
918 }
919
920 }
921 return( AT_FAIL );
922 }
923
924 /*
925 +-------------------------------------------------------------------+
926 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
927 | ROUTINE : psaSS_dasmRejectCmp |
928 +-------------------------------------------------------------------+
929
930 PURPOSE : disassemble the error component.
931 */
932
933 GLOBAL T_ACI_RETURN psaSS_dasmRejectCmp ( SHORT sId, T_rej_comp *rejCmp, BOOL is_fac_ussd )
934 {
935 TRACE_FUNCTION("psaSS_dasmRejectCmp");
936
937 if( rejCmp -> v_gen_problem )
938 {
939 ssShrdPrm.stb[sId].failType = SSF_GEN_PRB;
940 ssShrdPrm.stb[sId].rejPrb = rejCmp -> gen_problem;
941 }
942
943 else if( rejCmp -> v_inv_problem )
944 {
945 ssShrdPrm.stb[sId].failType = SSF_INV_PRB;
946 ssShrdPrm.stb[sId].rejPrb = rejCmp -> inv_problem;
947
948 /* check for protocol incompatibility for USSD */
949 if( is_fac_ussd AND
950 rejCmp -> inv_problem EQ INV_PROB_UNRECOG_OP )
951 {
952 if( psaSS_asmUSSDProt1(sId) )
953 {
954 return( AT_CMPL );
955 }
956 }
957 }
958
959 else if( rejCmp -> v_res_problem )
960 {
961 ssShrdPrm.stb[sId].failType = SSF_RSL_PRB;
962 ssShrdPrm.stb[sId].rejPrb = rejCmp -> res_problem;
963 }
964
965 else if( rejCmp -> v_err_problem )
966 {
967 ssShrdPrm.stb[sId].failType = SSF_ERR_PRB;
968 ssShrdPrm.stb[sId].rejPrb = rejCmp -> err_problem;
969 }
970 return( AT_FAIL );
971 }
972
973 /*
974 +-------------------------------------------------------------------+
975 | PROJECT : GSM-PS (6147) MODULE : PSA_SATF |
976 | ROUTINE : psaSAT_ss_end_ind |
977 +-------------------------------------------------------------------+
978
979 PURPOSE : handles responses to user after a SS.
980 is_fac_ussd TRUE if facility is a USSD
981 */
982
983 GLOBAL T_ACI_RETURN psaSS_ss_end_ind ( SHORT sId, T_COMPONENT *com, BOOL is_fac_ussd )
984 {
985 if( com->v_res_comp )
986 {
987 psaSS_dasmResultCmp( sId, &com->res_comp );
988 return( AT_EXCT );
989 }
990
991 if( com->v_err_comp )
992 {
993 return(psaSS_dasmErrorCmp( sId, &com->err_comp, is_fac_ussd ));
994 }
995
996 if( com->v_rej_comp )
997 {
998 return(psaSS_dasmRejectCmp( sId, &com->rej_comp, is_fac_ussd ));
999 }
1000
1001 TRACE_EVENT( "WRONG COMPONENT TYPE RECEIVED" );
1002 return(AT_FAIL);
1003 }
1004
1005 /*
1006 +-------------------------------------------------------------------+
1007 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1008 | ROUTINE : psaSS_stbNewEntry |
1009 +-------------------------------------------------------------------+
1010
1011 PURPOSE : returns the service table index for a free entry to be
1012 used, otherwise the function returns -1 to indicate that
1013 no entry is free.
1014 */
1015
1016 GLOBAL SHORT psaSS_stbNewEntry ( void )
1017 {
1018 SHORT stbIdx; /* holds service table index */
1019
1020 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx++ )
1021 {
1022 if( (ssShrdPrm.stb[stbIdx].ntryUsdFlg EQ FALSE) OR
1023 (ssShrdPrm.stb[stbIdx].srvStat EQ SSS_IDL) )
1024 {
1025 psaSS_InitStbNtry( stbIdx );
1026
1027 return( stbIdx );
1028 }
1029 }
1030
1031 return( -1 );
1032 }
1033
1034 /*
1035 +-------------------------------------------------------------------+
1036 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1037 | ROUTINE : psaSS_stbFindTi |
1038 +-------------------------------------------------------------------+
1039
1040 PURPOSE : returns the service table index for the entry that holds
1041 service parameters for the passed transaction identifier.
1042 Returning -1 indicates that the passed ti was not found.
1043 */
1044
1045 GLOBAL SHORT psaSS_stbFindTi ( UBYTE ti2Find )
1046 {
1047 SHORT stbIdx; /* holds service table index */
1048
1049 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx++ )
1050 {
1051 if( ssShrdPrm.stb[stbIdx].ti EQ ti2Find )
1052
1053 return( stbIdx );
1054 }
1055
1056 return( -1 );
1057 }
1058
1059 /*
1060 +-------------------------------------------------------------------+
1061 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1062 | ROUTINE : psaSS_stbFindInvId |
1063 +-------------------------------------------------------------------+
1064
1065 PURPOSE : returns the service table index for the entry that holds
1066 service parameters for the passed invoke id.
1067 Returning -1 indicates that the passed ti was not found.
1068 */
1069
1070 GLOBAL SHORT psaSS_stbFindInvId ( UBYTE iId2Find )
1071 {
1072 SHORT stbIdx; /* holds service table index */
1073
1074 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx++ )
1075 {
1076 if( ssShrdPrm.stb[stbIdx].ntryUsdFlg EQ TRUE AND
1077 ssShrdPrm.stb[stbIdx].iId EQ iId2Find )
1078
1079 return( stbIdx );
1080 }
1081
1082 return( -1 );
1083 }
1084
1085 /*
1086 +-------------------------------------------------------------------+
1087 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1088 | ROUTINE : psaSS_chgSrvTypCnt |
1089 +-------------------------------------------------------------------+
1090
1091 PURPOSE : this function modifies the service type counter (MOS/MTS)
1092 defined by the passed service id by the passed delta value.
1093 */
1094
1095 GLOBAL void psaSS_chngSrvTypCnt ( SHORT sId, SHORT dlt )
1096 {
1097
1098 switch( ssShrdPrm.stb[sId].srvType )
1099 {
1100 case( ST_MOS ):
1101
1102 ssShrdPrm.nrOfMOS += dlt;
1103
1104 if( ssShrdPrm.nrOfMOS < 0 ) ssShrdPrm.nrOfMOS = 0;
1105
1106 break;
1107
1108 case( ST_MTS ):
1109
1110 ssShrdPrm.nrOfMTS += dlt;
1111
1112 if( ssShrdPrm.nrOfMTS < 0 ) ssShrdPrm.nrOfMTS = 0;
1113
1114 break;
1115
1116 default:
1117
1118 TRACE_EVENT( "UNEXP SERVICE TYPE IN STB" );
1119 }
1120 }
1121
1122 /*
1123 +-------------------------------------------------------------------+
1124 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1125 | ROUTINE : psaSS_getMOSTi |
1126 +-------------------------------------------------------------------+
1127
1128 PURPOSE : this function selects a ti out of a pool of valid ti's
1129 and inserts it into the passed service table entry. if no
1130 ti is available the function returns -1.
1131 a bit of the pool stands for a valid ti.
1132 0 indicates a used ti, 1 indicates a free ti.
1133 */
1134
1135 GLOBAL SHORT psaSS_getMOSTi( SHORT sId )
1136 {
1137 UBYTE idx; /* holds pool idx */
1138
1139 for( idx = 0; idx < MAX_MOSTI_NR; idx++ )
1140 {
1141 if( tiPool & (1u << idx) )
1142 {
1143 tiPool &= ~(1u << idx);
1144 ssShrdPrm.stb[sId].ti = idx;
1145 return( 0 );
1146 }
1147 }
1148 return( -1 );
1149 }
1150
1151 /*
1152 +-------------------------------------------------------------------+
1153 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1154 | ROUTINE : psaSS_retMOSTi |
1155 +-------------------------------------------------------------------+
1156
1157 PURPOSE : this function returns a used ti to the ti pool if the
1158 call was a MOS. the ti is free for the next MOS
1159 afterwards.
1160 a bit of the pool stands for a valid ti.
1161 0 indicates a used ti, 1 indicates a free ti.
1162 */
1163
1164 GLOBAL void psaSS_retMOSTi( SHORT sId )
1165 {
1166 if( ssShrdPrm.stb[sId].srvType EQ ST_MOS )
1167
1168 if( ssShrdPrm.stb[sId].ti < MAX_MOSTI_NR )
1169
1170 tiPool |= (0x01 << ssShrdPrm.stb[sId].ti);
1171 }
1172
1173 /*
1174 +-------------------------------------------------------------------+
1175 | PROJECT : GSM-PS (6147) MODULE : PSA_SS |
1176 | ROUTINE : psaSS_InitStbNtry |
1177 +-------------------------------------------------------------------+
1178
1179 PURPOSE : initialize the indexed service table entry.
1180
1181 */
1182
1183 GLOBAL void psaSS_InitStbNtry ( SHORT idx )
1184 {
1185
1186 /*
1187 *-------------------------------------------------------------------
1188 * initialize call table entry
1189 *-------------------------------------------------------------------
1190 */
1191 ssShrdPrm.stb[idx].ntryUsdFlg = FALSE;
1192 ssShrdPrm.stb[idx].ti = (UBYTE)-1; /* NO_ENTRY is -1 and ti where is is assigning is UBYTE,so typecast with UBYTE */
1193 ssShrdPrm.stb[idx].iId = 0;
1194 ssShrdPrm.stb[idx].srvStat = NO_VLD_SSS;
1195 ssShrdPrm.stb[idx].srvType = NO_VLD_ST;
1196 ssShrdPrm.stb[idx].orgOPC = NOT_PRESENT_8BIT;
1197 ssShrdPrm.stb[idx].opCode = NOT_PRESENT_8BIT;
1198 ssShrdPrm.stb[idx].ssCode = NOT_PRESENT_8BIT;
1199 ssShrdPrm.stb[idx].ussdReqFlg = FALSE;
1200 ssShrdPrm.stb[idx].failType = NO_VLD_SSF;
1201 ssShrdPrm.stb[idx].entCs = NOT_PRESENT_16BIT;
1202 ssShrdPrm.stb[idx].rejPrb = NOT_PRESENT_8BIT;
1203 ssShrdPrm.stb[idx].errCd = NOT_PRESENT_8BIT;
1204 ssShrdPrm.stb[idx].errPrms = NOT_PRESENT_8BIT;
1205 ssShrdPrm.stb[idx].curCmd = AT_CMD_NONE;
1206 ssShrdPrm.stb[idx].srvOwn = (T_OWN)CMD_SRC_NONE;
1207 ssShrdPrm.stb[idx].SSver = DEF_SS_VER;
1208 ssShrdPrm.stb[idx].ussd_operation = FALSE;
1209 }
1210
1211 /*
1212 +-------------------------------------------------------------------+
1213 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1214 | ROUTINE : psaSS_stbFindUssdReq |
1215 +-------------------------------------------------------------------+
1216
1217 PURPOSE : returns the service table index for the entry that has a
1218 USSD request pending.
1219 Returning -1 indicates that no such service was found.
1220 */
1221
1222 GLOBAL SHORT psaSS_stbFindUssdReq ( void )
1223 {
1224 SHORT stbIdx; /* holds call table index */
1225
1226 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx++ )
1227 {
1228 if( ssShrdPrm.stb[stbIdx].ntryUsdFlg EQ TRUE AND
1229 ssShrdPrm.stb[stbIdx].ussdReqFlg EQ TRUE AND
1230 ssShrdPrm.stb[stbIdx].srvStat EQ SSS_ACT )
1231 {
1232 return( stbIdx );
1233 }
1234 }
1235
1236 return( -1 );
1237 }
1238
1239 /*
1240 +-------------------------------------------------------------------+
1241 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1242 | ROUTINE : psaSS_stbFindActSrv |
1243 +-------------------------------------------------------------------+
1244
1245 PURPOSE : returns the service table index for the first entry that
1246 holds an active service which is not the passed index.
1247 Returning -1 indicates that no active service was found.
1248 */
1249
1250 GLOBAL SHORT psaSS_stbFindActSrv ( SHORT sId )
1251 {
1252 SHORT stbIdx; /* holds call table index */
1253
1254 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx++ )
1255 {
1256 if( ssShrdPrm.stb[stbIdx].ntryUsdFlg EQ TRUE AND
1257 ssShrdPrm.stb[stbIdx].srvStat EQ SSS_ACT )
1258 {
1259 if( stbIdx NEQ sId )
1260
1261 return( stbIdx );
1262 }
1263 }
1264
1265 return( -1 );
1266 }
1267
1268 /*
1269 +-------------------------------------------------------------------+
1270 | PROJECT : GSM-PS (6147) MODULE : PSA_SS |
1271 | ROUTINE : psaSS_Init |
1272 +-------------------------------------------------------------------+
1273
1274 PURPOSE : initialize the protocol stack adapter for SS.
1275
1276 */
1277
1278 GLOBAL void psaSS_Init ( void )
1279 {
1280 UBYTE stbIdx; /* holds index to service table */
1281
1282 /*
1283 *-------------------------------------------------------------------
1284 * initialize service table
1285 *-------------------------------------------------------------------
1286 */
1287 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx++ )
1288 {
1289 psaSS_InitStbNtry( stbIdx );
1290 }
1291
1292 /*
1293 *-------------------------------------------------------------------
1294 * initialize shared parameter
1295 *-------------------------------------------------------------------
1296 */
1297 ssShrdPrm.nrOfMOS = 0;
1298 ssShrdPrm.nrOfMTS = 0;
1299 ssShrdPrm.iIdNxt = 0;
1300 }
1301
1302 /*
1303 +-------------------------------------------------------------------+
1304 | PROJECT : GSM-PS (6147) MODULE : PSA_SS |
1305 | ROUTINE : psaSS_DumpFIE |
1306 +-------------------------------------------------------------------+
1307
1308 PURPOSE : Dump facility information element to debug output.
1309
1310 */
1311
1312 GLOBAL void psaSS_DumpFIE ( T_fac_inf * fie )
1313 {
1314
1315 CHAR strBuf[40+1]; /* holds string buffer */
1316 UBYTE idx, cnt, mcnt; /* buffer index */
1317 CHAR *pDest; /* points to destination */
1318
1319 /*
1320 *-------------------------------------------------------------------
1321 * format FIE
1322 *-------------------------------------------------------------------
1323 */
1324 TRACE_EVENT( "FIE SENT/RECEIVED:" );
1325
1326 mcnt = fie->l_fac >> 3;
1327
1328 if( mcnt EQ 0 )
1329 {
1330 TRACE_EVENT("Empty Facility");
1331 return;
1332 }
1333
1334 for( cnt = 0; cnt < mcnt; cnt+=idx )
1335 {
1336 pDest = strBuf;
1337
1338 for( idx = 0; idx < 20 AND idx+cnt < mcnt; idx++ )
1339 {
1340 /* Implements Measure#32: Row 1312 */
1341 pDest += sprintf( pDest, format_2X_str, (UBYTE)fie->fac[idx+cnt] );
1342 }
1343
1344 *pDest = 0x0;
1345
1346 TRACE_EVENT( strBuf );
1347 }
1348 }
1349
1350 /*
1351 +-------------------------------------------------------------------+
1352 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1353 | ROUTINE : psaSS_stbDump |
1354 +-------------------------------------------------------------------+
1355
1356 PURPOSE : this function dumps the service table to the debug output.
1357 */
1358
1359 GLOBAL void psaSS_stbDump ( void )
1360 {
1361 #ifdef TRACING
1362
1363 SHORT stbIdx; /* holds service table index */
1364 char lnBuf[HDR_WDT+(MAX_ITM*ITM_WDT)+1]; /* holds buffer for output line */
1365 char verBuf[VERSION_LEN+1]; /* holds buffer for SS version */
1366 SHORT itmIdx; /* holds items per line index */
1367 SHORT chrNr; /* holds number of processed chars */
1368
1369 for( stbIdx = 0; stbIdx < MAX_SS_NR; stbIdx+=MAX_ITM )
1370 {
1371 /* --- service id ----------------------------------------------------------*/
1372 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " srv id");
1373
1374 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx+stbIdx<MAX_SS_NR); itmIdx++ )
1375 {
1376 chrNr += sprintf( lnBuf+chrNr, "%*d", ITM_WDT, stbIdx + itmIdx );
1377 }
1378 TRACE_EVENT( lnBuf );
1379
1380 /* --- entry used flag -----------------------------------------------------*/
1381 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "entry used" );
1382
1383 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1384 {
1385 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
1386 ssShrdPrm.stb[stbIdx+itmIdx].ntryUsdFlg );
1387 }
1388 TRACE_EVENT( lnBuf );
1389
1390 /* --- transaction identifier ----------------------------------------------*/
1391 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " ti" );
1392
1393 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1394 {
1395 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
1396 ssShrdPrm.stb[stbIdx+itmIdx].ti );
1397 }
1398 TRACE_EVENT( lnBuf );
1399
1400 /* --- service status ------------------------------------------------------*/
1401 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "srv status" );
1402
1403 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1404 {
1405 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
1406 ssShrdPrm.stb[stbIdx+itmIdx].srvStat );
1407 }
1408 TRACE_EVENT( lnBuf );
1409
1410 /* --- service type --------------------------------------------------------*/
1411 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " srv type" );
1412
1413 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1414 {
1415 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
1416 ssShrdPrm.stb[stbIdx+itmIdx].srvType );
1417 }
1418 TRACE_EVENT( lnBuf );
1419
1420 /* --- SS version ----------------------------------------------------------*/
1421 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "SS version" );
1422
1423 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1424 {
1425 chrNr += sprintf( lnBuf+chrNr, "%*d", ITM_WDT,
1426 ssShrdPrm.stb[stbIdx+itmIdx].SSver );
1427 }
1428 TRACE_EVENT( lnBuf );
1429
1430 /* --- failure type ------------------------------------------------------*/
1431 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "fail. type" );
1432
1433 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1434 {
1435 chrNr += sprintf( lnBuf+chrNr, "%*d", ITM_WDT,
1436 ssShrdPrm.stb[stbIdx+itmIdx].failType );
1437 }
1438 TRACE_EVENT( lnBuf );
1439
1440 /* --- entity cause ------------------------------------------------------*/
1441 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, "ent. cause" );
1442
1443 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1444 {
1445 chrNr += sprintf( lnBuf+chrNr, "%*d", ITM_WDT,
1446 ssShrdPrm.stb[stbIdx+itmIdx].entCs );
1447 }
1448 TRACE_EVENT( lnBuf );
1449
1450 /* --- reject problem ----------------------------------------------------*/
1451 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " rej. prob" );
1452
1453 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1454 {
1455 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
1456 ssShrdPrm.stb[stbIdx+itmIdx].rejPrb );
1457 }
1458 TRACE_EVENT( lnBuf );
1459
1460 /* --- error code ----------------------------------------------------*/
1461 chrNr = sprintf( lnBuf, "%*.*s", HDR_WDT, HDR_WDT, " err. code" );
1462
1463 for( itmIdx = 0; (itmIdx<MAX_ITM)AND(itmIdx<MAX_SS_NR); itmIdx++ )
1464 {
1465 chrNr += sprintf( lnBuf+chrNr, "%*hd", ITM_WDT,
1466 ssShrdPrm.stb[stbIdx+itmIdx].errCd );
1467 }
1468 TRACE_EVENT( lnBuf );
1469
1470 }
1471
1472 #endif /* of #ifdef TRACING */
1473 }
1474 /*
1475 +-------------------------------------------------------------------+
1476 | PROJECT : GSM-PS (6147) MODULE : CMH_F |
1477 | ROUTINE : psaSS_GetPendingTrn |
1478 +-------------------------------------------------------------------+
1479
1480 PURPOSE : Find Id of a pending call for multy-transaction operation
1481
1482 */
1483
1484 GLOBAL SHORT psaSS_GetPendingTrn ( void )
1485 {
1486 SHORT bit_len;
1487 SHORT i;
1488
1489 bit_len = 8 * sizeof(ssShrdPrm.mltyTrnFlg);
1490 for (i = 0; i < bit_len; i++)
1491 {
1492 if ( ssShrdPrm.mltyTrnFlg & ( 0x1 << i ) )
1493 return i;
1494 }
1495
1496 return -1;
1497 }
1498
1499 GLOBAL void psaSS_KillAllPendingTrn ( void ) /* sId: main transaction: not to be killed */
1500 {
1501 SHORT pending_idx;
1502
1503 TRACE_FUNCTION("psaSS_KillAllPendingTrn( )");
1504
1505 while ( ssShrdPrm.mltyTrnFlg )
1506 {
1507 pending_idx = psaSS_GetPendingTrn( );
1508 ssShrdPrm.mltyTrnFlg &= ~( 1u << pending_idx ); /* unsent id flag */
1509
1510 ssShrdPrm.stb[ pending_idx ].ntryUsdFlg = FALSE; /* free entry in ss table */
1511 ssShrdPrm.stb[ pending_idx ].srvStat = NO_VLD_SSS; /* not sure if it's necessary...? */
1512
1513 PFREE( ssShrdPrm.stb[pending_idx].save_prim ); /* free pending primitive */
1514 }
1515 }
1516
1517 /* Implements Measure # 195 */
1518 /*
1519 +-------------------------------------------------------------------+
1520 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF |
1521 | ROUTINE : psaSS_asmEraseSS |
1522 +-------------------------------------------------------------------+
1523
1524 PURPOSE : Assemble the erase, activate and deactivate SS facility
1525 information element.
1526
1527 */
1528
1529 LOCAL void psaSS_asmSSForBS ( UBYTE ssCode, UBYTE bscSrvType,
1530 UBYTE bscSrv, T_ssForBS *ssForBS)
1531 {
1532
1533 TRACE_FUNCTION("psaSS_asmSSForBS( )");
1534
1535 /* set service code */
1536 ssForBS->v_ssCode = TRUE;
1537 ssForBS->ssCode = ssCode;
1538
1539 /* set basic service type */
1540 switch( bscSrvType )
1541 {
1542 case( BS_BEAR_SRV ):
1543
1544 ssForBS->basicService.v_bearerService = TRUE;
1545 ssForBS->basicService.bearerService = bscSrv;
1546 break;
1547
1548 case( BS_TELE_SRV ):
1549
1550 ssForBS->basicService.v_teleservice = TRUE;
1551 ssForBS->basicService.teleservice = bscSrv;
1552 break;
1553 }
1554
1555 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
1556 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3;
1557 ccd_codeMsg (CCDENT_FAC, UPLINK,
1558 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg,
1559 NOT_PRESENT_8BIT);
1560
1561 ssShrdPrm.cmpType = CT_INV;
1562
1563 }
1564
1565 /*==== EOF ========================================================*/
1566