comparison g23m-gsm/cc/cc_for.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 : CC_FOR
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 formatter
18 | of the component CC.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CC_FOR_C
23 #define CC_FOR_C
24
25 #include "config.h"
26 #include "fixedconf.h"
27 #include "condat-features.h"
28
29 #define ENTITY_CC
30 /*==== INCLUDES ===================================================*/
31
32 #include <string.h>
33 #include "typedefs.h"
34 #include "pcm.h"
35 #include "vsi.h"
36 #include "custom.h"
37 #include "gsm.h"
38 #include "message.h"
39 #include "ccdapi.h"
40 #include "prim.h"
41 #include "cnf_cc.h"
42 #include "mon_cc.h"
43 #include "pei.h"
44 #include "tok.h"
45 #include "cc.h"
46 #include "cc_em.h"
47
48 /*==== EXPORT =====================================================*/
49
50 /*==== PROTOTYPES =================================================*/
51 /* Implements Measure# 44 */
52 LOCAL void for_send_u_release_comp (USHORT cause);
53 /* Implements Measure# 42 */
54 LOCAL void for_fill_sdu_and_send (UBYTE msg,
55 USHORT len);
56
57 /* Implements Measure# 11 */
58 LOCAL void code_msg (UBYTE * msg,
59 USHORT len);
60
61
62
63 /*==== PRIVAT =====================================================*/
64
65 /*==== VARIABLES ==================================================*/
66 #if !defined (SHARED_CCD_BUF)
67 GLOBAL UBYTE _decodedMsg [MAX_MSTRUCT_LEN_CC];
68 #else
69 GLOBAL UBYTE * _decodedMsg;
70 #endif
71
72 /*==== FUNCTIONS ==================================================*/
73
74 #if 0
75 /* xhegadeg 24th May 2005
76 The part of the code between #if 0 to #endif is never executed.*/
77
78 /*
79 Reason For Commenting :
80 Issue CC-ENH-30714---->
81 All the Layer3 CC messages are now traced via TRACE_BINDUMP.
82 So no need of the Function cc_trace_bcap() which was earlier
83 used for taking Setup ( Both Uplink & Downlink),Call Confirm,
84 Call Proceeding Traces using TRACE_BCAP.
85 */
86 #if defined TRACE_BCAP
87
88 /*
89 +--------------------------------------------------------------------+
90 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
91 | STATE : code ROUTINE : cc_trace_bcap |
92 +--------------------------------------------------------------------+
93
94 PURPOSE : Trace messages containing bearer caps. This has been shown
95 to be useful in the past.
96
97 */
98
99 LOCAL void cc_trace_bcap (T_CC_DATA *cc_data,
100 const T_sdu *sdu,
101 UBYTE direction)
102 {
103 const UBYTE *msg_ptr; /* Pointer to non-decoded message */
104 unsigned msg_len; /* Length of non-decoded message */
105 unsigned str_len; /* Length of trace string */
106
107 /* TRACE_FUNCTION ("cc_trace_bcap()"); */
108
109 trace_buf[0] = '\0';
110 if (direction EQ UPLINK)
111 {
112 switch (_decodedMsg[0])
113 {
114 case U_SETUP:
115 strcpy (trace_buf, "U_SETUP:");
116 break;
117 case U_CALL_CONF:
118 strcpy (trace_buf, "U_CCONF:");
119 break;
120 default:
121 break;
122 }
123 }
124 else
125 {
126 switch (_decodedMsg[0])
127 {
128 case D_SETUP:
129 strcpy (trace_buf, "D_SETUP:");
130 break;
131 case D_CALL_PROCEED:
132 strcpy (trace_buf, "D_CPROC:");
133 break;
134 default:
135 break;
136 }
137 }
138
139 str_len = strlen (trace_buf);
140 msg_len = sdu->l_buf >> 3;
141 msg_ptr = &sdu->buf[sdu->o_buf >> 3];
142
143 if (str_len > 0)
144 {
145 /* Known message containing bearer caps, trace it out */
146 unsigned count; /* Number of dumped hex bytes in the trace line */
147
148 count = 0;
149
150 if (msg_len > 40)
151 msg_len = 40; /* Limit trace load */
152
153 while (msg_len > 0)
154 {
155 sprintf (trace_buf + str_len," %02x", *msg_ptr);
156 msg_ptr++;
157 msg_len--;
158 count++;
159 str_len += 3;
160 if ((msg_len > 0) AND (count >= 20))
161 {
162 /* Start new trace line */
163 TRACE_EVENT (trace_buf);
164 strcpy (trace_buf, " ");
165 str_len = strlen (trace_buf);
166 count = 0;
167 }
168 }
169 TRACE_EVENT (trace_buf);
170 }
171 }
172 #endif /* #if defined TRACE_BCAP */
173 #endif /* #if 0 */
174
175 /*
176 +--------------------------------------------------------------------+
177 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
178 | STATE : code ROUTINE : for_init |
179 +--------------------------------------------------------------------+
180
181 PURPOSE : Initialize the formatter
182
183 */
184
185 GLOBAL void for_init (void)
186 {
187 TRACE_FUNCTION ("for_init()");
188 }
189
190 /*
191 +--------------------------------------------------------------------+
192 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
193 | STATE : code ROUTINE : for_mmcm_est_ind |
194 +--------------------------------------------------------------------+
195
196 PURPOSE : Processing the primitive MMCC_EST_IND from mobility
197 management.
198
199 */
200
201 GLOBAL void for_mmcm_est_ind (T_MMCM_ESTABLISH_IND * mmcm_establish_ind)
202 {
203 UBYTE pd;
204 BOOL rel_flag = FALSE;
205 GET_INSTANCE_DATA;
206
207 /* Enable the PCO to correctly decode the message */
208 PPASS (mmcm_establish_ind, data, MMCM_ESTABLISH_IND);
209
210 TRACE_FUNCTION ("for_mmcm_est_ind()");
211
212 cc_data->ti_ext = 0;
213 cc_data->ti_ext_pres = FALSE;
214
215 GET_PD (data->sdu, pd);
216 GET_TI (data->sdu, cc_data->ti);
217 cc_data->ti_rec = cc_data->ti;
218
219 if (cc_data->ti >= 8)
220 cc_data->ti -= 8;
221 else
222 cc_data->ti += 8;
223
224 if ((pd NEQ M_MM_PD_CC)
225 OR
226 (data->sdu.l_buf < 16))
227 /*
228 * wrong protocol discriminator
229 * or message too short
230 */
231 {
232 rel_flag = TRUE;
233 }
234 else if ((cc_data->ti & 7) EQ 7)
235 {
236 /* TI value indicates extension octet, not allowed currently */
237 /* retrieve the second octet for TI and store it for subsequent handling in or_decode */
238 GET_TI_EXT(data->sdu, cc_data->ti_ext);
239 if ((cc_data->ti_ext & EXTENDED_TI_VALID) EQ EXTENDED_TI_VALID)
240 {
241 cc_data->ti_ext_pres = TRUE;
242 }
243 else
244 { /* no extended TI */
245 rel_flag = TRUE;
246 }
247 }
248 if (rel_flag==TRUE)
249 {
250 PPASS (data, rel, MMCM_RELEASE_REQ);
251 rel->org_entity = NAS_ORG_ENTITY_CC;
252 rel->ti = cc_data->ti;
253 PSENDX (MM, rel);
254 return;
255
256 }
257
258 cc_data->error = 0;
259 cc_data->error_count = 0;
260 for_decode ((T_PRIM*)(D2P(data)), TRUE);
261
262 } /* for_mmcm_est_ind() */
263
264 /*
265 +--------------------------------------------------------------------+
266 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
267 | STATE : code ROUTINE : for_mmcm_data_ind |
268 +--------------------------------------------------------------------+
269
270 PURPOSE : Processing the primitive MMCM_DATA_IND from mobility
271 management.
272
273 */
274
275 GLOBAL void for_mmcm_data_ind (T_MMCM_DATA_IND * mmcm_data_ind)
276 {
277 UBYTE pd;
278 GET_INSTANCE_DATA;
279
280 /* Enable the PCO to correctly decode the message */
281 PPASS (mmcm_data_ind, data, MMCM_DATA_IND);
282
283 TRACE_FUNCTION ("for_mmcm_data_ind()");
284
285 cc_data->ti_ext = 0;
286 cc_data->ti_ext_pres = FALSE;
287
288 GET_PD (data->sdu, pd);
289 GET_TI (data->sdu, cc_data->ti);
290 cc_data->ti_rec = cc_data->ti;
291
292 if (cc_data->ti >= 8)
293 cc_data->ti -= 8;
294 else
295 cc_data->ti += 8;
296
297 if (((cc_data->ti & 7) EQ 7)
298 OR
299 (pd NEQ M_MM_PD_CC)
300 OR
301 (data->sdu.l_buf < 16))
302 /*
303 * TI value is reserved, not allowed
304 * or wrong protocol discriminator
305 * or message too short
306 */
307 {
308 PFREE (data);
309 }
310 else
311 {
312 cc_data->error = 0;
313 for_decode ((T_PRIM*)(D2P(data)), FALSE);
314 }
315 }
316
317
318 /*
319 +--------------------------------------------------------------------+
320 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
321 | STATE : code ROUTINE : for_decode |
322 +--------------------------------------------------------------------+
323
324 PURPOSE : Decoding and distributing of incoming messages.
325
326 */
327 typedef void (*T_FUNC_PTR) (void);
328
329 LOCAL const T_FUNC_PTR mess_table[] = {
330 cc_unknown_message, /* 0: not used */
331 for_d_alert, /* 1: D_ALERT */
332 for_d_call_proceed, /* 2: D_CALL_PROCEED */
333 for_d_progress, /* 3: D_PROGRESS */
334 for_d_cc_establishment, /* 4: D_CC_ESTABLISHMENT */
335 for_d_setup, /* 5: D_SETUP */
336 cc_unknown_message, /* 6: not used */
337 for_d_connect, /* 7: D_CONNECT */
338 cc_unknown_message, /* 8: not used */
339 cc_unknown_message, /* 9: not used */
340 cc_unknown_message, /* 10: not used */
341 for_d_recall, /* 11: D_RECALL */
342 cc_unknown_message, /* 12: not used */
343 cc_unknown_message, /* 13: not used */
344 cc_unknown_message, /* 14: not used */
345 cc_connect_ack, /* 15: B_CONNECT_ACK */
346 for_b_user_information, /* 16: B_USER_INFO */
347 cc_unknown_message, /* 17: not used */
348 cc_unknown_message, /* 18: not used */
349 for_b_modify_rej, /* 19: B_MODIFY_REJ */
350 cc_unknown_message, /* 20: not used */
351 cc_unknown_message, /* 21: not used */
352 cc_unknown_message, /* 22: not used */
353 for_b_modify, /* 23: B_MODIFY */
354 cc_unknown_message, /* 24: not used */
355 cc_hold_ack, /* 25: D_HOLD_ACK */
356 for_d_hold_rej, /* 26: D_HOLD_REJ */
357 cc_unknown_message, /* 27: not used */
358 cc_unknown_message, /* 28: not used */
359 cc_retrieve_ack, /* 29: D_RETRIEVE_ACK */
360 for_d_retrieve_rej, /* 30: D_RETRIEVE_REJ */
361 for_b_modify_comp, /* 31: B_MODIFY_COMP */
362 cc_unknown_message, /* 32: not used */
363 cc_unknown_message, /* 33: not used */
364 cc_unknown_message, /* 34: not used */
365 cc_unknown_message, /* 35: not used */
366 cc_unknown_message, /* 36: not used */
367 for_d_disconnect, /* 37: D_DISCONNECT */
368 cc_unknown_message, /* 38: not used */
369 cc_unknown_message, /* 39: not used */
370 cc_unknown_message, /* 40: not used */
371 cc_unknown_message, /* 41: not used */
372 for_d_release_comp, /* 42: D_RELEASE_COMP */
373 cc_unknown_message, /* 43: not used */
374 cc_unknown_message, /* 44: not used */
375 for_d_release, /* 45: D_RELEASE */
376 cc_unknown_message, /* 46: not used */
377 cc_unknown_message, /* 47: not used */
378 cc_unknown_message, /* 48: not used */
379 cc_unknown_message, /* 49: not used */
380 cc_stop_dtmf_ack, /* 50: D_STOP_DTMF_ACK */
381 cc_unknown_message, /* 51: not_used */
382 cc_status_enquiry, /* 52: B_STATUS_ENQ */
383 cc_unknown_message, /* 53: not used */
384 for_d_start_dtmf_ack, /* 54: D_START_DTMF_ACK */
385 for_d_start_dtmf_rej, /* 55: D_START_DTMF_REJ */
386 cc_unknown_message, /* 56: not used */
387 for_b_congest_ctrl, /* 57: B_CONGEST_CTRL */
388 for_d_facility, /* 58: D_FACILITY */
389 cc_unknown_message, /* 59: not used */
390 cc_unknown_message, /* 60: not used */
391 for_b_status, /* 61: B_STATUS */
392 for_b_notify, /* 62: B_NOTIFY */
393 cc_unknown_message /* 63: not used */
394 };
395
396 GLOBAL void for_decode (T_PRIM * prim, BOOL est_flag)
397 {
398 GET_INSTANCE_DATA;
399 U8 *payload;
400 U16 length;
401 /* Implements Measure#32: Row 43,...,70 */
402
403 PCAST (prim, data, MMCM_DATA_IND);
404
405 TRACE_FUNCTION ("for_decode()");
406
407 if (cc_data->ti_ext_pres EQ TRUE)
408 {
409 data->sdu.l_buf -= 16;
410 data->sdu.o_buf += 16;
411 }
412 else
413 {
414 data->sdu.l_buf -= 8;
415 data->sdu.o_buf += 8;
416 }
417
418
419 cc_data->mt = data->sdu.buf[data->sdu.o_buf >> 3];
420
421 /* Obtain the internal shared CCD output buffer */
422 CCD_START;
423
424 if (ccd_decodeMsg (CCDENT_CC,
425 DOWNLINK,
426 (T_MSGBUF *) &data->sdu,
427 (UBYTE *) _decodedMsg,
428 NOT_PRESENT_8BIT) NEQ ccdOK)
429 {
430 USHORT parlist[6];
431 UBYTE prev_err;
432 UBYTE ccd_err;
433
434 memset (parlist,0, sizeof (parlist));
435 ccd_err = ccd_getFirstError (CCDENT_CC, parlist);
436 /*
437 * Error Handling
438 */
439 do
440 {
441 TRACE_EVENT_P1 ("cuurent_error = %d", ccd_err);
442 switch (ccd_err)
443 {
444 case ERR_MSG_LEN: /* ignore message & send STATUS #96 */
445 case ERR_MAND_ELEM_MISS: /* ignore message & send STATUS #96 */
446 case ERR_COMPREH_REQUIRED: /* ignore message & send STATUS #96 */
447
448 for_set_mandatory_error ((UBYTE)parlist[0]);
449 break;
450
451 case ERR_INVALID_MID: /* ignore message & send STATUS #97 */
452 cc_data->error = M_CC_CAUSE_MESSAGE_TYPE_NOT_IMPLEM;
453 break;
454
455 case ERR_INTERNAL_ERROR:
456 #if defined (WIN32)
457 TRACE_EVENT_P1("An internal CCD error occured,CCD error code = %u", ccd_err);
458 #endif /* #if defined (WIN32) */
459 cc_data->error = M_CC_CAUSE_MESSAGE_INCOMPAT;
460 break;
461
462 case ERR_IE_SEQUENCE:
463 #if defined (WIN32)
464 TRACE_EVENT_P2("sequence error, CCD error = %u, Parameter = %d", ccd_err, parlist[0]);
465 #endif /* #if defined (WIN32) */
466 switch (cc_data->state[srv_convert_ti (cc_data->ti)])
467 {
468 case M_CC_CS_11:
469 case M_CC_CS_12:
470 case M_CC_CS_19:
471 break;
472 default: /* 24.008: 9.3.18.1.1 Cause ; This information element shall
473 * be included if this message is used to initiate call clearing.
474 */
475
476 if (parlist [0] EQ CAUSE_IEI)
477 {
478 for_set_mandatory_error ((UBYTE)parlist[0]);
479 }
480 break;
481 }
482 break;
483
484 #if defined (WIN32) /* This part is interesting only in implementation
485 and testing; may be included if specific handling
486 for specific errors is required in future releases */
487 case ERR_IE_NOT_EXPECTED:
488 TRACE_EVENT_P1("CCD ERROR: IE not expected. probably an R99 optional elemet like cell notification, eplmn, or t3302, CCD error code = %u", ccd_err);
489 break;
490 case ERR_MAX_IE_EXCEED:
491 TRACE_EVENT_P1("Maximum amount of repeatable information elements has exceeded, CCD error code = %u", ccd_err);
492 break;
493 case ERR_MAX_REPEAT:
494 TRACE_EVENT_P1("A repeatable element occurs too often in the message, CCD error code = %u", ccd_err);
495 break;
496 case ERR_PATTERN_MISMATCH:
497 case ERR_INVALID_TYPE:
498 TRACE_EVENT_P1 ("MNC decoding erroneous = %u", ccd_err);
499 break;
500 #endif /* #if defined (WIN32) */
501 default:
502 #if defined (WIN32)
503 TRACE_EVENT_P1 ("Unexpected warnings/errors = %u", ccd_err);
504 #endif /* #if defined (WIN32) */
505 break; /* No or non-interesting error */
506 }
507
508 prev_err = ccd_err;
509 ccd_err = ccd_getNextError (CCDENT_CC, parlist);
510 } while ( prev_err NEQ ERR_NO_MORE_ERROR
511 AND !cc_check_critical_error(cc_data->error) );
512 }
513 /*lint -e416 (creation of out-of-bounds pointer)*/
514 EM_CC_DOWNLINK_SETUP_RECEIVED;
515
516 /* adding TI and PD header to data */
517 data->sdu.l_buf += 8;
518 data->sdu.o_buf -= 8;
519
520 payload = &(data->sdu.buf[0]); /* beginning of buffer */
521 payload += ((data->sdu.o_buf) >> 3); /* plus offset (bytes) */
522 length = ((data->sdu.l_buf) >> 3); /* length (bytes, bits / 8) */
523
524 /* Implements Measure#32: Row 43,...,70 */
525 switch (_decodedMsg[0])
526 {
527 case D_ALERT:
528 TRACE_BINDUMP (cc_handle,
529 TC_USER4,
530 " Alert DL ",
531 payload,
532 length);
533 break;
534 case D_CALL_PROCEED:
535 TRACE_BINDUMP (cc_handle,
536 TC_USER4,
537 " Call Proceed DL ",
538 payload,
539 length);
540 break;
541 case D_PROGRESS:
542 TRACE_BINDUMP (cc_handle,
543 TC_USER4,
544 " Progress DL ",
545 payload,
546 length);
547 break;
548 case D_CC_ESTABLISHMENT:
549 TRACE_BINDUMP (cc_handle,
550 TC_USER4,
551 " CC Establishment DL ",
552 payload,
553 length);
554 break;
555 case D_SETUP:
556 TRACE_BINDUMP (cc_handle,
557 TC_USER4,
558 " Setup DL ",
559 payload,
560 length);
561 break;
562 case D_CONNECT:
563 TRACE_BINDUMP (cc_handle,
564 TC_USER4,
565 " Connect DL ",
566 payload,
567 length);
568 break;
569 case D_RECALL:
570 TRACE_BINDUMP (cc_handle,
571 TC_USER4,
572 " Recall DL ",
573 payload,
574 length);
575 break;
576 case B_CONNECT_ACK:
577 TRACE_BINDUMP (cc_handle,
578 TC_USER4,
579 " Connect Acknowledge DL ",
580 payload,
581 length);
582 break;
583 case B_USER_INFO:
584 TRACE_BINDUMP (cc_handle,
585 TC_USER4,
586 " User Information DL ",
587 payload,
588 length);
589 break;
590 case B_MODIFY_REJ:
591 TRACE_BINDUMP (cc_handle,
592 TC_USER4,
593 " Modification Reject DL ",
594 payload,
595 length);
596 break;
597 case B_MODIFY:
598 TRACE_BINDUMP (cc_handle,
599 TC_USER4,
600 " Call Modify DL ",
601 payload,
602 length);
603 break;
604 case D_HOLD_ACK:
605 TRACE_BINDUMP (cc_handle,
606 TC_USER4,
607 " Hold Acknowledge DL ",
608 payload,
609 length);
610 break;
611 case D_HOLD_REJ:
612 TRACE_BINDUMP (cc_handle,
613 TC_USER4,
614 " Hold Reject DL ",
615 payload,
616 length);
617 break;
618 case D_RETRIEVE_ACK:
619 TRACE_BINDUMP (cc_handle,
620 TC_USER4,
621 " Retrieve Acknowledge DL ",
622 payload,
623 length);
624 break;
625 case D_RETRIEVE_REJ:
626 TRACE_BINDUMP (cc_handle,
627 TC_USER4,
628 " Retrieve Reject DL ",
629 payload,
630 length);
631 break;
632 case B_MODIFY_COMP:
633 TRACE_BINDUMP (cc_handle,
634 TC_USER4,
635 " Modify Complete DL ",
636 payload,
637 length);
638 break;
639 case D_DISCONNECT:
640 TRACE_BINDUMP (cc_handle,
641 TC_USER4,
642 " Disconnect DL ",
643 payload,
644 length);
645 break;
646 case D_RELEASE_COMP:
647 TRACE_BINDUMP (cc_handle,
648 TC_USER4,
649 " Release Complete DL ",
650 payload,
651 length);
652 break;
653 case D_RELEASE:
654 TRACE_BINDUMP (cc_handle,
655 TC_USER4,
656 " Release DL ",
657 payload,
658 length);
659 break;
660 case D_STOP_DTMF_ACK:
661 TRACE_BINDUMP (cc_handle,
662 TC_USER4,
663 " Stop DTMF Acknowledge DL ",
664 payload,
665 length);
666 break;
667 case B_STATUS_ENQ:
668 TRACE_BINDUMP (cc_handle,
669 TC_USER4,
670 " Status Enquiry DL ",
671 payload,
672 length);
673 break;
674 case D_START_DTMF_ACK:
675 TRACE_BINDUMP (cc_handle,
676 TC_USER4,
677 " Start DTMF Acknowledge DL ",
678 payload,
679 length);
680 break;
681 case D_START_DTMF_REJ:
682 TRACE_BINDUMP (cc_handle,
683 TC_USER4,
684 " Start DTMF Reject DL ",
685 payload,
686 length);
687 break;
688 case B_CONGEST_CTRL:
689 TRACE_BINDUMP (cc_handle,
690 TC_USER4,
691 " Congestion Control DL ",
692 payload,
693 length);
694 break;
695 case D_FACILITY:
696 TRACE_BINDUMP (cc_handle,
697 TC_USER4,
698 " Facility DL ",
699 payload,
700 length);
701 break;
702 case B_STATUS:
703 TRACE_BINDUMP (cc_handle,
704 TC_USER4,
705 " Status DL ",
706 payload,
707 length);
708 break;
709 case B_NOTIFY:
710 TRACE_BINDUMP (cc_handle,
711 TC_USER4,
712 " Notify DL ",
713 payload,
714 length);
715 break;
716 default:
717 TRACE_EVENT("Unknown Message");
718 break;
719 } /*switch(_decodedMsg[0]) */
720
721 /* removing TI and PD header from data */
722 data->sdu.l_buf -= 8;
723 data->sdu.o_buf += 8;
724
725 #if 0
726 #if defined TRACE_BCAP
727 cc_trace_bcap (cc_data, &data->sdu, DOWNLINK);
728 #endif /* #if defined TRACE_BCAP */
729 #endif /* #if 0 */
730
731 PFREE (data);
732
733 /*
734 * Only the range 0 to 63 is relevant for the cc message type.
735 */
736 if (est_flag)
737 {
738 /*
739 * The message was received by MMCC_ESTABLISH_IND.
740 */
741 UBYTE result;
742
743 switch (_decodedMsg[0])
744 {
745 case D_SETUP:
746 if ((result = srv_define_ti ()) EQ NOT_PRESENT_8BIT)
747 {
748 /*
749 * Internal problem: CC has run out of call table entries.
750 * Release the call.
751 */
752 if ( cc_data->ti_rec < 8) /* 24.008; ch. 8.3.1 c) */
753 {
754 /*
755 * for a reasoning why CAUSE_USER_BUSY was chosen see the
756 * definition of UDUB in GSM 02.01!
757 */
758 for_send_u_release_comp (M_CC_CAUSE_USER_BUSY);
759 return;
760 }
761 }
762
763 if (cc_data->ti_ext_pres EQ TRUE)
764 {
765 /* [ 24.008; ch. 8.3.1]
766 * The mobile station and network shall reject a SETUP, EMERGENCY SETUP or START CC
767 * message received with octet 1 part of the TI value coded as "111" by sending
768 * RELEASE COMPLETE with cause #81 "Invalid transaction identifier value" The TI value
769 * in RELEASE COMPLETE shall be the complete TI value including the extension octet
770 * from the message that caused the rejection.
771 */
772
773 for_send_u_release_comp (M_CC_CAUSE_INVALID_TI);
774 return;
775 }
776
777 cc_data->index_ti = result;
778 break;
779
780 case B_STATUS:
781 break;
782
783 case D_RELEASE_COMP:
784 CCD_END;
785 for_rel_req ();
786 return;
787
788 default:
789 for_send_u_release_comp (M_CC_CAUSE_INVALID_TI);
790 return;
791 } /* switch (_decodedMsg[0]) */
792 }
793 else
794 {
795 /*
796 * The message was received by MMCC_DATA_IND.
797 */
798 if ((cc_data->index_ti = srv_convert_ti (cc_data->ti))
799 EQ NOT_PRESENT_8BIT)
800 {
801 for_send_u_release_comp (M_CC_CAUSE_INVALID_TI);
802 return;
803 }
804 }
805 if (_decodedMsg[0] < 64)
806 {
807 JUMP (*mess_table [_decodedMsg[0] & 63]) ();
808 }
809 else
810 {
811 cc_unknown_message ();
812 }
813 } /* for_decode() */
814
815
816 /*
817 +--------------------------------------------------------------------+
818 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
819 | STATE : code ROUTINE : for_d_alert |
820 +--------------------------------------------------------------------+
821
822 PURPOSE : Processing a D_ALERT message.
823
824 */
825 GLOBAL void for_d_alert (void)
826 {
827 MCAST (alert, D_ALERT);
828
829 TRACE_FUNCTION ("for_d_alert()");
830
831 if (alert->v_progress)
832 {
833 if (for_check_progress_indicator (&alert->progress) EQ FALSE)
834 {
835 for_set_optional_error (PROGRESS_IEI);
836 }
837 }
838
839 cc_alert (alert);
840 }
841
842 /*
843 +--------------------------------------------------------------------+
844 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
845 | STATE : code ROUTINE : for_d_call_proceed |
846 +--------------------------------------------------------------------+
847
848 PURPOSE : Processing a D_CALL_PROCEED message.
849
850 */
851
852 GLOBAL void for_d_call_proceed (void)
853 {
854 MCAST (proceed, D_CALL_PROCEED);
855
856 TRACE_FUNCTION ("for_d_call_proceed()");
857
858 if (proceed->v_repeat)
859 {
860 /* Repeat indicator present */
861 if (for_check_repeat_indicator (proceed->repeat) EQ FALSE)
862 {
863 /* Repeat indicator contains garbage */
864 for_set_optional_error (REPEAT_IEI);
865 }
866 if (!(proceed->v_bearer_cap AND proceed->v_bearer_cap_2))
867 {
868 /* Repeat indicator, but not both bearer caps present */
869 for_set_conditional_error (REPEAT_IEI);
870 }
871 }
872 else
873 {
874 /* No repeat indicator present */
875 if (proceed->v_bearer_cap AND proceed->v_bearer_cap_2)
876 {
877 /* No repeat indicator, but both bearer caps present */
878 for_set_conditional_error (REPEAT_IEI);
879 }
880 }
881
882 cc_call_proceeding (proceed);
883 }
884 /*
885 +--------------------------------------------------------------------+
886 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
887 | STATE : code ROUTINE : for_d_connect |
888 +--------------------------------------------------------------------+
889
890 PURPOSE : Processing a D_CONNECT message.
891
892 */
893
894 GLOBAL void for_d_connect (void)
895 {
896 MCAST (connect, D_CONNECT);
897
898 TRACE_FUNCTION ("for_d_connect()");
899
900 if (connect->v_progress)
901 {
902 if (for_check_progress_indicator (&connect->progress) EQ FALSE)
903 {
904 for_set_optional_error (PROGRESS_IEI);
905 }
906 }
907
908 if (connect->v_connect_num)
909 {
910 if (for_check_calling_party_bcd
911 ((T_M_CC_calling_num *)&connect->connect_num) EQ FALSE)
912 {
913 for_set_optional_error (CONNECTED_NUMBER_IEI);
914 }
915 }
916
917 if (connect->v_connect_subaddr)
918 {
919 if (for_check_calling_party_sub
920 ((T_M_CC_calling_subaddr *)&connect->connect_subaddr) EQ FALSE)
921 {
922 for_set_optional_error (CONNECTED_SUBADDR_IEI);
923 }
924 }
925
926 cc_connect (connect);
927 }
928
929 /*
930 +--------------------------------------------------------------------+
931 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
932 | STATE : code ROUTINE : for_d_facility |
933 +--------------------------------------------------------------------+
934
935 PURPOSE : Processing a D_FACILITY message.
936
937 */
938
939 GLOBAL void for_d_facility (void)
940 {
941 MCAST (facility, D_FACILITY);
942
943 TRACE_FUNCTION ("for_d_facility()");
944
945 cc_facility (facility);
946 }
947
948 /*
949 +--------------------------------------------------------------------+
950 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
951 | STATE : code ROUTINE : for_d_disconnect |
952 +--------------------------------------------------------------------+
953
954 PURPOSE : Processing a D_DISCONNECT message.
955
956 */
957
958 GLOBAL void for_d_disconnect (void)
959 {
960 MCAST (disconnect, D_DISCONNECT);
961
962 TRACE_FUNCTION ("for_d_disconnect()");
963
964 if (disconnect->v_progress)
965 {
966 if (for_check_progress_indicator (&disconnect->progress) EQ FALSE)
967 {
968 for_set_optional_error (PROGRESS_IEI);
969 }
970 }
971
972 if (for_check_cc_cause (&disconnect->cc_cause) EQ FALSE)
973 {
974 for_set_mandatory_error (CAUSE_IEI);
975 }
976
977 cc_disconnect (disconnect);
978 }
979
980 /*
981 +--------------------------------------------------------------------+
982 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
983 | STATE : code ROUTINE : for_b_modify |
984 +--------------------------------------------------------------------+
985
986 PURPOSE : Processing a B_MODIFY message.
987
988 */
989
990 GLOBAL void for_b_modify (void)
991 {
992 MCAST (modify, B_MODIFY);
993
994 TRACE_FUNCTION ("for_b_modify()");
995
996 cc_modify (modify);
997 }
998
999 /*
1000 +--------------------------------------------------------------------+
1001 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1002 | STATE : code ROUTINE : for_b_modify_comp |
1003 +--------------------------------------------------------------------+
1004
1005 PURPOSE : Processing a B_MODIFY_COMP message.
1006
1007 */
1008
1009 GLOBAL void for_b_modify_comp (void)
1010 {
1011 MCAST (modify_com, B_MODIFY_COMP);
1012
1013 TRACE_FUNCTION ("for_b_modify_comp()");
1014
1015 cc_modify_complete (modify_com);
1016 }
1017
1018 /*
1019 +--------------------------------------------------------------------+
1020 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1021 | STATE : code ROUTINE : for_b_modify_rej |
1022 +--------------------------------------------------------------------+
1023
1024 PURPOSE : Processing a B_MODIFY_REJ message.
1025
1026 */
1027
1028 GLOBAL void for_b_modify_rej (void)
1029 {
1030 MCAST (modify_rej, B_MODIFY_REJ);
1031
1032 TRACE_FUNCTION ("for_b_modify_rej()");
1033
1034 if (for_check_cc_cause (&modify_rej->cc_cause) EQ FALSE)
1035 {
1036 for_set_mandatory_error (CAUSE_IEI);
1037 }
1038
1039 cc_modify_reject (modify_rej);
1040 }
1041
1042 /*
1043 +--------------------------------------------------------------------+
1044 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1045 | STATE : code ROUTINE : for_b_notify |
1046 +--------------------------------------------------------------------+
1047
1048 PURPOSE : Processing a B_NOTIFY message.
1049
1050 Issue No 7674 :
1051 Accept the message as according to Anite test case ETSI 11.10 clause 26.8.1.4.2
1052 and do nothing,no need to send any Notification Indication to ACI.Also check the
1053 State of the CC, if we get a Notify in CC State other than U10 and U26 then Send
1054 STATUS message with cause "Message Type Incompatible" to the Network.
1055 */
1056
1057 GLOBAL void for_b_notify (void)
1058 {
1059 GET_INSTANCE_DATA;
1060
1061 TRACE_FUNCTION ("for_b_notify()");
1062
1063 /* Processing an incoming notify message.*/
1064 switch (cc_data->state[cc_data->index_ti])
1065 {
1066 /*
1067 * CS_0 is handled by the formatter
1068 */
1069 case M_CC_CS_10:
1070 case M_CC_CS_26:
1071
1072 CCD_END;
1073
1074 break;
1075
1076 default:
1077 CCD_END;
1078 /* Implements Measure# 3 and streamline encoding */
1079 cc_send_status (M_CC_CAUSE_MESSAGE_TYPE_INCOMPAT);
1080 break;
1081 }
1082 }
1083
1084 /*
1085 +--------------------------------------------------------------------+
1086 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1087 | STATE : code ROUTINE : for_d_progress |
1088 +--------------------------------------------------------------------+
1089
1090 PURPOSE : Processing a D_PROGRESS message.
1091
1092 */
1093
1094 GLOBAL void for_d_progress (void)
1095 {
1096 MCAST (progress, D_PROGRESS);
1097
1098 TRACE_FUNCTION ("for_d_progress()");
1099
1100 if (for_check_progress_indicator (&progress->progress) EQ FALSE)
1101 {
1102 for_set_mandatory_error (PROGRESS_IEI);
1103 }
1104
1105 cc_progress (progress);
1106 }
1107
1108 /*
1109 +--------------------------------------------------------------------+
1110 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1111 | STATE : code ROUTINE : for_d_release |
1112 +--------------------------------------------------------------------+
1113
1114 PURPOSE : Processing a D_RELEASE message.
1115
1116 */
1117
1118 GLOBAL void for_d_release (void)
1119 {
1120 MCAST (release, D_RELEASE);
1121
1122 TRACE_FUNCTION ("for_d_release()");
1123
1124 if (release->v_cc_cause)
1125 {
1126 if (for_check_cc_cause (&release->cc_cause) EQ FALSE)
1127 {
1128 for_set_optional_error (CAUSE_IEI);
1129 }
1130 }
1131
1132 if (release->v_cc_cause_2)
1133 {
1134 if (for_check_cc_cause ((T_M_CC_cc_cause*)&release->cc_cause_2) EQ FALSE)
1135 {
1136 for_set_optional_error (CAUSE_IEI);
1137 }
1138 }
1139
1140 cc_release (release);
1141 }
1142
1143
1144 /*
1145 +--------------------------------------------------------------------+
1146 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1147 | STATE : code ROUTINE : for_d_release_complete |
1148 +--------------------------------------------------------------------+
1149
1150 PURPOSE : Processing a D_RELEASE_COMPLETE message.
1151
1152 */
1153
1154 GLOBAL void for_d_release_comp (void)
1155 {
1156 MCAST (rel_comp, D_RELEASE_COMP);
1157
1158 TRACE_FUNCTION ("for_d_release_comp()");
1159
1160 if (rel_comp->v_cc_cause)
1161 {
1162 if (for_check_cc_cause (&rel_comp->cc_cause) EQ FALSE)
1163 {
1164 for_set_optional_error (CAUSE_IEI);
1165 }
1166 }
1167
1168 cc_release_complete (rel_comp);
1169 }
1170
1171
1172 /*
1173 +--------------------------------------------------------------------+
1174 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1175 | STATE : code ROUTINE : for_d_cc_establishment |
1176 +--------------------------------------------------------------------+
1177
1178 PURPOSE : Processing of a D_CC_ESTABLISHMENT message.
1179
1180 */
1181
1182 GLOBAL void for_d_cc_establishment (void)
1183 {
1184 MCAST(cc_est, D_CC_ESTABLISHMENT);
1185 T_U_SETUP * setup = NULL;
1186 USHORT len_in_bits = (cc_est->setup_cont.c_setup_msg + 1) << 3;
1187 BYTE result;
1188
1189 TRACE_FUNCTION ("for_d_cc_establishment()");
1190
1191 /*
1192 * Decode uplink setup message delivered in setup container.
1193 */
1194 {
1195 PALLOC_SDU (data, MMCM_DATA_REQ, len_in_bits);
1196 memcpy(&data->sdu.buf[1],
1197 cc_est->setup_cont.setup_msg,
1198 cc_est->setup_cont.c_setup_msg);
1199 data->sdu.buf[0] = U_SETUP;
1200 data->sdu.l_buf = len_in_bits;
1201 data->sdu.o_buf = 0;
1202 result = ccd_decodeMsg (CCDENT_CC,
1203 UPLINK,
1204 (T_MSGBUF *) &data->sdu,
1205 (UBYTE *) _decodedMsg,
1206 NOT_PRESENT_8BIT);
1207
1208 setup = (T_U_SETUP *)_decodedMsg;
1209 PFREE (data);
1210 }
1211
1212 if (result NEQ ccdOK)
1213 {
1214 USHORT parlist[6];
1215 UBYTE first_err;
1216
1217 memset (parlist,0, sizeof (parlist));
1218 first_err = ccd_getFirstError (CCDENT_CC, parlist);
1219 /*
1220 * Error Handling
1221 */
1222 switch (first_err)
1223 {
1224 case ERR_COMPREH_REQUIRED: /* comprehension required */
1225 for_set_mandatory_error ((UBYTE)parlist[0]);
1226 break;
1227 case ERR_MAND_ELEM_MISS: /* Mandatory elements missing */
1228 /*
1229 * Error handling is carried out by checking the content.
1230 */
1231 break;
1232 }
1233 }
1234
1235 /* Check repeat indicator bearer capabilities */
1236 if (setup->v_repeat )
1237 {
1238 if (for_check_repeat_indicator (setup->repeat) EQ FALSE)
1239 {
1240 for_set_optional_error (REPEAT_IEI);
1241 }
1242 }
1243
1244 /* Check presence of bearer capability I */
1245 if (setup->v_bearer_cap)
1246 {
1247 /* Compability check not done here */
1248 }
1249 else
1250 for_set_mandatory_error (BEARER_CAP_IEI);
1251
1252 /* Check calling party subaddress */
1253 if (setup->v_calling_subaddr)
1254 {
1255 if (for_check_calling_party_sub (&setup->calling_subaddr) EQ FALSE)
1256 {
1257 for_set_optional_error (CALLING_PARTY_SUB_IEI);
1258 }
1259 }
1260
1261 /* Check called party BCD number */
1262 if (setup->v_ul_called_num)
1263 {
1264 if (for_check_called_party_bcd (setup->ul_called_num.ton,
1265 setup->ul_called_num.npi) EQ FALSE)
1266 {
1267 for_set_mandatory_error (CALLED_PARTY_BCD_IEI);
1268 }
1269 }
1270 else
1271 {
1272 for_set_mandatory_error (CALLED_PARTY_BCD_IEI);
1273 }
1274
1275 /* Check called party subaddress */
1276 if (setup->v_called_subaddr)
1277 {
1278 if (for_check_called_party_sub (&setup->called_subaddr) EQ FALSE)
1279 {
1280 for_set_optional_error (CALLED_PARTY_SUB_IEI);
1281 }
1282 }
1283
1284 /* Check LLC repeat indicator */
1285 if (setup->v_repeat_2)
1286 {
1287 if (for_check_repeat_indicator (setup->repeat_2) EQ FALSE)
1288 {
1289 for_set_optional_error (REPEAT_IEI);
1290 }
1291 }
1292
1293 /* Check HLC repeat indicator */
1294 if (setup->v_repeat_3)
1295 {
1296 if (for_check_repeat_indicator (setup->repeat_3) EQ FALSE)
1297 {
1298 for_set_optional_error (REPEAT_IEI);
1299 }
1300 }
1301
1302 /* Check BC repeat indicator conditions */
1303 if (setup->v_repeat)
1304 {
1305 if (!(setup->v_bearer_cap AND setup->v_bearer_cap_2))
1306 {
1307 cc_for_set_conditional_error (REPEAT_IEI);
1308 }
1309 }
1310
1311 /* Check LLC repeat indicator conditions */
1312 if (setup->v_repeat_2)
1313 {
1314 if (!(setup->v_bearer_cap
1315 AND setup->v_low_layer_comp
1316 AND (setup->v_repeat EQ setup->v_repeat_2)))
1317 {
1318 cc_for_set_conditional_error (REPEAT_IEI);
1319 }
1320 }
1321
1322 /* Check second LLC IE condition */
1323 if (setup->v_low_layer_comp_2)
1324 {
1325 if (!setup->v_repeat_2)
1326 {
1327 cc_for_set_conditional_error (REPEAT_IEI);
1328 }
1329 }
1330
1331 /* Check HLC repeat indicator conditions */
1332 if (setup->v_high_layer_comp_2)
1333 {
1334 if (!(setup->v_repeat AND setup->v_high_layer_comp))
1335 {
1336 cc_for_set_conditional_error (REPEAT_IEI);
1337 }
1338 }
1339
1340 /* Check second HLC IE condition */
1341 if (setup->v_high_layer_comp)
1342 {
1343 if (!setup->v_repeat_3)
1344 {
1345 cc_for_set_conditional_error (REPEAT_IEI);
1346 }
1347 }
1348
1349 /*
1350 * The only interesting part of the CC ESTABLISHMENT message
1351 * is the setup container, so only this is delivered
1352 */
1353 cc_cc_establishment (setup);
1354 }
1355
1356
1357 /*
1358 +--------------------------------------------------------------------+
1359 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1360 | STATE : code ROUTINE : for_d_cc_establishment |
1361 +--------------------------------------------------------------------+
1362
1363 PURPOSE : Processing of a D_RECALL message.
1364
1365 */
1366
1367 GLOBAL void for_d_recall (void)
1368 {
1369 MCAST (recall, D_RECALL);
1370
1371 TRACE_FUNCTION ("for_d_recall()");
1372
1373 cc_recall(recall);
1374 }
1375
1376
1377 /*
1378 +--------------------------------------------------------------------+
1379 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1380 | STATE : code ROUTINE : for_d_setup |
1381 +--------------------------------------------------------------------+
1382
1383 PURPOSE : Processing a D_SETUP message.
1384
1385 */
1386
1387 GLOBAL void for_d_setup (void)
1388 {
1389 MCAST (setup, D_SETUP);
1390 UBYTE rep_cnt = 0;
1391 UBYTE bc_cnt = 0;
1392 UBYTE lc_cnt = 0;
1393 UBYTE hc_cnt = 0;
1394
1395 TRACE_FUNCTION ("for_d_setup()");
1396
1397 if (setup->v_repeat)
1398 {
1399 if (for_check_repeat_indicator (setup->repeat) EQ FALSE)
1400 {
1401 for_set_optional_error (REPEAT_IEI);
1402 }
1403 }
1404
1405 if (setup->v_progress)
1406 {
1407 if (for_check_progress_indicator (&setup->progress) EQ FALSE)
1408 {
1409 for_set_optional_error (PROGRESS_IEI);
1410 }
1411 }
1412
1413 if (setup->v_signal)
1414 {
1415 if (for_check_signal (setup->signal) EQ FALSE)
1416 {
1417 for_set_optional_error (SIGNAL_IEI);
1418 }
1419 }
1420
1421 if (setup->v_calling_num)
1422 {
1423 if (for_check_calling_party_bcd (&setup->calling_num) EQ FALSE)
1424 {
1425 for_set_optional_error (CALLING_PARTY_BCD_IEI);
1426 }
1427 }
1428
1429 if (setup->v_calling_subaddr)
1430 {
1431 if (for_check_calling_party_sub (&setup->calling_subaddr) EQ FALSE)
1432 {
1433 for_set_optional_error (CALLING_PARTY_SUB_IEI);
1434 }
1435 }
1436
1437 if (setup->v_dl_called_num)
1438 {
1439 if (for_check_called_party_bcd (setup->dl_called_num.ton,
1440 setup->dl_called_num.npi) EQ FALSE)
1441 {
1442 for_set_optional_error (CALLED_PARTY_BCD_IEI);
1443 }
1444 }
1445
1446 if (setup->v_called_subaddr)
1447 {
1448 if (for_check_called_party_sub (&setup->called_subaddr) EQ FALSE)
1449 {
1450 for_set_optional_error (CALLED_PARTY_SUB_IEI);
1451 }
1452 }
1453
1454 if (setup->v_repeat_2)
1455 {
1456 if (for_check_repeat_indicator (setup->repeat_2) EQ FALSE)
1457 {
1458 for_set_optional_error (REPEAT_IEI);
1459 }
1460 }
1461
1462 if (setup->v_repeat_3)
1463 {
1464 if (for_check_repeat_indicator (setup->repeat_3) EQ FALSE)
1465 {
1466 for_set_optional_error (REPEAT_IEI);
1467 }
1468 }
1469
1470 rep_cnt = setup->v_repeat +
1471 setup->v_repeat_2 +
1472 setup->v_repeat_3;
1473
1474 bc_cnt = setup->v_bearer_cap +
1475 setup->v_bearer_cap_2;
1476
1477 lc_cnt = setup->v_low_layer_comp +
1478 setup->v_low_layer_comp_2;
1479
1480 hc_cnt = setup->v_high_layer_comp +
1481 setup->v_high_layer_comp_2;
1482
1483 switch (rep_cnt)
1484 {
1485 case 0:
1486 if ((bc_cnt EQ 2) OR
1487 (lc_cnt EQ 2) OR
1488 (hc_cnt EQ 2))
1489 {
1490 for_set_conditional_error (REPEAT_IEI);
1491 }
1492 break;
1493
1494 case 1:
1495 if ((bc_cnt NEQ 2) OR
1496 (lc_cnt EQ 2) OR
1497 (hc_cnt EQ 2))
1498 {
1499 for_set_conditional_error (REPEAT_IEI);
1500 }
1501 break;
1502
1503 case 2:
1504 if ((bc_cnt NEQ 2) OR
1505 (lc_cnt NEQ 2) OR
1506 (hc_cnt EQ 2))
1507 {
1508 for_set_conditional_error (REPEAT_IEI);
1509 }
1510 break;
1511
1512 case 3:
1513 if ((bc_cnt NEQ 2) OR
1514 (lc_cnt NEQ 2) OR
1515 (hc_cnt NEQ 2))
1516 {
1517 for_set_conditional_error (REPEAT_IEI);
1518 }
1519 break;
1520 }
1521
1522 cc_setup (setup);
1523 }
1524
1525
1526 /*
1527 +--------------------------------------------------------------------+
1528 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1529 | STATE : code ROUTINE : for_d_start_dtmf_ack |
1530 +--------------------------------------------------------------------+
1531
1532 PURPOSE : Processing a D_START_DTMF_ACK message.
1533
1534 */
1535
1536 GLOBAL void for_d_start_dtmf_ack (void)
1537 {
1538 MCAST (start_ack, D_START_DTMF_ACK);
1539
1540 TRACE_FUNCTION ("for_d_start_dtmf_ack()");
1541
1542 cc_start_dtmf_ack (start_ack);
1543 }
1544
1545
1546 /*
1547 +--------------------------------------------------------------------+
1548 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1549 | STATE : code ROUTINE : for_d_start_dtmf_rej |
1550 +--------------------------------------------------------------------+
1551
1552 PURPOSE : Processing a D_START_DTMF_REJ message.
1553
1554 */
1555
1556 GLOBAL void for_d_start_dtmf_rej (void)
1557 {
1558 MCAST (start_rej, D_START_DTMF_REJ);
1559
1560 TRACE_FUNCTION ("for_d_start_dtmf_rej()");
1561
1562 if (for_check_cc_cause (&start_rej->cc_cause) EQ FALSE)
1563 {
1564 for_set_mandatory_error (CAUSE_IEI);
1565 }
1566
1567 cc_start_dtmf_rej (start_rej);
1568 }
1569
1570
1571 /*
1572 +--------------------------------------------------------------------+
1573 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1574 | STATE : code ROUTINE : for_b_status |
1575 +--------------------------------------------------------------------+
1576
1577 PURPOSE : Processing a B_STATUS message.
1578
1579 */
1580
1581 GLOBAL void for_b_status (void)
1582 {
1583 MCAST (status, B_STATUS); /* T_B_STATUS */
1584
1585 TRACE_FUNCTION ("for_b_status()");
1586 if (for_check_cc_cause (&status->cc_cause) EQ FALSE)
1587 {
1588 for_set_mandatory_error (CAUSE_IEI);
1589 }
1590
1591 for_check_call_state (&status->call_state);
1592
1593 cc_status (status);
1594 }
1595
1596 /*
1597 +--------------------------------------------------------------------+
1598 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1599 | STATE : code ROUTINE : for_d_hold_rej |
1600 +--------------------------------------------------------------------+
1601
1602 PURPOSE : Processing a D_HOLD_REJ message.
1603
1604 */
1605
1606 GLOBAL void for_d_hold_rej (void)
1607 {
1608 MCAST (hold_rej, D_HOLD_REJ);
1609
1610 TRACE_FUNCTION ("for_d_hold_rej()");
1611
1612 if (for_check_cc_cause (&hold_rej->cc_cause) EQ FALSE)
1613 {
1614 for_set_mandatory_error (CAUSE_IEI);
1615 }
1616
1617 cc_hold_rej (hold_rej);
1618 }
1619
1620
1621 /*
1622 +--------------------------------------------------------------------+
1623 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1624 | STATE : code ROUTINE : for_d_retrieve_rej |
1625 +--------------------------------------------------------------------+
1626
1627 PURPOSE : Processing a D_RETRIEVE_REJ message.
1628
1629 */
1630
1631 GLOBAL void for_d_retrieve_rej (void)
1632 {
1633 MCAST (retrieve_rej, D_RETRIEVE_REJ);
1634
1635 TRACE_FUNCTION ("for_d_retrieve_rej()");
1636
1637 if (for_check_cc_cause (&retrieve_rej->cc_cause) EQ FALSE)
1638 {
1639 for_set_mandatory_error (CAUSE_IEI);
1640 }
1641
1642 cc_retrieve_rej (retrieve_rej);
1643 }
1644
1645 /*
1646 +--------------------------------------------------------------------+
1647 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1648 | STATE : code ROUTINE : for_b_congest_ctrl |
1649 +--------------------------------------------------------------------+
1650
1651 PURPOSE : Processing a B_CONGEST_CTRL message.
1652
1653 */
1654
1655 GLOBAL void for_b_congest_ctrl (void)
1656 {
1657 MCAST (cong, B_CONGEST_CTRL);
1658
1659 TRACE_FUNCTION ("for_b_congest_ctrl()");
1660
1661 if (cong->v_cc_cause)
1662 {
1663 if (for_check_cc_cause (&cong->cc_cause) EQ FALSE)
1664 {
1665 for_set_optional_error (CAUSE_IEI);
1666 }
1667 }
1668
1669 cc_congestion_control (cong);
1670 }
1671
1672 /*
1673 +--------------------------------------------------------------------+
1674 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1675 | STATE : code ROUTINE : for_b_user_information |
1676 +--------------------------------------------------------------------+
1677
1678 PURPOSE : Processing a B_USER_INFORMATION message.
1679
1680 */
1681
1682 GLOBAL void for_b_user_information (void)
1683 {
1684
1685 MCAST (user, B_USER_INFO);
1686
1687 TRACE_FUNCTION ("for_b_user_information()");
1688
1689 cc_user_information (user);
1690 }
1691
1692 /*
1693 +--------------------------------------------------------------------+
1694 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1695 | STATE : code ROUTINE : for_mmcm_sync_ind |
1696 +--------------------------------------------------------------------+
1697
1698 PURPOSE : Processing the primitive MMCC_SYNC_IND from mobility
1699 management.
1700
1701 */
1702
1703 GLOBAL void for_mmcm_sync_ind (T_MMCM_SYNC_IND * sync)
1704 {
1705 GET_INSTANCE_DATA;
1706
1707 TRACE_FUNCTION ("for_mmcm_sync_ind()");
1708
1709 cc_data->ti = sync->ti;
1710
1711 EM_CC_CHANNEL_MODE_CHANGE;
1712
1713 cc_sync_ind (sync);
1714 }
1715
1716 /*
1717 +--------------------------------------------------------------------+
1718 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1719 | STATE : code ROUTINE : for_mmcm_est_cnf |
1720 +--------------------------------------------------------------------+
1721
1722 PURPOSE : Processing the primitive MMCC_EST_CNF from mobility
1723 management.
1724
1725 */
1726
1727 GLOBAL void for_mmcm_est_cnf (T_MMCM_ESTABLISH_CNF * est_cnf)
1728 {
1729 GET_INSTANCE_DATA;
1730
1731 TRACE_FUNCTION ("for_mmcm_est_cnf()");
1732
1733 cc_data->ti = est_cnf->ti;
1734 if ((cc_data->index_ti = srv_convert_ti (cc_data->ti))
1735 NEQ NOT_PRESENT_8BIT)
1736 {
1737 cc_est_cnf ();
1738 }
1739
1740 EM_CC_MM_CONNECTION_ESTABLISHED_MO;
1741
1742 PFREE (est_cnf);
1743 }
1744 /*
1745 +--------------------------------------------------------------------+
1746 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1747 | STATE : code ROUTINE : for_mmcm_rel_ind |
1748 +--------------------------------------------------------------------+
1749
1750 PURPOSE : Processing the primitive MMCC_REL_IND from mobility
1751 management.
1752
1753 */
1754 GLOBAL void for_mmcm_rel_ind (T_MMCM_RELEASE_IND * rel_ind)
1755 {
1756 GET_INSTANCE_DATA;
1757
1758 TRACE_FUNCTION ("for_mmcm_rel_ind()");
1759
1760 cc_data->ti = rel_ind->ti;
1761 if ((cc_data->index_ti = srv_convert_ti (cc_data->ti))
1762 NEQ NOT_PRESENT_8BIT)
1763 {
1764 cc_rel_ind (rel_ind->cause);
1765 }
1766
1767 EM_CC_LOSS_OF_CONNECTION;
1768
1769 PFREE (rel_ind);
1770 }
1771
1772
1773 /*
1774 +--------------------------------------------------------------------+
1775 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1776 | STATE : code ROUTINE : for_mmcm_prompt_ind |
1777 +--------------------------------------------------------------------+
1778
1779 PURPOSE : Processing the primitive MMCC_PROMPT_IND from mobility
1780 management. In the CC entity nothing is done with the
1781 primitve, a transaction identifier still is not assigned.
1782 The reception of the primitive only causes the emission
1783 of MNCC_PROMPT_IND to upper layers.
1784
1785 */
1786
1787 GLOBAL void for_mmcm_prompt_ind (T_MMCM_PROMPT_IND * mmcm_prompt_ind)
1788 {
1789 TRACE_FUNCTION ("for_mmcm_prompt_ind()");
1790
1791 PFREE (mmcm_prompt_ind);
1792
1793 {
1794 PALLOC (mncc_prompt_ind, MNCC_PROMPT_IND);
1795 PSENDX (MMI, mncc_prompt_ind);
1796
1797 // EM2
1798 }
1799 }
1800
1801
1802 /*
1803 +--------------------------------------------------------------------+
1804 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1805 | STATE : code ROUTINE : for_mmcm_err_ind |
1806 +--------------------------------------------------------------------+
1807
1808 PURPOSE : Processing the primitive MMCC_ERR_IND from mobility
1809 management.
1810
1811 */
1812
1813 GLOBAL void for_mmcm_err_ind (T_MMCM_ERROR_IND * err_ind)
1814 {
1815 GET_INSTANCE_DATA;
1816
1817 TRACE_FUNCTION ("for_mmcm_err_ind()");
1818
1819 EM_CC_MM_CONNECTION_FAILED;
1820
1821 cc_data->ti = err_ind->ti;
1822 if ((cc_data->index_ti = srv_convert_ti (cc_data->ti))
1823 NEQ NOT_PRESENT_8BIT)
1824 {
1825 cc_err_ind (err_ind);
1826 }
1827 }
1828
1829 /*
1830 +--------------------------------------------------------------------+
1831 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1832 | STATE : code ROUTINE : for_mmcm_reest_cnf |
1833 +--------------------------------------------------------------------+
1834
1835 PURPOSE : Processing the primitive MMCC_REEST_CNF from mobility
1836 management.
1837
1838 */
1839
1840 GLOBAL void for_mmcm_reest_cnf (T_MMCM_REESTABLISH_CNF * reest_cnf)
1841 {
1842 GET_INSTANCE_DATA;
1843
1844 TRACE_FUNCTION ("for_mmcm_reest_cnf()");
1845
1846 cc_data->ti = reest_cnf->ti;
1847 if ((cc_data->index_ti = srv_convert_ti (cc_data->ti))
1848 NEQ NOT_PRESENT_8BIT)
1849 {
1850 cc_reest_cnf ();
1851 }
1852
1853 EM_CC_REESTABLISHED_SUCCESSFUL;
1854
1855 PFREE (reest_cnf);
1856 }
1857
1858 /*
1859 +--------------------------------------------------------------------+
1860 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1861 | STATE : code ROUTINE : for_est_req |
1862 +--------------------------------------------------------------------+
1863
1864 PURPOSE : Build the primitive MMCC_EST_REQ and send them to
1865 mobility management.
1866
1867 */
1868
1869 GLOBAL void for_est_req (T_MMCM_ESTABLISH_REQ * mmcm_establish_req)
1870 {
1871 TRACE_FUNCTION ("for_est_req()");
1872
1873 EM_CC_START_MO_CALL; /*Needs perhaps a review */
1874
1875 PSENDX (MM, mmcm_establish_req);
1876 }
1877
1878 /*
1879 +--------------------------------------------------------------------+
1880 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1881 | STATE : code ROUTINE : for_rel_req |
1882 +--------------------------------------------------------------------+
1883
1884 PURPOSE : Build the primitive MMCC_RELEASE_REQ and send them to
1885 mobility management.
1886
1887 */
1888
1889 GLOBAL void for_rel_req (void)
1890 {
1891 GET_INSTANCE_DATA;
1892
1893 PALLOC (rel, MMCM_RELEASE_REQ);
1894
1895 TRACE_FUNCTION ("for_rel_req()");
1896 rel->org_entity = NAS_ORG_ENTITY_CC;
1897 rel->ti = cc_data->ti;
1898
1899 PSENDX (MM, rel);
1900
1901 EM_CC_RELEASE_SENT;
1902
1903 if (cc_data->ti NEQ cc_data->setup_reattempt_ti)
1904 {
1905 srv_free_ti ();
1906 }
1907 }
1908
1909 /*
1910 +--------------------------------------------------------------------+
1911 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1912 | STATE : code ROUTINE : for_reest_req |
1913 +--------------------------------------------------------------------+
1914
1915 PURPOSE : Build the primitive MMCC_REEST_REQ and send them to
1916 mobility management.
1917
1918 */
1919
1920 GLOBAL void for_reest_req (void)
1921 {
1922 GET_INSTANCE_DATA;
1923
1924 PALLOC (reest, MMCM_REESTABLISH_REQ);
1925
1926 TRACE_FUNCTION ("for_reest_req()");
1927
1928 reest->ti = cc_data->ti;
1929
1930 PSENDX (MM, reest);
1931 }
1932
1933 /*
1934 +--------------------------------------------------------------------+
1935 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1936 | STATE : code ROUTINE : for_start_cc |
1937 +--------------------------------------------------------------------+
1938
1939 PURPOSE : Code the START CC message and send it to MM.
1940
1941 */
1942
1943 GLOBAL void for_start_cc (T_U_START_CC * start_cc)
1944 {
1945 TRACE_FUNCTION ("for_start_cc()");
1946
1947 /* Implements Measure# 38 */
1948 code_msg ((UBYTE *)start_cc, BSIZE_U_START_CC);
1949 }
1950
1951
1952 /*
1953 +--------------------------------------------------------------------+
1954 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1955 | STATE : code ROUTINE : for_cc_est_confirm |
1956 +--------------------------------------------------------------------+
1957
1958 PURPOSE : Code the CC EST. CONFIRMED message and send it to MM.
1959
1960 */
1961
1962 GLOBAL void for_cc_est_confirm (T_U_CC_EST_CONF * est_cnf)
1963 {
1964 TRACE_FUNCTION ("for_cc_est_confirm()");
1965
1966 /* Implements Measure# 38 */
1967 code_msg ((UBYTE *)est_cnf, BSIZE_U_CC_EST_CONF);
1968 }
1969
1970
1971 /*
1972 +--------------------------------------------------------------------+
1973 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
1974 | STATE : code ROUTINE : for_setup |
1975 +--------------------------------------------------------------------+
1976
1977 PURPOSE : Code the message setup. The setup
1978 message is here not sent to MM, but stored.
1979
1980 */
1981
1982 GLOBAL void for_setup (T_U_SETUP * setup)
1983 {
1984 GET_INSTANCE_DATA;
1985 /*
1986 * the maximum length of the outgoing setup message is 128 Bytes plus
1987 * the length of the outgoing facility element
1988 */
1989
1990 USHORT len_in_bits = LEN_U_SETUP;
1991
1992 if (setup->v_facility)
1993 len_in_bits += setup->facility.c_fac * 8;
1994 {
1995 PALLOC_SDU (data, MMCM_DATA_REQ, len_in_bits);
1996
1997 TRACE_FUNCTION ("for_setup()");
1998
1999 data->sdu.o_buf = CC_ENCODE_OFFSET;
2000
2001 ccd_codeMsg (CCDENT_CC,
2002 UPLINK,
2003 (T_MSGBUF *) &data->sdu,
2004 (UBYTE *) setup,
2005 NOT_PRESENT_8BIT);
2006
2007 EM_CC_SENT_SETUP_MESSAGE;/*lint !e416 (creation of out-of-bounds pointer)*/
2008 #if 0
2009 #if defined TRACE_BCAP
2010 cc_trace_bcap (cc_data, &data->sdu, UPLINK);
2011 #endif
2012 #endif /* #if 0 */
2013
2014 srv_free_stored_setup (); /* Security */
2015 cc_data->stored_setup = data;
2016 }
2017 }
2018
2019 /*
2020 +--------------------------------------------------------------------+
2021 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2022 | STATE : code ROUTINE : for_emergency_setup |
2023 +--------------------------------------------------------------------+
2024
2025 PURPOSE : Code the message emergency setup. The emergency setup
2026 message is here not sent to MM, but stored.
2027
2028 */
2029
2030 GLOBAL void for_emergency_setup (T_U_EMERGE_SETUP * emerg_setup)
2031 {
2032 GET_INSTANCE_DATA;
2033
2034 PALLOC_MSG (data, MMCM_DATA_REQ, U_EMERGE_SETUP);
2035
2036 TRACE_FUNCTION ("for_emergency_setup()");
2037
2038 data->sdu.o_buf = CC_ENCODE_OFFSET;
2039 ccd_codeMsg (CCDENT_CC,
2040 UPLINK,
2041 (T_MSGBUF *) &data->sdu,
2042 (UBYTE *) emerg_setup,
2043 NOT_PRESENT_8BIT);
2044
2045 EM_CC_SENT_EMERGENCY_SETUP_MESSAGE;
2046
2047 srv_free_stored_setup (); /* Security */
2048 cc_data->stored_setup = data;
2049 }
2050
2051 /*
2052 +--------------------------------------------------------------------+
2053 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2054 | STATE : code ROUTINE : for_status |
2055 +--------------------------------------------------------------------+
2056
2057 PURPOSE : Code the message status and send them to
2058 mobility management.
2059
2060 */
2061
2062 GLOBAL void for_status (T_B_STATUS * status)
2063 {
2064 TRACE_FUNCTION ("for_status()");
2065 /* Implements Measure# 22 */
2066 code_msg ((UBYTE *)status, BSIZE_B_STATUS);
2067 EM_CC_STATUS_SENT;
2068 }
2069
2070 /*
2071 +--------------------------------------------------------------------+
2072 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2073 | STATE : code ROUTINE : for_release_complete |
2074 +--------------------------------------------------------------------+
2075
2076 PURPOSE : Code the message release_complete and send them to
2077 mobility management.
2078
2079 */
2080
2081 GLOBAL void for_release_complete (T_U_RELEASE_COMP * rel_com)
2082 {
2083 GET_INSTANCE_DATA;
2084 /*
2085 * the sdu has a maximum length of 34 bytes.
2086 * User-User, facility and ss version are never used
2087 */
2088 PALLOC_SDU (data, MMCM_DATA_REQ, LEN_U_RELEASE_COMPLETE);
2089
2090 TRACE_FUNCTION ("for_release_complete()");
2091
2092 if (cc_data->ti_ext_pres EQ TRUE)
2093 {
2094 data->sdu.o_buf = (USHORT)(CC_ENCODE_OFFSET+8); /* additional byte for extended TI */
2095 }
2096 else
2097 {
2098 data->sdu.o_buf = CC_ENCODE_OFFSET;
2099 }
2100
2101 ccd_codeMsg (CCDENT_CC,
2102 UPLINK,
2103 (T_MSGBUF *) &data->sdu,
2104 (UBYTE *) rel_com,
2105 NOT_PRESENT_8BIT);
2106
2107 EM_CC_RELEASE_COMPLETE_SENT;
2108
2109 for_pd (data);
2110 }
2111
2112 /*
2113 +--------------------------------------------------------------------+
2114 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2115 | STATE : code ROUTINE : for_disconnect |
2116 +--------------------------------------------------------------------+
2117
2118 PURPOSE : Code the message disconnect and send them to
2119 mobility management.
2120
2121 */
2122
2123 GLOBAL void for_disconnect (T_U_DISCONNECT * disconnect)
2124 {
2125 /*
2126 * The mandatory part has a length of 33 bytes.
2127 * User-User, facility and ss version are never used.
2128 */
2129 TRACE_FUNCTION ("for_disconnect()");
2130 /* Implements Measure# 11 */
2131 code_msg ((UBYTE *)disconnect, LEN_U_DISCONNECT);
2132 }
2133
2134 /*
2135 +--------------------------------------------------------------------+
2136 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2137 | STATE : code ROUTINE : for_modify_reject |
2138 +--------------------------------------------------------------------+
2139
2140 PURPOSE : Code the message modify reject and send them to
2141 mobility management.
2142
2143 */
2144
2145 GLOBAL void for_modify_reject (T_B_MODIFY_REJ * modify_rej)
2146 {
2147 /*
2148 * The message has a maximum length of 47 Bytes.
2149 * HLC and LLC are never used.
2150 */
2151 TRACE_FUNCTION ("for_modify_reject()");
2152 /* Implements Measure# 11 */
2153 code_msg ((UBYTE *)modify_rej, LEN_U_MODIFY_REJ);
2154 }
2155
2156 /*
2157 +--------------------------------------------------------------------+
2158 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2159 | STATE : code ROUTINE : for_modify_complete |
2160 +--------------------------------------------------------------------+
2161
2162 PURPOSE : Code the message modify complete and send them to
2163 mobility management.
2164
2165 */
2166 GLOBAL void for_modify_complete (T_B_MODIFY_COMP * mod_com)
2167 {
2168
2169 TRACE_FUNCTION ("for_modify_complete()");
2170 /* Implements Measure# 27 */
2171 code_msg ((UBYTE *)mod_com, BSIZE_B_MODIFY_COMP);
2172 }
2173
2174 /*
2175 +--------------------------------------------------------------------+
2176 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2177 | STATE : code ROUTINE : for_start_dtmf |
2178 +--------------------------------------------------------------------+
2179
2180 PURPOSE : Code the message start dtmf and send them to
2181 mobility management.
2182
2183 */
2184
2185 GLOBAL void for_start_dtmf ( T_U_START_DTMF * start_dtmf)
2186 {
2187 TRACE_FUNCTION ("for_start_dtmf()");
2188 /* Implements Measure# 22 */
2189 code_msg ((UBYTE *)start_dtmf, BSIZE_U_START_DTMF);
2190 EM_CC_START_DTMF;
2191 }
2192
2193 /*
2194 +--------------------------------------------------------------------+
2195 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2196 | STATE : code ROUTINE : for_stop_dtmf |
2197 +--------------------------------------------------------------------+
2198
2199 PURPOSE : Code the message stop dtmf and send them to
2200 mobility management.
2201
2202 */
2203
2204 GLOBAL void for_stop_dtmf (void)
2205 {
2206 GET_INSTANCE_DATA;
2207
2208 TRACE_FUNCTION ("for_stop_dtmf()");
2209 /* Implements Measure 42 */
2210 for_fill_sdu_and_send (U_STOP_DTMF, BSIZE_U_STOP_DTMF);
2211 EM_CC_STOP_DTMF;
2212 }
2213
2214 /*
2215 +--------------------------------------------------------------------+
2216 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2217 | STATE : code ROUTINE : for_call_confirm |
2218 +--------------------------------------------------------------------+
2219
2220 PURPOSE : Code the message call confirm and send them to
2221 mobility management.
2222
2223 */
2224
2225 /* Here measure Measure# 23 is removed since we are accessing data ptr in
2226 EM_CC_CALL_CONFIRM_SENT */
2227 GLOBAL void for_call_confirm (T_U_CALL_CONF * call_confirm)
2228 {
2229 GET_INSTANCE_DATA;
2230 PALLOC_MSG (data, MMCM_DATA_REQ, U_CALL_CONF);
2231
2232 TRACE_FUNCTION ("for_call_confirm()");
2233
2234 data->sdu.o_buf = CC_ENCODE_OFFSET;
2235 ccd_codeMsg (CCDENT_CC,
2236 UPLINK,
2237 (T_MSGBUF *) &data->sdu,
2238 (UBYTE *) call_confirm,
2239 NOT_PRESENT_8BIT);
2240
2241 EM_CC_CALL_CONFIRM_SENT;/*lint !e416 (creation of out-of-bounds pointer)*/
2242 #if 0
2243 #if defined TRACE_BCAP
2244 cc_trace_bcap (cc_data, &data->sdu, UPLINK);
2245 #endif /* #if defined TRACE_BCAP */
2246 #endif /* #if 0 */
2247
2248 for_pd (data);
2249 }
2250
2251 /*
2252 +--------------------------------------------------------------------+
2253 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2254 | STATE : code ROUTINE : for_release |
2255 +--------------------------------------------------------------------+
2256
2257 PURPOSE : Code the message release and send them to
2258 mobility management.
2259
2260 */
2261
2262 GLOBAL void for_release (T_U_RELEASE * release)
2263 {
2264 /*
2265 * the message has a maximum length of 34 bytes.
2266 * It does not include cc_cause2, facility,
2267 * user-user or ss version.
2268 */
2269 TRACE_FUNCTION ("for_release()");
2270
2271 /* Implements Measure# 12 */
2272 code_msg ((UBYTE *)release, LEN_U_RELEASE);
2273 }
2274
2275 /*
2276 +--------------------------------------------------------------------+
2277 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2278 | STATE : code ROUTINE : for_connect_ack |
2279 +--------------------------------------------------------------------+
2280
2281 PURPOSE : Code the message connect ack and send them to
2282 mobility management.
2283
2284 */
2285
2286 GLOBAL void for_connect_ack (T_B_CONNECT_ACK *b_connect_ack )
2287 {
2288 GET_INSTANCE_DATA;
2289
2290 TRACE_FUNCTION ("for_connect_ack()");
2291 /* Implements Measure 34 */
2292 for_fill_sdu_and_send (B_CONNECT_ACK, BSIZE_B_CONNECT_ACK);
2293 EM_CC_CONNECT_ACKNOWLEDGE;
2294 }
2295
2296 /*
2297 +--------------------------------------------------------------------+
2298 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2299 | STATE : code ROUTINE : for_retrieve |
2300 +--------------------------------------------------------------------+
2301
2302 PURPOSE : Code the message retrieve and send them to
2303 mobility management.
2304
2305 */
2306
2307 GLOBAL void for_retrieve (void)
2308 {
2309 TRACE_FUNCTION ("for_retrieve()");
2310
2311 /* Implements Measure 42 */
2312 for_fill_sdu_and_send (U_RETRIEVE, BSIZE_U_RETRIEVE);
2313 }
2314
2315 /*
2316 +--------------------------------------------------------------------+
2317 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2318 | STATE : code ROUTINE : for_hold |
2319 +--------------------------------------------------------------------+
2320
2321 PURPOSE : Code the message hold and send them to
2322 mobility management.
2323
2324 */
2325
2326 GLOBAL void for_hold (void)
2327 {
2328 TRACE_FUNCTION ("for_hold()");
2329
2330 /* Implements Measure 42 */
2331 for_fill_sdu_and_send (U_HOLD, BSIZE_U_HOLD);
2332 }
2333
2334 /*
2335 +--------------------------------------------------------------------+
2336 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2337 | STATE : code ROUTINE : for_user_information |
2338 +--------------------------------------------------------------------+
2339
2340 PURPOSE : Code the message user information and send them to
2341 mobility management.
2342
2343 */
2344
2345 GLOBAL void for_user_information (T_B_USER_INFO * user_info)
2346 {
2347 GET_INSTANCE_DATA;
2348
2349 /*
2350 * The length of the outgoing message depends on
2351 * the length of the user information plus message
2352 * type, transaction identifier and the more data flag.
2353 */
2354 PALLOC_SDU (data, MMCM_DATA_REQ,
2355 (USHORT)(LEN_U_USER_USER + user_info->user_user.c_info * 8));
2356
2357 TRACE_FUNCTION ("for_user_information()");
2358
2359 EM_CC_USUER_TO_USER_DATA_SENT;
2360
2361 data->sdu.o_buf = CC_ENCODE_OFFSET;
2362 ccd_codeMsg (CCDENT_CC,
2363 UPLINK,
2364 (T_MSGBUF *) &data->sdu,
2365 (UBYTE *) user_info,
2366 NOT_PRESENT_8BIT);
2367 for_pd (data);
2368 }
2369
2370 /*
2371 +--------------------------------------------------------------------+
2372 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2373 | STATE : code ROUTINE : for_congestion_control |
2374 +--------------------------------------------------------------------+
2375
2376 PURPOSE : Code the message congestion control and send them to
2377 mobility management.
2378
2379 */
2380
2381 GLOBAL void for_congestion_control (T_B_CONGEST_CTRL * cong)
2382 {
2383 TRACE_FUNCTION ("for_congestion_control()");
2384 /* Implements Measure# 27 */
2385 code_msg ((UBYTE *)cong, BSIZE_B_CONGEST_CTRL);
2386 }
2387
2388 /*
2389 +--------------------------------------------------------------------+
2390 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2391 | STATE : code ROUTINE : for_modify |
2392 +--------------------------------------------------------------------+
2393
2394 PURPOSE : Code the message modify and send them to
2395 mobility management.
2396
2397 */
2398
2399 GLOBAL void for_modify (T_B_MODIFY * modify)
2400 {
2401 TRACE_FUNCTION ("for_modify()");
2402
2403 /* Implements Measure# 28 */
2404 code_msg ((UBYTE *)modify, BSIZE_B_MODIFY);
2405 }
2406
2407
2408 /*
2409 +--------------------------------------------------------------------+
2410 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2411 | STATE : code ROUTINE : for_connect |
2412 +--------------------------------------------------------------------+
2413
2414 PURPOSE : Code the message connect and send them to
2415 mobility management.
2416
2417 */
2418
2419 GLOBAL void for_connect (T_U_CONNECT * connect)
2420 {
2421 /*
2422 * the message contains only message type
2423 * and transaction identifier and no
2424 * optional elements
2425 */
2426
2427 TRACE_FUNCTION ("for_connect()");
2428
2429 /* Implements Measure# 13 */
2430 code_msg ((UBYTE *)connect, LEN_U_CONNECT);
2431 }
2432
2433 /*
2434 +--------------------------------------------------------------------+
2435 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2436 | STATE : code ROUTINE : for_alert |
2437 +--------------------------------------------------------------------+
2438
2439 PURPOSE : Code the message alert and send them to
2440 mobility management.
2441
2442 */
2443
2444 GLOBAL void for_alert (T_U_ALERT * alert)
2445 {
2446 /*
2447 * the message contains only message type and
2448 * transaction identifier and no optional
2449 * elements
2450 */
2451
2452 TRACE_FUNCTION ("for_alert()");
2453
2454 /* Implements Measure# 14 */
2455 code_msg ((UBYTE *)alert, LEN_U_ALERT);
2456 }
2457
2458 /*
2459 +--------------------------------------------------------------------+
2460 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2461 | STATE : code ROUTINE : for_facility |
2462 +--------------------------------------------------------------------+
2463
2464 PURPOSE : Code the message facility and send them to
2465 mobility management.
2466
2467 */
2468
2469 GLOBAL void for_facility (T_U_FACILITY * facility)
2470 {
2471 /*
2472 * The length of the outgoing message depends
2473 * on the length of the facility information
2474 * element plus message type, transaction identifier
2475 * and ss version.
2476 */
2477 PALLOC_SDU (data, MMCM_DATA_REQ,
2478 (USHORT)(LEN_U_FACILITY + facility->facility.c_fac * 8));
2479
2480 TRACE_FUNCTION ("for_facility()");
2481
2482 data->sdu.o_buf = CC_ENCODE_OFFSET;
2483 ccd_codeMsg (CCDENT_CC,
2484 UPLINK,
2485 (T_MSGBUF *) &data->sdu,
2486 (UBYTE *) facility,
2487 NOT_PRESENT_8BIT);
2488 for_pd (data);
2489 }
2490
2491
2492 /*
2493 +--------------------------------------------------------------------+
2494 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2495 | STATE : code ROUTINE : for_pd |
2496 +--------------------------------------------------------------------+
2497
2498 PURPOSE : Add protocol discriminator and transaction identifier.
2499
2500 */
2501
2502 GLOBAL void for_pd (T_MMCM_DATA_REQ * data)
2503 {
2504 GET_INSTANCE_DATA;
2505
2506 U8 *payload;
2507 U16 length;
2508 UBYTE *msg_type;
2509 /* Implements Measure#32: Row 71,...,95 */
2510
2511
2512 TRACE_FUNCTION ("for_pd()");
2513
2514 data->org_entity = NAS_ORG_ENTITY_CC;
2515
2516 TRACE_EVENT_P1("extended TI %spresent", (cc_data->ti_ext_pres EQ TRUE)? "":"not ");
2517 if (cc_data->ti_ext_pres EQ TRUE)
2518 {
2519 data->sdu.o_buf -= 8;
2520 data->sdu.l_buf += 8;
2521 data->sdu.buf[data->sdu.o_buf >> 3] = cc_data->ti_ext;
2522 }
2523
2524 SET_PD (data->sdu, M_MM_PD_CC);
2525 SET_TI (data->sdu, cc_data->ti);
2526 data->sdu.l_buf += 8;
2527 data->sdu.o_buf -= 8;
2528
2529 msg_type = &(data->sdu.buf[CC_ENCODE_OFFSET >> 3]);/*lint !e415 !e416 Likely access or creation of out-of-bounds pointer*/
2530 payload = &(data->sdu.buf[0]); /* beginning of buffer */
2531 payload += ((data->sdu.o_buf) >> 3); /* plus offset (bytes) */
2532 length = ((data->sdu.l_buf) >> 3); /* length (bytes, bits / 8) */
2533
2534 /*lint -e{415} Likely access or creation of out-of-bounds pointer*/
2535 switch (*msg_type)
2536 {
2537 case U_SETUP:
2538 TRACE_BINDUMP (cc_handle,
2539 TC_USER4,
2540 " Setup UL ",
2541 payload,
2542 length);
2543 break;
2544 case U_EMERGE_SETUP:
2545 TRACE_BINDUMP (cc_handle,
2546 TC_USER4,
2547 " Emergency Setup UL ",
2548 payload,
2549 length);
2550 break;
2551 case U_START_CC:
2552 TRACE_BINDUMP (cc_handle,
2553 TC_USER4,
2554 " Call Control Capability UL ",
2555 payload,
2556 length);
2557 break;
2558 case U_CC_EST_CONF:
2559 TRACE_BINDUMP (cc_handle,
2560 TC_USER4,
2561 " Establishment Confirm UL ",
2562 payload,
2563 length);
2564 break;
2565 case B_STATUS:
2566 TRACE_BINDUMP (cc_handle,
2567 TC_USER4,
2568 " Status UL ",
2569 payload,
2570 length);
2571 break;
2572 case U_DISCONNECT:
2573 TRACE_BINDUMP (cc_handle,
2574 TC_USER4,
2575 " Disconnect UL ",
2576 payload,
2577 length);
2578 break;
2579 case B_MODIFY_REJ:
2580 TRACE_BINDUMP (cc_handle,
2581 TC_USER4,
2582 " Modify Reject UL ",
2583 payload,
2584 length);
2585 break;
2586 case B_MODIFY_COMP:
2587 TRACE_BINDUMP (cc_handle,
2588 TC_USER4,
2589 " Modify Complete UL ",
2590 payload,
2591 length);
2592 break;
2593 case U_START_DTMF:
2594 TRACE_BINDUMP (cc_handle,
2595 TC_USER4,
2596 " Start DTMF UL ",
2597 payload,
2598 length);
2599 break;
2600 case U_STOP_DTMF:
2601 TRACE_BINDUMP (cc_handle,
2602 TC_USER4,
2603 " Stop DTMF UL ",
2604 payload,
2605 length);
2606 break;
2607 case U_CALL_CONF:
2608 TRACE_BINDUMP (cc_handle,
2609 TC_USER4,
2610 " Call Confirm UL ",
2611 payload,
2612 length);
2613 break;
2614 case U_RELEASE :
2615 TRACE_BINDUMP (cc_handle,
2616 TC_USER4,
2617 " Release UL ",
2618 payload,
2619 length);
2620 break;
2621 case B_CONNECT_ACK:
2622 TRACE_BINDUMP (cc_handle,
2623 TC_USER4,
2624 " Connect Acknowledge UL ",
2625 payload,
2626 length);
2627 break;
2628 case U_RETRIEVE:
2629 TRACE_BINDUMP (cc_handle,
2630 TC_USER4,
2631 " Retrieve UL ",
2632 payload,
2633 length);
2634 break;
2635 case U_HOLD:
2636 TRACE_BINDUMP (cc_handle,
2637 TC_USER4,
2638 " Hold UL ",
2639 payload,
2640 length);
2641 break;
2642 case B_USER_INFO:
2643 TRACE_BINDUMP (cc_handle,
2644 TC_USER4,
2645 " User Info UL ",
2646 payload,
2647 length);
2648 break;
2649 case B_CONGEST_CTRL:
2650 TRACE_BINDUMP (cc_handle,
2651 TC_USER4,
2652 " Congestion Control UL ",
2653 payload,
2654 length);
2655 break;
2656 case B_MODIFY:
2657 TRACE_BINDUMP (cc_handle,
2658 TC_USER4,
2659 " Modify UL ",
2660 payload,
2661 length);
2662 break;
2663 case U_CONNECT:
2664 TRACE_BINDUMP (cc_handle,
2665 TC_USER4,
2666 " Connect UL ",
2667 payload,
2668 length);
2669 break;
2670 case U_ALERT:
2671 TRACE_BINDUMP (cc_handle,
2672 TC_USER4,
2673 " Alert UL ",
2674 payload,
2675 length);
2676 break;
2677 case U_FACILITY:
2678 TRACE_BINDUMP (cc_handle,
2679 TC_USER4,
2680 " Facility UL ",
2681 payload,
2682 length);
2683 break;
2684 case U_RELEASE_COMP:
2685 TRACE_BINDUMP (cc_handle,
2686 TC_USER4,
2687 "Release Complete UL ",
2688 payload,
2689 length);
2690 break;
2691 case B_NOTIFY:
2692 TRACE_BINDUMP (cc_handle,
2693 TC_USER4,
2694 "Notify UL ",
2695 payload,
2696 length);
2697 break;
2698 case B_STATUS_ENQ:
2699 TRACE_BINDUMP (cc_handle,
2700 TC_USER4,
2701 "Status Enquiry UL ",
2702 payload,
2703 length);
2704 break;
2705 default:
2706 TRACE_EVENT("Unknown Message");
2707 break;
2708 } /* switch (*msg_type) */
2709 PSENDX (MM, data);
2710 }
2711 /* Implements Measure# 11, 12, 13, 14, 22, 27, 28 and 38 */
2712
2713 /*
2714 +--------------------------------------------------------------------+
2715 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2716 | STATE : code ROUTINE : code_msg |
2717 +--------------------------------------------------------------------+
2718
2719 PURPOSE : Code the message and add protocol discriminator and
2720 transaction identifier.
2721
2722 */
2723
2724 LOCAL void code_msg (UBYTE * mStruct,
2725 USHORT len)
2726 {
2727 TRACE_FUNCTION ("code_msg()");
2728 {
2729 /* Here we are using PALLOC_SDU for PALLOC_MSG also since they are same */
2730 PALLOC_SDU (data, MMCM_DATA_REQ, len);
2731
2732 data->sdu.o_buf = CC_ENCODE_OFFSET;
2733 ccd_codeMsg (CCDENT_CC,
2734 UPLINK,
2735 (T_MSGBUF *) &data->sdu,
2736 mStruct,
2737 NOT_PRESENT_8BIT);
2738 for_pd (data);
2739 }
2740 }
2741
2742
2743 /* Implements Measure# 44 */
2744 /*
2745 +--------------------------------------------------------------------+
2746 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2747 | STATE : code ROUTINE : for_send_u_release_comp |
2748 +--------------------------------------------------------------------+
2749
2750 PURPOSE : Send release complete.
2751
2752 */
2753 LOCAL void for_send_u_release_comp (USHORT cause)
2754 {
2755 TRACE_FUNCTION ("for_send_u_release_comp()");
2756
2757 CCD_END;
2758 CCD_START;
2759 /*
2760 * For MM the connection is still valid
2761 * CC has already released the connection.
2762 */
2763 {
2764 MCAST (rel_com, U_RELEASE_COMP);
2765
2766 cc_build_release_complete (rel_com,
2767 CAUSE_MAKE(DEFBY_STD,
2768 ORIGSIDE_MS,
2769 MNCC_CC_ORIGINATING_ENTITY,
2770 cause));
2771 for_release_complete (rel_com);
2772 }
2773 CCD_END;
2774 for_rel_req ();
2775 }
2776
2777 /* Implements Measure# 42 */
2778 /*
2779 +--------------------------------------------------------------------+
2780 | PROJECT : GSM-PS (6147) MODULE : CC_FOR |
2781 | STATE : code ROUTINE : for_retrieve_hold |
2782 +--------------------------------------------------------------------+
2783
2784 PURPOSE : Send release complete.
2785
2786 */
2787
2788 LOCAL void for_fill_sdu_and_send (UBYTE msg,
2789 USHORT len)
2790 {
2791 PALLOC_SDU (data, MMCM_DATA_REQ, len);
2792 data->sdu.o_buf = CC_ENCODE_OFFSET;
2793 data->sdu.l_buf = 8;
2794 /*lint -e{415} (warning-- Likely access or creation of out-of-bounds pointer)*/
2795 data->sdu.buf [CC_ENCODE_OFFSET >> 3] = msg;
2796 for_pd (data);
2797 }
2798 #endif