FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/cc/cc_cfk.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_CFK | |
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 called by the primitive | |
18 | processing functions of the SDL process CC. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CC_CFK_C | |
23 #define CC_CFK_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 | |
47 /*==== EXPORT =====================================================*/ | |
48 | |
49 /*==== PROTOTYPE ==================================================*/ | |
50 /* Implements Measure# 21 */ | |
51 LOCAL void cc_set_neg_bearer_cap (const T_M_CC_bearer_cap * bearer_cap, | |
52 T_MNCC_bcpara * bcpara, | |
53 T_M_CC_bearer_cap * neg_bearer_cap, | |
54 EF_MSCAP mscap); | |
55 /* Implements Measure# 15 */ | |
56 LOCAL void cc_fill_struct (UBYTE is_num_pres, | |
57 T_MNCC_calling_party *calling_party, | |
58 const T_M_CC_calling_num *calling_num); | |
59 /* Implements Measure# 24, 25 and 26 */ | |
60 LOCAL void cc_fill_sub_struct (UBYTE is_num_pres, | |
61 T_MNCC_connected_number_sub *connected_number_sub, | |
62 const T_M_CC_connect_subaddr *connect_subaddr); | |
63 /*==== PRIVAT =====================================================*/ | |
64 | |
65 /*==== VARIABLES ==================================================*/ | |
66 | |
67 /*==== FUNCTIONS ==================================================*/ | |
68 | |
69 /* | |
70 +--------------------------------------------------------------------+ | |
71 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
72 | STATE : code ROUTINE : cc_voice_capability | | |
73 +--------------------------------------------------------------------+ | |
74 | |
75 PURPOSE : This function returns TRUE if the mobile has voice | |
76 cababilities (support for any speech codec). | |
77 | |
78 */ | |
79 | |
80 GLOBAL BOOL cc_voice_capability (void) | |
81 { | |
82 GET_INSTANCE_DATA; | |
83 TRACE_FUNCTION ("cc_voice_capability()"); | |
84 | |
85 return (FldGet (cc_data->mscap.chnMode, spchSupV1) OR | |
86 FldGet (cc_data->mscap.chnMode, AHS) OR | |
87 FldGet (cc_data->mscap.chnMode, AFS)); | |
88 } | |
89 | |
90 | |
91 /* | |
92 +--------------------------------------------------------------------+ | |
93 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
94 | STATE : code ROUTINE : cc_bcs_compatible | | |
95 +--------------------------------------------------------------------+ | |
96 | |
97 PURPOSE : Compare of two bearer capabilities. | |
98 | |
99 */ | |
100 | |
101 GLOBAL BOOL cc_bcs_compatible (const T_M_CC_bearer_cap * bc1, | |
102 const T_M_CC_bearer_cap * bc2, | |
103 BOOL full) | |
104 { | |
105 BOOL itc_chg = FALSE; | |
106 | |
107 TRACE_FUNCTION ("cc_bcs_compatible()"); | |
108 | |
109 /* | |
110 * Compare Octett 3, Coding Standard | |
111 */ | |
112 if (bc1->code NEQ bc2->code) | |
113 return FALSE; | |
114 | |
115 /* | |
116 * Compare Transfer Mode | |
117 */ | |
118 if (bc1->trans_mode NEQ bc2->trans_mode) | |
119 return FALSE; | |
120 | |
121 /* | |
122 * Compare Information Transfer Capability | |
123 * Note: The combination UDI <-> AUDIO is allowed | |
124 */ | |
125 if (bc1->trans_cap NEQ bc2->trans_cap) | |
126 { | |
127 itc_chg = TRUE; | |
128 | |
129 if (((bc1->trans_cap NEQ M_CC_ITC_DIGITAL_UNRESTRICTED) | |
130 AND | |
131 (bc1->trans_cap NEQ M_CC_ITC_AUDIO)) | |
132 OR | |
133 ((bc2->trans_cap NEQ M_CC_ITC_DIGITAL_UNRESTRICTED) | |
134 AND | |
135 (bc2->trans_cap NEQ M_CC_ITC_AUDIO))) | |
136 return FALSE; | |
137 } | |
138 | |
139 /* | |
140 * if speech is used the compare is successfull | |
141 */ | |
142 if (bc1->trans_cap EQ M_CC_ITC_SPEECH OR | |
143 bc1->trans_cap EQ M_CC_ITC_AUXILIARY_SPEECH) | |
144 return TRUE; | |
145 | |
146 /* | |
147 * Octett 4, Check Existence | |
148 */ | |
149 if (bc1->v_compress NEQ bc2->v_compress) | |
150 return FALSE; | |
151 | |
152 /* | |
153 * Compare Compression | |
154 */ | |
155 if (bc1->compress NEQ bc2->compress) | |
156 return FALSE; | |
157 | |
158 /* | |
159 * Compare Duplex Mode | |
160 */ | |
161 if (bc1->duplex NEQ bc2->duplex) | |
162 return FALSE; | |
163 | |
164 /* | |
165 * Compare Configuration | |
166 */ | |
167 if (bc1->config NEQ bc2->config) | |
168 return FALSE; | |
169 | |
170 #ifdef REL99 | |
171 if (bc1->v_nirr != bc2->v_nirr) | |
172 return FALSE; | |
173 if (bc1->v_nirr AND (bc1->nirr != bc2->nirr)) | |
174 return FALSE; | |
175 #endif | |
176 | |
177 | |
178 | |
179 /* | |
180 * Compare Establishment | |
181 */ | |
182 if (bc1->establish NEQ bc2->establish) | |
183 return FALSE; | |
184 | |
185 /* | |
186 * Octett 5, Check Existence | |
187 */ | |
188 if (bc1->v_access_ident NEQ bc2->v_access_ident) | |
189 return FALSE; | |
190 | |
191 /* | |
192 * Compare Rate Adaption | |
193 * Note: Error if same ITC but different rate adaption | |
194 */ | |
195 if (bc1->rate_adapt NEQ bc2->rate_adapt) | |
196 { | |
197 if (itc_chg EQ FALSE) | |
198 return FALSE; | |
199 } | |
200 | |
201 /* | |
202 * Compare Signalling Access Protocol | |
203 */ | |
204 if (bc1->sig_access_prot NEQ bc2->sig_access_prot) | |
205 return FALSE; | |
206 | |
207 #ifdef REL99 | |
208 /* | |
209 * Octet 5a, Check Existence and contents | |
210 */ | |
211 if (bc1->v_other_itc != bc2->v_other_itc) | |
212 return FALSE; | |
213 if (bc1->v_other_itc AND (bc1->other_itc != bc2->other_itc)) | |
214 return FALSE; | |
215 if (bc1->v_other_ra != bc2->v_other_ra) | |
216 return FALSE; | |
217 if (bc1->v_other_ra AND (bc1->other_ra != bc2->other_ra)) | |
218 return FALSE; | |
219 #endif | |
220 | |
221 /* | |
222 * Octett 6, Check Existence | |
223 */ | |
224 if (bc1->v_l1_ident NEQ bc2->v_l1_ident) | |
225 return FALSE; | |
226 | |
227 /* | |
228 * Compare User Information Layer 1 Protocol | |
229 */ | |
230 if (bc1->v_user_inf_l1_prot NEQ bc2->v_user_inf_l1_prot) | |
231 return FALSE; | |
232 | |
233 /* | |
234 * Compare Synchronous / Asynchronous | |
235 */ | |
236 if (bc1->sync_async NEQ bc2->sync_async) | |
237 return FALSE; | |
238 | |
239 /* | |
240 * Octett 6a, Check Existence | |
241 */ | |
242 if (bc1->v_num_stop NEQ bc2->v_num_stop) | |
243 return FALSE; | |
244 | |
245 /* | |
246 * Compare negotiation | |
247 */ | |
248 if (bc1->negotiate NEQ bc2->negotiate) | |
249 return FALSE; | |
250 | |
251 /* | |
252 * Compare User Rate | |
253 * Note: For Fax the user rate is unimportant | |
254 */ | |
255 if (bc1->user_rate NEQ bc2->user_rate) | |
256 { | |
257 if (bc1->trans_cap NEQ M_CC_ITC_FAX_GROUP_3) | |
258 return FALSE; | |
259 } | |
260 | |
261 /* | |
262 * Octett 6b, Check Existence | |
263 */ | |
264 if (bc1->v_intermed_rate NEQ bc2->v_intermed_rate) | |
265 return FALSE; | |
266 | |
267 /* | |
268 * Compare Network Independent Clock TX | |
269 */ | |
270 if (bc1->nic_tx NEQ bc2->nic_tx) | |
271 return FALSE; | |
272 | |
273 /* | |
274 * Compare Network Independent Clock RX | |
275 */ | |
276 if (bc1->nic_rx NEQ bc2->nic_rx) | |
277 return FALSE; | |
278 | |
279 /* | |
280 * Octett 6c, Check Existence | |
281 */ | |
282 if (bc1->v_conn_elem NEQ bc2->v_conn_elem) | |
283 return FALSE; | |
284 | |
285 /* | |
286 * Compare Connection Element | |
287 * Note: The combination transparent and non-transparent | |
288 * is not allowed. | |
289 * For transparent the structure must be UNSTRUCTED. | |
290 * For non-transparent the structure must be DATA UNIT INTEGRITY. | |
291 */ | |
292 if (((bc1->conn_elem EQ M_CC_CE_TRANSPA) AND | |
293 (bc2->conn_elem EQ M_CC_CE_RLP)) OR | |
294 ((bc1->conn_elem EQ M_CC_CE_RLP) AND | |
295 (bc2->conn_elem EQ M_CC_CE_TRANSPA))) | |
296 return FALSE; | |
297 | |
298 if (bc1->v_structure AND bc1->v_conn_elem) | |
299 { | |
300 if (bc1->conn_elem EQ M_CC_CE_TRANSPA) | |
301 { | |
302 if (bc1->structure NEQ M_CC_STRC_UNSTRUCTURED) | |
303 return FALSE; | |
304 } | |
305 else | |
306 { | |
307 if (bc1->structure NEQ M_CC_STRC_SERV_DATA_INTEG) | |
308 return FALSE; | |
309 } | |
310 } | |
311 | |
312 /* | |
313 * Compare Modem Type | |
314 * Note: Error if no change in information | |
315 * Transfer Capability. | |
316 */ | |
317 if (bc1->modem_type NEQ bc2->modem_type) | |
318 if (itc_chg EQ FALSE) | |
319 return FALSE; | |
320 | |
321 /* | |
322 * Compare of all parameters ? | |
323 */ | |
324 if (full EQ FALSE) | |
325 return TRUE; | |
326 | |
327 /* | |
328 * Compare Number of Stop Bits | |
329 */ | |
330 if (bc1->num_stop NEQ bc2->num_stop) | |
331 return FALSE; | |
332 | |
333 /* | |
334 * Compare Number of Data Bits | |
335 */ | |
336 if (bc1->num_data NEQ bc2->num_data) | |
337 return FALSE; | |
338 | |
339 /* | |
340 * Compare Intermediate Rate | |
341 */ | |
342 if (bc1->intermed_rate NEQ bc2->intermed_rate) | |
343 return FALSE; | |
344 | |
345 /* | |
346 * Compare Parity | |
347 */ | |
348 if (bc1->parity NEQ bc2->parity) | |
349 return FALSE; | |
350 | |
351 #ifdef REL99 | |
352 /* | |
353 * Octet 6d, Compare Existence only | |
354 */ | |
355 /*(subject to negotiation)*/ | |
356 if (bc1->v_modem_type_2 != bc2->v_modem_type_2) | |
357 return FALSE; | |
358 /*(subject to negotiation)*/ | |
359 if (bc1->v_fnur != bc2->v_fnur) | |
360 return FALSE; | |
361 | |
362 if(bc1->v_fnur) | |
363 { | |
364 /* | |
365 * Octet 6e, Compare Existence and contents | |
366 */ | |
367 if (bc1->v_acc != bc2->v_acc) | |
368 return FALSE; | |
369 if (bc1->v_acc AND (bc1->acc != bc2->acc)) | |
370 return FALSE; | |
371 if (bc1->v_mTch != bc2->v_mTch) | |
372 return FALSE; | |
373 if (bc1->v_mTch AND (bc1->mTch != bc2->mTch)) | |
374 return FALSE; | |
375 | |
376 /* | |
377 * Theres a extra condition here with MO NT pref negotiated to T because | |
378 * according to 24.008 Octet 6e (UIMI+WAIUR) is not sent in T Bearer Cap | |
379 */ | |
380 if(bc1->conn_elem != M_CC_CE_TRANSPA && bc2->conn_elem != M_CC_CE_TRANSPA) | |
381 { | |
382 /* | |
383 * Octet 6f, Compare Existence and contents | |
384 */ | |
385 if (bc1->v_uimi != bc2->v_uimi) | |
386 return FALSE; | |
387 if (bc1->v_uimi AND (bc1->uimi != bc2->uimi)) | |
388 return FALSE; | |
389 if (bc1->v_waiur != bc2->v_waiur) | |
390 return FALSE; | |
391 if (bc1->v_waiur AND (bc1->waiur != bc2->waiur)) | |
392 return FALSE; | |
393 } | |
394 | |
395 /* | |
396 * Octet 6g, Compare Existence and contents | |
397 */ | |
398 if (bc1->v_acc_ext_288 != bc2->v_acc_ext_288) | |
399 return FALSE; | |
400 if (bc1->v_acc_ext_288 AND (bc1->acc_ext_288 != bc2->acc_ext_288)) | |
401 return FALSE; | |
402 if (bc1->v_acc_ext_320 != bc2->v_acc_ext_320) | |
403 return FALSE; | |
404 if (bc1->v_acc_ext_320 AND (bc1->acc_ext_320 != bc2->acc_ext_320)) | |
405 return FALSE; | |
406 if (bc1->v_acc_ext_432 != bc2->v_acc_ext_432) | |
407 return FALSE; | |
408 if (bc1->v_acc_ext_432 AND (bc1->acc_ext_432 != bc2->acc_ext_432)) | |
409 return FALSE; | |
410 | |
411 if (bc1->v_ch_cod_asym != bc2->v_ch_cod_asym) | |
412 return FALSE; | |
413 if (bc1->v_ch_cod_asym AND (bc1->ch_cod_asym != bc2->ch_cod_asym)) | |
414 return FALSE; | |
415 } | |
416 | |
417 #endif | |
418 | |
419 /* | |
420 * Octett 7, Compare Existence | |
421 */ | |
422 if (bc1->v_l2_ident NEQ bc2->v_l2_ident) | |
423 return FALSE; | |
424 | |
425 /* | |
426 * Compare User Information Layer 2 Protocol | |
427 */ | |
428 if (bc1->v_l2_ident AND | |
429 (bc1->user_inf_l2_prot NEQ bc2->user_inf_l2_prot)) | |
430 return FALSE; | |
431 | |
432 return TRUE; | |
433 } | |
434 | |
435 | |
436 /* | |
437 +--------------------------------------------------------------------+ | |
438 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
439 | STATE : code ROUTINE : cc_build_bc | | |
440 +--------------------------------------------------------------------+ | |
441 | |
442 PURPOSE : Define bearer capability depending on the bearer capability | |
443 parameters. | |
444 | |
445 */ | |
446 GLOBAL void cc_build_bc (T_M_CC_bearer_cap * bearer_cap, /* out */ | |
447 UBYTE * serv, /* out */ | |
448 const T_MNCC_bcpara * bc_params) /* in*/ | |
449 { | |
450 | |
451 TRACE_FUNCTION ("cc_build_bc()"); | |
452 | |
453 cc_csf_ms_cap (); | |
454 | |
455 switch (bc_params->bearer_serv) | |
456 { | |
457 case MNCC_BEARER_SERV_SPEECH: | |
458 case MNCC_BEARER_SERV_AUX_SPEECH: | |
459 case MNCC_BEARER_SERV_SPEECH_CTM: | |
460 case MNCC_BEARER_SERV_AUX_SPEECH_CTM: | |
461 * serv = MNCC_SERV_SPEECH; | |
462 memset (bearer_cap, 0, sizeof (T_M_CC_bearer_cap)); | |
463 cc_set_trans_cap (bearer_cap, bc_params); | |
464 | |
465 cc_set_radio_channel_requirement (bearer_cap, bc_params); | |
466 break; | |
467 | |
468 case MNCC_BEARER_SERV_FAX: | |
469 /* | |
470 * Only transparent is supported | |
471 */ | |
472 * serv = MNCC_SERV_DATA; | |
473 memset (bearer_cap, 0, sizeof (T_M_CC_bearer_cap)); | |
474 cc_set_trans_cap (bearer_cap, bc_params); | |
475 cc_set_radio_channel_requirement (bearer_cap, bc_params); | |
476 cc_set_data_default_parameter (bearer_cap); | |
477 cc_set_conn_elem (bearer_cap, MNCC_CONN_ELEM_TRANS, bc_params->flow_control); | |
478 cc_set_user_rate (bearer_cap, bc_params->rate, M_CC_MT_NONE); | |
479 cc_set_sync_async (bearer_cap, bc_params); | |
480 break; | |
481 | |
482 case MNCC_BEARER_SERV_PACKET_ACCESS: | |
483 case MNCC_BEARER_SERV_SYNC: | |
484 * serv = MNCC_SERV_DATA; | |
485 memset (bearer_cap, 0, sizeof (T_M_CC_bearer_cap)); | |
486 cc_set_trans_cap (bearer_cap, bc_params); | |
487 cc_set_radio_channel_requirement (bearer_cap, bc_params); | |
488 cc_set_data_default_parameter (bearer_cap); | |
489 cc_set_conn_elem (bearer_cap, bc_params->conn_elem, bc_params->flow_control); | |
490 cc_set_user_rate (bearer_cap, bc_params->rate, bc_params->modem_type); | |
491 cc_set_sync_async (bearer_cap, bc_params); | |
492 break; | |
493 | |
494 case MNCC_BEARER_SERV_PAD_ACCESS: | |
495 case MNCC_BEARER_SERV_ASYNC: | |
496 * serv = MNCC_SERV_DATA; | |
497 memset (bearer_cap, 0, sizeof (T_M_CC_bearer_cap)); | |
498 cc_set_trans_cap (bearer_cap, bc_params); | |
499 cc_set_radio_channel_requirement (bearer_cap, bc_params); | |
500 cc_set_data_default_parameter (bearer_cap); | |
501 cc_set_conn_elem (bearer_cap, bc_params->conn_elem, bc_params->flow_control); | |
502 cc_set_user_rate (bearer_cap, bc_params->rate, bc_params->modem_type); | |
503 cc_set_sync_async (bearer_cap, bc_params); | |
504 break; | |
505 | |
506 default: | |
507 TRACE_ERROR ("Unexpected bearer_serv"); | |
508 break; | |
509 } | |
510 } | |
511 | |
512 | |
513 /* | |
514 +--------------------------------------------------------------------+ | |
515 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
516 | STATE : code ROUTINE : cc_set_data_default_parameter | | |
517 +--------------------------------------------------------------------+ | |
518 | |
519 PURPOSE : Set bearer capability parameters for data. | |
520 | |
521 */ | |
522 | |
523 GLOBAL void cc_set_data_default_parameter (T_M_CC_bearer_cap * bearer_cap) | |
524 { | |
525 TRACE_FUNCTION ("cc_set_data_default_parameter()"); | |
526 | |
527 /* | |
528 * Octet 3 | |
529 */ | |
530 #ifdef REL99 | |
531 bearer_cap->v_code = TRUE; | |
532 bearer_cap->code = M_CC_CSTD_GSM; | |
533 bearer_cap->v_trans_mode = TRUE; | |
534 bearer_cap->trans_mode = M_CC_TM_CIRCUIT; | |
535 #endif | |
536 | |
537 /* | |
538 * Octet 4 | |
539 */ | |
540 bearer_cap->v_compress = TRUE; /* now spare, used in previous releases */ | |
541 bearer_cap->compress = M_CC_COMP_NO; | |
542 /* structure -> by other function */ | |
543 bearer_cap->v_duplex = TRUE; | |
544 bearer_cap->duplex = M_CC_DUPLEX_FULL; | |
545 | |
546 bearer_cap->v_config = TRUE; | |
547 bearer_cap->config = M_CC_CONF_POINT_TO_POINT; | |
548 /* nirr -> by other function */ | |
549 bearer_cap->v_establish= TRUE; | |
550 bearer_cap->establish = M_CC_ESTAB_DEMAND; | |
551 | |
552 /* | |
553 * Octet 5 | |
554 */ | |
555 bearer_cap->v_access_ident = TRUE; | |
556 bearer_cap->access_ident = M_CC_AI_OCT_ID; | |
557 | |
558 bearer_cap->v_sig_access_prot = TRUE; | |
559 bearer_cap->sig_access_prot = M_CC_SIAP_I440; | |
560 | |
561 /* | |
562 * Octet 6 | |
563 */ | |
564 bearer_cap->v_l1_ident = TRUE; | |
565 bearer_cap->l1_ident = M_CC_L1_OCT_ID; | |
566 | |
567 bearer_cap->v_user_inf_l1_prot = TRUE; | |
568 bearer_cap->user_inf_l1_prot = M_CC_L1_DEFAULT; | |
569 /* sync_async -> by other function */ | |
570 /* | |
571 * Octet 6a | |
572 */ | |
573 /* num_stop -> by other function */ | |
574 bearer_cap->v_negotiate = TRUE; | |
575 bearer_cap->negotiate = M_CC_NEGOTIATE_NO; | |
576 /* num_data -> by other function */ | |
577 /* user_rate -> by other function */ | |
578 /* | |
579 * Octet 6b | |
580 */ | |
581 /* intermed_rate -> by other function */ | |
582 bearer_cap->v_nic_tx = TRUE; | |
583 bearer_cap->nic_tx = M_CC_NIC_TX_NO; | |
584 bearer_cap->v_nic_rx = TRUE; | |
585 bearer_cap->nic_rx = M_CC_NIC_RX_NO; | |
586 /* parity -> by other function */ | |
587 /* conn_elem -> by other function */ | |
588 /* modem_type -> by other function */ | |
589 /* | |
590 * Octet 7 | |
591 */ | |
592 /* l2_ident -> by other function */ | |
593 /* user_inf_l2_prot -> by other function */ | |
594 } | |
595 | |
596 /* | |
597 +--------------------------------------------------------------------+ | |
598 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
599 | STATE : code ROUTINE : cc_set_radio_channel_requirement | | |
600 +--------------------------------------------------------------------+ | |
601 | |
602 PURPOSE : Set bearer capability parameters for data. | |
603 | |
604 */ | |
605 GLOBAL void cc_set_radio_channel_requirement (T_M_CC_bearer_cap * bearer_cap, | |
606 const T_MNCC_bcpara * bcpara) | |
607 { | |
608 GET_INSTANCE_DATA; | |
609 UBYTE index, prio; | |
610 const UBYTE codec_prio[5] = {M_CC_SPEECH_VERS_AMR_FR, M_CC_SPEECH_VERS_AMR_HR, M_CC_SPEECH_VERS_EFR, | |
611 M_CC_SPEECH_VERS_FR, M_CC_SPEECH_VERS_HR}; | |
612 UBYTE codec_val[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; | |
613 | |
614 TRACE_FUNCTION ("cc_set_radio_channel_requirement()"); | |
615 | |
616 switch (bcpara->bearer_serv) | |
617 { | |
618 case MNCC_BEARER_SERV_SPEECH: | |
619 case MNCC_BEARER_SERV_AUX_SPEECH: | |
620 case MNCC_BEARER_SERV_SPEECH_CTM: | |
621 case MNCC_BEARER_SERV_AUX_SPEECH_CTM: | |
622 bearer_cap->v_rad_chan_req = TRUE; | |
623 bearer_cap->v_code = TRUE; | |
624 bearer_cap->code = M_CC_CSTD_GSM; | |
625 bearer_cap->v_trans_mode = TRUE; | |
626 bearer_cap->trans_mode = M_CC_TM_CIRCUIT; | |
627 index = (UBYTE)FldGet(cc_data->mscap.chnMode, HR_EFRSup); | |
628 | |
629 TRACE_EVENT_P1 ("index = %d", index); | |
630 if(bcpara->rad_chan_req NEQ 0) | |
631 { | |
632 TRACE_EVENT_P1 ("bearer_cap->rad_chan_req = %d", bearer_cap->rad_chan_req); | |
633 bearer_cap->rad_chan_req = bcpara->rad_chan_req ; | |
634 } | |
635 else | |
636 bearer_cap->rad_chan_req = bc_prio_0 [index]; | |
637 index = 0; | |
638 for (prio = 0; prio < MAX_SPEECH_CODECS; prio++) | |
639 { | |
640 switch (codec_prio[prio]) | |
641 { | |
642 case M_CC_SPEECH_VERS_FR: /* Full rate speech version 1 */ | |
643 /* Always */ | |
644 codec_val[index] = M_CC_SPEECH_VERS_FR; | |
645 index++; | |
646 break; | |
647 case M_CC_SPEECH_VERS_HR: /* Half rate speech version 1 */ | |
648 if (FldGet (cc_data->mscap.chnMode, hrSup) NEQ 0) | |
649 { | |
650 codec_val[index] = M_CC_SPEECH_VERS_HR; | |
651 index++; | |
652 } | |
653 break; | |
654 case M_CC_SPEECH_VERS_EFR: /* Full rate speech version 2 - EFR */ | |
655 if (FldGet (cc_data->mscap.chnMode, EFRSupV2) NEQ 0) | |
656 { | |
657 codec_val[index] = M_CC_SPEECH_VERS_EFR; | |
658 index++; | |
659 } | |
660 break; | |
661 case M_CC_SPEECH_VERS_AMR_HR: /* Half rate speech version 3 - AMR */ | |
662 if ((FldGet (cc_data->mscap.chnMode, AHS) NEQ 0) | |
663 #if (CHIPSET != 15) | |
664 AND !(bcpara->bearer_serv EQ MNCC_BEARER_SERV_SPEECH_CTM OR | |
665 bcpara->bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH_CTM) | |
666 #endif | |
667 ) /* TTY over AMR is currently not supported by DSP, except Locosto Chipset 15*/ | |
668 { | |
669 codec_val[index] = M_CC_SPEECH_VERS_AMR_HR; | |
670 index++; | |
671 } | |
672 | |
673 break; | |
674 case M_CC_SPEECH_VERS_AMR_FR: /* Full rate speech version 3 - AMR */ | |
675 if ((FldGet (cc_data->mscap.chnMode, AFS) NEQ 0) | |
676 #if (CHIPSET != 15) | |
677 AND !(bcpara->bearer_serv EQ MNCC_BEARER_SERV_SPEECH_CTM OR | |
678 bcpara->bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH_CTM) | |
679 #endif | |
680 ) /* TTY over AMR is currently not supported by the DSP, except Locosto Chipset 15*/ | |
681 { | |
682 codec_val[index] = M_CC_SPEECH_VERS_AMR_FR; | |
683 index++; | |
684 } | |
685 break; | |
686 } /* switch (codec_prio[prio])*/ | |
687 } /* for */ | |
688 | |
689 if (bcpara->bearer_serv EQ MNCC_BEARER_SERV_SPEECH_CTM OR | |
690 bcpara->bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH_CTM) | |
691 { | |
692 bearer_cap->v_ctm = TRUE; | |
693 bearer_cap->ctm = M_CC_CTM_YES; | |
694 bearer_cap->v_coding_bc3x1 = TRUE; | |
695 bearer_cap->coding_bc3x1 = M_CC_CODING_BC3X_SPEECH; | |
696 bearer_cap->v_speech_vers1 = TRUE; | |
697 | |
698 if (codec_val[0] NEQ NOT_PRESENT_8BIT) | |
699 { | |
700 bearer_cap->speech_vers1 = codec_val[0]; | |
701 } | |
702 else switch (bearer_cap->rad_chan_req) | |
703 { | |
704 case M_CC_RCR_HALF_PREF: | |
705 bearer_cap->speech_vers1 = M_CC_SPEECH_VERS_HR; | |
706 break; | |
707 case M_CC_RCR_FULL_PREF: | |
708 default: | |
709 bearer_cap->speech_vers1 = M_CC_SPEECH_VERS_FR; | |
710 break; | |
711 } | |
712 } | |
713 else if (codec_val[0] NEQ NOT_PRESENT_8BIT) | |
714 { | |
715 bearer_cap->v_ctm = TRUE; | |
716 bearer_cap->ctm = M_CC_CTM_NO; | |
717 bearer_cap->v_coding_bc3x1 = TRUE; | |
718 bearer_cap->coding_bc3x1 = M_CC_CODING_BC3X_SPEECH; | |
719 bearer_cap->v_speech_vers1 = TRUE; | |
720 bearer_cap->speech_vers1 = codec_val[0]; | |
721 } | |
722 if (codec_val[1] NEQ NOT_PRESENT_8BIT) | |
723 { | |
724 bearer_cap->v_speech_vers2 = TRUE; | |
725 bearer_cap->speech_vers2 = codec_val[1]; | |
726 bearer_cap->v_coding_bc3x2 = TRUE; | |
727 bearer_cap->coding_bc3x2 = M_CC_CODING_BC3X_SPEECH; | |
728 } | |
729 if (codec_val[2] NEQ NOT_PRESENT_8BIT) | |
730 { | |
731 bearer_cap->v_speech_vers3 = TRUE; | |
732 bearer_cap->speech_vers3 = codec_val[2]; | |
733 bearer_cap->v_coding_bc3x3 = TRUE; | |
734 bearer_cap->coding_bc3x3 = M_CC_CODING_BC3X_SPEECH; | |
735 } | |
736 if (codec_val[3] NEQ NOT_PRESENT_8BIT) | |
737 { | |
738 bearer_cap->v_speech_vers4 = TRUE; | |
739 bearer_cap->speech_vers4 = codec_val[3]; | |
740 bearer_cap->v_coding_bc3x4 = TRUE; | |
741 bearer_cap->coding_bc3x4 = M_CC_CODING_BC3X_SPEECH; | |
742 } | |
743 if (codec_val[4] NEQ NOT_PRESENT_8BIT) | |
744 { | |
745 bearer_cap->v_speech_vers5 = TRUE; | |
746 bearer_cap->speech_vers5 = codec_val[4]; | |
747 bearer_cap->v_coding_bc3x5 = TRUE; | |
748 bearer_cap->coding_bc3x5 = M_CC_CODING_BC3X_SPEECH; | |
749 } | |
750 break; | |
751 default: | |
752 bearer_cap->v_rad_chan_req = TRUE; | |
753 bearer_cap->v_code = TRUE; | |
754 bearer_cap->code = M_CC_CSTD_GSM; | |
755 bearer_cap->v_trans_mode = TRUE; | |
756 bearer_cap->trans_mode = M_CC_TM_CIRCUIT; | |
757 | |
758 if (FldGet (cc_data->mscap.datCap2, DHRSup) AND | |
759 bcpara->bearer_serv NEQ MNCC_BEARER_SERV_FAX) /* TA 29.2.3.7 */ | |
760 /* Halfrate support */ | |
761 bearer_cap->rad_chan_req = M_CC_RCR_FULL_PREF; | |
762 else | |
763 bearer_cap->rad_chan_req = M_CC_RCR_FULL_ONLY; | |
764 break; | |
765 } | |
766 } | |
767 | |
768 | |
769 /* | |
770 +--------------------------------------------------------------------+ | |
771 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
772 | STATE : code ROUTINE : cc_set_trans_cap | | |
773 +--------------------------------------------------------------------+ | |
774 | |
775 PURPOSE : Set bearer capability parameters for data. | |
776 | |
777 */ | |
778 | |
779 GLOBAL void cc_set_trans_cap (T_M_CC_bearer_cap * bearer_cap, | |
780 const T_MNCC_bcpara * bcpara) | |
781 { | |
782 TRACE_FUNCTION ("cc_set_trans_cap()"); | |
783 | |
784 bearer_cap->v_trans_cap = TRUE; | |
785 | |
786 switch (bcpara->bearer_serv) | |
787 { | |
788 case MNCC_BEARER_SERV_SPEECH: | |
789 case MNCC_BEARER_SERV_SPEECH_CTM: | |
790 bearer_cap->trans_cap = M_CC_ITC_SPEECH; | |
791 break; | |
792 | |
793 case MNCC_BEARER_SERV_AUX_SPEECH: | |
794 case MNCC_BEARER_SERV_AUX_SPEECH_CTM: | |
795 /* | |
796 * Alternate Line Service | |
797 */ | |
798 bearer_cap->trans_cap = M_CC_ITC_AUXILIARY_SPEECH; | |
799 break; | |
800 | |
801 case MNCC_BEARER_SERV_FAX: | |
802 bearer_cap->trans_cap = M_CC_ITC_FAX_GROUP_3; | |
803 bearer_cap->rate_adapt = M_CC_RA_NONE; | |
804 bearer_cap->v_rate_adapt = TRUE; | |
805 break; | |
806 | |
807 case MNCC_BEARER_SERV_ASYNC: | |
808 case MNCC_BEARER_SERV_SYNC: | |
809 case MNCC_BEARER_SERV_PAD_ACCESS: | |
810 case MNCC_BEARER_SERV_PACKET_ACCESS: | |
811 #ifdef REL99 | |
812 /* MT - Modem type digital */ | |
813 if (bcpara->modem_type EQ M_CC_MT_NONE) | |
814 { | |
815 /* ITC - Information Transfer Capability */ | |
816 if (bcpara->transfer_cap == MNCC_ITC_UDI) | |
817 { | |
818 bearer_cap->trans_cap = M_CC_ITC_DIGITAL_UNRESTRICTED; | |
819 } | |
820 else if (bcpara->transfer_cap == MNCC_ITC_RDI) | |
821 { | |
822 bearer_cap->trans_cap = M_CC_ITC_OTHER; | |
823 bearer_cap->other_itc = M_CC_ITC_DIGITAL_RESTRICTED; | |
824 bearer_cap->v_other_itc = TRUE; | |
825 } | |
826 /* RA - Rate adaption */ | |
827 if (bcpara->rate_adaption == MNCC_RATE_ADAPT_V110) | |
828 { | |
829 bearer_cap->rate_adapt = M_CC_RA_V110; | |
830 } | |
831 else if (bcpara->rate_adaption == MNCC_RATE_ADAPT_V120) | |
832 { | |
833 bearer_cap->rate_adapt = M_CC_RA_OTHER; | |
834 bearer_cap->other_ra = M_CC_RA_V120; | |
835 bearer_cap->v_other_itc = TRUE; /* set for CCD encoding of Octet 5a */ | |
836 bearer_cap->v_other_ra = TRUE; | |
837 } | |
838 } | |
839 /* MT - Modem type audio */ | |
840 else | |
841 { | |
842 bearer_cap->trans_cap = M_CC_ITC_AUDIO; | |
843 if (bcpara->rate_adaption == MNCC_RATE_ADAPT_H223_H245) | |
844 { | |
845 bearer_cap->rate_adapt = M_CC_RA_OTHER; | |
846 bearer_cap->v_other_itc = TRUE; /* set for CCD encoding of Octet 5a */ | |
847 bearer_cap->v_other_ra = TRUE; | |
848 bearer_cap->other_ra = M_CC_RA_H223_H245; | |
849 } | |
850 else | |
851 { | |
852 bearer_cap->rate_adapt = M_CC_RA_NONE; | |
853 } | |
854 } | |
855 bearer_cap->v_rate_adapt = TRUE; | |
856 break; | |
857 #else | |
858 if (bcpara->modem_type EQ M_CC_MT_NONE) | |
859 { | |
860 bearer_cap->trans_cap = M_CC_ITC_DIGITAL_UNRESTRICTED; | |
861 bearer_cap->rate_adapt = M_CC_RA_V110; | |
862 } | |
863 else | |
864 { | |
865 bearer_cap->trans_cap = M_CC_ITC_AUDIO; | |
866 bearer_cap->rate_adapt = M_CC_RA_NONE; | |
867 } | |
868 bearer_cap->v_rate_adapt = TRUE; | |
869 break; | |
870 #endif | |
871 | |
872 } | |
873 } | |
874 | |
875 | |
876 /* | |
877 +--------------------------------------------------------------------+ | |
878 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
879 | STATE : code ROUTINE : cc_set_conn_elem | | |
880 +--------------------------------------------------------------------+ | |
881 | |
882 PURPOSE : Set bearer capability parameters according to connection | |
883 element. | |
884 | |
885 */ | |
886 | |
887 GLOBAL void cc_set_conn_elem (T_M_CC_bearer_cap * bearer_cap, | |
888 UBYTE conn_elem, | |
889 UBYTE flow_control) | |
890 { | |
891 TRACE_FUNCTION ("cc_set_conn_elem()"); | |
892 | |
893 bearer_cap->v_structure = TRUE; | |
894 bearer_cap->v_conn_elem = TRUE; | |
895 switch (conn_elem) | |
896 { | |
897 case MNCC_CONN_ELEM_TRANS: | |
898 bearer_cap->conn_elem = M_CC_CE_TRANSPA; | |
899 bearer_cap->structure = M_CC_STRC_UNSTRUCTURED; | |
900 flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
901 break; | |
902 case MNCC_CONN_ELEM_NON_TRANS: | |
903 bearer_cap->conn_elem = M_CC_CE_RLP; | |
904 bearer_cap->structure = M_CC_STRC_SERV_DATA_INTEG; | |
905 flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
906 break; | |
907 case MNCC_CONN_ELEM_TRANS_PREF: | |
908 bearer_cap->conn_elem = M_CC_CE_TRANSPA_PREF; | |
909 bearer_cap->structure = M_CC_STRC_SERV_DATA_INTEG; | |
910 flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
911 break; | |
912 case MNCC_CONN_ELEM_NON_TRANS_PREF: | |
913 bearer_cap->conn_elem = M_CC_CE_RLP_PREF; | |
914 bearer_cap->structure = M_CC_STRC_SERV_DATA_INTEG; | |
915 flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
916 break; | |
917 default: | |
918 break; | |
919 } | |
920 switch (flow_control) | |
921 { | |
922 case MNCC_INBAND_FLOW_CONTROL: | |
923 case MNCC_NO_FLOW_CONTROL: | |
924 bearer_cap->v_l2_ident = TRUE; | |
925 bearer_cap->l2_ident = M_CC_L2_OCT_ID; | |
926 bearer_cap->v_user_inf_l2_prot = TRUE; | |
927 bearer_cap->user_inf_l2_prot = flow_control; | |
928 break; | |
929 default: | |
930 break; | |
931 } | |
932 } | |
933 | |
934 /* | |
935 +--------------------------------------------------------------------+ | |
936 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
937 | STATE : code ROUTINE : cc_set_sync_async | | |
938 +--------------------------------------------------------------------+ | |
939 | |
940 PURPOSE : Set bearer capability parameters according to synchronous | |
941 flag. | |
942 | |
943 */ | |
944 | |
945 GLOBAL void cc_set_sync_async (T_M_CC_bearer_cap * bearer_cap, | |
946 const T_MNCC_bcpara * bc_para) | |
947 { | |
948 TRACE_FUNCTION ("cc_set_sync_async()"); | |
949 | |
950 bearer_cap->v_sync_async = TRUE; | |
951 bearer_cap->v_num_stop = TRUE; | |
952 bearer_cap->v_num_data = TRUE; | |
953 bearer_cap->v_parity = TRUE; | |
954 | |
955 switch (bc_para->bearer_serv) | |
956 { | |
957 case MNCC_BEARER_SERV_SYNC: | |
958 case MNCC_BEARER_SERV_PACKET_ACCESS: | |
959 case MNCC_BEARER_SERV_FAX: | |
960 bearer_cap->sync_async = 0; | |
961 bearer_cap->num_stop = M_CC_NSTOP_1; | |
962 bearer_cap->num_data = M_CC_NDATA_8; | |
963 bearer_cap->parity = bc_para->parity; | |
964 break; | |
965 default: | |
966 bearer_cap->sync_async = 1; | |
967 bearer_cap->num_stop = bc_para->stop_bits; | |
968 bearer_cap->num_data = bc_para->data_bits; | |
969 bearer_cap->parity = bc_para->parity; | |
970 break; | |
971 } | |
972 } | |
973 | |
974 /* | |
975 +--------------------------------------------------------------------+ | |
976 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
977 | STATE : code ROUTINE : cc_set_user_rate | | |
978 +--------------------------------------------------------------------+ | |
979 | |
980 PURPOSE : Set bearer capability parameters according to user rate. | |
981 | |
982 */ | |
983 | |
984 | |
985 GLOBAL void cc_set_user_rate (T_M_CC_bearer_cap * bearer_cap, | |
986 UBYTE rate, | |
987 UBYTE modem_type) | |
988 { | |
989 GET_INSTANCE_DATA; | |
990 TRACE_FUNCTION ("cc_set_user_rate()"); | |
991 | |
992 bearer_cap->v_user_rate = TRUE; | |
993 bearer_cap->v_nirr = TRUE; | |
994 bearer_cap->nirr = M_CC_NIRR_NO_MEANING; | |
995 | |
996 bearer_cap->v_intermed_rate = TRUE; | |
997 bearer_cap->v_modem_type = TRUE; | |
998 | |
999 switch( modem_type ) | |
1000 { | |
1001 case MNCC_MT_V32_BIS: | |
1002 bearer_cap->modem_type = M_CC_MT_V32; | |
1003 bearer_cap->v_modem_type_2 = TRUE; | |
1004 bearer_cap->modem_type_2 = M_CC_OTHER_MODEM_TYPE_V32BIS; | |
1005 break; | |
1006 | |
1007 case MNCC_MT_V34: | |
1008 bearer_cap->modem_type = M_CC_MT_V32; | |
1009 bearer_cap->v_modem_type_2 = TRUE; | |
1010 bearer_cap->modem_type_2 = M_CC_OTHER_MODEM_TYPE_V34; | |
1011 break; | |
1012 | |
1013 default: | |
1014 bearer_cap->modem_type = modem_type; | |
1015 if( rate EQ MNCC_UR_14_4_KBIT ) | |
1016 { | |
1017 bearer_cap->v_modem_type_2 = TRUE; | |
1018 bearer_cap->modem_type_2 = M_CC_OTHER_MODEM_TYPE_NONE; | |
1019 } | |
1020 } | |
1021 | |
1022 switch (rate) | |
1023 { | |
1024 case MNCC_UR_0_3_KBIT: | |
1025 case MNCC_UR_1_2_KBIT: | |
1026 case MNCC_UR_2_4_KBIT: | |
1027 case MNCC_UR_4_8_KBIT: | |
1028 case MNCC_UR_1_2_KBIT_V23: | |
1029 bearer_cap->user_rate = rate; | |
1030 if (bearer_cap->conn_elem EQ M_CC_CE_RLP) | |
1031 bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
1032 else | |
1033 bearer_cap->intermed_rate = M_CC_IR_8_KBIT; | |
1034 | |
1035 /* | |
1036 * PZ removed because R&S does not support 6 kbit channels | |
1037 if (bearer_cap->conn_elem EQ M_CC_CE_RLP AND | |
1038 bearer_cap->rad_chan_req EQ RCR_FULL_ONLY) | |
1039 bearer_cap->nirr = M_CC_NIRR_DATA; | |
1040 */ | |
1041 break; | |
1042 case MNCC_UR_14_4_KBIT: | |
1043 bearer_cap->user_rate = MNCC_UR_9_6_KBIT; | |
1044 bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
1045 bearer_cap->v_fnur = TRUE; | |
1046 bearer_cap->fnur = M_CC_FNUR_14400; | |
1047 bearer_cap->v_mTch = TRUE; | |
1048 bearer_cap->mTch = M_CC_MAX_TCH_1; | |
1049 | |
1050 /* | |
1051 * These parameters are only used for NT data. | |
1052 * Otherwise they are optional (i.e. omitted). | |
1053 */ | |
1054 if (bearer_cap->conn_elem == M_CC_CE_RLP) | |
1055 { | |
1056 bearer_cap->v_uimi = TRUE; | |
1057 bearer_cap->uimi = M_CC_UIMI_NOT_ALLOWED; | |
1058 bearer_cap->v_waiur = TRUE; | |
1059 bearer_cap->waiur = M_CC_WAIUR_14400; | |
1060 } | |
1061 | |
1062 bearer_cap->v_acc = TRUE; | |
1063 bearer_cap->acc = M_CC_ACC_96; | |
1064 | |
1065 if (FldGet (cc_data->mscap.datCap2, DHRSup)) | |
1066 bearer_cap->acc += M_CC_ACC_48; | |
1067 if (FldGet (cc_data->mscap.datCap1, Dr14_4Sup)) | |
1068 bearer_cap->acc += M_CC_ACC_144; | |
1069 break; | |
1070 default: | |
1071 bearer_cap->user_rate = rate; | |
1072 bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
1073 break; | |
1074 } | |
1075 } | |
1076 | |
1077 /* | |
1078 +--------------------------------------------------------------------+ | |
1079 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1080 | STATE : code ROUTINE : cc_build_call_confirm | | |
1081 +--------------------------------------------------------------------+ | |
1082 | |
1083 PURPOSE : Filling of the C-Structure for call confirm message. | |
1084 | |
1085 */ | |
1086 | |
1087 GLOBAL void cc_build_call_confirm ( T_U_CALL_CONF * call_cnf, | |
1088 USHORT cause) | |
1089 { | |
1090 GET_INSTANCE_DATA; | |
1091 TRACE_FUNCTION ("cc_build_call_confirm()"); | |
1092 | |
1093 call_cnf->msg_type = U_CALL_CONF; | |
1094 | |
1095 if (cc_data->negotiation) | |
1096 { | |
1097 if (cc_data->neg_ri EQ NOT_PRESENT_8BIT) | |
1098 call_cnf->v_repeat = FALSE; | |
1099 else | |
1100 { | |
1101 call_cnf->v_repeat = TRUE; | |
1102 call_cnf->repeat = cc_data->neg_ri; | |
1103 } | |
1104 | |
1105 if (cc_data->neg_serv1 EQ NOT_PRESENT_8BIT) | |
1106 call_cnf->v_bearer_cap = FALSE; | |
1107 else | |
1108 { | |
1109 call_cnf->v_bearer_cap = TRUE; | |
1110 call_cnf->bearer_cap = cc_data->neg_bc1; | |
1111 } | |
1112 | |
1113 if (cc_data->neg_serv2 EQ NOT_PRESENT_8BIT) | |
1114 call_cnf->v_bearer_cap_2 = FALSE; | |
1115 else | |
1116 { | |
1117 call_cnf->v_bearer_cap_2 = TRUE; | |
1118 memcpy (&call_cnf->bearer_cap_2, &cc_data->neg_bc2, | |
1119 sizeof (T_M_CC_bearer_cap)); | |
1120 } | |
1121 } | |
1122 else | |
1123 { | |
1124 call_cnf->v_repeat = FALSE; | |
1125 call_cnf->v_bearer_cap = FALSE; | |
1126 call_cnf->v_bearer_cap_2 = FALSE; | |
1127 } | |
1128 if (IS_CAUSE_INVALID(cause)) | |
1129 call_cnf->v_cc_cause = FALSE; | |
1130 else | |
1131 { | |
1132 call_cnf->v_cc_cause = TRUE; | |
1133 cc_encode_cause (&call_cnf->cc_cause, cause); | |
1134 } | |
1135 | |
1136 /* | |
1137 * GSM 24.008 has no clear advice when to include the CC capabilities, | |
1138 * neither in clause 5.2.2.3 nor in clause 9.3.2, but it is assumed that | |
1139 * it has to be included if at least one capability is present. | |
1140 * This means, with R99 and above always. | |
1141 */ | |
1142 call_cnf->v_call_ctrl_cap = (cc_data->call_ctrl_cap.dtmf NEQ 0) OR | |
1143 (cc_data->call_ctrl_cap.pcp NEQ 0); | |
1144 if (call_cnf->v_call_ctrl_cap) | |
1145 { | |
1146 call_cnf->call_ctrl_cap = cc_data->call_ctrl_cap; /* Struct copy */ | |
1147 } | |
1148 } | |
1149 | |
1150 | |
1151 /* | |
1152 +--------------------------------------------------------------------+ | |
1153 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1154 | STATE : code ROUTINE : cc_build_cc_est_confirm | | |
1155 +--------------------------------------------------------------------+ | |
1156 | |
1157 PURPOSE : Filling of the C-Structure for CC EST. CONFIRMED message. | |
1158 | |
1159 */ | |
1160 | |
1161 GLOBAL void cc_build_cc_est_confirm (T_U_CC_EST_CONF * cc_est_conf, | |
1162 USHORT cause) | |
1163 { | |
1164 GET_INSTANCE_DATA; | |
1165 TRACE_FUNCTION ("cc_build_cc_est_confirm()"); | |
1166 | |
1167 cc_est_conf->msg_type = U_CC_EST_CONF; | |
1168 if (cc_data->neg_ri EQ NOT_PRESENT_8BIT) | |
1169 cc_est_conf->v_repeat = FALSE; | |
1170 else | |
1171 { | |
1172 cc_est_conf->v_repeat = TRUE; | |
1173 cc_est_conf->repeat = cc_data->neg_ri; | |
1174 } | |
1175 | |
1176 cc_est_conf->v_bearer_cap = TRUE; | |
1177 cc_est_conf->bearer_cap = cc_data->neg_bc1; | |
1178 | |
1179 if (cc_data->neg_serv2 EQ NOT_PRESENT_8BIT) | |
1180 cc_est_conf->v_bearer_cap_2 = FALSE; | |
1181 else | |
1182 { | |
1183 cc_est_conf->v_bearer_cap_2 = TRUE; | |
1184 memcpy (&cc_est_conf->bearer_cap_2, &cc_data->neg_bc2, | |
1185 sizeof (T_M_CC_bearer_cap)); | |
1186 } | |
1187 | |
1188 if (IS_CAUSE_INVALID(cause)) | |
1189 cc_est_conf->v_cc_cause = FALSE; | |
1190 else | |
1191 { | |
1192 cc_est_conf->v_cc_cause = TRUE; | |
1193 cc_encode_cause (&cc_est_conf->cc_cause, cause); | |
1194 } | |
1195 } | |
1196 | |
1197 | |
1198 /* | |
1199 +--------------------------------------------------------------------+ | |
1200 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1201 | STATE : code ROUTINE : cc_build_congestion_control| | |
1202 +--------------------------------------------------------------------+ | |
1203 | |
1204 PURPOSE : Filling of the C-Structure for congestion control message. | |
1205 | |
1206 */ | |
1207 | |
1208 GLOBAL void cc_build_congestion_control (const T_MNCC_USER_REQ * user, | |
1209 T_B_CONGEST_CTRL * cong_ctrl) | |
1210 { | |
1211 TRACE_FUNCTION ("cc_build_congestion_control()"); | |
1212 | |
1213 cong_ctrl->msg_type = B_CONGEST_CTRL; | |
1214 cong_ctrl->congest_lev = user->congest_lev; | |
1215 cong_ctrl->v_cc_cause = FALSE; | |
1216 } | |
1217 | |
1218 /* | |
1219 +--------------------------------------------------------------------+ | |
1220 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1221 | STATE : code ROUTINE : cc_build_disconnect | | |
1222 +--------------------------------------------------------------------+ | |
1223 | |
1224 PURPOSE : Filling of the C-Structure for disconnect message. | |
1225 | |
1226 */ | |
1227 GLOBAL void cc_build_disconnect (T_U_DISCONNECT * disconnect, | |
1228 USHORT cause, | |
1229 const T_NAS_fac_inf * fac_inf, | |
1230 UBYTE ss_ver) | |
1231 { | |
1232 | |
1233 TRACE_FUNCTION ("cc_build_disconnect()"); | |
1234 | |
1235 disconnect->msg_type = U_DISCONNECT; | |
1236 cc_encode_cause (&disconnect->cc_cause, cause); | |
1237 | |
1238 disconnect->v_facility = FALSE; | |
1239 disconnect->v_user_user = FALSE; | |
1240 disconnect->v_ss_version = FALSE; | |
1241 | |
1242 if ((fac_inf NEQ NULL) AND (fac_inf->l_fac NEQ 0)) | |
1243 { | |
1244 /* Send facility IE */ | |
1245 disconnect->v_facility = TRUE; | |
1246 disconnect->facility.c_fac = fac_inf->l_fac >> 3; | |
1247 memcpy (disconnect->facility.fac, | |
1248 &fac_inf->fac[fac_inf->o_fac >> 3], | |
1249 disconnect->facility.c_fac); | |
1250 | |
1251 if (ss_ver NEQ MNCC_SS_VER_NOT_PRES) | |
1252 { | |
1253 disconnect->v_ss_version = TRUE; | |
1254 disconnect->ss_version.c_ver = 1; | |
1255 disconnect->ss_version.ver[0] = ss_ver; | |
1256 } | |
1257 } | |
1258 | |
1259 /* no security check for validity of cause; cause is mandatory in DISCONNECT */ | |
1260 cc_encode_cause (&disconnect->cc_cause, cause); | |
1261 } | |
1262 | |
1263 /* | |
1264 +--------------------------------------------------------------------+ | |
1265 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1266 | STATE : code ROUTINE : cc_build_emergency_setup | | |
1267 +--------------------------------------------------------------------+ | |
1268 | |
1269 PURPOSE : Filling of the C-Structure for emergency setup message. | |
1270 | |
1271 */ | |
1272 | |
1273 GLOBAL void cc_build_emergency_setup (T_U_EMERGE_SETUP * emergency_setup) | |
1274 { | |
1275 GET_INSTANCE_DATA; | |
1276 TRACE_FUNCTION ("cc_build_emergency_setup()"); | |
1277 | |
1278 emergency_setup->msg_type = U_EMERGE_SETUP; | |
1279 /*emergency_setup->v_bearer_cap = FALSE;*/ | |
1280 emergency_setup->v_bearer_cap = TRUE; | |
1281 emergency_setup->bearer_cap = cc_data->bc1; | |
1282 } | |
1283 | |
1284 /* | |
1285 +--------------------------------------------------------------------+ | |
1286 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1287 | STATE : code ROUTINE : cc_build_facility | | |
1288 +--------------------------------------------------------------------+ | |
1289 | |
1290 PURPOSE : Filling of the C-Structure for facility message. | |
1291 | |
1292 */ | |
1293 | |
1294 GLOBAL void cc_build_facility (const T_MNCC_FACILITY_REQ * facility, | |
1295 T_U_FACILITY * facility_msg) | |
1296 { | |
1297 UBYTE length; | |
1298 | |
1299 TRACE_FUNCTION ("cc_build_facility()"); | |
1300 | |
1301 length = facility->fac_inf.l_fac>>3; | |
1302 | |
1303 if (length > 251) | |
1304 return; | |
1305 | |
1306 facility_msg->msg_type = U_FACILITY; | |
1307 facility_msg->facility.c_fac = length; | |
1308 memcpy (facility_msg->facility.fac, | |
1309 &facility->fac_inf.fac[facility->fac_inf.o_fac>>3], length); | |
1310 | |
1311 if (facility->ss_version EQ NOT_PRESENT_8BIT) | |
1312 facility_msg->v_ss_version = FALSE; | |
1313 else | |
1314 { | |
1315 facility_msg->v_ss_version = TRUE; | |
1316 facility_msg->ss_version.c_ver = 1; | |
1317 facility_msg->ss_version.ver[0] = facility->ss_version; | |
1318 } | |
1319 } | |
1320 | |
1321 | |
1322 /* | |
1323 +--------------------------------------------------------------------+ | |
1324 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1325 | STATE : code ROUTINE : cc_build_mncc_alert_ind | | |
1326 +--------------------------------------------------------------------+ | |
1327 | |
1328 PURPOSE : Filling of the C-Structure for MNCC_ALERT_IND. | |
1329 | |
1330 */ | |
1331 | |
1332 GLOBAL void cc_build_mncc_alert_ind ( const T_D_ALERT * alert, | |
1333 T_MNCC_ALERT_IND * alert_ind) | |
1334 { | |
1335 GET_INSTANCE_DATA; | |
1336 TRACE_FUNCTION ("cc_build_mncc_alert_ind()"); | |
1337 | |
1338 alert_ind->ti = cc_data->ti; | |
1339 | |
1340 if (alert->v_progress) | |
1341 { | |
1342 alert_ind->progress_desc = alert->progress.progress_desc; | |
1343 } | |
1344 else | |
1345 { | |
1346 alert_ind->progress_desc = NOT_PRESENT_8BIT; | |
1347 } | |
1348 } | |
1349 | |
1350 /* | |
1351 +--------------------------------------------------------------------+ | |
1352 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1353 | STATE : code ROUTINE : cc_build_mncc_proceed_ind | | |
1354 +--------------------------------------------------------------------+ | |
1355 | |
1356 PURPOSE : Filling of the C-Structure for MNCC_CALL_PROCEED_IND. | |
1357 | |
1358 */ | |
1359 | |
1360 GLOBAL void cc_build_mncc_proceed_ind (const T_D_CALL_PROCEED * proceed, | |
1361 T_MNCC_CALL_PROCEED_IND * proceed_ind) | |
1362 { | |
1363 GET_INSTANCE_DATA; | |
1364 TRACE_FUNCTION ("cc_build_mncc_proceed_ind()"); | |
1365 | |
1366 proceed_ind->ti = cc_data->ti; | |
1367 proceed_ind->ri = cc_data->neg_ri; | |
1368 memcpy (&proceed_ind->bcpara, &cc_data->neg_bcpara1, sizeof (T_MNCC_bcpara)); | |
1369 memcpy (&proceed_ind->bcpara2, &cc_data->neg_bcpara2, sizeof (T_MNCC_bcpara)); | |
1370 | |
1371 #if defined (WIN32) | |
1372 TRACE_EVENT_P1 ("Rate = %d", cc_data->neg_bcpara1.rate); | |
1373 TRACE_EVENT_P1 ("Bearer Serv = %d", cc_data->neg_bcpara1.bearer_serv); | |
1374 TRACE_EVENT_P1 ("Conn Elem = %d", cc_data->neg_bcpara1.conn_elem); | |
1375 TRACE_EVENT_P1 ("Stop Bits = %d", cc_data->neg_bcpara1.stop_bits); | |
1376 TRACE_EVENT_P1 ("Data Bits = %d", cc_data->neg_bcpara1.data_bits); | |
1377 TRACE_EVENT_P1 ("Parity = %d", cc_data->neg_bcpara1.parity); | |
1378 TRACE_EVENT_P1 ("Flow Control = %d", cc_data->neg_bcpara1.flow_control); | |
1379 #endif | |
1380 | |
1381 if (proceed->v_progress) | |
1382 { | |
1383 proceed_ind->progress_desc = proceed->progress.progress_desc; | |
1384 } | |
1385 else | |
1386 { | |
1387 proceed_ind->progress_desc = NOT_PRESENT_8BIT; | |
1388 } | |
1389 } | |
1390 | |
1391 | |
1392 /* | |
1393 +--------------------------------------------------------------------+ | |
1394 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1395 | STATE : code ROUTINE : cc_build_mncc_progress_ind | | |
1396 +--------------------------------------------------------------------+ | |
1397 | |
1398 PURPOSE : Filling of the C-Structure for MNCC_PROGRESS_IND. | |
1399 | |
1400 */ | |
1401 | |
1402 GLOBAL void cc_build_mncc_progress_ind (const T_D_PROGRESS * progress, | |
1403 T_MNCC_PROGRESS_IND * progress_ind) | |
1404 { | |
1405 GET_INSTANCE_DATA; | |
1406 TRACE_FUNCTION ("cc_build_mncc_progress_ind()"); | |
1407 | |
1408 progress_ind->ti = cc_data->ti; | |
1409 progress_ind->progress_desc = progress->progress.progress_desc; | |
1410 } | |
1411 | |
1412 /* | |
1413 +--------------------------------------------------------------------+ | |
1414 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1415 | STATE : code ROUTINE : cc_build_mncc_setup_cnf | | |
1416 +--------------------------------------------------------------------+ | |
1417 | |
1418 PURPOSE : Filling of the C-Structure for MNCC_SETUP_CNF. | |
1419 | |
1420 */ | |
1421 | |
1422 GLOBAL void cc_build_mncc_setup_cnf (const T_D_CONNECT * connect, | |
1423 T_MNCC_SETUP_CNF * setup_cnf) | |
1424 { | |
1425 GET_INSTANCE_DATA; | |
1426 TRACE_FUNCTION ("cc_build_mncc_setup_cnf()"); | |
1427 | |
1428 setup_cnf->ti = cc_data->ti; | |
1429 setup_cnf->cause = MNCC_CAUSE_SUCCESS; | |
1430 | |
1431 if (connect->v_progress) | |
1432 { | |
1433 setup_cnf->progress_desc = connect->progress.progress_desc; | |
1434 } | |
1435 else | |
1436 { | |
1437 setup_cnf->progress_desc = NOT_PRESENT_8BIT; | |
1438 } | |
1439 /* Implements Measure# 15 */ | |
1440 cc_fill_struct (connect->v_connect_num, | |
1441 &setup_cnf->connected_number, | |
1442 (T_M_CC_calling_num*)&connect->connect_num); | |
1443 /* Implements Measure# 24 */ | |
1444 cc_fill_sub_struct (connect->v_connect_subaddr, | |
1445 &setup_cnf->connected_number_sub, | |
1446 &connect->connect_subaddr); | |
1447 } | |
1448 | |
1449 /* | |
1450 +--------------------------------------------------------------------+ | |
1451 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1452 | STATE : code ROUTINE : cc_build_mncc_setup_ind | | |
1453 +--------------------------------------------------------------------+ | |
1454 | |
1455 PURPOSE : Filling of the C-Structure for MNCC_SETUP_IND. | |
1456 | |
1457 */ | |
1458 | |
1459 GLOBAL void cc_build_mncc_setup_ind (const T_D_SETUP * setup, | |
1460 T_MNCC_SETUP_IND * setup_ind) | |
1461 { | |
1462 GET_INSTANCE_DATA; | |
1463 TRACE_FUNCTION ("cc_build_mncc_setup_ind()"); | |
1464 | |
1465 setup_ind->ti = cc_data->ti; | |
1466 | |
1467 setup_ind->ri = cc_data->neg_ri; | |
1468 memcpy (&setup_ind->bcpara, &cc_data->neg_bcpara1, sizeof (T_MNCC_bcpara)); | |
1469 memcpy (&setup_ind->bcpara2, &cc_data->neg_bcpara2, sizeof (T_MNCC_bcpara)); | |
1470 | |
1471 if (setup->v_progress) | |
1472 { | |
1473 setup_ind->progress_desc = setup->progress.progress_desc; | |
1474 } | |
1475 else | |
1476 { | |
1477 setup_ind->progress_desc = MNCC_PROG_NOT_PRES; | |
1478 } | |
1479 | |
1480 if (setup->v_signal) | |
1481 setup_ind->sig = setup->signal; | |
1482 else | |
1483 setup_ind->sig = MNCC_SIG_NOT_PRES; | |
1484 /* Implements Measure# 15 */ | |
1485 cc_fill_struct (setup->v_calling_num, | |
1486 &setup_ind->calling_party, | |
1487 &setup->calling_num); | |
1488 /* Implements Measure# 24 */ | |
1489 cc_fill_sub_struct (setup->v_calling_subaddr, | |
1490 &setup_ind->calling_party_sub, | |
1491 (T_M_CC_connect_subaddr*)&setup->calling_subaddr); | |
1492 if (setup->v_dl_called_num) | |
1493 { | |
1494 setup_ind->called_party.ton = setup->dl_called_num.ton; | |
1495 setup_ind->called_party.npi = setup->dl_called_num.npi; | |
1496 setup_ind->called_party.c_called_num = setup->dl_called_num.c_num; | |
1497 memcpy (setup_ind->called_party.called_num, | |
1498 setup->dl_called_num.num, setup->dl_called_num.c_num); | |
1499 } | |
1500 else | |
1501 { | |
1502 setup_ind->called_party.ton = MNCC_TON_NOT_PRES; | |
1503 setup_ind->called_party.npi = MNCC_NPI_NOT_PRES; | |
1504 setup_ind->called_party.c_called_num = 0; | |
1505 } | |
1506 /* Implements Measure# 25 */ | |
1507 cc_fill_sub_struct (setup->v_called_subaddr, | |
1508 &setup_ind->called_party_sub, | |
1509 (T_M_CC_connect_subaddr *)&setup->called_subaddr); | |
1510 if (setup->v_redirecting_num) | |
1511 { | |
1512 setup_ind->redirecting_party.ton = setup->redirecting_num.ton; | |
1513 setup_ind->redirecting_party.npi = setup->redirecting_num.npi; | |
1514 setup_ind->redirecting_party.c_redir_num = setup->redirecting_num.c_num; | |
1515 memcpy (setup_ind->redirecting_party.redir_num, | |
1516 setup->redirecting_num.num, | |
1517 setup->redirecting_num.c_num); | |
1518 if (setup->redirecting_num.v_screen) | |
1519 setup_ind->redirecting_party.screen = setup->redirecting_num.screen; | |
1520 else | |
1521 setup_ind->redirecting_party.screen = MNCC_SCREEN_IND_NOT_PRES; | |
1522 if (setup->redirecting_num.v_present) | |
1523 setup_ind->redirecting_party.present = setup->redirecting_num.present; | |
1524 else | |
1525 setup_ind->redirecting_party.present = MNCC_PRES_NOT_PRES; | |
1526 } | |
1527 else | |
1528 { | |
1529 setup_ind->redirecting_party.ton = MNCC_TON_NOT_PRES; | |
1530 setup_ind->redirecting_party.npi = MNCC_NPI_NOT_PRES; | |
1531 setup_ind->redirecting_party.present = MNCC_PRES_NOT_PRES; | |
1532 setup_ind->redirecting_party.screen = MNCC_SCREEN_IND_NOT_PRES; | |
1533 setup_ind->redirecting_party.c_redir_num = 0; | |
1534 } | |
1535 /* Implements Measure# 26 */ | |
1536 cc_fill_sub_struct (setup->v_redirecting_subaddr, | |
1537 &setup_ind->redirecting_party_sub, | |
1538 (T_M_CC_connect_subaddr *)&setup->redirecting_subaddr); | |
1539 } | |
1540 | |
1541 /* | |
1542 +--------------------------------------------------------------------+ | |
1543 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1544 | STATE : code ROUTINE : cc_build_modify | | |
1545 +--------------------------------------------------------------------+ | |
1546 | |
1547 PURPOSE : Filling of the C-Structure for modify message. | |
1548 | |
1549 */ | |
1550 | |
1551 GLOBAL void cc_build_modify (const T_MNCC_MODIFY_REQ * modify, | |
1552 T_B_MODIFY * modify_msg) | |
1553 { | |
1554 GET_INSTANCE_DATA; | |
1555 TRACE_FUNCTION ("cc_build_modify()"); | |
1556 | |
1557 modify_msg->msg_type = B_MODIFY; | |
1558 if (modify->serv EQ cc_data->neg_serv1) | |
1559 { | |
1560 modify_msg->bearer_cap = cc_data->neg_bc1; | |
1561 cc_data->new_itc = cc_data->neg_bc1.trans_cap; | |
1562 cc_data->old_itc = cc_data->neg_bc2.trans_cap; | |
1563 } | |
1564 else | |
1565 { | |
1566 modify_msg->bearer_cap = cc_data->neg_bc2; | |
1567 cc_data->new_itc = cc_data->neg_bc2.trans_cap; | |
1568 cc_data->old_itc = cc_data->neg_bc1.trans_cap; | |
1569 } | |
1570 | |
1571 if (modify_msg->bearer_cap.trans_cap EQ M_CC_ITC_DIGITAL_UNRESTRICTED) | |
1572 { | |
1573 cc_build_llc (&modify_msg->v_low_layer_comp, | |
1574 &modify_msg->low_layer_comp, | |
1575 &modify_msg->bearer_cap); | |
1576 } | |
1577 else | |
1578 modify_msg->v_low_layer_comp = FALSE; | |
1579 modify_msg->v_high_layer_comp = FALSE; | |
1580 | |
1581 if (cc_data->call_type [cc_data->index_ti] EQ CALL_TYPE_MTC) | |
1582 modify_msg->v_reverse_call = TRUE; | |
1583 else | |
1584 modify_msg->v_reverse_call = FALSE; | |
1585 } | |
1586 | |
1587 /* | |
1588 +--------------------------------------------------------------------+ | |
1589 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1590 | STATE : code ROUTINE : cc_build_modify_complete | | |
1591 +--------------------------------------------------------------------+ | |
1592 | |
1593 PURPOSE : Filling of the C-Structure for modify complete message. | |
1594 | |
1595 */ | |
1596 | |
1597 GLOBAL void cc_build_modify_complete (T_B_MODIFY_COMP * modify_com) | |
1598 { | |
1599 GET_INSTANCE_DATA; | |
1600 TRACE_FUNCTION ("cc_build_modify_complete()"); | |
1601 | |
1602 modify_com->msg_type = B_MODIFY_COMP; | |
1603 if (cc_data->active_service EQ cc_data->neg_serv1) | |
1604 modify_com->bearer_cap = cc_data->neg_bc1; | |
1605 else | |
1606 modify_com->bearer_cap = cc_data->neg_bc2; | |
1607 | |
1608 if (cc_data->call_type [cc_data->index_ti] EQ CALL_TYPE_MTC) | |
1609 { | |
1610 modify_com->v_reverse_call = TRUE; | |
1611 modify_com->v_low_layer_comp = FALSE; | |
1612 } | |
1613 else | |
1614 { | |
1615 modify_com->v_reverse_call = FALSE; | |
1616 if (modify_com->bearer_cap.trans_cap EQ M_CC_ITC_DIGITAL_UNRESTRICTED) | |
1617 { | |
1618 cc_build_llc (&modify_com->v_low_layer_comp, | |
1619 &modify_com->low_layer_comp, | |
1620 &modify_com->bearer_cap); | |
1621 } | |
1622 else | |
1623 modify_com->v_low_layer_comp = FALSE; | |
1624 } | |
1625 | |
1626 modify_com->v_high_layer_comp = FALSE; | |
1627 } | |
1628 | |
1629 /* | |
1630 +--------------------------------------------------------------------+ | |
1631 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1632 | STATE : code ROUTINE : cc_build_modify_reject | | |
1633 +--------------------------------------------------------------------+ | |
1634 | |
1635 PURPOSE : Filling of the C-Structure for modify reject message. | |
1636 | |
1637 */ | |
1638 | |
1639 GLOBAL void cc_build_modify_reject (T_B_MODIFY_REJ * modify_rej, | |
1640 USHORT cause) | |
1641 { | |
1642 GET_INSTANCE_DATA; | |
1643 TRACE_FUNCTION ("cc_build_modify_reject()"); | |
1644 | |
1645 modify_rej->msg_type = B_MODIFY_REJ; | |
1646 if (cc_data->active_service EQ cc_data->neg_serv1) | |
1647 modify_rej->bearer_cap = cc_data->neg_bc1; | |
1648 else | |
1649 modify_rej->bearer_cap = cc_data->neg_bc2; | |
1650 | |
1651 if (cc_data->call_type [cc_data->index_ti] EQ CALL_TYPE_MTC) | |
1652 { | |
1653 modify_rej->v_low_layer_comp = FALSE; | |
1654 } | |
1655 else | |
1656 { | |
1657 if (modify_rej->bearer_cap.trans_cap EQ M_CC_ITC_DIGITAL_UNRESTRICTED) | |
1658 { | |
1659 cc_build_llc (&modify_rej->v_low_layer_comp, | |
1660 &modify_rej->low_layer_comp, | |
1661 &modify_rej->bearer_cap); | |
1662 } | |
1663 else | |
1664 modify_rej->v_low_layer_comp = FALSE; | |
1665 } | |
1666 | |
1667 modify_rej->v_high_layer_comp = FALSE; | |
1668 | |
1669 /* no security check for validity of cause; cause is mandatory in MODIFY REJECT */ | |
1670 cc_encode_cause (&modify_rej->cc_cause, cause); | |
1671 } | |
1672 | |
1673 | |
1674 /* | |
1675 +--------------------------------------------------------------------+ | |
1676 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1677 | STATE : code ROUTINE : cc_build_release | | |
1678 +--------------------------------------------------------------------+ | |
1679 | |
1680 PURPOSE : Filling of the C-Structure for release message. | |
1681 | |
1682 */ | |
1683 GLOBAL void cc_build_release (T_U_RELEASE * release, | |
1684 USHORT cause, | |
1685 const T_NAS_fac_inf * fac_inf, | |
1686 UBYTE ss_ver) | |
1687 { | |
1688 | |
1689 TRACE_FUNCTION ("cc_build_release()"); | |
1690 | |
1691 release->msg_type = U_RELEASE; | |
1692 if (IS_CAUSE_INVALID(cause)) | |
1693 { | |
1694 release->v_cc_cause = FALSE; | |
1695 } | |
1696 else | |
1697 { | |
1698 release->v_cc_cause = TRUE; | |
1699 cc_encode_cause (&release->cc_cause, cause); | |
1700 } | |
1701 | |
1702 release->v_cc_cause_2 = FALSE; | |
1703 release->v_facility = FALSE; | |
1704 release->v_user_user = FALSE; | |
1705 release->v_ss_version = FALSE; | |
1706 | |
1707 if ((fac_inf NEQ NULL) AND (fac_inf->l_fac NEQ 0)) | |
1708 { | |
1709 /* Send facility IE */ | |
1710 release->v_facility = TRUE; | |
1711 release->facility.c_fac = fac_inf->l_fac >> 3; | |
1712 memcpy (release->facility.fac, | |
1713 &fac_inf->fac[fac_inf->o_fac >> 3], | |
1714 release->facility.c_fac); | |
1715 | |
1716 if (ss_ver NEQ MNCC_SS_VER_NOT_PRES) | |
1717 { | |
1718 release->v_ss_version = TRUE; | |
1719 release->ss_version.c_ver = 1; | |
1720 release->ss_version.ver[0] = ss_ver; | |
1721 } | |
1722 } | |
1723 } | |
1724 | |
1725 | |
1726 /* | |
1727 +--------------------------------------------------------------------+ | |
1728 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1729 | STATE : code ROUTINE : cc_build_release_complete | | |
1730 +--------------------------------------------------------------------+ | |
1731 | |
1732 PURPOSE : Filling of the C-Structure for release complete message. | |
1733 | |
1734 */ | |
1735 | |
1736 GLOBAL void cc_build_release_complete (T_U_RELEASE_COMP * rel_com, | |
1737 USHORT cause) | |
1738 { | |
1739 | |
1740 TRACE_FUNCTION ("cc_build_release_complete()"); | |
1741 | |
1742 rel_com->msg_type = U_RELEASE_COMP; | |
1743 if (IS_CAUSE_INVALID(cause)) | |
1744 { | |
1745 rel_com->v_cc_cause = FALSE; | |
1746 } | |
1747 else | |
1748 { | |
1749 rel_com->v_cc_cause = TRUE; | |
1750 cc_encode_cause (&rel_com->cc_cause, cause); | |
1751 } | |
1752 | |
1753 rel_com->v_facility = FALSE; | |
1754 rel_com->v_user_user = FALSE; | |
1755 rel_com->v_ss_version = FALSE; | |
1756 } | |
1757 | |
1758 /* | |
1759 +--------------------------------------------------------------------+ | |
1760 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1761 | STATE : code ROUTINE : cc_build_start_cc | | |
1762 +--------------------------------------------------------------------+ | |
1763 | |
1764 PURPOSE : Filling of the C-Structure for a START CC message. | |
1765 | |
1766 */ | |
1767 | |
1768 GLOBAL void cc_build_start_cc (T_U_START_CC * start_cc) | |
1769 { | |
1770 GET_INSTANCE_DATA; | |
1771 TRACE_FUNCTION ("cc_build_start_cc()"); | |
1772 | |
1773 start_cc->msg_type = U_START_CC; | |
1774 start_cc->v_call_ctrl_cap = (cc_data->call_ctrl_cap.dtmf NEQ 0) OR | |
1775 (cc_data->call_ctrl_cap.pcp NEQ 0); | |
1776 if (start_cc->v_call_ctrl_cap) | |
1777 { | |
1778 start_cc->call_ctrl_cap = cc_data->call_ctrl_cap; /* Struct copy */ | |
1779 } | |
1780 } | |
1781 | |
1782 | |
1783 /* | |
1784 +--------------------------------------------------------------------+ | |
1785 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1786 | STATE : code ROUTINE : cc_fill_llc_hlc | | |
1787 +--------------------------------------------------------------------+ | |
1788 | |
1789 PURPOSE : Filling of the C-Structure for LLC and HLC in the | |
1790 setup message. | |
1791 | |
1792 */ | |
1793 | |
1794 GLOBAL void cc_fill_llc_hlc (T_U_SETUP * setup) | |
1795 { | |
1796 | |
1797 TRACE_FUNCTION ("cc_fill_llc_hlc()"); | |
1798 | |
1799 /* | |
1800 * add lower layer capability if | |
1801 * at least one bearer cap indicates | |
1802 * information transfer capability = UDI | |
1803 */ | |
1804 if ((setup->v_bearer_cap AND | |
1805 setup->bearer_cap.trans_cap EQ M_CC_ITC_DIGITAL_UNRESTRICTED) OR | |
1806 (setup->v_bearer_cap_2 AND | |
1807 setup->bearer_cap_2.trans_cap EQ M_CC_ITC_DIGITAL_UNRESTRICTED)) | |
1808 { | |
1809 /* | |
1810 * copy repeat indicator if available | |
1811 */ | |
1812 setup->v_repeat_2 = setup->v_repeat; | |
1813 setup->repeat_2 = setup->repeat; | |
1814 /* | |
1815 * Fill LLC if bearer cap is available | |
1816 */ | |
1817 if (setup->v_bearer_cap) | |
1818 cc_build_llc (&setup->v_low_layer_comp, &setup->low_layer_comp, | |
1819 &setup->bearer_cap); | |
1820 if (setup->v_bearer_cap_2) | |
1821 cc_build_llc (&setup->v_low_layer_comp_2, (T_M_CC_low_layer_comp *)&setup->low_layer_comp_2, | |
1822 (T_M_CC_bearer_cap *)&setup->bearer_cap_2); | |
1823 } | |
1824 else | |
1825 { | |
1826 /* | |
1827 * default dont include LLC | |
1828 */ | |
1829 setup->v_repeat_2 = FALSE; | |
1830 setup->v_low_layer_comp = FALSE; | |
1831 setup->v_low_layer_comp_2 = FALSE; | |
1832 } | |
1833 setup->v_repeat_3 = FALSE; | |
1834 setup->v_high_layer_comp = FALSE; | |
1835 setup->v_high_layer_comp_2 = FALSE; | |
1836 } | |
1837 | |
1838 | |
1839 /* | |
1840 +--------------------------------------------------------------------+ | |
1841 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1842 | STATE : code ROUTINE : cc_build_setup | | |
1843 +--------------------------------------------------------------------+ | |
1844 | |
1845 PURPOSE : Filling of the C-Structure for setup message. | |
1846 | |
1847 */ | |
1848 | |
1849 GLOBAL void cc_build_setup ( T_U_SETUP * setup_msg, | |
1850 const T_MNCC_SETUP_REQ *setup_prm) | |
1851 { | |
1852 GET_INSTANCE_DATA; | |
1853 TRACE_FUNCTION ("cc_build_setup()"); | |
1854 | |
1855 TRACE_EVENT_P2 ("SERV2=%x RI=%x", cc_data->serv2, cc_data->ri); | |
1856 | |
1857 setup_msg->msg_type = U_SETUP; | |
1858 setup_msg->v_bearer_cap = TRUE; | |
1859 setup_msg->bearer_cap = cc_data->bc1; | |
1860 if (cc_data->serv2 NEQ NOT_PRESENT_8BIT) | |
1861 { | |
1862 setup_msg->v_bearer_cap_2 = TRUE; | |
1863 memcpy (&setup_msg->bearer_cap_2, | |
1864 &cc_data->bc2, | |
1865 sizeof (T_M_CC_bearer_cap)); | |
1866 setup_msg->v_repeat = TRUE; | |
1867 setup_msg->repeat = cc_data->ri; | |
1868 } | |
1869 else | |
1870 { | |
1871 setup_msg->v_repeat = FALSE; | |
1872 setup_msg->v_bearer_cap_2 = FALSE; | |
1873 } | |
1874 | |
1875 cc_fill_llc_hlc (setup_msg); | |
1876 | |
1877 setup_msg->v_user_user = FALSE; | |
1878 setup_msg->v_ss_version = FALSE; | |
1879 setup_msg->v_fac_adv = FALSE; | |
1880 | |
1881 if (cc_data->my_party_subaddr.c_subaddr NEQ 0) | |
1882 { | |
1883 setup_msg->v_calling_subaddr = TRUE; | |
1884 setup_msg->calling_subaddr = cc_data->my_party_subaddr; /* Struct copy */ | |
1885 } | |
1886 else | |
1887 { | |
1888 setup_msg->v_calling_subaddr = FALSE; | |
1889 } | |
1890 | |
1891 if (setup_prm->called_party.c_called_num NEQ 0) | |
1892 { | |
1893 setup_msg->v_ul_called_num = TRUE; | |
1894 setup_msg->ul_called_num.v_ton = TRUE; | |
1895 setup_msg->ul_called_num.ton = setup_prm->called_party.ton; | |
1896 setup_msg->ul_called_num.v_npi = TRUE; | |
1897 setup_msg->ul_called_num.npi = setup_prm->called_party.npi; | |
1898 setup_msg->ul_called_num.c_num = setup_prm->called_party.c_called_num; | |
1899 memcpy (&setup_msg->ul_called_num.num[0], | |
1900 &setup_prm->called_party.called_num[0], | |
1901 setup_prm->called_party.c_called_num); | |
1902 } | |
1903 else | |
1904 { | |
1905 setup_msg->v_ul_called_num = FALSE; | |
1906 } | |
1907 | |
1908 if (setup_prm->called_party_sub.c_subaddr NEQ 0) | |
1909 { | |
1910 setup_msg->v_called_subaddr = TRUE; | |
1911 setup_msg->called_subaddr.v_tos = TRUE; | |
1912 setup_msg->called_subaddr.tos = setup_prm->called_party_sub.tos; | |
1913 setup_msg->called_subaddr.v_odd_even = TRUE; | |
1914 setup_msg->called_subaddr.odd_even = setup_prm->called_party_sub.odd_even; | |
1915 setup_msg->called_subaddr.c_subaddr = setup_prm->called_party_sub.c_subaddr; | |
1916 memcpy (&setup_msg->called_subaddr.subaddr[0], | |
1917 &setup_prm->called_party_sub.subaddr[0], | |
1918 setup_prm->called_party_sub.c_subaddr); | |
1919 } | |
1920 else | |
1921 { | |
1922 setup_msg->v_called_subaddr = FALSE; | |
1923 } | |
1924 | |
1925 switch (setup_prm->clir_sup) | |
1926 { | |
1927 case MNCC_CLR_SUP: | |
1928 setup_msg->v_clir_suppr = TRUE; | |
1929 setup_msg->v_clir_invoc = FALSE; | |
1930 break; | |
1931 | |
1932 case MNCC_CLR_SUP_NOT: | |
1933 setup_msg->v_clir_suppr = FALSE; | |
1934 setup_msg->v_clir_invoc = TRUE; | |
1935 break; | |
1936 | |
1937 default: /* CLR_NOT_PRES */ | |
1938 setup_msg->v_clir_suppr = FALSE; | |
1939 setup_msg->v_clir_invoc = FALSE; | |
1940 break; | |
1941 } | |
1942 | |
1943 setup_msg->v_call_ctrl_cap = (cc_data->call_ctrl_cap.dtmf NEQ 0) OR | |
1944 (cc_data->call_ctrl_cap.pcp NEQ 0); | |
1945 if (setup_msg->v_call_ctrl_cap) | |
1946 { | |
1947 setup_msg->call_ctrl_cap = cc_data->call_ctrl_cap; /* Struct copy */ | |
1948 } | |
1949 | |
1950 if (setup_msg->bearer_cap.conn_elem EQ MNCC_CONN_ELEM_TRANS) | |
1951 { | |
1952 /* | |
1953 * set parameters invalid according to GSM 07.01 V7.1.1 Rel 1998 - | |
1954 * CC-ENH-2378 | |
1955 */ | |
1956 setup_msg->bearer_cap.v_uimi = FALSE; | |
1957 setup_msg->bearer_cap.v_waiur = FALSE; | |
1958 } | |
1959 | |
1960 if (setup_prm->fac_inf.l_fac EQ 0) | |
1961 { | |
1962 setup_msg->v_facility = FALSE; | |
1963 } | |
1964 else | |
1965 { | |
1966 setup_msg->v_facility = TRUE; | |
1967 setup_msg->facility.c_fac = setup_prm->fac_inf.l_fac >> 3; | |
1968 memcpy (setup_msg->facility.fac, | |
1969 &setup_prm->fac_inf.fac[setup_prm->fac_inf.o_fac>>3], | |
1970 setup_msg->facility.c_fac); | |
1971 } | |
1972 } | |
1973 | |
1974 /* | |
1975 +--------------------------------------------------------------------+ | |
1976 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1977 | STATE : code ROUTINE : cc_build_start_dtmf | | |
1978 +--------------------------------------------------------------------+ | |
1979 | |
1980 PURPOSE : Filling of the C-Structure for start dtmf message. | |
1981 | |
1982 */ | |
1983 | |
1984 GLOBAL void cc_build_start_dtmf (UBYTE key, | |
1985 T_U_START_DTMF * start_dtmf) | |
1986 { | |
1987 TRACE_FUNCTION ("cc_build_start_dtmf()"); | |
1988 | |
1989 start_dtmf->msg_type = U_START_DTMF; | |
1990 start_dtmf->v_key_facility = TRUE; | |
1991 start_dtmf->key_facility.key = key; | |
1992 } | |
1993 | |
1994 /* | |
1995 +--------------------------------------------------------------------+ | |
1996 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
1997 | STATE : code ROUTINE : cc_build_alert | | |
1998 +--------------------------------------------------------------------+ | |
1999 | |
2000 PURPOSE : Filling of the C-Structure for alert message. | |
2001 | |
2002 */ | |
2003 | |
2004 GLOBAL void cc_build_alert (T_U_ALERT * alert_msg) | |
2005 { | |
2006 TRACE_FUNCTION ("cc_build_alert()"); | |
2007 | |
2008 alert_msg->msg_type = U_ALERT; | |
2009 alert_msg->v_facility = FALSE; | |
2010 alert_msg->v_user_user = FALSE; | |
2011 alert_msg->v_ss_version = FALSE; | |
2012 } | |
2013 | |
2014 /* | |
2015 +--------------------------------------------------------------------+ | |
2016 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2017 | STATE : code ROUTINE : cc_build_connect | | |
2018 +--------------------------------------------------------------------+ | |
2019 | |
2020 PURPOSE : Filling of the C-Structure for connect message. | |
2021 | |
2022 */ | |
2023 | |
2024 GLOBAL void cc_build_connect (T_U_CONNECT * connect_msg) | |
2025 { | |
2026 TRACE_FUNCTION ("cc_build_connect()"); | |
2027 | |
2028 connect_msg->msg_type = U_CONNECT; | |
2029 connect_msg->v_facility = FALSE; | |
2030 connect_msg->v_connect_subaddr = FALSE; | |
2031 connect_msg->v_user_user = FALSE; | |
2032 connect_msg->v_ss_version = FALSE; | |
2033 } | |
2034 | |
2035 /* | |
2036 +--------------------------------------------------------------------+ | |
2037 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2038 | STATE : code ROUTINE : cc_build_status | | |
2039 +--------------------------------------------------------------------+ | |
2040 | |
2041 PURPOSE : Filling of the C-Structure for status message. | |
2042 | |
2043 */ | |
2044 | |
2045 GLOBAL void cc_build_status (T_B_STATUS * status, | |
2046 USHORT cause) | |
2047 { | |
2048 GET_INSTANCE_DATA; | |
2049 TRACE_FUNCTION ("cc_build_status()"); | |
2050 | |
2051 status->msg_type = B_STATUS; | |
2052 | |
2053 /* no security check for validity of cause; cause is mandatory in STATUS */ | |
2054 cc_encode_cause (&status->cc_cause, cause); | |
2055 | |
2056 status->call_state.cs = M_CC_CS_GSM_PLMN; /* vk 04-jul-97 */ | |
2057 status->call_state.state = cc_data->state[cc_data->index_ti]; | |
2058 | |
2059 switch (status->call_state.state) | |
2060 { | |
2061 case M_CC_CS_10: | |
2062 case M_CC_CS_26: | |
2063 if (cc_data->hold_state[cc_data->index_ti] NEQ M_CC_HLD_IDLE OR | |
2064 cc_data->mpty_state[cc_data->index_ti] NEQ M_CC_MPTY_IDLE) | |
2065 { | |
2066 | |
2067 TRACE_EVENT_P3 (" ti=%d, hold=%d, mpty=%d", | |
2068 cc_data->ti, | |
2069 cc_data->hold_state[cc_data->index_ti], | |
2070 cc_data->mpty_state[cc_data->index_ti]); | |
2071 | |
2072 status->v_aux_states = TRUE; | |
2073 status->aux_states.v_hold = TRUE; | |
2074 status->aux_states.hold = cc_data->hold_state[cc_data->index_ti]; | |
2075 status->aux_states.v_mpty = TRUE; | |
2076 status->aux_states.mpty = cc_data->mpty_state[cc_data->index_ti]; | |
2077 } | |
2078 else | |
2079 { | |
2080 status->v_aux_states = FALSE; | |
2081 } | |
2082 break; | |
2083 | |
2084 default: | |
2085 status->v_aux_states = FALSE; | |
2086 break; | |
2087 } | |
2088 } | |
2089 | |
2090 /* | |
2091 +--------------------------------------------------------------------+ | |
2092 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2093 | STATE : code ROUTINE : cc_build_user_ind_from_cong| | |
2094 +--------------------------------------------------------------------+ | |
2095 | |
2096 PURPOSE : Build primitive MNCC_USER_IND from congestion control | |
2097 message. | |
2098 | |
2099 */ | |
2100 | |
2101 GLOBAL void cc_build_user_ind_from_cong (T_MNCC_USER_IND * user, | |
2102 const T_B_CONGEST_CTRL * cong) | |
2103 { | |
2104 GET_INSTANCE_DATA; | |
2105 TRACE_FUNCTION ("cc_build_user_ind_from_cong()"); | |
2106 | |
2107 user->ti = cc_data->ti; | |
2108 user->more_data = NOT_PRESENT_8BIT; | |
2109 user->congest_lev = cong->congest_lev; | |
2110 memset (&user->user, 0, sizeof (T_MNCC_user)); | |
2111 } | |
2112 | |
2113 /* | |
2114 +--------------------------------------------------------------------+ | |
2115 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2116 | STATE : code ROUTINE : cc_build_user_ind_from_user| | |
2117 +--------------------------------------------------------------------+ | |
2118 | |
2119 PURPOSE : Build primitive MNCC_USER_IND from user information | |
2120 message. | |
2121 | |
2122 */ | |
2123 | |
2124 GLOBAL void cc_build_user_ind_from_user (T_MNCC_USER_IND * user_ind, | |
2125 const T_B_USER_INFO * user) | |
2126 { | |
2127 GET_INSTANCE_DATA; | |
2128 TRACE_FUNCTION ("cc_build_user_ind_from_user()"); | |
2129 | |
2130 user_ind->ti = cc_data->ti; | |
2131 user_ind->user.info_context = MNCC_USER_IN_USER; | |
2132 user_ind->user.pd = user->user_user.pd; | |
2133 user_ind->user.c_info = user->user_user.c_info; | |
2134 memcpy (user_ind->user.info, user->user_user.info, MNCC_USER_LEN); | |
2135 user_ind->congest_lev = NOT_PRESENT_8BIT; | |
2136 user_ind->more_data = user->v_more_data; | |
2137 } | |
2138 | |
2139 /* | |
2140 +--------------------------------------------------------------------+ | |
2141 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2142 | STATE : code ROUTINE : cc_build_user_information | | |
2143 +--------------------------------------------------------------------+ | |
2144 | |
2145 PURPOSE : Filling the C-structure for user information message. | |
2146 | |
2147 */ | |
2148 | |
2149 GLOBAL void cc_build_user_information (T_MNCC_USER_REQ * user, | |
2150 T_B_USER_INFO * user_msg) | |
2151 { | |
2152 TRACE_FUNCTION ("cc_build_user_information()"); | |
2153 | |
2154 user_msg->msg_type = B_USER_INFO; | |
2155 user_msg->user_user.pd = user->user.pd; | |
2156 user_msg->user_user.c_info = user->user.c_info; | |
2157 memcpy (user_msg->user_user.info, user->user.info, MNCC_USER_LEN); | |
2158 user_msg->v_more_data = user->more_data; | |
2159 } | |
2160 | |
2161 /* | |
2162 +--------------------------------------------------------------------+ | |
2163 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2164 | STATE : code ROUTINE : cc_check_error_flag | | |
2165 +--------------------------------------------------------------------+ | |
2166 | |
2167 PURPOSE : Checks the error variable of CC data and sends status | |
2168 message if necessary. | |
2169 | |
2170 */ | |
2171 | |
2172 GLOBAL BOOL cc_check_error_flag (void) | |
2173 { | |
2174 GET_INSTANCE_DATA; | |
2175 | |
2176 TRACE_FUNCTION ("cc_check_error_flag()"); | |
2177 | |
2178 switch (cc_data->error) | |
2179 { | |
2180 case M_CC_CAUSE_INVALID_MAND_INFO: | |
2181 case M_CC_CAUSE_COND_INFO_ELEM: | |
2182 CCD_END; | |
2183 /* Implements Measure# 7 and streamline encoding*/ | |
2184 cc_send_status (cc_data->error); | |
2185 return FALSE; | |
2186 | |
2187 default: | |
2188 return TRUE; | |
2189 } | |
2190 } | |
2191 | |
2192 /* | |
2193 +--------------------------------------------------------------------+ | |
2194 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2195 | STATE : code ROUTINE : cc_check_ms_cap_repeat_indicator_support | | |
2196 +--------------------------------------------------------------------+ | |
2197 | |
2198 PURPOSE : The mobile station repeat indicator capabilities are checked | |
2199 against the request. | |
2200 | |
2201 RETURN: OKAY if capabilities supported. | |
2202 ERROR if capabilitis not supported. | |
2203 | |
2204 */ | |
2205 U8 cc_check_ms_cap_repeat_indicator_support(const U8 repeat) | |
2206 { | |
2207 GET_INSTANCE_DATA; | |
2208 TRACE_FUNCTION ("cc_check_ms_cap_repeat_indicator_support()"); | |
2209 | |
2210 cc_csf_ms_cap (); | |
2211 | |
2212 switch (repeat) | |
2213 { | |
2214 case M_CC_REPEAT_CIRCULAR: | |
2215 if (FldGet (cc_data->mscap.datCap2, NAltSrvSup) EQ TRUE) /* still needed for TS61 - not for BS61 */ | |
2216 { | |
2217 TRACE_EVENT("ERROR - alternate services not allowed by manufacturer"); | |
2218 return ERROR; /* No alternate services allowed by manufacturer */ | |
2219 } | |
2220 | |
2221 if( | |
2222 ((cc_data->neg_bcpara1.bearer_serv EQ MNCC_BEARER_SERV_FAX) AND | |
2223 (cc_data->neg_bcpara2.bearer_serv EQ MNCC_BEARER_SERV_SPEECH) ) | |
2224 OR | |
2225 ((cc_data->neg_bcpara2.bearer_serv EQ MNCC_BEARER_SERV_FAX) AND | |
2226 (cc_data->neg_bcpara1.bearer_serv EQ MNCC_BEARER_SERV_SPEECH) ) | |
2227 ) | |
2228 return OKAY; | |
2229 | |
2230 TRACE_EVENT("ERROR - no TS61 found - wrong repeat indicator - BS61 not supported at all"); | |
2231 return ERROR; | |
2232 | |
2233 case M_CC_REPEAT_FALLBACK: | |
2234 return OKAY; /* MS cap checked earlier */ | |
2235 | |
2236 default: | |
2237 return ERROR; | |
2238 } /* switch (repeat) */ | |
2239 | |
2240 }/* cc_check_ms_cap_repeat_indicator_support */ | |
2241 | |
2242 | |
2243 /* | |
2244 +--------------------------------------------------------------------+ | |
2245 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2246 | STATE : code ROUTINE : cc_compatibility_check | | |
2247 +--------------------------------------------------------------------+ | |
2248 | |
2249 PURPOSE : Checks the compatibility of incoming setup message to | |
2250 its own configuration. | |
2251 | |
2252 */ | |
2253 | |
2254 GLOBAL UBYTE cc_compatibility_check (const T_D_SETUP * setup) | |
2255 { | |
2256 GET_INSTANCE_DATA; | |
2257 TRACE_FUNCTION ("cc_compatibility_check()"); | |
2258 | |
2259 cc_csf_ms_cap (); | |
2260 | |
2261 cc_data->negotiation = FALSE; | |
2262 | |
2263 cc_data->neg_serv1 = NOT_PRESENT_8BIT; | |
2264 memset (&cc_data->neg_bcpara1, 0, sizeof (T_MNCC_bcpara)); | |
2265 cc_data->neg_bcpara1.bearer_serv = NOT_PRESENT_8BIT; | |
2266 | |
2267 cc_data->neg_serv2 = NOT_PRESENT_8BIT; | |
2268 memset (&cc_data->neg_bcpara2, 0, sizeof (T_MNCC_bcpara)); | |
2269 cc_data->neg_bcpara2.bearer_serv = NOT_PRESENT_8BIT; | |
2270 cc_data->neg_ri = NOT_PRESENT_8BIT; | |
2271 | |
2272 if (setup->v_bearer_cap) | |
2273 { | |
2274 if (cc_check_bc (&setup->bearer_cap, | |
2275 &cc_data->neg_bc1, | |
2276 &cc_data->neg_bcpara1, | |
2277 &cc_data->neg_serv1, | |
2278 &cc_data->negotiation) EQ ERROR) | |
2279 { | |
2280 #if 0 /* HM 03-09-2002, code to merge is superflous, I don't take it | |
2281 The part of the code between #if 0 to #endif is never executed.*/ | |
2282 /* | |
2283 * set parameters invalid according to GSM 07.01 V7.1.1 Rel 1998 - | |
2284 * CC-ENH-2378 | |
2285 */ | |
2286 if ((setup->bearer_cap.v_modem_type_2 EQ FALSE) OR | |
2287 (setup->bearer_cap.v_fnur EQ FALSE)) | |
2288 { | |
2289 cc_data->neg_bc1.v_modem_type_2 = FALSE; | |
2290 cc_data->neg_bc1.v_fnur = FALSE; | |
2291 cc_data->neg_bc1.v_acc = FALSE; | |
2292 cc_data->neg_bc1.v_mTch = FALSE; | |
2293 cc_data->neg_bc1.v_uimi = FALSE; | |
2294 cc_data->neg_bc1.v_waiur = FALSE; | |
2295 } | |
2296 #endif | |
2297 return ERROR; | |
2298 } | |
2299 } | |
2300 else | |
2301 { | |
2302 /* | |
2303 * The incoming setup message contains no bearer capabilities | |
2304 * | |
2305 * This indicates single numbering scheme | |
2306 * | |
2307 * use the parameter of sns_mode to set the negotiated answer | |
2308 */ | |
2309 cc_data->negotiation = TRUE; | |
2310 memset (&cc_data->neg_bcpara1, 0, sizeof (T_MNCC_bcpara)); | |
2311 memset (&cc_data->neg_bcpara2, 0, sizeof (T_MNCC_bcpara)); | |
2312 | |
2313 switch (cc_data->sns_mode) | |
2314 { | |
2315 case MNCC_SNS_MODE_VOICE: /* VOICE calls */ | |
2316 if (!cc_voice_capability ()) | |
2317 return ERROR; | |
2318 memcpy (&cc_data->neg_bcpara1, &cc_data->sns_bcpara, | |
2319 sizeof (T_MNCC_bcpara)); | |
2320 cc_data->neg_bcpara2.bearer_serv = NOT_PRESENT_8BIT; | |
2321 cc_data->neg_ri = NOT_PRESENT_8BIT; | |
2322 cc_data->neg_serv1 = MNCC_SERV_SPEECH; | |
2323 cc_data->neg_serv2 = NOT_PRESENT_8BIT; | |
2324 cc_build_bc (&cc_data->neg_bc1, &cc_data->neg_serv1, | |
2325 &cc_data->neg_bcpara1); | |
2326 break; | |
2327 case MNCC_SNS_MODE_VAF_VOICE: /* Voice Alternating Fax, VOICE first */ | |
2328 case MNCC_SNS_MODE_VAD_VOICE: /* Voice Alternating Data, VOICE first */ | |
2329 if (!cc_voice_capability ()) | |
2330 return ERROR; | |
2331 memset (&cc_data->neg_bcpara1, 0, sizeof (T_MNCC_bcpara)); | |
2332 cc_data->neg_bcpara1.bearer_serv = (cc_data->ctm_ena EQ MNCC_CTM_ENABLED)? | |
2333 MNCC_BEARER_SERV_SPEECH_CTM: MNCC_BEARER_SERV_SPEECH; | |
2334 memcpy (&cc_data->neg_bcpara2, &cc_data->sns_bcpara, | |
2335 sizeof (T_MNCC_bcpara)); | |
2336 cc_data->neg_ri = MNCC_RI_CIRCULAR; | |
2337 cc_data->neg_serv1 = MNCC_SERV_SPEECH; | |
2338 cc_data->neg_serv2 = MNCC_SERV_DATA; | |
2339 cc_build_bc (&cc_data->neg_bc1, &cc_data->neg_serv1, | |
2340 &cc_data->neg_bcpara1); | |
2341 cc_build_bc (&cc_data->neg_bc2, &cc_data->neg_serv2, | |
2342 &cc_data->neg_bcpara2); | |
2343 break; | |
2344 case MNCC_SNS_MODE_FAX: /* FAX calls */ | |
2345 case MNCC_SNS_MODE_DATA: /* DATA calls */ | |
2346 memcpy (&cc_data->neg_bcpara1, &cc_data->sns_bcpara, | |
2347 sizeof (T_MNCC_bcpara)); | |
2348 cc_data->neg_bcpara2.bearer_serv = NOT_PRESENT_8BIT; | |
2349 cc_data->neg_ri = NOT_PRESENT_8BIT; | |
2350 cc_data->neg_serv1 = MNCC_SERV_DATA; | |
2351 cc_data->neg_serv2 = NOT_PRESENT_8BIT; | |
2352 cc_build_bc (&cc_data->neg_bc1, &cc_data->neg_serv1, | |
2353 &cc_data->neg_bcpara1); | |
2354 break; | |
2355 case MNCC_SNS_MODE_VAF_FAX: /* Voice Alternating Fax, FAX first */ | |
2356 case MNCC_SNS_MODE_VAD_DATA: /* Voice Alternating Data, DATA first */ | |
2357 if (!cc_voice_capability ()) | |
2358 return ERROR; | |
2359 memset (&cc_data->neg_bcpara2, 0, sizeof (T_MNCC_bcpara)); | |
2360 cc_data->neg_bcpara2.bearer_serv = (cc_data->ctm_ena EQ MNCC_CTM_ENABLED)? | |
2361 MNCC_BEARER_SERV_SPEECH_CTM: MNCC_BEARER_SERV_SPEECH; | |
2362 memcpy (&cc_data->neg_bcpara1, &cc_data->sns_bcpara, | |
2363 sizeof (T_MNCC_bcpara)); | |
2364 cc_data->neg_ri = MNCC_RI_CIRCULAR; | |
2365 cc_data->neg_serv1 = MNCC_SERV_DATA; | |
2366 cc_data->neg_serv2 = MNCC_SERV_SPEECH; | |
2367 cc_build_bc (&cc_data->neg_bc1, &cc_data->neg_serv1, | |
2368 &cc_data->neg_bcpara1); | |
2369 break; | |
2370 case MNCC_SNS_MODE_VFD: /* Voice Followed by Data */ | |
2371 if (!cc_voice_capability ()) | |
2372 return ERROR; | |
2373 memset (&cc_data->neg_bcpara1, 0, sizeof (T_MNCC_bcpara)); | |
2374 cc_data->neg_bcpara1.bearer_serv = (cc_data->ctm_ena EQ MNCC_CTM_ENABLED)? | |
2375 MNCC_BEARER_SERV_SPEECH_CTM: MNCC_BEARER_SERV_SPEECH; | |
2376 memcpy (&cc_data->neg_bcpara2, &cc_data->sns_bcpara, | |
2377 sizeof (T_MNCC_bcpara)); | |
2378 cc_data->neg_ri = MNCC_RI_SEQUENTIAL; | |
2379 cc_data->neg_serv1 = MNCC_SERV_SPEECH; | |
2380 cc_data->neg_serv2 = MNCC_SERV_DATA; | |
2381 cc_build_bc (&cc_data->neg_bc1, &cc_data->neg_serv1, | |
2382 &cc_data->neg_bcpara1); | |
2383 cc_build_bc (&cc_data->neg_bc2, &cc_data->neg_serv2, | |
2384 &cc_data->neg_bcpara2); | |
2385 break; | |
2386 default: | |
2387 TRACE_ERROR ("Unexpected default"); /* All cases caught */ | |
2388 break; | |
2389 } | |
2390 } | |
2391 if (setup->v_bearer_cap_2) | |
2392 { | |
2393 if (cc_check_bc ((T_M_CC_bearer_cap *)&setup->bearer_cap_2, | |
2394 &cc_data->neg_bc2, | |
2395 &cc_data->neg_bcpara2, | |
2396 &cc_data->neg_serv2, | |
2397 &cc_data->negotiation) EQ ERROR) | |
2398 return ERROR; | |
2399 } | |
2400 | |
2401 /*Check for repeat Indicator*/ | |
2402 if (setup->v_repeat) | |
2403 { | |
2404 if (cc_check_ms_cap_repeat_indicator_support(setup->repeat) EQ ERROR) | |
2405 return ERROR; | |
2406 | |
2407 cc_data->neg_ri = setup->repeat; | |
2408 } | |
2409 | |
2410 | |
2411 /* | |
2412 * Two bearer capabilities are available. The | |
2413 * single numbering scheme command on ACI level can | |
2414 * be used to swap bearer capabilities. For example | |
2415 * SNS Mode is set to voice alternating fax, voice first | |
2416 * and the network indicates voice alternating fax, fax first. | |
2417 * Then the BCs are swapped. | |
2418 */ | |
2419 if (setup->v_bearer_cap_2) | |
2420 { | |
2421 UBYTE swap = FALSE; | |
2422 switch (cc_data->sns_mode) | |
2423 { | |
2424 case MNCC_SNS_MODE_VAF_VOICE: | |
2425 if (cc_data->neg_bcpara1.bearer_serv EQ MNCC_BEARER_SERV_FAX AND | |
2426 (cc_data->neg_serv2 EQ MNCC_SERV_SPEECH) AND | |
2427 cc_data->neg_ri EQ MNCC_RI_CIRCULAR) | |
2428 swap = TRUE; | |
2429 break; | |
2430 case MNCC_SNS_MODE_VAD_VOICE: | |
2431 if (cc_data->neg_bcpara1.bearer_serv NEQ MNCC_BEARER_SERV_FAX AND | |
2432 (cc_data->neg_serv1 NEQ MNCC_SERV_SPEECH) AND | |
2433 (cc_data->neg_serv2 EQ MNCC_SERV_SPEECH) AND | |
2434 cc_data->neg_ri EQ MNCC_RI_CIRCULAR) | |
2435 swap = TRUE; | |
2436 break; | |
2437 case MNCC_SNS_MODE_VAF_FAX: | |
2438 if (cc_data->neg_bcpara2.bearer_serv EQ MNCC_BEARER_SERV_FAX AND | |
2439 (cc_data->neg_serv1 EQ MNCC_SERV_SPEECH) AND | |
2440 cc_data->neg_ri EQ MNCC_RI_CIRCULAR) | |
2441 swap = TRUE; | |
2442 break; | |
2443 case MNCC_SNS_MODE_VAD_DATA: | |
2444 if (cc_data->neg_bcpara2.bearer_serv NEQ MNCC_BEARER_SERV_FAX AND | |
2445 (cc_data->neg_serv2 NEQ MNCC_SERV_SPEECH) AND | |
2446 (cc_data->neg_serv1 EQ MNCC_SERV_SPEECH) AND | |
2447 cc_data->neg_ri EQ MNCC_RI_CIRCULAR) | |
2448 swap = TRUE; | |
2449 break; | |
2450 } | |
2451 if (swap) | |
2452 { | |
2453 /* | |
2454 * Both bearer capabilities shall be swapped | |
2455 */ | |
2456 T_MNCC_bcpara temp_bcpara; | |
2457 UBYTE temp_serv; | |
2458 T_M_CC_bearer_cap temp_bc; /*lint !e813 length info of struct*/ | |
2459 | |
2460 memcpy (&temp_bcpara, &cc_data->neg_bcpara1, sizeof (T_MNCC_bcpara)); | |
2461 memcpy (&cc_data->neg_bcpara1, &cc_data->neg_bcpara2, sizeof (T_MNCC_bcpara)); | |
2462 memcpy (&cc_data->neg_bcpara2, &temp_bcpara, sizeof (T_MNCC_bcpara)); | |
2463 | |
2464 temp_serv = cc_data->neg_serv1; | |
2465 cc_data->neg_serv1 = cc_data->neg_serv2; | |
2466 cc_data->neg_serv2 = temp_serv; | |
2467 | |
2468 memcpy (&temp_bc, &cc_data->neg_bc1, sizeof (T_M_CC_bearer_cap)); | |
2469 memcpy (&cc_data->neg_bc1, &cc_data->neg_bc2, sizeof (T_M_CC_bearer_cap)); | |
2470 memcpy (&cc_data->neg_bc2, &temp_bc, sizeof (T_M_CC_bearer_cap)); | |
2471 | |
2472 cc_data->negotiation = TRUE; | |
2473 } | |
2474 } | |
2475 | |
2476 /* | |
2477 * set parameters invalid according to GSM 07.01 V7.1.1 Rel 1998 - | |
2478 * CC-ENH-2378 | |
2479 */ | |
2480 if ((setup->bearer_cap.v_modem_type_2 EQ FALSE) OR | |
2481 (setup->bearer_cap.v_fnur EQ FALSE)) | |
2482 { | |
2483 cc_data->neg_bc1.v_modem_type_2 = FALSE; | |
2484 cc_data->neg_bc1.v_fnur = FALSE; | |
2485 cc_data->neg_bc1.v_acc = FALSE; | |
2486 cc_data->neg_bc1.v_mTch = FALSE; | |
2487 cc_data->neg_bc1.v_uimi = FALSE; | |
2488 cc_data->neg_bc1.v_waiur = FALSE; | |
2489 } | |
2490 | |
2491 cc_data->active_service = cc_data->neg_serv1; | |
2492 | |
2493 if (cc_mtc_check_subaddr (setup) EQ BAD_SUBADDRESS) | |
2494 return BAD_SUBADDRESS; | |
2495 | |
2496 if (cc_data->negotiation) | |
2497 return NEGOTIATION; | |
2498 else | |
2499 return OKAY; | |
2500 } | |
2501 | |
2502 | |
2503 /* | |
2504 +--------------------------------------------------------------------+ | |
2505 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2506 | STATE : code ROUTINE : cc_basic_service_align() | | |
2507 +--------------------------------------------------------------------+ | |
2508 | |
2509 PURPOSE: Checks the compatibility of incoming uplink setup message | |
2510 to its own configuration and performs basic service group | |
2511 alignment. This is used for Network Initiated MO Call (CCBS). | |
2512 See GSM 04.08 subclause 5.2.3.2.1 "Basic service group | |
2513 alignment". | |
2514 | |
2515 The following fields in cc_data are changed by a call | |
2516 of this function: | |
2517 | |
2518 cc_data->serv1; | |
2519 cc_data->serv2; | |
2520 cc_data->ri; | |
2521 cc_data->bc1; | |
2522 cc_data->bc2; | |
2523 cc_data->bcpara1; | |
2524 cc_data->bcpara2; | |
2525 cc_data->neg_serv1; | |
2526 cc_data->neg_serv2; | |
2527 cc_data->neg_ri; | |
2528 cc_data->neg_bc1; | |
2529 cc_data->neg_bc2; | |
2530 cc_data->neg_bcpara1; | |
2531 cc_data->neg_bcpara2; | |
2532 cc_data->negotiation; | |
2533 | |
2534 PARAMETERS: cc_data: IN/OUT | |
2535 setup: IN/OUT | |
2536 | |
2537 RETURN: OKAY if setup (bearer caps) is compatible with mobile, | |
2538 ERROR otherwise. | |
2539 | |
2540 */ | |
2541 | |
2542 GLOBAL UBYTE cc_basic_service_align (T_U_SETUP * setup) | |
2543 { | |
2544 GET_INSTANCE_DATA; | |
2545 TRACE_FUNCTION ("cc_basic_service_align()"); | |
2546 | |
2547 cc_csf_ms_cap (); | |
2548 | |
2549 if (FldGet (cc_data->mscap.datCap2, NAltSrvSup) AND setup->v_repeat) | |
2550 return ERROR; /* No alternate services allowed by manufacturer */ | |
2551 | |
2552 cc_data->ri = (setup->v_repeat) ? setup->repeat : NOT_PRESENT_8BIT; | |
2553 cc_data->neg_ri = cc_data->ri; | |
2554 | |
2555 /* BC is mandatory IE in uplink setup message */ | |
2556 if (!setup->v_bearer_cap) | |
2557 return ERROR; | |
2558 if (cc_check_bc (&setup->bearer_cap, | |
2559 &cc_data->bc1, /* Not used */ | |
2560 &cc_data->bcpara1, | |
2561 &cc_data->serv1, /* Not used */ | |
2562 &cc_data->negotiation) /* Not used */ | |
2563 EQ ERROR) | |
2564 return ERROR; /* Not expected to catch */ | |
2565 | |
2566 if (!cc_check_capabilities (&cc_data->bcpara1)) | |
2567 return ERROR; /* Not expected to catch */ | |
2568 | |
2569 cc_build_bc (&cc_data->bc1, &cc_data->serv1, &cc_data->bcpara1); | |
2570 setup->bearer_cap = cc_data->bc1; /* Struct copy */ | |
2571 cc_data->neg_serv1 = cc_data->serv1; | |
2572 cc_data->neg_bc1 = cc_data->bc1; /* Struct copy */ | |
2573 cc_data->neg_bcpara1 = cc_data->bcpara1; /* Struct copy */ | |
2574 | |
2575 /* BC2 is optional IE in uplink setup message */ | |
2576 if (setup->v_bearer_cap_2) | |
2577 { | |
2578 if (cc_check_bc ((T_M_CC_bearer_cap *)&setup->bearer_cap_2, | |
2579 &cc_data->bc2, /* Not used */ | |
2580 &cc_data->bcpara2, | |
2581 &cc_data->serv2, /* Not used */ | |
2582 &cc_data->negotiation) | |
2583 EQ ERROR) | |
2584 return ERROR; /* Bearer caps 2 incompatible */ | |
2585 if (!cc_check_capabilities (&cc_data->bcpara2)) | |
2586 return ERROR; /* Not expected to catch */ | |
2587 | |
2588 cc_build_bc (&cc_data->bc2, &cc_data->serv2, &cc_data->bcpara2); | |
2589 setup->bearer_cap_2 = *(T_M_CC_bearer_cap_2*)&cc_data->bc2; /* Struct copy */ | |
2590 cc_data->neg_bc2 = cc_data->bc2; /* Struct copy */ | |
2591 } | |
2592 else | |
2593 { | |
2594 cc_data->serv2 = NOT_PRESENT_8BIT; | |
2595 cc_data->bcpara2.bearer_serv = NOT_PRESENT_8BIT; | |
2596 } | |
2597 cc_data->neg_serv2 = cc_data->serv2; | |
2598 cc_data->neg_bcpara2 = cc_data->bcpara2; /* Struct copy */ | |
2599 | |
2600 /* check repeat indicator */ | |
2601 if (setup->v_repeat EQ TRUE) | |
2602 { | |
2603 if (cc_check_ms_cap_repeat_indicator_support(setup->repeat) EQ ERROR) | |
2604 return ERROR; | |
2605 | |
2606 cc_data->ri = setup->repeat; | |
2607 } | |
2608 else | |
2609 cc_data->ri = NOT_PRESENT_8BIT; | |
2610 | |
2611 cc_data->neg_ri = cc_data->ri; | |
2612 | |
2613 cc_fill_llc_hlc (setup); | |
2614 | |
2615 return OKAY; | |
2616 } | |
2617 | |
2618 | |
2619 /* | |
2620 +--------------------------------------------------------------------+ | |
2621 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2622 | STATE : code ROUTINE : cc_count_active_connections| | |
2623 +--------------------------------------------------------------------+ | |
2624 | |
2625 PURPOSE : Counts the number of active connections. | |
2626 | |
2627 */ | |
2628 | |
2629 GLOBAL UBYTE cc_count_active_connections (void) | |
2630 { | |
2631 GET_INSTANCE_DATA; | |
2632 UBYTE i; | |
2633 UBYTE x; | |
2634 | |
2635 TRACE_FUNCTION ("cc_count_active_connections()"); | |
2636 | |
2637 for (i=0,x=0 ; i< MAX_CC_CALLS; i++) | |
2638 if (cc_data->state[i] NEQ M_CC_CS_0) | |
2639 x++; | |
2640 | |
2641 return x; | |
2642 } | |
2643 | |
2644 | |
2645 /* | |
2646 +--------------------------------------------------------------------+ | |
2647 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2648 | STATE : code ROUTINE : cc_disconnect_after_timeout| | |
2649 +--------------------------------------------------------------------+ | |
2650 | |
2651 PURPOSE : Start disconnection after timeout. A disconnect message | |
2652 is send to the infrastructure. MMI is informed and timer | |
2653 T305 is started. | |
2654 | |
2655 */ | |
2656 | |
2657 GLOBAL void cc_disconnect_after_timeout (void) | |
2658 { | |
2659 GET_INSTANCE_DATA; | |
2660 PALLOC (setup_cnf, MNCC_SETUP_CNF); | |
2661 | |
2662 TRACE_FUNCTION ("cc_disconnect_after_timeout()"); | |
2663 | |
2664 CCD_START; | |
2665 { | |
2666 MCAST (disconnect, U_DISCONNECT); | |
2667 cc_build_disconnect (disconnect, CAUSE_MAKE(DEFBY_STD, | |
2668 ORIGSIDE_MS, | |
2669 MNCC_CC_ORIGINATING_ENTITY, | |
2670 M_CC_CAUSE_TIMER), | |
2671 NULL, MNCC_SS_VER_NOT_PRES); | |
2672 for_disconnect (disconnect); | |
2673 } | |
2674 CCD_END; | |
2675 | |
2676 memset (setup_cnf, 0, sizeof (T_MNCC_SETUP_CNF)); | |
2677 setup_cnf->ti = cc_data->ti; | |
2678 setup_cnf->cause = CAUSE_MAKE(DEFBY_STD, | |
2679 ORIGSIDE_MS, | |
2680 MNCC_CC_ORIGINATING_ENTITY, | |
2681 M_CC_CAUSE_TIMER); | |
2682 PSENDX (MMI, setup_cnf); | |
2683 | |
2684 TIMERSTART (T305, T305_VALUE); | |
2685 } | |
2686 | |
2687 | |
2688 /* | |
2689 +--------------------------------------------------------------------+ | |
2690 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2691 | STATE : code ROUTINE : cc_encode_cause | | |
2692 +--------------------------------------------------------------------+ | |
2693 | |
2694 PURPOSE : Coding of the cc_cause element and storing of the cause | |
2695 value in cc data. Dependent on the cause the diagnostic | |
2696 field is filled. It is expected that checking of validity | |
2697 is done outside this function. | |
2698 | |
2699 */ | |
2700 | |
2701 static const UBYTE timername[] = { '3', '0', '3', 0, | |
2702 '3', '0', '5', 0, | |
2703 '3', '0', '8', 0, | |
2704 '3', '1', '0', 0, | |
2705 '3', '1', '3', 0, | |
2706 '3', '2', '3', 0, | |
2707 '3', '3', '2', 0, | |
2708 '3', '3', '5', 0, | |
2709 '3', '3', '6', 0, | |
2710 '3', '3', '7', 0 }; | |
2711 | |
2712 GLOBAL void cc_encode_cause (T_M_CC_cc_cause * cc_cause, | |
2713 USHORT cause) | |
2714 { | |
2715 GET_INSTANCE_DATA; | |
2716 TRACE_FUNCTION ("cc_encode_cause()"); | |
2717 | |
2718 /* perform "security" checks of application of cause concept */ | |
2719 switch (GET_CAUSE_DEFBY(cause)) | |
2720 { | |
2721 case DEFBY_STD: | |
2722 { | |
2723 switch (GET_CAUSE_ORIGIN_ENTITY(cause)) | |
2724 { | |
2725 case MNCC_CC_ORIGINATING_ENTITY: | |
2726 case MNCC_ACI_ORIGINATING_ENTITY: | |
2727 { | |
2728 switch (GET_CAUSE_ORIGSIDE(cause)) | |
2729 { | |
2730 case ORIGSIDE_NET: | |
2731 TRACE_EVENT("Warning: NET originated cause"); | |
2732 /* no error correction */ | |
2733 break; | |
2734 default: /* ORIGSIDE_MS */ | |
2735 break; /* this is the expected case */ | |
2736 } | |
2737 break; /* MNCC_ACI_ORIGINATING_ENTITY, ACI_ORIGINATING_ENTITY */ | |
2738 } | |
2739 default: | |
2740 TRACE_ERROR("Non ACI or CC cause originator"); | |
2741 /* no error correction */ | |
2742 break; | |
2743 } | |
2744 } | |
2745 break; | |
2746 default: /* DEFBY_CONDAT */ | |
2747 TRACE_ERROR("Illegal use of cause: DEFBY_CONDAT"); | |
2748 /* overwrite the cause with a standard cause */ | |
2749 cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, M_CC_CAUSE_UNSPECIFIED); | |
2750 break; | |
2751 } | |
2752 | |
2753 cc_cause->v_cs = TRUE; | |
2754 cc_cause->cs = M_CC_CS_GSM_PLMN; | |
2755 cc_cause->v_loc = TRUE; | |
2756 cc_cause->loc = M_CC_LOC_USER; | |
2757 cc_cause->v_rec = FALSE; | |
2758 cc_cause->v_cause = TRUE; | |
2759 cc_cause->cause = GET_CAUSE_VALUE(cause); | |
2760 | |
2761 /* | |
2762 * store the cause for later usage (e.g. timeout) | |
2763 * store the entire 16 bits | |
2764 */ | |
2765 if (cc_cause->cause NEQ M_CC_CAUSE_STATUS_ENQUIRY) | |
2766 cc_data->cc_cause [cc_data->index_ti] = cause; | |
2767 | |
2768 /* feed diagnostic information if necessary */ | |
2769 switch (cc_cause->cause) | |
2770 { | |
2771 case M_CC_CAUSE_MESSAGE_TYPE_INCOMPAT: | |
2772 case M_CC_CAUSE_MESSAGE_TYPE_NOT_IMPLEM: | |
2773 case M_CC_CAUSE_MESSAGE_INCOMPAT: | |
2774 cc_cause->c_diag = 1; | |
2775 cc_cause->diag[0] = cc_data->mt; | |
2776 break; | |
2777 | |
2778 case M_CC_CAUSE_INVALID_MAND_INFO: | |
2779 case M_CC_CAUSE_COND_INFO_ELEM: | |
2780 cc_cause->c_diag = cc_data->error_count; | |
2781 memcpy (cc_cause->diag, cc_data->error_inf, cc_cause->c_diag); | |
2782 break; | |
2783 | |
2784 case M_CC_CAUSE_TIMER: | |
2785 cc_cause->c_diag = 3; | |
2786 memcpy (cc_cause->diag, | |
2787 &timername[cc_data->timer[cc_data->index_ti]<<2], 3); | |
2788 break; | |
2789 | |
2790 default: | |
2791 cc_cause->c_diag = 0; | |
2792 break; | |
2793 } | |
2794 } | |
2795 | |
2796 /* | |
2797 +--------------------------------------------------------------------+ | |
2798 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2799 | STATE : code ROUTINE : cc_mtc_check_subaddr | | |
2800 +--------------------------------------------------------------------+ | |
2801 | |
2802 PURPOSE : Check the subaddress if available for the | |
2803 mobile terminated call. | |
2804 | |
2805 */ | |
2806 | |
2807 GLOBAL UBYTE cc_mtc_check_subaddr (const T_D_SETUP * setup) | |
2808 { | |
2809 GET_INSTANCE_DATA; | |
2810 UBYTE i; | |
2811 | |
2812 TRACE_FUNCTION ("cc_mtc_check_subaddr()"); | |
2813 | |
2814 if (cc_data->my_party_subaddr.c_subaddr AND setup->v_called_subaddr) | |
2815 { | |
2816 if (cc_data->my_party_subaddr.tos NEQ setup->called_subaddr.tos) | |
2817 return BAD_SUBADDRESS; | |
2818 | |
2819 if (cc_data->my_party_subaddr.c_subaddr NEQ | |
2820 setup->called_subaddr.c_subaddr) | |
2821 return BAD_SUBADDRESS; | |
2822 | |
2823 for (i=0; i<cc_data->my_party_subaddr.c_subaddr; i++) | |
2824 if (cc_data->my_party_subaddr.subaddr[i] NEQ | |
2825 setup->called_subaddr.subaddr[i]) | |
2826 return BAD_SUBADDRESS; | |
2827 } | |
2828 | |
2829 return OKAY; | |
2830 } | |
2831 | |
2832 | |
2833 /* | |
2834 +--------------------------------------------------------------------+ | |
2835 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2836 | STATE : code ROUTINE : cc_build_bcpara | | |
2837 +--------------------------------------------------------------------+ | |
2838 | |
2839 PURPOSE : Build the local transmission parameters (for MMI)(bcpara) | |
2840 of the incoming bearer caps to the mobile station configuration | |
2841 for the Mobile Originated Call (after reception of a call | |
2842 proceeding message). | |
2843 | |
2844 */ | |
2845 | |
2846 LOCAL void cc_build_bcpara( T_MNCC_bcpara *bcpara, | |
2847 const T_M_CC_bearer_cap *bearer_cap) | |
2848 { | |
2849 TRACE_FUNCTION ("cc_build_bcpara()"); | |
2850 | |
2851 memset (bcpara, 0, sizeof (T_MNCC_bcpara)); | |
2852 | |
2853 switch (bearer_cap->trans_cap) | |
2854 { | |
2855 case M_CC_ITC_SPEECH: | |
2856 /* | |
2857 * Speech bearer capability | |
2858 */ | |
2859 { | |
2860 bcpara->bearer_serv = MNCC_BEARER_SERV_SPEECH; | |
2861 | |
2862 break; | |
2863 } | |
2864 case M_CC_ITC_AUXILIARY_SPEECH: | |
2865 /* | |
2866 * Speech bearer capability for alternate line service | |
2867 */ | |
2868 { | |
2869 bcpara->bearer_serv = MNCC_BEARER_SERV_AUX_SPEECH; | |
2870 | |
2871 break; | |
2872 } | |
2873 case M_CC_ITC_AUDIO: | |
2874 case M_CC_ITC_DIGITAL_UNRESTRICTED: | |
2875 { | |
2876 bcpara->bearer_serv = MNCC_BEARER_SERV_ASYNC; | |
2877 bcpara->stop_bits = bearer_cap->num_stop; | |
2878 bcpara->data_bits = bearer_cap->num_data; | |
2879 bcpara->parity = bearer_cap->parity; | |
2880 bcpara->modem_type = bearer_cap->modem_type; | |
2881 if (bearer_cap->v_fnur AND (bearer_cap->fnur EQ M_CC_FNUR_14400)) | |
2882 { | |
2883 bcpara->rate = MNCC_UR_14_4_KBIT; | |
2884 } | |
2885 else | |
2886 { | |
2887 bcpara->rate = bearer_cap->user_rate; | |
2888 } | |
2889 switch (bearer_cap->conn_elem) | |
2890 { | |
2891 case MNCC_CONN_ELEM_TRANS: | |
2892 { | |
2893 bcpara->conn_elem = MNCC_CONN_ELEM_TRANS; | |
2894 bcpara->flow_control = NOT_PRESENT_8BIT; | |
2895 | |
2896 break; | |
2897 } | |
2898 case MNCC_CONN_ELEM_NON_TRANS: | |
2899 { | |
2900 bcpara->conn_elem = MNCC_CONN_ELEM_NON_TRANS; | |
2901 if (bearer_cap->v_user_inf_l2_prot) | |
2902 { | |
2903 switch (bearer_cap->user_inf_l2_prot) | |
2904 { | |
2905 case M_CC_L2_ISO6429: | |
2906 { | |
2907 bcpara->flow_control = MNCC_INBAND_FLOW_CONTROL; | |
2908 | |
2909 break; | |
2910 } | |
2911 case M_CC_L2_COPFC: | |
2912 { | |
2913 bcpara->flow_control = MNCC_NO_FLOW_CONTROL; | |
2914 | |
2915 break; | |
2916 } | |
2917 default: | |
2918 { | |
2919 bcpara->flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
2920 | |
2921 break; | |
2922 } | |
2923 } | |
2924 } | |
2925 else | |
2926 { | |
2927 bcpara->flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
2928 } | |
2929 break; | |
2930 } | |
2931 case MNCC_CONN_ELEM_TRANS_PREF: | |
2932 case MNCC_CONN_ELEM_NON_TRANS_PREF: | |
2933 case MNCC_CONN_ELEM_NOT_PRES: | |
2934 { | |
2935 TRACE_EVENT ("Call setup failed due to wrong conn_elem in bearer caps"); | |
2936 | |
2937 break; | |
2938 } | |
2939 } | |
2940 break; | |
2941 } | |
2942 case M_CC_ITC_FAX_GROUP_3: | |
2943 { | |
2944 if (bearer_cap->v_fnur AND (bearer_cap->fnur EQ M_CC_FNUR_14400)) | |
2945 { | |
2946 bcpara->rate = MNCC_UR_14_4_KBIT; | |
2947 } | |
2948 else | |
2949 { | |
2950 bcpara->rate = bearer_cap->user_rate; | |
2951 } | |
2952 bcpara->bearer_serv = MNCC_BEARER_SERV_FAX; | |
2953 bcpara->conn_elem = MNCC_CONN_ELEM_TRANS; | |
2954 bcpara->stop_bits = bearer_cap->num_stop; | |
2955 bcpara->data_bits = bearer_cap->num_data; | |
2956 bcpara->parity = bearer_cap->parity; | |
2957 bcpara->modem_type = bearer_cap->modem_type; | |
2958 bcpara->flow_control = NOT_PRESENT_8BIT; | |
2959 break; | |
2960 } | |
2961 default: | |
2962 { | |
2963 TRACE_EVENT ("Call setup failed due to wrong ITC in bearer caps"); | |
2964 | |
2965 break; | |
2966 } | |
2967 } | |
2968 } | |
2969 | |
2970 | |
2971 /* | |
2972 +--------------------------------------------------------------------+ | |
2973 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
2974 | STATE : code ROUTINE : cc_moc_compatibility | | |
2975 +--------------------------------------------------------------------+ | |
2976 | |
2977 PURPOSE : Check the compatibility of the incoming bearer caps | |
2978 to the mobile station configuration for the | |
2979 mobile originated call (after reception of a call | |
2980 proceeding message). | |
2981 | |
2982 */ | |
2983 | |
2984 GLOBAL UBYTE cc_moc_compatibility (const T_D_CALL_PROCEED * proceed) | |
2985 { | |
2986 GET_INSTANCE_DATA; | |
2987 UBYTE proceed_ri; | |
2988 | |
2989 TRACE_FUNCTION ("cc_moc_compatibility()"); | |
2990 | |
2991 if (proceed->v_bearer_cap) | |
2992 { | |
2993 if (proceed->v_repeat) | |
2994 proceed_ri = proceed->repeat; | |
2995 else | |
2996 proceed_ri = NOT_PRESENT_8BIT; | |
2997 if ((proceed_ri EQ NOT_PRESENT_8BIT) && (cc_data->ri NEQ NOT_PRESENT_8BIT)) | |
2998 { | |
2999 /* | |
3000 * No repeat indicator from the network | |
3001 * that means only one bearer capability. | |
3002 * Mobile station has send two bearer | |
3003 * capabilities. Check whether bearer | |
3004 * capability is compatible to one of the | |
3005 * mobile station bearer capabilities. | |
3006 */ | |
3007 if (cc_bcs_compatible (&proceed->bearer_cap, | |
3008 &cc_data->bc1, TRUE)) | |
3009 { | |
3010 cc_data->neg_ri = NOT_PRESENT_8BIT; | |
3011 cc_data->neg_bc1 = proceed->bearer_cap; | |
3012 cc_data->neg_serv1 = cc_data->serv1; | |
3013 cc_data->neg_serv2 = NOT_PRESENT_8BIT; | |
3014 cc_build_bcpara(&cc_data->neg_bcpara1,&proceed->bearer_cap); | |
3015 cc_data->neg_bcpara2.bearer_serv = NOT_PRESENT_8BIT; /* jk: wg. cc705 */ | |
3016 cc_data->active_service = cc_data->serv1; | |
3017 return OKAY; | |
3018 } | |
3019 else | |
3020 { | |
3021 if (cc_bcs_compatible (&proceed->bearer_cap, | |
3022 &cc_data->bc2, TRUE)) | |
3023 { | |
3024 cc_data->neg_ri = NOT_PRESENT_8BIT; | |
3025 memcpy (&cc_data->neg_bc1, &proceed->bearer_cap,sizeof (T_M_CC_bearer_cap)); | |
3026 cc_data->neg_serv1 = cc_data->serv2; | |
3027 cc_data->neg_serv2 = NOT_PRESENT_8BIT; | |
3028 cc_build_bcpara(&cc_data->neg_bcpara1,&proceed->bearer_cap); | |
3029 cc_data->active_service = cc_data->serv2; | |
3030 return OKAY; | |
3031 } | |
3032 else | |
3033 { | |
3034 return ERROR; | |
3035 } | |
3036 } | |
3037 } | |
3038 else | |
3039 { | |
3040 if (proceed_ri EQ cc_data->ri) | |
3041 { | |
3042 /* | |
3043 * both Repeat Indicators are the same | |
3044 * e.g. both not present OR both valid | |
3045 * but not the Bearer Capabilities. | |
3046 */ | |
3047 if (cc_bcs_compatible (&proceed->bearer_cap, | |
3048 &cc_data->bc1, TRUE) EQ FALSE) | |
3049 { | |
3050 return ERROR; | |
3051 } | |
3052 else | |
3053 { | |
3054 if (proceed_ri NEQ NOT_PRESENT_8BIT) | |
3055 { | |
3056 if (cc_bcs_compatible ((T_M_CC_bearer_cap*)&proceed->bearer_cap_2, | |
3057 &cc_data->bc2, TRUE) EQ FALSE) | |
3058 return ERROR; | |
3059 /* 2 Bearer Capabilities from the Network sent */ | |
3060 cc_data->neg_ri = proceed_ri; | |
3061 cc_data->neg_bc1 = proceed->bearer_cap; | |
3062 memcpy (&cc_data->neg_bc2, &proceed->bearer_cap_2,sizeof (T_M_CC_bearer_cap)); | |
3063 cc_data->neg_serv1 = cc_data->serv1; | |
3064 cc_data->neg_serv2 = cc_data->serv2; | |
3065 cc_build_bcpara(&cc_data->neg_bcpara1,&cc_data->neg_bc1); | |
3066 cc_build_bcpara(&cc_data->neg_bcpara2,&cc_data->neg_bc2); | |
3067 cc_data->active_service = cc_data->serv1; | |
3068 return OKAY; | |
3069 } | |
3070 else | |
3071 { | |
3072 /* only 1 BC from the Network sent*/ | |
3073 cc_data->neg_ri = proceed_ri; | |
3074 cc_data->neg_bc1 = proceed->bearer_cap; | |
3075 cc_data->neg_serv1 = cc_data->serv1; | |
3076 cc_data->neg_serv2 = NOT_PRESENT_8BIT; | |
3077 cc_build_bcpara(&cc_data->neg_bcpara1,&cc_data->neg_bc1); | |
3078 cc_data->neg_bcpara2 = cc_data->bcpara2; | |
3079 cc_data->active_service = cc_data->serv1; | |
3080 return OKAY; | |
3081 } | |
3082 }/*else*/ | |
3083 }/*if*/ | |
3084 else | |
3085 { | |
3086 /* | |
3087 * network has changed repeat indicator in an illegal way | |
3088 */ | |
3089 return ERROR; | |
3090 } | |
3091 } /*else*/ | |
3092 } | |
3093 cc_data->neg_ri = cc_data->ri; | |
3094 cc_data->neg_bc1 = cc_data->bc1; | |
3095 cc_data->neg_bc2 = cc_data->bc2; | |
3096 cc_data->neg_serv1 = cc_data->serv1; | |
3097 cc_data->neg_serv2 = cc_data->serv2; | |
3098 cc_data->neg_bcpara1 = cc_data->bcpara1; | |
3099 cc_data->neg_bcpara2 = cc_data->bcpara2; | |
3100 cc_data->active_service = cc_data->serv1; | |
3101 return OKAY; | |
3102 } | |
3103 | |
3104 | |
3105 #ifndef NTRACE | |
3106 /* | |
3107 +--------------------------------------------------------------------+ | |
3108 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3109 | STATE : code ROUTINE : cc_trace_state | | |
3110 +--------------------------------------------------------------------+ | |
3111 | |
3112 PURPOSE : Maps CC state numbers to string constants. | |
3113 | |
3114 */ | |
3115 LOCAL T_S2I_STRING cc_sname (UBYTE state) | |
3116 { | |
3117 switch (state) | |
3118 { | |
3119 case M_CC_CS_0 : return S2I_STRING("U0 "); | |
3120 case M_CC_CS_01 : return S2I_STRING("U0.1"); | |
3121 case M_CC_CS_03 : return S2I_STRING("U0.3"); | |
3122 case M_CC_CS_05 : return S2I_STRING("U0.5"); | |
3123 case M_CC_CS_06 : return S2I_STRING("U0.6"); | |
3124 case M_CC_CS_1 : return S2I_STRING("U1 "); | |
3125 case M_CC_CS_3 : return S2I_STRING("U3 "); | |
3126 case M_CC_CS_4 : return S2I_STRING("U4 "); | |
3127 case M_CC_CS_6 : return S2I_STRING("U6 "); | |
3128 case M_CC_CS_7 : return S2I_STRING("U7 "); | |
3129 case M_CC_CS_8 : return S2I_STRING("U8 "); | |
3130 case M_CC_CS_9 : return S2I_STRING("U9 "); | |
3131 case M_CC_CS_10 : return S2I_STRING("U10"); | |
3132 case M_CC_CS_11 : return S2I_STRING("U11"); | |
3133 case M_CC_CS_12 : return S2I_STRING("U12"); | |
3134 case M_CC_CS_19 : return S2I_STRING("U19"); | |
3135 case M_CC_CS_26 : return S2I_STRING("U26"); | |
3136 case M_CC_CS_27 : return S2I_STRING("U27"); | |
3137 case M_CC_CS_28 : return S2I_STRING("U28"); | |
3138 case CS_101 : return S2I_STRING("U10.1"); | |
3139 case CS_261 : return S2I_STRING("U26.1"); | |
3140 default : return S2I_STRING("???"); | |
3141 } | |
3142 } | |
3143 #endif | |
3144 | |
3145 /* | |
3146 +--------------------------------------------------------------------+ | |
3147 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3148 | STATE : code ROUTINE : cc_set_state | | |
3149 +--------------------------------------------------------------------+ | |
3150 | |
3151 PURPOSE : Sets the new state for call control. If necessary the | |
3152 instance administration is updated. | |
3153 | |
3154 */ | |
3155 | |
3156 GLOBAL void cc_set_state (UBYTE new_state) | |
3157 { | |
3158 GET_INSTANCE_DATA; | |
3159 #ifndef NTRACE | |
3160 vsi_o_state_ttrace ("CC[%d]: %s -> %s", | |
3161 cc_data->index_ti, | |
3162 S2I_STRING(cc_sname(cc_data->state[cc_data->index_ti])), | |
3163 S2I_STRING(cc_sname(new_state))); | |
3164 #endif | |
3165 | |
3166 cc_data->state[cc_data->index_ti] = new_state; | |
3167 if ((new_state EQ M_CC_CS_0) AND (cc_data->ti NEQ cc_data->setup_reattempt_ti)) | |
3168 srv_free_ti (); | |
3169 if (new_state EQ M_CC_CS_10) /* // Questionable after RLF/REEST */ | |
3170 cc_data->hold_state[cc_data->index_ti] = M_CC_HLD_IDLE; | |
3171 } | |
3172 | |
3173 /* | |
3174 +--------------------------------------------------------------------+ | |
3175 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3176 | STATE : code ROUTINE : cc_check_bc | | |
3177 +--------------------------------------------------------------------+ | |
3178 | |
3179 PURPOSE : Checks an incoming bearer capability. | |
3180 But not only checks are done, also | |
3181 neg_bearer_cap, bcpara and service are | |
3182 computed. If negotiation is required, | |
3183 negotiation will be set to TRUE | |
3184 (but never to FALSE by this function). | |
3185 | |
3186 RETURN: OKAY if bearer_cap could be processed, | |
3187 otherwise ERROR. | |
3188 | |
3189 */ | |
3190 | |
3191 | |
3192 GLOBAL UBYTE cc_check_bc (const T_M_CC_bearer_cap * bearer_cap, /* in */ | |
3193 T_M_CC_bearer_cap * neg_bearer_cap, /* out */ | |
3194 T_MNCC_bcpara * bcpara, /* out */ | |
3195 UBYTE * service, /* out */ | |
3196 BOOL * negotiation ) /* in/out */ | |
3197 { | |
3198 GET_INSTANCE_DATA; | |
3199 UBYTE found, temp; | |
3200 | |
3201 TRACE_FUNCTION ("cc_check_bc()"); | |
3202 | |
3203 memcpy (neg_bearer_cap, bearer_cap, sizeof (T_M_CC_bearer_cap)); | |
3204 | |
3205 cc_csf_ms_cap (); | |
3206 | |
3207 switch (bearer_cap->trans_cap) | |
3208 { | |
3209 case M_CC_ITC_SPEECH: | |
3210 case M_CC_ITC_AUXILIARY_SPEECH: | |
3211 if (!cc_voice_capability ()) | |
3212 return ERROR; | |
3213 temp = bcpara->rad_chan_req; | |
3214 memset (bcpara, 0, sizeof (T_MNCC_bcpara)); | |
3215 bcpara->rad_chan_req = temp; | |
3216 *service = MNCC_SERV_SPEECH; | |
3217 if (bearer_cap->trans_cap EQ M_CC_ITC_SPEECH) | |
3218 { | |
3219 /* Speech bearer capability */ | |
3220 if (cc_data->ctm_ena EQ MNCC_CTM_ENABLED) | |
3221 { | |
3222 bcpara->bearer_serv = MNCC_BEARER_SERV_SPEECH_CTM; | |
3223 cc_build_bc (neg_bearer_cap, service, bcpara); | |
3224 *negotiation = TRUE; | |
3225 return OKAY; | |
3226 } | |
3227 else | |
3228 bcpara->bearer_serv = MNCC_BEARER_SERV_SPEECH; | |
3229 } | |
3230 else | |
3231 { | |
3232 /* Speech bearer capability for alternate line service */ | |
3233 if (cc_data->ctm_ena EQ MNCC_CTM_ENABLED) | |
3234 { | |
3235 bcpara->bearer_serv = MNCC_BEARER_SERV_AUX_SPEECH_CTM; | |
3236 cc_build_bc (neg_bearer_cap, service, bcpara); | |
3237 *negotiation = TRUE; | |
3238 return OKAY; | |
3239 } | |
3240 else | |
3241 bcpara->bearer_serv = MNCC_BEARER_SERV_AUX_SPEECH; | |
3242 } | |
3243 | |
3244 /* | |
3245 * For negotiation, the rules of GSM 04.08 clause 9.3.2.2 shall apply | |
3246 */ | |
3247 if ((FldGet(cc_data->mscap.chnMode, EFRSupV2) OR | |
3248 FldGet(cc_data->mscap.chnMode, AHS) OR | |
3249 FldGet(cc_data->mscap.chnMode, AFS)) AND | |
3250 (bearer_cap->v_speech_vers1 EQ FALSE)) | |
3251 { | |
3252 /* | |
3253 * if the incoming message indicates only full rate channel, | |
3254 * all supported bearer caps shall be returned. | |
3255 */ | |
3256 cc_build_bc (neg_bearer_cap, service, bcpara); | |
3257 *negotiation = TRUE; | |
3258 } | |
3259 return OKAY; | |
3260 | |
3261 case M_CC_ITC_AUDIO: | |
3262 case M_CC_ITC_DIGITAL_UNRESTRICTED: | |
3263 *service = MNCC_SERV_DATA; | |
3264 found = FALSE; | |
3265 switch (cc_data->conn_elem) | |
3266 { | |
3267 case MNCC_CONN_ELEM_TRANS: | |
3268 cc_check_transparent_async (&found, bearer_cap, neg_bearer_cap, | |
3269 bcpara, negotiation ); | |
3270 break; | |
3271 case MNCC_CONN_ELEM_NON_TRANS: | |
3272 cc_check_non_transparent_async (&found, bearer_cap, neg_bearer_cap, | |
3273 bcpara, negotiation); | |
3274 break; | |
3275 case MNCC_CONN_ELEM_TRANS_PREF: | |
3276 cc_check_transparent_async (&found, bearer_cap, neg_bearer_cap, | |
3277 bcpara, negotiation); | |
3278 cc_check_non_transparent_async (&found, bearer_cap, neg_bearer_cap, | |
3279 bcpara, negotiation); | |
3280 break; | |
3281 case MNCC_CONN_ELEM_NON_TRANS_PREF: | |
3282 cc_check_non_transparent_async (&found, bearer_cap, neg_bearer_cap, | |
3283 bcpara, negotiation); | |
3284 cc_check_transparent_async (&found, bearer_cap, neg_bearer_cap, | |
3285 bcpara, negotiation); | |
3286 break; | |
3287 case MNCC_CONN_ELEM_NOT_PRES: | |
3288 TRACE_EVENT ("Call setup failed due to uninitialised conn_elem in cc_data"); | |
3289 break; | |
3290 } | |
3291 /* | |
3292 * not yet supported (this stuff must be included in the switch (cc_data->conn_elem) above ) | |
3293 * | |
3294 * cc_check_transparent_sync (&found, bearer_cap, neg_bearer_cap, | |
3295 * bcpara, cc_data); | |
3296 * cc_check_non_transparent_sync (&found, bearer_cap, neg_bearer_cap, | |
3297 * bcpara, cc_data); | |
3298 * | |
3299 * cc_check_transparent_packet_sync | |
3300 * cc_check_non_transparent_packet_sync | |
3301 * cc_check_transparent_pad_async | |
3302 * cc_check_non_transparent_pad_async | |
3303 * | |
3304 */ | |
3305 if (found) | |
3306 { | |
3307 return OKAY; | |
3308 } | |
3309 return ERROR; | |
3310 | |
3311 case M_CC_ITC_FAX_GROUP_3: | |
3312 *service = MNCC_SERV_DATA; | |
3313 if (cc_check_transparent_fax (bearer_cap, neg_bearer_cap, | |
3314 bcpara, negotiation)) | |
3315 { | |
3316 return OKAY; | |
3317 } | |
3318 return ERROR; | |
3319 | |
3320 default: | |
3321 /* reserved ITC value e.g. */ | |
3322 return ERROR; | |
3323 } | |
3324 } | |
3325 | |
3326 /* | |
3327 +--------------------------------------------------------------------+ | |
3328 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3329 | STATE : code ROUTINE : cc_check_transparent_async | | |
3330 +--------------------------------------------------------------------+ | |
3331 | |
3332 PURPOSE : Checks an incoming bearer capability for the transparent | |
3333 asynchronous data service. | |
3334 | |
3335 */ | |
3336 GLOBAL void cc_check_transparent_async (UBYTE * found, | |
3337 const T_M_CC_bearer_cap * bearer_cap, | |
3338 T_M_CC_bearer_cap * neg_bearer_cap, | |
3339 T_MNCC_bcpara * bcpara, | |
3340 BOOL * negotiation ) | |
3341 { | |
3342 GET_INSTANCE_DATA; | |
3343 TRACE_FUNCTION ("cc_check_transparent_async()"); | |
3344 | |
3345 if (*found EQ FALSE) | |
3346 { | |
3347 memcpy (neg_bearer_cap, bearer_cap, sizeof (T_M_CC_bearer_cap)); | |
3348 | |
3349 if (FldGet(cc_data->mscap.datCap1, AsySup)) | |
3350 { | |
3351 /* | |
3352 * check only if transparent M_CC_ASYNCHRONOUS data services are supported | |
3353 */ | |
3354 if (bearer_cap->sync_async NEQ M_CC_ASYNCHRONOUS OR | |
3355 bearer_cap->sig_access_prot NEQ M_CC_SIAP_I440) /* no async service */ | |
3356 return; | |
3357 switch (bearer_cap->conn_elem) | |
3358 { | |
3359 case M_CC_CE_TRANSPA: | |
3360 neg_bearer_cap->compress = M_CC_COMP_NO; | |
3361 break; | |
3362 case M_CC_CE_TRANSPA_PREF: /* set to trans async */ | |
3363 case M_CC_CE_RLP_PREF: | |
3364 *negotiation = TRUE; | |
3365 neg_bearer_cap->conn_elem = M_CC_CE_TRANSPA; | |
3366 neg_bearer_cap->structure = M_CC_STRC_UNSTRUCTURED; | |
3367 neg_bearer_cap->compress = M_CC_COMP_NO; | |
3368 if (bearer_cap->modem_type EQ M_CC_MT_AUTO) | |
3369 { | |
3370 switch (bearer_cap->user_rate) /* set the modem type matching a data rate */ | |
3371 { | |
3372 case MNCC_UR_0_3_KBIT: | |
3373 neg_bearer_cap->modem_type = M_CC_MT_V21; | |
3374 break; | |
3375 case MNCC_UR_1_2_KBIT: | |
3376 neg_bearer_cap->modem_type = M_CC_MT_V22; | |
3377 break; | |
3378 case MNCC_UR_2_4_KBIT: | |
3379 neg_bearer_cap->modem_type = M_CC_MT_V22BIS; | |
3380 break; | |
3381 case MNCC_UR_4_8_KBIT: | |
3382 neg_bearer_cap->modem_type = M_CC_MT_V32; | |
3383 break; | |
3384 case MNCC_UR_9_6_KBIT: | |
3385 case MNCC_UR_12_0_KBIT_TRANS: | |
3386 case MNCC_UR_14_4_KBIT: | |
3387 neg_bearer_cap->modem_type = M_CC_MT_V32; | |
3388 break; | |
3389 case MNCC_UR_1_2_KBIT_V23: | |
3390 neg_bearer_cap->modem_type = M_CC_MT_V23; | |
3391 break; | |
3392 default: | |
3393 neg_bearer_cap->modem_type = M_CC_MT_UNDEF; | |
3394 break; | |
3395 } /* END OF set the modem type matching the data rate */ | |
3396 } /* END OF if (bearer_cap->modem_type EQ M_CC_MT_AUTO) */ | |
3397 if ((bearer_cap->user_rate EQ M_CC_UR_9_6_KBIT) OR | |
3398 (bearer_cap->user_rate EQ M_CC_UR_12_0_KBIT_TRANS)) | |
3399 neg_bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
3400 else | |
3401 neg_bearer_cap->intermed_rate = M_CC_IR_8_KBIT; | |
3402 neg_bearer_cap->v_l2_ident = FALSE; | |
3403 neg_bearer_cap->v_user_inf_l2_prot = FALSE; | |
3404 break; | |
3405 | |
3406 case M_CC_CE_RLP: /* non-transparent service */ | |
3407 return; | |
3408 | |
3409 default: | |
3410 return; | |
3411 } /* end SWITCH (bearer_cap->conn_elem)*/ | |
3412 /* | |
3413 * copy important parameters | |
3414 */ | |
3415 *found = TRUE; | |
3416 | |
3417 /* | |
3418 * this is a first step to 14.4 | |
3419 * if FNUR is available, use this as user rate | |
3420 */ | |
3421 /* Implements Measure# 21 */ | |
3422 cc_set_neg_bearer_cap(bearer_cap, bcpara, neg_bearer_cap, cc_data->mscap); | |
3423 bcpara->flow_control = NOT_PRESENT_8BIT; | |
3424 bcpara->conn_elem = MNCC_CONN_ELEM_TRANS; | |
3425 | |
3426 } | |
3427 } | |
3428 } | |
3429 | |
3430 /* | |
3431 +--------------------------------------------------------------------+ | |
3432 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3433 | STATE : code ROUTINE : cc_check_non_transparent_async | | |
3434 +--------------------------------------------------------------------+ | |
3435 | |
3436 PURPOSE : Checks an incoming bearer capability for the | |
3437 non-transparent asynchronous data service. | |
3438 | |
3439 */ | |
3440 | |
3441 GLOBAL void cc_check_non_transparent_async (UBYTE * found, | |
3442 const T_M_CC_bearer_cap * bearer_cap, | |
3443 T_M_CC_bearer_cap * neg_bearer_cap, | |
3444 T_MNCC_bcpara * bcpara, | |
3445 BOOL * negotiation ) | |
3446 { | |
3447 GET_INSTANCE_DATA; | |
3448 TRACE_FUNCTION ("cc_check_non_transparent_async()"); | |
3449 | |
3450 if (*found EQ FALSE) | |
3451 { | |
3452 memcpy (neg_bearer_cap, bearer_cap, sizeof (T_M_CC_bearer_cap)); | |
3453 | |
3454 if (FldGet (cc_data->mscap.datCap1, RLPSup)) | |
3455 { | |
3456 /* | |
3457 * check only if non-transparent M_CC_ASYNCHRONOUS data services are supported | |
3458 */ | |
3459 if (bearer_cap->sync_async NEQ M_CC_ASYNCHRONOUS OR | |
3460 bearer_cap->sig_access_prot NEQ M_CC_SIAP_I440) /* no async service */ | |
3461 return; | |
3462 switch (bearer_cap->conn_elem) | |
3463 { | |
3464 case M_CC_CE_RLP: | |
3465 break; | |
3466 | |
3467 case M_CC_CE_RLP_PREF: /* set to non-trans async */ | |
3468 case M_CC_CE_TRANSPA_PREF: | |
3469 *negotiation = TRUE; | |
3470 neg_bearer_cap->conn_elem = M_CC_CE_RLP; | |
3471 neg_bearer_cap->structure = M_CC_STRC_SERV_DATA_INTEG; | |
3472 /* | |
3473 * TA 29.2.3.5 Negotiation of intermediate rate | |
3474 */ | |
3475 if ((bearer_cap->nirr EQ M_CC_NIRR_DATA) AND | |
3476 (bearer_cap->user_rate <= M_CC_UR_4_8_KBIT)) | |
3477 neg_bearer_cap->intermed_rate = M_CC_IR_8_KBIT; | |
3478 else | |
3479 neg_bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
3480 break; | |
3481 | |
3482 case M_CC_CE_TRANSPA: /* transparent service */ | |
3483 return; | |
3484 | |
3485 default: | |
3486 return; | |
3487 } | |
3488 | |
3489 /* | |
3490 * copy important parameters | |
3491 */ | |
3492 *found = TRUE; | |
3493 /* | |
3494 * this is a first step to 14.4 | |
3495 * if FNUR is available, use this as user rate | |
3496 */ | |
3497 /* Implements Measure# 21 */ | |
3498 cc_set_neg_bearer_cap(bearer_cap, bcpara, neg_bearer_cap, cc_data->mscap); | |
3499 bcpara->conn_elem = MNCC_CONN_ELEM_NON_TRANS; | |
3500 | |
3501 if (bearer_cap->v_user_inf_l2_prot) | |
3502 { | |
3503 switch (bearer_cap->user_inf_l2_prot) | |
3504 { | |
3505 case M_CC_L2_ISO6429: | |
3506 bcpara->flow_control = MNCC_INBAND_FLOW_CONTROL; | |
3507 break; | |
3508 case M_CC_L2_COPFC: | |
3509 bcpara->flow_control = MNCC_NO_FLOW_CONTROL; | |
3510 break; | |
3511 default: | |
3512 bcpara->flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
3513 break; | |
3514 } | |
3515 } | |
3516 else | |
3517 bcpara->flow_control = MNCC_OUTBAND_FLOW_CONTROL; | |
3518 } | |
3519 } | |
3520 } | |
3521 | |
3522 /* | |
3523 +--------------------------------------------------------------------+ | |
3524 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3525 | STATE : code ROUTINE : cc_check_transparent_fax | | |
3526 +--------------------------------------------------------------------+ | |
3527 | |
3528 PURPOSE : Checks an incoming bearer capability for the transparent | |
3529 fax service. | |
3530 | |
3531 */ | |
3532 | |
3533 GLOBAL UBYTE cc_check_transparent_fax (const T_M_CC_bearer_cap * bearer_cap, | |
3534 T_M_CC_bearer_cap * neg_bearer_cap, | |
3535 T_MNCC_bcpara * bcpara, | |
3536 BOOL * negotiation ) | |
3537 { | |
3538 GET_INSTANCE_DATA; | |
3539 TRACE_FUNCTION ("cc_check_transparent_fax()"); | |
3540 | |
3541 memcpy (neg_bearer_cap, bearer_cap, sizeof (T_M_CC_bearer_cap)); | |
3542 | |
3543 if (FldGet (cc_data->mscap.datCap1, TFaxSup)) | |
3544 { | |
3545 /* | |
3546 * check only if transparent fax services are supported | |
3547 */ | |
3548 | |
3549 if (bearer_cap->sync_async NEQ M_CC_SYNCHRONOUS OR | |
3550 bearer_cap->sig_access_prot NEQ M_CC_SIAP_I440) /* no async service */ | |
3551 return FALSE; | |
3552 | |
3553 switch (bearer_cap->conn_elem) | |
3554 { | |
3555 case M_CC_CE_TRANSPA: | |
3556 break; | |
3557 | |
3558 case M_CC_CE_TRANSPA_PREF: /* set to trans async */ | |
3559 case M_CC_CE_RLP_PREF: | |
3560 *negotiation = TRUE; | |
3561 neg_bearer_cap->conn_elem = M_CC_CE_TRANSPA; | |
3562 neg_bearer_cap->structure = M_CC_STRC_UNSTRUCTURED; | |
3563 if ((bearer_cap->user_rate EQ M_CC_UR_9_6_KBIT) OR | |
3564 (bearer_cap->user_rate EQ M_CC_UR_12_0_KBIT_TRANS)) | |
3565 neg_bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
3566 else | |
3567 neg_bearer_cap->intermed_rate = M_CC_IR_8_KBIT; | |
3568 neg_bearer_cap->v_l2_ident = FALSE; | |
3569 neg_bearer_cap->v_user_inf_l2_prot = FALSE; | |
3570 break; | |
3571 | |
3572 | |
3573 case M_CC_CE_RLP: /* non-transparent service */ | |
3574 default: | |
3575 return FALSE; | |
3576 } | |
3577 | |
3578 /* | |
3579 * copy important parameters | |
3580 */ | |
3581 /* | |
3582 * this is a first step to 14.4 | |
3583 * if FNUR is available, use this as user rate | |
3584 */ | |
3585 if (bearer_cap->v_fnur AND (bearer_cap->fnur EQ M_CC_FNUR_14400)) | |
3586 { | |
3587 bcpara->rate = 8; | |
3588 /* | |
3589 * define acceptable channel codings | |
3590 */ | |
3591 neg_bearer_cap->acc = M_CC_ACC_96; | |
3592 if (FldGet (cc_data->mscap.datCap2, DHRSup)) | |
3593 neg_bearer_cap->acc += M_CC_ACC_48; | |
3594 if (FldGet (cc_data->mscap.datCap1, Dr14_4Sup)) | |
3595 neg_bearer_cap->acc += M_CC_ACC_144; | |
3596 neg_bearer_cap->v_acc = TRUE; | |
3597 | |
3598 neg_bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
3599 | |
3600 neg_bearer_cap->v_mTch = TRUE; | |
3601 neg_bearer_cap->mTch = M_CC_MAX_TCH_1; | |
3602 neg_bearer_cap->v_uimi = TRUE; | |
3603 neg_bearer_cap->uimi = M_CC_UIMI_NOT_ALLOWED; | |
3604 neg_bearer_cap->modem_type_2 = M_CC_OTHER_MODEM_TYPE_V34; | |
3605 } | |
3606 else | |
3607 bcpara->rate = bearer_cap->user_rate; | |
3608 bcpara->bearer_serv = MNCC_BEARER_SERV_FAX; | |
3609 bcpara->conn_elem = MNCC_CONN_ELEM_TRANS; | |
3610 bcpara->stop_bits = bearer_cap->num_stop; | |
3611 bcpara->data_bits = bearer_cap->num_data; | |
3612 bcpara->parity = bearer_cap->parity; | |
3613 bcpara->modem_type = bearer_cap->modem_type; | |
3614 bcpara->flow_control = NOT_PRESENT_8BIT; | |
3615 return TRUE; | |
3616 } | |
3617 return FALSE; | |
3618 } | |
3619 | |
3620 | |
3621 /* | |
3622 +--------------------------------------------------------------------+ | |
3623 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3624 | STATE : code ROUTINE : cc_build_facility_ind | | |
3625 +--------------------------------------------------------------------+ | |
3626 | |
3627 PURPOSE : Forwards a facility information element to the upper layer | |
3628 if available. | |
3629 | |
3630 */ | |
3631 | |
3632 GLOBAL void cc_build_facility_ind (UBYTE context, | |
3633 UBYTE valid, | |
3634 const T_M_CC_facility * facility ) | |
3635 { | |
3636 GET_INSTANCE_DATA; | |
3637 TRACE_FUNCTION ("cc_build_facility_ind()"); | |
3638 | |
3639 if (valid) | |
3640 { | |
3641 PALLOC (facility_ind, MNCC_FACILITY_IND); | |
3642 | |
3643 facility_ind->ti = cc_data->ti; | |
3644 facility_ind->fac_context = context; | |
3645 facility_ind->fac_inf.l_fac = facility->c_fac<<3; | |
3646 facility_ind->fac_inf.o_fac = 0; | |
3647 | |
3648 memcpy (facility_ind->fac_inf.fac, facility->fac, facility->c_fac); | |
3649 | |
3650 PSENDX (MMI, facility_ind); | |
3651 } | |
3652 } | |
3653 | |
3654 | |
3655 /* | |
3656 +--------------------------------------------------------------------+ | |
3657 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3658 | STATE : code ROUTINE : cc_build_user_user_ind | | |
3659 +--------------------------------------------------------------------+ | |
3660 | |
3661 PURPOSE : Forwards a user user information element to the upper layer | |
3662 if available. | |
3663 | |
3664 */ | |
3665 | |
3666 GLOBAL void cc_build_user_user_ind (UBYTE context, | |
3667 UBYTE valid, | |
3668 T_M_CC_user_user * user_user ) | |
3669 { | |
3670 GET_INSTANCE_DATA; | |
3671 TRACE_FUNCTION ("cc_build_user_user_ind()"); | |
3672 | |
3673 if (valid) | |
3674 { | |
3675 PALLOC (user_ind, MNCC_USER_IND); | |
3676 | |
3677 user_ind->ti = cc_data->ti; | |
3678 user_ind->user.info_context = context; | |
3679 user_ind->user.c_info = user_user->c_info; | |
3680 user_ind->user.pd = user_user->pd; | |
3681 memcpy (user_ind->user.info, user_user->info, | |
3682 MNCC_USER_LEN); | |
3683 | |
3684 PSENDX (MMI, user_ind); | |
3685 } | |
3686 } | |
3687 | |
3688 /* | |
3689 +--------------------------------------------------------------------+ | |
3690 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3691 | STATE : code ROUTINE : cc_check_capabilities | | |
3692 +--------------------------------------------------------------------+ | |
3693 | |
3694 PURPOSE : The mobile station capabilities are checked against the | |
3695 upper layer request. | |
3696 | |
3697 RETURN: TRUE if bearer capabilities supported. | |
3698 FALSE if bearer capabilitis not supported. | |
3699 | |
3700 */ | |
3701 | |
3702 GLOBAL UBYTE cc_check_capabilities (const T_MNCC_bcpara * bcpara) | |
3703 { | |
3704 GET_INSTANCE_DATA; | |
3705 TRACE_FUNCTION ("cc_check_capabilities()"); | |
3706 | |
3707 cc_csf_ms_cap (); | |
3708 switch (bcpara->bearer_serv) | |
3709 { | |
3710 case MNCC_BEARER_SERV_SYNC: | |
3711 if (bcpara->conn_elem EQ MNCC_CONN_ELEM_TRANS) | |
3712 { | |
3713 return (FldGet (cc_data->mscap.datCap1, TSynSup) NEQ 0); | |
3714 } | |
3715 return (FldGet (cc_data->mscap.datCap1, NTSynSup) NEQ 0); | |
3716 | |
3717 case MNCC_BEARER_SERV_ASYNC: | |
3718 if (bcpara->conn_elem EQ MNCC_CONN_ELEM_TRANS) | |
3719 { | |
3720 return (FldGet (cc_data->mscap.datCap1, AsySup) NEQ 0); | |
3721 } | |
3722 return (FldGet (cc_data->mscap.datCap1, RLPSup) NEQ 0); | |
3723 | |
3724 case MNCC_BEARER_SERV_PAD_ACCESS: | |
3725 if (bcpara->conn_elem EQ MNCC_CONN_ELEM_TRANS) | |
3726 { | |
3727 return (FldGet (cc_data->mscap.datCap2,TPadSup) NEQ 0); | |
3728 } | |
3729 return (FldGet (cc_data->mscap.datCap2,NTPadSup) NEQ 0); | |
3730 | |
3731 case MNCC_BEARER_SERV_PACKET_ACCESS: | |
3732 if (bcpara->conn_elem EQ MNCC_CONN_ELEM_TRANS) | |
3733 { | |
3734 return (FldGet (cc_data->mscap.datCap2, TPackSup) NEQ 0); | |
3735 } | |
3736 return (FldGet (cc_data->mscap.datCap2, NTPackSup) NEQ 0); | |
3737 | |
3738 case MNCC_BEARER_SERV_FAX: | |
3739 if (bcpara->conn_elem EQ MNCC_CONN_ELEM_TRANS) | |
3740 { | |
3741 return (FldGet (cc_data->mscap.datCap1, TFaxSup) NEQ 0); | |
3742 } | |
3743 return FALSE; | |
3744 | |
3745 case MNCC_BEARER_SERV_SPEECH: | |
3746 case MNCC_BEARER_SERV_AUX_SPEECH: | |
3747 case MNCC_BEARER_SERV_SPEECH_CTM: | |
3748 case MNCC_BEARER_SERV_AUX_SPEECH_CTM: | |
3749 return cc_voice_capability (); | |
3750 | |
3751 case MNCC_BEARER_SERV_NOT_PRES: | |
3752 return TRUE; | |
3753 | |
3754 default: | |
3755 return FALSE; | |
3756 } | |
3757 } | |
3758 | |
3759 #ifdef SIM_TOOLKIT | |
3760 /* | |
3761 +--------------------------------------------------------------------+ | |
3762 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3763 | STATE : code ROUTINE : cc_bearer_cap_code | | |
3764 +--------------------------------------------------------------------+ | |
3765 | |
3766 PURPOSE: Checks the compatibility of bearer capabilities. | |
3767 Bearer capabilities in paramter form are tranformed to | |
3768 coded form. | |
3769 | |
3770 RETURN VALUE: ERROR if bearer caps not supported, otherwise OKAY | |
3771 Special case of no bearer caps given is OKAY. | |
3772 | |
3773 */ | |
3774 | |
3775 GLOBAL UBYTE cc_bearer_cap_code (const T_MNCC_bcpara *bcpara, T_MNCC_bcconf *bcconf ) | |
3776 { | |
3777 T_M_CC_bearer_cap bearer_cap; /* A lot of stuff on stack */ /*lint !e813 length info of struct*/ | |
3778 UBYTE dummy_service; | |
3779 UBYTE *ptr; | |
3780 UBYTE result; | |
3781 | |
3782 TRACE_FUNCTION ("cc_bearer_cap_code()"); | |
3783 | |
3784 /* Clear output */ | |
3785 bcconf->bc_len = 0; | |
3786 memset (bcconf->bc, 0x00, sizeof (bcconf->bc)); | |
3787 | |
3788 if (bcpara->bearer_serv EQ MNCC_BEARER_SERV_NOT_PRES) | |
3789 return OKAY; /* No BC in -> no BC out */ | |
3790 | |
3791 /* | |
3792 * Check requested upper layer capabilities | |
3793 * against mobile station capabilities | |
3794 */ | |
3795 if (cc_check_capabilities (bcpara) EQ FALSE) | |
3796 { | |
3797 /* MS doesn't support the requested services */ | |
3798 return ERROR; | |
3799 } | |
3800 | |
3801 cc_build_bc (&bearer_cap, | |
3802 &dummy_service, /* Not used */ | |
3803 bcpara); | |
3804 | |
3805 /* | |
3806 * Build a U_EMERGE_SETUP message which contains the coded bearer caps. | |
3807 * The U_EMERGE_SETUP message was chosen because it is the most | |
3808 * simple message containing bearer capabilities. In the next step, | |
3809 * read the coded bearer capabilities directly from this message. | |
3810 */ | |
3811 CCD_START; | |
3812 { | |
3813 MCAST (emerge_setup, U_EMERGE_SETUP); | |
3814 PALLOC_MSG (data, MMCM_DATA_REQ, U_EMERGE_SETUP); | |
3815 | |
3816 emerge_setup->msg_type = U_EMERGE_SETUP; | |
3817 emerge_setup->v_bearer_cap = TRUE; | |
3818 emerge_setup->bearer_cap = bearer_cap; | |
3819 data->sdu.o_buf = CC_ENCODE_OFFSET; | |
3820 ccd_codeMsg (CCDENT_CC, | |
3821 UPLINK, | |
3822 (T_MSGBUF *) &data->sdu, | |
3823 (UBYTE *) emerge_setup, | |
3824 NOT_PRESENT_8BIT); | |
3825 | |
3826 ptr = &data->sdu.buf[CC_ENCODE_OFFSET >> 3]; | |
3827 | |
3828 /* | |
3829 * The following is an internal check and not expected to fail. | |
3830 * Short circuit evaluation, ANSI C guarantees execution order LR here. | |
3831 */ | |
3832 if ((*ptr++ EQ U_EMERGE_SETUP) AND /* Message type */ | |
3833 (*ptr++ EQ 0x04) AND /* BC tag (0x04) */ | |
3834 (*ptr <= sizeof (bcconf->bc))) /* Field length not exceeded */ | |
3835 { | |
3836 result = OKAY; | |
3837 bcconf->bc_len = *ptr++; | |
3838 memcpy (bcconf->bc, ptr, bcconf->bc_len); | |
3839 } | |
3840 else | |
3841 result = ERROR; | |
3842 PFREE (data); | |
3843 } | |
3844 CCD_END; | |
3845 | |
3846 return result; | |
3847 } | |
3848 | |
3849 /* | |
3850 +--------------------------------------------------------------------+ | |
3851 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3852 | STATE : code ROUTINE : cc_bearer_cap_decode | | |
3853 +--------------------------------------------------------------------+ | |
3854 | |
3855 PURPOSE: Checks the compatibility of bearer capabilities. | |
3856 Bearer capabilities in coded form are tranformed to | |
3857 parameter form. | |
3858 | |
3859 RETURN VALUE: ERROR if bearer caps not supported | |
3860 Special case of empty bearer caps given is OKAY | |
3861 | |
3862 */ | |
3863 | |
3864 GLOBAL UBYTE cc_bearer_cap_decode (const T_MNCC_bcconf *bcconf, T_MNCC_bcpara *bcpara ) | |
3865 | |
3866 { | |
3867 T_M_CC_bearer_cap dummy_neg_bearer_cap; /* A lot of stuff on stack */ /*lint !e813 length info of struct*/ | |
3868 UBYTE dummy_service; | |
3869 BOOL dummy_negotiation; | |
3870 UBYTE * start_ptr; | |
3871 UBYTE * ptr; | |
3872 BYTE result; | |
3873 | |
3874 TRACE_FUNCTION ("cc_bearer_cap_decode()"); | |
3875 | |
3876 bcpara->bearer_serv = MNCC_BEARER_SERV_NOT_PRES; | |
3877 | |
3878 if (bcconf->bc_len EQ 0) | |
3879 return OKAY; /* No BC in -> no BC out */ | |
3880 | |
3881 CCD_START | |
3882 { | |
3883 /* | |
3884 * Build a U_EMERGE_SETUP message which contains the coded bearer caps. | |
3885 * The U_EMERGE_SETUP message was chosen because it is the most | |
3886 * simple message containing bearer capabilities. | |
3887 */ | |
3888 MCAST (emerge_setup, U_EMERGE_SETUP); | |
3889 PALLOC_MSG (data, MMCM_DATA_REQ, U_EMERGE_SETUP); | |
3890 data->sdu.o_buf = CC_ENCODE_OFFSET; | |
3891 ptr = start_ptr = &data->sdu.buf[CC_ENCODE_OFFSET >> 3]; | |
3892 *ptr++ = U_EMERGE_SETUP; /* Message type field */ | |
3893 *ptr++ = 0x04; /* BC tag */ | |
3894 *ptr++ = bcconf->bc_len; /* BC length */ | |
3895 memcpy(ptr, bcconf->bc, bcconf->bc_len); | |
3896 ptr += bcconf->bc_len; | |
3897 data->sdu.l_buf = (ptr - start_ptr) << 3; | |
3898 | |
3899 result = ERROR; | |
3900 if ((ccd_decodeMsg (CCDENT_CC, | |
3901 UPLINK, | |
3902 (T_MSGBUF *) &data->sdu, | |
3903 (UBYTE *)_decodedMsg, | |
3904 NOT_PRESENT_8BIT) EQ ccdOK)) | |
3905 { | |
3906 if (emerge_setup->v_bearer_cap) | |
3907 { | |
3908 /* | |
3909 * CCD was able to decode emergency setup message | |
3910 * and contained BC. Check them. | |
3911 * This also transforms coded form into parameter form as desired | |
3912 */ | |
3913 if(emerge_setup->bearer_cap.v_rad_chan_req) | |
3914 { | |
3915 bcpara->rad_chan_req = emerge_setup->bearer_cap.rad_chan_req ; | |
3916 TRACE_EVENT_P1 ("bcpara->rad_chan_req = %d", bcpara->rad_chan_req ); | |
3917 } | |
3918 result = cc_check_bc (&emerge_setup->bearer_cap, /* Input BC */ | |
3919 &dummy_neg_bearer_cap, /* Not used */ | |
3920 bcpara, /* BC parameter */ | |
3921 &dummy_service, /* Not used */ | |
3922 &dummy_negotiation ); /* Not used */ | |
3923 } | |
3924 } | |
3925 PFREE (data); | |
3926 } | |
3927 CCD_END; | |
3928 | |
3929 return result; | |
3930 } | |
3931 | |
3932 #endif /*SIM_TOOLKIT */ | |
3933 | |
3934 /* | |
3935 +--------------------------------------------------------------------+ | |
3936 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
3937 | STATE : code ROUTINE : cc_build_llc | | |
3938 +--------------------------------------------------------------------+ | |
3939 | |
3940 PURPOSE : Define low layer compat depending on the bearer capability | |
3941 parameters. | |
3942 | |
3943 */ | |
3944 | |
3945 static const UBYTE BC_LLC_USERRATE[8] = | |
3946 { | |
3947 /* reserved 0000 */ 0, | |
3948 /* 0.3 0001 */ 0x1E, | |
3949 /* 1.2 0010 */ 2, | |
3950 /* 2.4 0011 */ 3, | |
3951 /* 4.8 0100 */ 5, | |
3952 /* 9.6 0101 */ 8, | |
3953 /* 12.0 transp 0110 */ 0x1F, | |
3954 /* 12.0/75 0111 */ 0x18 | |
3955 }; | |
3956 | |
3957 static const UBYTE BC_LLC_INTERMED_RATE [4] = | |
3958 { | |
3959 /* not used 00 */ 0x00, | |
3960 /* not used 01 */ 0x00, | |
3961 /* 8 kbit/s 10 */ 0x20, | |
3962 /* 16 kbit/s 11 */ 0x40 | |
3963 }; | |
3964 | |
3965 GLOBAL void cc_build_llc (UBYTE * v_low_layer_compat, | |
3966 T_M_CC_low_layer_comp * low_layer_compat, | |
3967 const T_M_CC_bearer_cap * bc) | |
3968 { | |
3969 TRACE_FUNCTION ("cc_build_llc()"); | |
3970 | |
3971 /* | |
3972 * infoelement shall be included | |
3973 */ | |
3974 *v_low_layer_compat = TRUE; | |
3975 | |
3976 if (bc->trans_cap EQ M_CC_ITC_DIGITAL_UNRESTRICTED) | |
3977 { | |
3978 /* | |
3979 * length is fixed with 6 bytes | |
3980 */ | |
3981 low_layer_compat->c_llc = 6; | |
3982 | |
3983 /* | |
3984 * octet 3 | |
3985 * | |
3986 * bit 8 : extension = 1 (fixed) | |
3987 * bit 76 : coding standard = GSM (fixed) | |
3988 * bit 54321 : information transfer capability = UDI (fixed) | |
3989 */ | |
3990 low_layer_compat->llc[0] = 0x88; | |
3991 | |
3992 /* | |
3993 * octet 4 | |
3994 * | |
3995 * bit 8 : extension = 1 (fixed) | |
3996 * bit 76 : transfer mode = circuit (fixed) | |
3997 * bit 54321 : information transfer rate = 64 kbit/s (fixed) | |
3998 */ | |
3999 low_layer_compat->llc[1] = 0x90; | |
4000 | |
4001 /* | |
4002 * octet 5 | |
4003 * | |
4004 * bit 8 : extension = 0 (fixed) | |
4005 * bit 76 : layer 1 identifier = 1 (fixed) | |
4006 * bit 54321 : user information layer 1 protocol = V.110 (fixed) | |
4007 */ | |
4008 low_layer_compat->llc[2] = 0x21; | |
4009 | |
4010 /* | |
4011 * octet 5a | |
4012 * | |
4013 * bit 8 : extension = 0 (fixed) | |
4014 * bit 7 : sync/async -> from BC | |
4015 * BC LLC | |
4016 * M_CC_ASYNCHRONOUS 1 1 | |
4017 * M_CC_SYNCHRONOUS 0 0 | |
4018 * bit 6 : negotiation = 0 (fixed) | |
4019 * bit 54321 : user rate -> from BC | |
4020 BC LLC | |
4021 0.3 0001 11110 | |
4022 1.2 0010 00010 | |
4023 2.4 0011 00011 | |
4024 4.8 0100 00101 | |
4025 9.6 0101 01000 | |
4026 12.0 transp 0110 11111 | |
4027 12.0/75 0111 11000 | |
4028 */ | |
4029 | |
4030 if (bc->sync_async) | |
4031 low_layer_compat->llc[3] = 0x40; | |
4032 else | |
4033 low_layer_compat->llc[3] = 0x00; | |
4034 | |
4035 low_layer_compat->llc[3] += BC_LLC_USERRATE[bc->user_rate & 7]; | |
4036 | |
4037 /* | |
4038 * octet 5b | |
4039 * | |
4040 * bit 8 : extension = 0 (fixed) | |
4041 * bit 76 : intermediate rate -> from BC | |
4042 * BC LLC | |
4043 * not used 00/01 00 | |
4044 * 8 kbit/s 10 01 | |
4045 * 16 kbit/s 11 10 | |
4046 * 32 kbit/s -- 11 | |
4047 * bit 5 : NIC/TX = 0 (fixed) | |
4048 * bit 4 : NIC/RX = 0 (fixed) | |
4049 * bit 3 : Flow Control on Tx = 0 (fixed) | |
4050 * bit 2 : Flow Control on Rx = 0 (fixed) | |
4051 * bit 1 : Spare = 0 (fixed) | |
4052 */ | |
4053 low_layer_compat->llc[4] = BC_LLC_INTERMED_RATE[bc->intermed_rate]; | |
4054 | |
4055 /* | |
4056 * octet 5c | |
4057 * | |
4058 * bit 8 : extension = 1 (fixed) | |
4059 * bit 76 : number of stop bits -> BC | |
4060 * BC LLC | |
4061 * not used -- 00 | |
4062 * 1 bit 0 01 | |
4063 * 1.5 bits -- 10 | |
4064 * 2 bits 1 11 | |
4065 * bit 54 : number of data bits -> BC | |
4066 * BC LLC | |
4067 * not used 00 | |
4068 * 5 bits 01 | |
4069 * 7 bits 0 10 | |
4070 * 8 bits 1 11 | |
4071 * bit 321 : parity -> BC | |
4072 * BC LLC | |
4073 * odd 000 000 | |
4074 * even 010 010 | |
4075 * none 011 011 | |
4076 * forced to 0 100 100 | |
4077 * forced to 1 101 101 | |
4078 */ | |
4079 low_layer_compat->llc[5] = 0x80 + bc->parity; | |
4080 | |
4081 if (bc->num_stop) | |
4082 low_layer_compat->llc[5] += 0x60; | |
4083 else | |
4084 low_layer_compat->llc[5] += 0x20; | |
4085 | |
4086 if (bc->num_data) | |
4087 low_layer_compat->llc[5] += 0x18; | |
4088 else | |
4089 low_layer_compat->llc[5] += 0x10; | |
4090 } | |
4091 else | |
4092 { | |
4093 /* | |
4094 * set length to zero -> not applicable | |
4095 */ | |
4096 memset (low_layer_compat, 0, sizeof (T_M_CC_low_layer_comp)); | |
4097 } | |
4098 } | |
4099 | |
4100 /* | |
4101 +--------------------------------------------------------------------+ | |
4102 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
4103 | STATE : code ROUTINE : cc_get_ss_diag | | |
4104 +--------------------------------------------------------------------+ | |
4105 | |
4106 PURPOSE : Added for CQ23619: Extracts the supplementary diagnostic | |
4107 from the disconnect indication if there a respective cause given. | |
4108 For further details see: TS 24.008 section 10.5.4.11 "NOTE 1" | |
4109 (This implementation follows version V3.19.0 (2004-06)) | |
4110 | |
4111 IN: - curr_cause: current cause | |
4112 - disconnect indication received by CC | |
4113 OUT:- ss_diag: ss diagnostic | |
4114 */ | |
4115 | |
4116 GLOBAL UBYTE cc_get_ss_diag ( USHORT curr_cause, | |
4117 T_D_DISCONNECT * disc) | |
4118 { | |
4119 | |
4120 UBYTE ss_diag = MNCC_SS_DIAG_NOT_PROVIDED; /* holds the ss diagnostic */ | |
4121 | |
4122 TRACE_FUNCTION ("cc_get_ss_diag()"); | |
4123 | |
4124 /* | |
4125 * Only the following causes may also provide a supplementary diagnostic value | |
4126 * - cause 17: User busy - MNCC_CAUSE_USER_BUSY | |
4127 * - cause 29: Facility rejected - MNCC_CAUSE_FACILITY_REJECT | |
4128 * - cause 34: No circuit/channel available - MNCC_CAUSE_NO_CHAN_AVAIL | |
4129 * - cause 50: Requested facility not subscribed - MNCC_CAUSE_FACILITY_UNSUBSCRIB | |
4130 * - cause 55: Incoming call barred within the CUG - MNCC_CAUSE_BARRED_IN_CUG | |
4131 * - cause 69: Requested facility not implemented - MNCC_CAUSE_FACILITY_NOT_IMPLEM | |
4132 * - cause 87: User not member of CUG - MNCC_CAUSE_USER_NOT_IN_CUG | |
4133 */ | |
4134 switch (curr_cause) | |
4135 { | |
4136 case MNCC_CAUSE_USER_BUSY: | |
4137 case MNCC_CAUSE_FACILITY_REJECT: | |
4138 case MNCC_CAUSE_NO_CHAN_AVAIL: | |
4139 case MNCC_CAUSE_FACILITY_UNSUBSCRIB: | |
4140 case MNCC_CAUSE_BARRED_IN_CUG: | |
4141 case MNCC_CAUSE_FACILITY_NOT_IMPLEM: | |
4142 case MNCC_CAUSE_USER_NOT_IN_CUG: | |
4143 /* | |
4144 * parse ss diagnostic, find details of encoding in TS 24.008 | |
4145 * section 10.5.4.11 "NOTE 1" | |
4146 */ | |
4147 if(disc->cc_cause.c_diag > 0) /* check count of diag elements */ | |
4148 { | |
4149 /* take the first byte, ignore the rest */ | |
4150 ss_diag = disc->cc_cause.diag[0] & 0x7F; | |
4151 if (ss_diag EQ 0x7F) | |
4152 { | |
4153 ss_diag = MNCC_SS_DIAG_NOT_PROVIDED; | |
4154 } | |
4155 } | |
4156 break; | |
4157 default: | |
4158 /* force MNCC_SS_DIAG_NOT_PROVIDED return */ | |
4159 break; | |
4160 } /* end of switch (curr_cause) */ | |
4161 | |
4162 return ss_diag; | |
4163 } | |
4164 | |
4165 /* | |
4166 +--------------------------------------------------------------------+ | |
4167 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
4168 | STATE : code ROUTINE : cc_build_cause | | |
4169 +--------------------------------------------------------------------+ | |
4170 | |
4171 PURPOSE : Added for CQ62853: We have to pass the cause byte stream as | |
4172 sent by the network to ACI. This has been done to satisfy the SAT test | |
4173 case 27.22.4.16-2 for event download(CALL DISCONNECTED). | |
4174 | |
4175 IN: - decoded_cause_val: decoded cause value | |
4176 OUT:- raw_cause_length: Number of bytes in raw_cause_bytes | |
4177 raw_cause_bytes: Encoded bytes as in 24.008 v3.15.0 sec 10.5.4.11 | |
4178 */ | |
4179 | |
4180 GLOBAL UBYTE cc_build_cause (T_M_CC_cc_cause * decoded_cause_val, | |
4181 UBYTE * raw_cause_bytes) | |
4182 { | |
4183 | |
4184 UBYTE cause_ix = 0; | |
4185 | |
4186 TRACE_FUNCTION ("cc_build_cause()"); | |
4187 | |
4188 memset(raw_cause_bytes, 0, MNCC_MAX_CC_CAUSE_LENGTH); | |
4189 | |
4190 /* Fill the coding standard and the location fields */ | |
4191 raw_cause_bytes[cause_ix] = (decoded_cause_val->cs << 5) | decoded_cause_val->loc; | |
4192 | |
4193 if(decoded_cause_val->v_rec) | |
4194 { | |
4195 /* ext bit is not set in the first byte. Move to the next byte */ | |
4196 cause_ix++; | |
4197 /* recommendation value is copied and ext bit is set */ | |
4198 raw_cause_bytes[cause_ix++] = decoded_cause_val->rec | 0x80; | |
4199 } | |
4200 else | |
4201 { | |
4202 /* If the recommendation field is not present, set the ext bit in the first byte*/ | |
4203 raw_cause_bytes[cause_ix] = raw_cause_bytes[cause_ix] | 0x80; | |
4204 cause_ix++; | |
4205 } | |
4206 | |
4207 /* Fill the cause value and set the ext bit */ | |
4208 raw_cause_bytes[cause_ix++] = decoded_cause_val->cause | 0x80; | |
4209 | |
4210 /* Fill the diagnostics value */ | |
4211 if(decoded_cause_val->c_diag NEQ 0) | |
4212 { | |
4213 memcpy (raw_cause_bytes + cause_ix, | |
4214 decoded_cause_val->diag, | |
4215 decoded_cause_val->c_diag); | |
4216 } | |
4217 | |
4218 /* Return the number of bytes that have been filled */ | |
4219 return (cause_ix + decoded_cause_val->c_diag); | |
4220 } | |
4221 | |
4222 | |
4223 /* Implements Measure# 21 */ | |
4224 /* | |
4225 +--------------------------------------------------------------------+ | |
4226 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
4227 | STATE : code ROUTINE : cc_set_neg_bearer_cap | | |
4228 +--------------------------------------------------------------------+ | |
4229 | |
4230 PURPOSE : Copy some bearer capabilities values | |
4231 */ | |
4232 | |
4233 LOCAL void cc_set_neg_bearer_cap (const T_M_CC_bearer_cap * bearer_cap, | |
4234 T_MNCC_bcpara * bcpara, | |
4235 T_M_CC_bearer_cap * neg_bearer_cap, | |
4236 EF_MSCAP mscap) | |
4237 { | |
4238 | |
4239 TRACE_FUNCTION ("cc_set_neg_bearer_cap()"); | |
4240 | |
4241 if (bearer_cap->v_fnur AND (bearer_cap->fnur EQ M_CC_FNUR_14400)) | |
4242 { | |
4243 bcpara->rate = MNCC_UR_14_4_KBIT; | |
4244 /* | |
4245 * define acceptable channel codings | |
4246 */ | |
4247 neg_bearer_cap->acc = M_CC_ACC_96; | |
4248 if (FldGet (mscap.datCap2, DHRSup)) | |
4249 { | |
4250 neg_bearer_cap->acc += M_CC_ACC_48; | |
4251 } | |
4252 if (FldGet (mscap.datCap1, Dr14_4Sup)) | |
4253 { | |
4254 neg_bearer_cap->acc += M_CC_ACC_144; | |
4255 } | |
4256 neg_bearer_cap->v_acc = TRUE; | |
4257 | |
4258 neg_bearer_cap->v_intermed_rate = TRUE; | |
4259 neg_bearer_cap->intermed_rate = M_CC_IR_16_KBIT; | |
4260 neg_bearer_cap->v_mTch = TRUE; | |
4261 neg_bearer_cap->mTch = M_CC_MAX_TCH_1; | |
4262 neg_bearer_cap->v_uimi = TRUE; | |
4263 neg_bearer_cap->uimi = M_CC_UIMI_NOT_ALLOWED; | |
4264 neg_bearer_cap->v_waiur = TRUE; | |
4265 neg_bearer_cap->waiur = M_CC_WAIUR_14400; | |
4266 neg_bearer_cap->v_modem_type_2 = TRUE; | |
4267 neg_bearer_cap->modem_type_2 = M_CC_OTHER_MODEM_TYPE_V34; | |
4268 } | |
4269 else | |
4270 { | |
4271 bcpara->rate = bearer_cap->user_rate; | |
4272 } | |
4273 | |
4274 /* ITC - Information Transfer Capability */ | |
4275 if (bearer_cap->trans_cap == M_CC_ITC_DIGITAL_UNRESTRICTED) | |
4276 { | |
4277 bcpara->transfer_cap = MNCC_ITC_UDI; | |
4278 } | |
4279 else if (bearer_cap->trans_cap == M_CC_ITC_AUDIO) | |
4280 { | |
4281 bcpara->transfer_cap = MNCC_ITC_NONE; | |
4282 } | |
4283 bcpara->bearer_serv = MNCC_BEARER_SERV_ASYNC; | |
4284 bcpara->stop_bits = bearer_cap->num_stop; | |
4285 bcpara->data_bits = bearer_cap->num_data; | |
4286 bcpara->parity = bearer_cap->parity; | |
4287 | |
4288 if (bearer_cap->modem_type_2 == M_CC_OTHER_MODEM_TYPE_V34) | |
4289 { | |
4290 bcpara->modem_type = MNCC_MT_V34; | |
4291 } | |
4292 else | |
4293 { | |
4294 bcpara->modem_type = bearer_cap->modem_type; | |
4295 } | |
4296 | |
4297 } | |
4298 | |
4299 /* Implements Measure# 15 */ | |
4300 /* | |
4301 +--------------------------------------------------------------------+ | |
4302 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
4303 | STATE : code ROUTINE : cc_fill_struct | | |
4304 +--------------------------------------------------------------------+ | |
4305 | |
4306 PURPOSE : Copy values from setup_ind to setup_cnf | |
4307 */ | |
4308 | |
4309 LOCAL void cc_fill_struct (UBYTE is_num_pres, | |
4310 T_MNCC_calling_party *calling_party, | |
4311 const T_M_CC_calling_num *calling_num) | |
4312 { | |
4313 | |
4314 if (is_num_pres) | |
4315 { | |
4316 calling_party->ton = calling_num->ton; | |
4317 calling_party->npi = calling_num->npi; | |
4318 calling_party->c_num = calling_num->c_num; | |
4319 memcpy (calling_party->num, calling_num->num, | |
4320 calling_num->c_num); | |
4321 if (calling_num->v_screen) | |
4322 { | |
4323 calling_party->screen = calling_num->screen; | |
4324 } | |
4325 else | |
4326 { | |
4327 calling_party->screen = NOT_PRESENT_8BIT; | |
4328 } | |
4329 if (calling_num->v_present) | |
4330 { | |
4331 calling_party->present = calling_num->present; | |
4332 } | |
4333 else | |
4334 { | |
4335 calling_party->present = NOT_PRESENT_8BIT; | |
4336 } | |
4337 } | |
4338 else | |
4339 { | |
4340 calling_party->ton = MNCC_TON_NOT_PRES; | |
4341 calling_party->npi = MNCC_NPI_NOT_PRES; | |
4342 calling_party->present = MNCC_PRES_NOT_PRES; | |
4343 calling_party->screen = MNCC_SCREEN_IND_NOT_PRES; | |
4344 calling_party->c_num = 0; | |
4345 } | |
4346 } | |
4347 | |
4348 | |
4349 /* Implements Measure# 24, 25 and 26 */ | |
4350 /* | |
4351 +--------------------------------------------------------------------+ | |
4352 | PROJECT : GSM-PS (6147) MODULE : CC_CFK | | |
4353 | STATE : code ROUTINE : cc_fill_sub_struct | | |
4354 +--------------------------------------------------------------------+ | |
4355 | |
4356 PURPOSE : Copy values from setup_cnf to setup_ind | |
4357 */ | |
4358 | |
4359 LOCAL void cc_fill_sub_struct (UBYTE is_num_pres, | |
4360 T_MNCC_connected_number_sub *connected_number_sub, | |
4361 const T_M_CC_connect_subaddr *connect_subaddr) | |
4362 { | |
4363 if (is_num_pres) | |
4364 { | |
4365 connected_number_sub->tos = connect_subaddr->tos; | |
4366 connected_number_sub->odd_even = | |
4367 connect_subaddr->odd_even; | |
4368 connected_number_sub->c_subaddr = | |
4369 connect_subaddr->c_subaddr; | |
4370 memcpy (connected_number_sub->subaddr, | |
4371 connect_subaddr->subaddr, MNCC_SUB_LENGTH); | |
4372 } | |
4373 else | |
4374 { | |
4375 connected_number_sub->tos = NOT_PRESENT_8BIT; | |
4376 connected_number_sub->c_subaddr = 0; | |
4377 } | |
4378 } | |
4379 #endif |