comparison src/g23m-gsm/cc/cc_ffk.c @ 104:27a4235405c6

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