comparison g23m-gsm/cc/cc_ffk.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_FFK
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 FORMATTER.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CC_FFK_C
23 #define CC_FFK_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 /*==== PRIVAT =====================================================*/
50
51 /*==== VARIABLES ==================================================*/
52
53 /*==== FUNCTIONS ==================================================*/
54 /*
55 +--------------------------------------------------------------------+
56 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
57 | STATE : code ROUTINE : for_check_called_party_bcd |
58 +--------------------------------------------------------------------+
59
60 PURPOSE : Checks the content of a called party bcd information
61 element.
62
63 */
64
65 GLOBAL BOOL for_check_called_party_bcd (UBYTE ton, UBYTE npi)
66 {
67 TRACE_FUNCTION ("for_check_called_party_bcd()");
68
69 /*
70 * Check numbering type
71 */
72 if (ton <= M_CC_TON_DEDICATED)
73 {
74 /*
75 * Check numbering plan
76 */
77 switch (npi)
78 {
79 case M_CC_NPI_UNKNOWN:
80 case M_CC_NPI_ISDN:
81 case M_CC_NPI_X121:
82 case M_CC_NPI_F69:
83 case M_CC_NPI_NATIONAL:
84 case M_CC_NPI_PRIVATE:
85 return TRUE;
86 default:
87 break;
88 }
89 }
90 return FALSE;
91 }
92
93 /*
94 +--------------------------------------------------------------------+
95 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
96 | STATE : code ROUTINE : for_check_called_party_sub |
97 +--------------------------------------------------------------------+
98
99 PURPOSE : Checks the content of a called party sub information
100 element.
101
102 */
103
104 GLOBAL BOOL for_check_called_party_sub (T_M_CC_called_subaddr * called_subaddr)
105 {
106 TRACE_FUNCTION ("for_check_called_party_sub()");
107
108 switch (called_subaddr->tos)
109 {
110 case M_CC_TOS_NSAP:
111 case M_CC_TOS_USER:
112 return TRUE;
113 default:
114 return FALSE;
115 }
116 }
117
118 /*
119 +--------------------------------------------------------------------+
120 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
121 | STATE : code ROUTINE : for_check_calling_party_bcd|
122 +--------------------------------------------------------------------+
123
124 PURPOSE : Checks the content of a calling party bcd information
125 element.
126
127 */
128
129 GLOBAL BOOL for_check_calling_party_bcd (T_M_CC_calling_num * calling_num)
130 {
131 TRACE_FUNCTION ("for_check_calling_party_bcd()");
132
133 /*
134 * Check numbering type
135 */
136 if (calling_num->ton <= M_CC_TON_DEDICATED)
137 {
138 /*
139 * Check numbering plan
140 */
141 switch (calling_num->npi)
142 {
143 case M_CC_NPI_UNKNOWN:
144 case M_CC_NPI_ISDN:
145 case M_CC_NPI_X121:
146 case M_CC_NPI_F69:
147 case M_CC_NPI_NATIONAL:
148 case M_CC_NPI_PRIVATE:
149 break;
150 default:
151 return FALSE;
152 }
153 /*
154 * Check Present Indicator
155 */
156 if (calling_num->v_present AND
157 (calling_num->present > M_CC_PRES_NOT_AVAIL))
158 return FALSE;
159 else
160 return TRUE;
161 }
162 return FALSE;
163 }
164
165 /*
166 +--------------------------------------------------------------------+
167 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
168 | STATE : code ROUTINE : for_check_calling_party_sub |
169 +--------------------------------------------------------------------+
170
171 PURPOSE : Checks the content of a calling party sub information
172 element.
173
174 */
175
176 GLOBAL BOOL for_check_calling_party_sub (T_M_CC_calling_subaddr * calling_subaddr)
177 {
178 TRACE_FUNCTION ("for_check_calling_party_sub()");
179
180 switch (calling_subaddr->tos)
181 {
182 case M_CC_TOS_NSAP:
183 case M_CC_TOS_USER:
184 return TRUE;
185 default:
186 return FALSE;
187 }
188 }
189
190 /*
191 +--------------------------------------------------------------------+
192 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
193 | STATE : code ROUTINE : for_check_callstate |
194 +--------------------------------------------------------------------+
195
196 PURPOSE : Checks the content of a callstate information
197 element.
198
199 */
200
201 GLOBAL void for_check_call_state (T_M_CC_call_state * call_state)
202 {
203 TRACE_FUNCTION ("for_check_call_state()");
204
205 if ( call_state->cs NEQ M_CC_CS_GSM_PLMN ) /* VK 04-jul-97 */
206 call_state->state = M_CC_CS_10; /* VK 04-jul-97 */
207 }
208
209 /*
210 +--------------------------------------------------------------------+
211 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
212 | STATE : code ROUTINE : for_check_cc_cause |
213 +--------------------------------------------------------------------+
214
215 PURPOSE : Checks the content of a cc cause information
216 element.
217
218 */
219
220 GLOBAL BOOL for_check_cc_cause (T_M_CC_cc_cause* cc_cause)
221 {
222 TRACE_FUNCTION ("for_check_cc_cause()");
223 //TISH patch for OMAPS00129223
224 #if 0
225 /*
226 * this is a (dirty) "trick" to detect that the cause IE was not present
227 * although mandatory (for some messages): value 0 is reserved, i.e. it is not
228 * expected that it will be sent by a network; CCD/the frame ensures that the
229 * memory contents is 0 which will be seen as value if the cause IE was not present
230 */
231 if (cc_cause->cause EQ 0)
232 return FALSE;
233 #endif
234 /*
235 * coding standards other than GSM are not supported (which is a valid option);
236 * map the cause value to interworking, unspecified then, skip further checks
237 */
238 if (cc_cause->cs NEQ M_CC_CS_GSM_PLMN )
239 {
240 cc_cause->cause = M_CC_CAUSE_INTERWORKING;
241 return TRUE;
242 }
243
244 /* check for reserved Location (octet 3) */
245 switch (cc_cause->loc)
246 {
247 case M_CC_LOC_USER:
248 case M_CC_LOC_PRIV_NET_LOCAL_USER:
249 case M_CC_LOC_PUB_NET_LOCAL_USER:
250 case M_CC_LOC_TRANSIT_NET:
251 case M_CC_LOC_PRIV_NET_REMOTE_USER:
252 case M_CC_LOC_PUB_NET_REMOTE_USER:
253 case M_CC_LOC_INTERNATIONAL_NET:
254 case M_CC_LOC_BEYOND_POINT:
255 break;
256 default:
257 return FALSE;
258 }
259
260 /* check Recommendation (octet 3a) */
261 /*
262 * the condition below also checks the value of octet 3a (if present);
263 * this stems from GSM 04.08 of Ph1 were the value 1 was defined as indicating
264 * GSM; since Ph2 there is the requirement that octet 3a shall not be included
265 * for coding standard being equal to GSM; however, the design decision is
266 * to keep the Ph1 behaviour in order to be a "tolerant" MS and to avoid
267 * interworking problems with Ph1 infrastructure, especially as this case is
268 * not treated in GSM 09.90
269 */
270 if (cc_cause->v_rec AND
271 (cc_cause->rec NEQ 1))
272 return FALSE;
273 else
274 return TRUE;
275 }
276
277 /*
278 +--------------------------------------------------------------------+
279 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
280 | STATE : code ROUTINE : for_check_progress_indicator|
281 +--------------------------------------------------------------------+
282
283 PURPOSE : Checks the content of a progress indicator information
284 element.
285
286 */
287
288 GLOBAL BOOL for_check_progress_indicator (T_M_CC_progress * progress)
289 {
290 TRACE_FUNCTION ("for_check_progress_indicator()");
291
292 /* coding standard and progress description are not in optional octets (3 and 4) */
293 if ((progress->v_cs EQ FALSE) OR
294 (progress->v_progress_desc EQ FALSE))
295 return FALSE;
296
297 /*
298 * map progress description to "Unspecific" if coding standard other than
299 * GSM is used; note that it is an option to not support coding standards
300 * other than GSM (which Condat takes)
301 */
302 if (progress->cs NEQ M_CC_CS_GSM_PLMN)
303 {
304 progress->progress_desc = MNCC_PROG_UNSPECIFIC;
305 return TRUE; /* don't care about reserved values for Location anymore of other standards */
306 }
307
308 /* check for reserved Location values */
309 switch (progress->loc)
310 {
311 case M_CC_LOC_USER:
312 case M_CC_LOC_PRIV_NET_LOCAL_USER:
313 case M_CC_LOC_PUB_NET_LOCAL_USER:
314 case M_CC_LOC_PRIV_NET_REMOTE_USER:
315 case M_CC_LOC_PUB_NET_REMOTE_USER:
316 case M_CC_LOC_BEYOND_POINT:
317 break;
318 default:
319 return FALSE;
320 }
321
322 return TRUE;
323 }
324
325 /*
326 +--------------------------------------------------------------------+
327 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
328 | STATE : code ROUTINE : for_check_repeat_indicator |
329 +--------------------------------------------------------------------+
330
331 PURPOSE : Checks the content of a repeat indicator information
332 element.
333
334 */
335
336 GLOBAL BOOL for_check_repeat_indicator (UBYTE repeat)
337 {
338 TRACE_FUNCTION ("for_check_repeat_indicator()");
339
340 if ((repeat EQ M_CC_REPEAT_CIRCULAR)
341 OR
342 (repeat EQ M_CC_REPEAT_SEQUENTIAL)
343 )
344 return TRUE;
345 else
346 return FALSE;
347 }
348
349 /*
350 +--------------------------------------------------------------------+
351 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
352 | STATE : code ROUTINE : for_check_signal |
353 +--------------------------------------------------------------------+
354
355 PURPOSE : Checks the content of a signal information
356 element.
357
358 */
359
360 GLOBAL BOOL for_check_signal (UBYTE signal)
361 {
362 TRACE_FUNCTION ("for_check_signal()");
363
364 if ((signal <= M_CC_SIGNAL_HOOK_OFF_ON)
365 OR
366 (signal EQ M_CC_SIGNAL_TONES_OFF)
367 OR
368 (signal EQ M_CC_SIGNAL_ALERT_OFF))
369 return TRUE;
370 else
371 return FALSE;
372 }
373
374 /*
375 +--------------------------------------------------------------------+
376 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
377 | STATE : code ROUTINE : for_set_conditional_error |
378 +--------------------------------------------------------------------+
379
380 PURPOSE : Stores a detected conditional error.
381
382 */
383
384 GLOBAL void for_set_conditional_error (UBYTE iei)
385 {
386 GET_INSTANCE_DATA;
387 TRACE_FUNCTION ("for_set_conditional_error()");
388
389 switch (cc_data->error)
390 {
391 case M_CC_CAUSE_INFO_ELEM_NOT_IMPLEM:
392 case M_CC_CAUSE_INVALID_MAND_INFO:
393 break;
394
395 default:
396 cc_data->error = M_CC_CAUSE_COND_INFO_ELEM;
397 if (cc_data->error_count < MAX_ERROR_TAGS)
398 cc_data->error_inf [cc_data->error_count++] = iei;
399 break;
400 }
401 }
402
403 /*
404 +--------------------------------------------------------------------+
405 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
406 | STATE : code ROUTINE : for_set_mandatory_error |
407 +--------------------------------------------------------------------+
408
409 PURPOSE : Stores a detected mandatory error.
410
411 */
412
413 GLOBAL void for_set_mandatory_error ( UBYTE iei)
414 {
415 GET_INSTANCE_DATA;
416 TRACE_FUNCTION ("for_set_mandatory_error()");
417
418 switch (cc_data->error)
419 {
420 case M_CC_CAUSE_INFO_ELEM_NOT_IMPLEM:
421 case M_CC_CAUSE_COND_INFO_ELEM:
422 cc_data->error_count = 0;
423 /*FALLTHROUGH*/ /*lint -fallthrough*/
424
425 default:
426 cc_data->error = M_CC_CAUSE_INVALID_MAND_INFO;
427 if (cc_data->error_count < MAX_ERROR_TAGS)
428 cc_data->error_inf [cc_data->error_count++] = iei;
429 break;
430 }
431 }
432
433 /*
434 +--------------------------------------------------------------------+
435 | PROJECT : GSM-PS (6147) MODULE : CC_FFK |
436 | STATE : code ROUTINE : for_set_optional_error |
437 +--------------------------------------------------------------------+
438
439 PURPOSE : Stores a detected optional error.
440
441 */
442
443 GLOBAL void for_set_optional_error ( UBYTE iei)
444 {
445 GET_INSTANCE_DATA;
446 TRACE_FUNCTION ("for_set_optional_error()");
447
448 switch (cc_data->error)
449 {
450 case M_CC_CAUSE_INVALID_MAND_INFO:
451 break;
452
453 case M_CC_CAUSE_COND_INFO_ELEM:
454 cc_data->error_count = 0;
455 /*FALLTHROUGH*/ /*lint -fallthrough*/
456
457 default:
458 /*
459 * Check whether the iei is compression required
460 */
461 if ((iei & 0xF0) EQ 0)
462 for_set_mandatory_error (iei);
463 else
464 {
465 cc_data->error = M_CC_CAUSE_INFO_ELEM_NOT_IMPLEM;
466 if (cc_data->error_count < MAX_ERROR_TAGS)
467 cc_data->error_inf [cc_data->error_count++] = iei;
468 }
469 break;
470 }
471 }
472
473 /*
474 +--------------------------------------------------------------------+
475 | | STATE : code ROUTINE : cc_check_critical_error |
476 +--------------------------------------------------------------------+
477
478 PURPOSE : This function checks wheter a critical error has been
479 detected in the air message. Critical errors which prevent
480 the treatment of an air message are
481 - invalid Message ID
482 - mandatory IE missing
483 - IE coded as comprehension required missing
484 */
485
486 GLOBAL BOOL cc_check_critical_error (UBYTE cc_err)
487 {
488 TRACE_FUNCTION ("cc_check_critical_error ()");
489 if (cc_err EQ M_CC_CAUSE_INVALID_MAND_INFO OR
490 cc_err EQ M_CC_CAUSE_MESSAGE_TYPE_NOT_IMPLEM OR
491 cc_err EQ M_CC_CAUSE_COND_INFO_ELEM OR
492 cc_err EQ M_CC_CAUSE_SERVICE_NOT_IMPLEM )
493 return (TRUE);
494 else
495 return (FALSE);
496 }
497
498 #endif