comparison g23m-gsm/ss/ss_ss.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 :
4 | Modul :
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 modul defines the functions for the supplementary
18 | services.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef SS_SS_C
23 #define SS_SS_C
24
25 #include "config.h"
26 #include "fixedconf.h"
27 #include "condat-features.h"
28
29 #define ENTITY_SS
30
31 /*==== INCLUDES ===================================================*/
32 #if defined (NEW_FRAME)
33
34 #include <string.h>
35 #include <stdlib.h>
36 #include <stddef.h>
37 #include "typedefs.h"
38 #include "pcm.h"
39 #include "pconst.cdg"
40 #include "mconst.cdg"
41 #include "message.h"
42 #include "ccdapi.h"
43 #include "vsi.h"
44 #include "custom.h"
45 #include "gsm.h"
46 #include "prim.h"
47 #include "cnf_ss.h"
48 #include "mon_ss.h"
49 #include "pei.h"
50 #include "tok.h"
51 #include "ss.h"
52 #include "ss_em.h"
53
54 #else
55
56 #include <string.h>
57 #include <stdlib.h>
58 #include <stddef.h>
59 #include "stddefs.h"
60 #include "pcm.h"
61 #include "pconst.cdg"
62 #include "mconst.cdg"
63 #include "message.h"
64 #include "ccdapi.h"
65 #include "custom.h"
66 #include "gsm.h"
67 #include "prim.h"
68 #include "cnf_ss.h"
69 #include "mon_ss.h"
70 #include "vsi.h"
71 #include "pei.h"
72 #include "tok.h"
73 #include "ss.h"
74 #include "ss_em.h"
75
76 #endif
77
78 /*==== EXPORT =====================================================*/
79
80 /*==== PRIVAT =====================================================*/
81
82 /*==== VARIABLES ==================================================*/
83 #ifdef TI_PS_HCOMM_CHANGE
84 #else
85 #if defined (NEW_FRAME)
86 EXTERN T_HANDLE hCommMM; /* MM Communication */
87 EXTERN T_HANDLE hCommMMI; /* MMI Communication */
88 #else
89 EXTERN T_VSI_CHANDLE hCommMM; /* MM Communication */
90 EXTERN T_VSI_CHANDLE hCommMMI; /* MMI Communication */
91 #endif
92 #endif
93
94 #ifdef SS_TEST
95 UBYTE trc[100];
96 #endif
97
98 /*==== FUNCTIONS ==================================================*/
99
100 /*
101 * -------------------------------------------------------------------
102 * PRIMITIVE Processing functions
103 * -------------------------------------------------------------------
104 */
105
106 /*
107 +--------------------------------------------------------------------+
108 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
109 | STATE : code ROUTINE : ss_init_ss_data |
110 +--------------------------------------------------------------------+
111
112 PURPOSE : Initialize the SS data for the module supplem. services.
113
114 */
115
116 GLOBAL void ss_init_ss_data (void)
117 {
118 GET_INSTANCE_DATA;
119 UBYTE i;
120 TRACE_FUNCTION ("ss_init_ss_data()");
121
122 ss_init ();
123 for (i = 0; i < MAX_INST; i++)
124 SET_SS_STATE(ss_data->ss_state,i,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
125
126 }
127
128 /*
129 +--------------------------------------------------------------------+
130 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
131 | STATE : code ROUTINE : ss_mmss_error_ind |
132 +--------------------------------------------------------------------+
133
134 PURPOSE : Process the primitive MMSS_ERROR_IND.
135
136 */
137
138 GLOBAL void ss_mmss_error_ind (T_MMSS_ERROR_IND *mmss_error_ind)
139 {
140 GET_INSTANCE_DATA;
141 TRACE_FUNCTION ("ss_mmss_error_ind()");
142
143 ss_data->ti = mmss_error_ind->ti;
144 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
145 {
146 case SS_CONNECTION_PENDING:
147 PFREE (P2D(ss_data->prim[ss_data->ti]));
148 ss_data->prim[ss_data->ti] = NULL;
149 /*FALLTHROUGH*/
150 case SS_CONNECTED:
151 {
152 PALLOC (mnss_end_ind, MNSS_END_IND);
153
154 ss_data->ti = mmss_error_ind->ti;
155
156 mnss_end_ind->cause = mmss_error_ind->cause;
157 mnss_end_ind->ti = ss_data->ti;
158 memset (&mnss_end_ind->fac_inf, 0, sizeof (T_fac_inf)) ;
159
160 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
161
162 PSENDX (MMI, mnss_end_ind);
163 {
164 PALLOC (mmss_release_req, MMSS_RELEASE_REQ);
165 mmss_release_req->ti = ss_data->ti;
166 PSENDX (MM, mmss_release_req);
167 }
168
169 MM_EM_MM_CONNECTION_ABORTED;
170
171 break;
172 }
173
174 default:
175 break;
176 }
177 PFREE (mmss_error_ind);
178 }
179
180 /*
181 +--------------------------------------------------------------------+
182 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
183 | STATE : code ROUTINE : ss_mmss_establish_cnf |
184 +--------------------------------------------------------------------+
185
186 PURPOSE : Process the primitive MMSS_ESTABLISH_CNF.
187
188 */
189 GLOBAL void ss_mmss_establish_cnf (T_MMSS_ESTABLISH_CNF *mmss_establish_cnf)
190 {
191 GET_INSTANCE_DATA;
192 TRACE_FUNCTION ("ss_mmss_establish_cnf()");
193
194 ss_data->ti = mmss_establish_cnf->ti;
195
196 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
197 {
198 case SS_CONNECTION_PENDING:
199 CCD_START;
200 {
201 T_MNSS_BEGIN_REQ * mnss_begin_req;
202 MCAST (ss_register, U_SS_REGISTER);
203
204 ss_register->msg_type = U_SS_REGISTER;
205 mnss_begin_req = (T_MNSS_BEGIN_REQ *)P2D(ss_data->prim[ss_data->ti]);
206
207
208 ss_register->ss_version.c_ver = mnss_begin_req->ss_ver.len;
209 if(ss_register->ss_version.c_ver)
210 {
211 ss_register->v_ss_version = TRUE;
212 memcpy (ss_register->ss_version.ver,
213 mnss_begin_req->ss_ver.ver,
214 ss_register->ss_version.c_ver);
215 }
216 else
217 {
218 ss_register->v_ss_version = FALSE;
219 }
220
221 ss_register->ss_facility.c_fac_info = mnss_begin_req->fac_inf.l_fac >> 3;
222 if(ss_register->ss_facility.c_fac_info)
223 {
224 ss_register->v_ss_facility = TRUE;
225 memcpy (ss_register->ss_facility.fac_info,
226 &mnss_begin_req->fac_inf.fac[mnss_begin_req->fac_inf.o_fac >>3],
227 ss_register->ss_facility.c_fac_info);
228 }
229 else
230 {
231 ss_register->v_ss_facility = FALSE;
232 }
233
234 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_CONNECTED); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
235
236 PFREE (P2D(ss_data->prim[ss_data->ti]));
237 ss_data->prim[ss_data->ti] = NULL;
238 ss_for_data_req ((USHORT)(LEN_U_SS_REGISTER + ss_register->ss_facility.c_fac_info * 8));
239
240 MM_EM_MM_CONNECTION_ESTABLISHED;
241
242 }
243 CCD_END;
244 break;
245
246 default:
247 break;
248 }
249 PFREE (mmss_establish_cnf);
250 }
251
252 /*
253 +--------------------------------------------------------------------+
254 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
255 | STATE : code ROUTINE : ss_mmss_release_ind |
256 +--------------------------------------------------------------------+
257
258 PURPOSE : Process the primitive MMSS_RELEASE_IND.
259
260 */
261 GLOBAL void ss_mmss_release_ind (T_MMSS_RELEASE_IND *mmss_release_ind)
262 {
263 GET_INSTANCE_DATA;
264 TRACE_FUNCTION ("ss_mmss_release_ind()");
265
266 ss_data->ti = mmss_release_ind->ti;
267
268 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
269 {
270 case SS_CONNECTION_PENDING:
271 PFREE (P2D(ss_data->prim[ss_data->ti]));
272 ss_data->prim[ss_data->ti] = NULL;
273
274 MM_EM_MM_CONNECTION_FAILED;
275
276 /*FALLTHROUGH*/
277 case SS_CONNECTED:
278 {
279 PALLOC (mnss_end_ind, MNSS_END_IND);
280
281 mnss_end_ind->ti = ss_data->ti;
282 mnss_end_ind->cause = mmss_release_ind->cause;
283 memset (&mnss_end_ind->fac_inf, 0, sizeof (T_fac_inf));
284 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
285
286 MM_EM_MM_CONNECTION_RELEASED;
287
288 PSENDX (MMI, mnss_end_ind);
289 break;
290 }
291 default:
292 break;
293 }
294 PFREE (mmss_release_ind);
295 }
296
297 /*
298 +--------------------------------------------------------------------+
299 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
300 | STATE : code ROUTINE : ss_mnss_begin_req |
301 +--------------------------------------------------------------------+
302
303 PURPOSE : Process the primitive MNSS_BEGIN_REQ.
304
305 */
306 GLOBAL void ss_mnss_begin_req (T_MNSS_BEGIN_REQ *mnss_begin_req)
307 {
308 GET_INSTANCE_DATA;
309 TRACE_FUNCTION ("ss_mnss_begin_req()");
310
311 ss_data->ti = mnss_begin_req->ti;
312
313 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
314 {
315 case SS_IDLE:
316 {
317 if (ss_data->ti < 7)
318 {
319 #if defined (NEW_FRAME)
320 ss_data->prim[ss_data->ti] = (T_PRIM *)D2P(mnss_begin_req);
321 #else
322 ss_data->prim[ss_data->ti] = D2P(mnss_begin_req);
323 #endif
324 {
325 PALLOC (mmss_establish_req, MMSS_ESTABLISH_REQ);
326
327 mmss_establish_req->ti = ss_data->ti;
328 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_CONNECTION_PENDING); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
329
330 PSENDX (MM, mmss_establish_req);
331
332 MM_EM_MM_CONNECTION_STARTED;
333
334 }
335 return; /* Don't free primitive */
336 }
337 break;
338 }
339 default:
340 break;
341 }
342 PFREE (mnss_begin_req);
343 }
344
345 /*
346 +--------------------------------------------------------------------+
347 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
348 | STATE : code ROUTINE : ss_mnss_end_req |
349 +--------------------------------------------------------------------+
350
351 PURPOSE : Process the primitive MNSS_END_REQ.
352
353 */
354 GLOBAL void ss_mnss_end_req (T_MNSS_END_REQ *mnss_end_req)
355 {
356 GET_INSTANCE_DATA;
357 TRACE_FUNCTION ("ss_mnss_end_req()");
358
359 ss_data->ti = mnss_end_req->ti;
360
361 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
362 {
363 case SS_CONNECTION_PENDING:
364 if (ss_data->prim[ss_data->ti] NEQ NULL)
365 {
366 /* Free stored primitive */
367 PFREE (P2D(ss_data->prim[ss_data->ti]));
368 ss_data->prim[ss_data->ti] = NULL;
369 }
370
371 /* Send MMSS_RELEASE_REQ */
372 {
373 PALLOC (mmss_release_req, MMSS_RELEASE_REQ); /* T_MMSS_RELEASE_REQ */
374 mmss_release_req->ti = ss_data->ti;
375 PSENDX (MM, mmss_release_req);
376 }
377
378 /* Next state is SS_IDLE */
379 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
380 break;
381
382 case SS_CONNECTED:
383 CCD_START;
384 {
385 MCAST (ss_rel_comp, B_SS_REL_COMP);
386
387 ss_rel_comp->msg_type = B_SS_REL_COMP;
388 ss_rel_comp->v_ss_cause = FALSE;
389 ss_rel_comp->v_ss_facility = (mnss_end_req->fac_inf.l_fac) ?
390 TRUE : FALSE;
391 ss_rel_comp->ss_facility.c_fac_info = mnss_end_req->fac_inf.l_fac >> 3;
392 memcpy (ss_rel_comp->ss_facility.fac_info,
393 &mnss_end_req->fac_inf.fac[mnss_end_req->fac_inf.o_fac >>3],
394 ss_rel_comp->ss_facility.c_fac_info);
395 if (ss_rel_comp->v_ss_facility)
396 {
397 ss_for_data_req ((USHORT)(LEN_U_SS_RELEASE_COMPLETE +
398 ss_rel_comp->ss_facility.c_fac_info * 8));
399 }
400 else
401 {
402 ss_for_data_req (LEN_U_SS_RELEASE_COMPLETE);
403 }
404
405 {
406 PALLOC (mmss_release_req, MMSS_RELEASE_REQ);
407
408 mmss_release_req->ti = ss_data->ti;
409 ss_data->ss_state = SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
410
411 PSENDX (MM, mmss_release_req);
412 }
413 }
414 CCD_END;
415
416 MM_EM_MM_RELEASE_COMPLETE_SENT;
417
418 break;
419 }
420 PFREE (mnss_end_req);
421 }
422
423 /*
424 +--------------------------------------------------------------------+
425 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
426 | STATE : code ROUTINE : ss_mnss_facility_req |
427 +--------------------------------------------------------------------+
428
429 PURPOSE : Process the primitive MNSS_FACILITY_REQ.
430
431 */
432
433 GLOBAL void ss_mnss_facility_req (T_MNSS_FACILITY_REQ *mnss_facility_req)
434 {
435 GET_INSTANCE_DATA;
436 CCD_START;
437 {
438 MCAST (ss_facility, U_SS_FACILITY);
439
440 TRACE_FUNCTION ("ss_mnss_facility_req()");
441
442 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
443 {
444 case SS_CONNECTED:
445 ss_data->ti = mnss_facility_req->ti;
446 ss_facility->msg_type = U_SS_FACILITY;
447 ss_facility->ss_facility.c_fac_info = mnss_facility_req->fac_inf.l_fac >> 3;
448 memcpy (ss_facility->ss_facility.fac_info,
449 &mnss_facility_req->fac_inf.fac[mnss_facility_req->fac_inf.o_fac >>3],
450 ss_facility->ss_facility.c_fac_info);
451 ss_for_data_req ((USHORT)(LEN_U_SS_FACILITY +
452 ss_facility->ss_facility.c_fac_info * 8));
453
454 MM_EM_FACILITY_MESSAGE_SENT;
455
456 break;
457 default:
458 break;
459 }
460 }
461 CCD_END;
462 PFREE (mnss_facility_req);
463 }
464
465 /*
466 * -------------------------------------------------------------------
467 * SIGNAL Processing functions
468 * -------------------------------------------------------------------
469 */
470
471 /*
472 +--------------------------------------------------------------------+
473 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
474 | STATE : code ROUTINE : ss_b_ss_rel_comp |
475 +--------------------------------------------------------------------+
476
477 PURPOSE : Process the signal B_SS_REL_COMP.
478
479 */
480
481 GLOBAL void ss_b_ss_rel_comp (void)
482 {
483 GET_INSTANCE_DATA;
484 TRACE_FUNCTION ("ss_b_ss_rel_comp()");
485
486 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
487 {
488 case SS_IDLE:
489 /* Unrecognised TI : Ignore Message TS 24.010 Section 3.7.3 a)*/
490 {
491 PALLOC (mmss_release_req, MMSS_RELEASE_REQ); /* T_MMSS_RELEASE_REQ */
492 mmss_release_req->ti = ss_data->ti;
493 PSENDX (MM, mmss_release_req);
494 }
495 break;
496
497 case SS_CONNECTED:
498 if (! ss_data->est_flag)
499 {
500 MCAST (ss_rel_comp, B_SS_REL_COMP);
501 PALLOC (mnss_end_ind, MNSS_END_IND);
502
503 mnss_end_ind->ti = ss_data->ti;
504 if (ss_rel_comp->v_ss_cause)
505 mnss_end_ind->cause = CAUSE_MAKE(DEFBY_STD,
506 ORIGSIDE_NET,
507 SS_ORIGINATING_ENTITY,
508 ss_rel_comp->ss_cause.cs);
509 else
510 mnss_end_ind->cause = CAUSE_MAKE(DEFBY_CONDAT,
511 ORIGSIDE_NET,
512 SS_ORIGINATING_ENTITY,
513 NOT_PRESENT_8BIT);
514 memcpy (mnss_end_ind->fac_inf.fac, ss_rel_comp->ss_facility.fac_info,
515 ss_rel_comp->ss_facility.c_fac_info);
516 mnss_end_ind->fac_inf.l_fac = ss_rel_comp->ss_facility.c_fac_info << 3;
517 mnss_end_ind->fac_inf.o_fac = 0;
518
519 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
520
521 PSENDX (MMI, mnss_end_ind);
522 {
523 PALLOC (mmss_release_req, MMSS_RELEASE_REQ);
524 mmss_release_req->ti = ss_data->ti;
525 PSENDX (MM, mmss_release_req);
526 }
527
528 MM_EM_MM_RELEASE_COMPLETE_RECEIVED;
529 }
530 break;
531
532 default:
533 /* Should never reach here */
534 TRACE_FUNCTION("**BAD SS State**");
535 break;
536 }
537 }
538
539 /*
540 +--------------------------------------------------------------------+
541 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
542 | STATE : code ROUTINE : ss_d_ss_facility |
543 +--------------------------------------------------------------------+
544
545 PURPOSE : Process the signal D_SS_FACILITY.
546
547 */
548
549 GLOBAL void ss_d_ss_facility (void)
550 {
551 GET_INSTANCE_DATA;
552 TRACE_FUNCTION ("ss_d_ss_facility()");
553
554 switch( ss_data->error )
555 {
556 case CAUSE_INVALID_MAND_INFO:
557 /* Send RELEASE COMPLETE with this cause TS 24.010 Section 3.7.4*/
558 send_rel_comp(CAUSE_INVALID_MAND_INFO);
559 return;
560
561 default:
562 break;
563 }
564
565 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
566 {
567 case SS_IDLE:
568 /* Unrecognised TI : TS 24.010 Section 3.7.3 b)*/
569 send_rel_comp(CAUSE_INVALID_TI);
570 break;
571
572 case SS_CONNECTED:
573 {
574 MCAST (ss_facility, U_SS_FACILITY);
575
576 if (! ss_data->est_flag)
577 {
578 PALLOC (mnss_facility_ind, MNSS_FACILITY_IND);
579
580 mnss_facility_ind->ti = ss_data->ti;
581
582 memcpy (mnss_facility_ind->fac_inf.fac, ss_facility->ss_facility.fac_info,
583 ss_facility->ss_facility.c_fac_info);
584 mnss_facility_ind->fac_inf.l_fac = ss_facility->ss_facility.c_fac_info << 3;
585 mnss_facility_ind->fac_inf.o_fac = 0;
586
587 MM_EM_FACILITY_MESSAGE_RECEIVED;
588
589 PSENDX (MMI, mnss_facility_ind);
590 }
591 break;
592 }
593 default:
594 /* Should never reach here */
595 TRACE_FUNCTION("**BAD SS State**");
596 break;
597 }
598 }
599
600 /*
601 +--------------------------------------------------------------------+
602 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
603 | STATE : code ROUTINE : ss_d_ss_register |
604 +--------------------------------------------------------------------+
605
606 PURPOSE : Process the signal D_SS_REGISTER.
607
608 */
609
610 GLOBAL void ss_d_ss_register (void)
611 {
612 GET_INSTANCE_DATA;
613 MCAST (ss_register, U_SS_REGISTER);
614
615 TRACE_FUNCTION ("ss_d_ss_register()");
616
617 switch( ss_data->error )
618 {
619 case CAUSE_INVALID_MAND_INFO:
620 /* Send RELEASE COMPLETE with this cause TS 24.010 Section 3.7.4*/
621 send_rel_comp(CAUSE_INVALID_MAND_INFO);
622 return;
623
624 default:
625 break;
626 }
627
628 switch (GET_SS_STATE(ss_data->ss_state,ss_data->ti))
629 {
630 case SS_CONNECTED:
631 /* This TI is already being used therefore ignore Message */
632 /* TS 24.010 Section 3.7.3 c) */
633 break;
634
635 case SS_IDLE:
636 if (ss_data->est_flag AND
637 (ss_data->ti >= 8 AND ss_data->ti < 15))
638 {
639 PALLOC (mnss_begin_ind, MNSS_BEGIN_IND);
640
641 mnss_begin_ind->ti = ss_data->ti;
642 memcpy (mnss_begin_ind->fac_inf.fac, ss_register->ss_facility.fac_info,
643 ss_register->ss_facility.c_fac_info);
644 mnss_begin_ind->fac_inf.l_fac = ss_register->ss_facility.c_fac_info << 3;
645 mnss_begin_ind->fac_inf.o_fac = 0;
646
647 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_CONNECTED); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
648
649 MM_EM_REGISTER_MESSAGE_RECEIVED;
650
651 PSENDX (MMI, mnss_begin_ind);
652 }
653 else
654 {
655 /* REGISTER with set TI flag received. Release the connection */
656 PALLOC (mmss_release_req, MMSS_RELEASE_REQ); /* T_MMSS_RELEASE_REQ */
657 mmss_release_req->ti = ss_data->ti;
658 PSENDX (MM, mmss_release_req);
659 }
660 break;
661
662 default:
663 /* Should never reach here */
664 TRACE_FUNCTION("**BAD SS State**");
665 break;
666 }
667 }
668
669 /*
670 * -------------------------------------------------------------------
671 * Procedures
672 * -------------------------------------------------------------------
673 */
674
675 /*
676 +--------------------------------------------------------------------+
677 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
678 | STATE : code ROUTINE : ss_init |
679 +--------------------------------------------------------------------+
680
681 PURPOSE :
682
683 */
684
685 GLOBAL void ss_init (void)
686 {
687 GET_INSTANCE_DATA;
688 memset (ss_data, 0, sizeof (T_SS_DATA));
689 }
690
691 /*
692 +--------------------------------------------------------------------+
693 | PROJECT : GSM-PS (6147) MODULE : SS_SS |
694 | STATE : code ROUTINE : send_rel_comp |
695 +--------------------------------------------------------------------+
696
697 PURPOSE : This functions sends a RELEASE COMPLETE message with a
698 specified 'cause' value
699
700 */
701
702 GLOBAL void send_rel_comp(U8 cause)
703 {
704 GET_INSTANCE_DATA;
705 TRACE_FUNCTION ("send_rel_comp()");
706
707 {
708 MCAST (ss_rel_comp, B_SS_REL_COMP);
709
710 ss_rel_comp->msg_type = B_SS_REL_COMP;
711 ss_rel_comp->v_ss_facility = FALSE;
712 ss_rel_comp->v_ss_cause = TRUE;
713
714 ss_rel_comp->ss_cause.v_cs2 = TRUE;
715 ss_rel_comp->ss_cause.cs2 = CS_GSM_PLMN;
716
717 ss_rel_comp->ss_cause.v_loc = TRUE;
718 ss_rel_comp->ss_cause.loc = LOC_PUB_NET_REMOTE_USER;
719
720 ss_rel_comp->ss_cause.v_rec = TRUE;
721 ss_rel_comp->ss_cause.rec = 0x00;
722
723 ss_rel_comp->ss_cause.v_cs = TRUE;
724 ss_rel_comp->ss_cause.cs = cause;
725
726 ss_rel_comp->ss_cause.c_diag = 0x00;
727
728 ss_for_data_req(LEN_U_SS_RELEASE_COMPLETE);
729 }
730
731 {
732 PALLOC (mmss_release_req, MMSS_RELEASE_REQ);
733 mmss_release_req->ti = ss_data->ti;
734 PSENDX (MM, mmss_release_req);
735 }
736
737 SET_SS_STATE(ss_data->ss_state,ss_data->ti,SS_IDLE); /*lint !e502 (Warning -- Warning 502: Expected unsigned type ) */
738 }
739
740 /*
741 +--------------------------------------------------------------------+
742 | | STATE : code ROUTINE : ss_check_critical_error |
743 +--------------------------------------------------------------------+
744
745 PURPOSE : This function checks wheter a critical error has been
746 detected in the air message. Critical errors which prevent
747 the treatment of an air message are
748 - invalid Message ID
749 - mandatory IE missing
750 - IE coded as comprehension required missing
751 */
752
753 GLOBAL BOOL ss_check_critical_error (UINT ss_err)
754 {
755 TRACE_FUNCTION ("cc_check_critical_error ()");
756 if (ss_err EQ CAUSE_INVALID_MAND_INFO OR
757 ss_err EQ CAUSE_MESSAGE_TYPE_NOT_IMPLEM OR
758 ss_err EQ ERR_INVALID_MID OR
759 ss_err EQ CAUSE_SERVICE_NOT_IMPLEM )
760 return (TRUE);
761 else
762 return (FALSE);
763 }
764 #endif /* #ifndef SS_SS_C */