comparison gsm-fw/g23m-gsm/ss/ss_ss.c @ 673:2f7df7a314f8

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