comparison g23m-gsm/mm/mm_forp.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 (8410)
4 | Modul : MM_FORP
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul defines the functions for the formatter
18 | capability of the module Mobility Management.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef MM_FORP_C
23 #define MM_FORP_C
24
25 #include "config.h"
26 #include "fixedconf.h"
27 #include "condat-features.h"
28
29 #define ENTITY_MM
30
31 /*==== INCLUDES ===================================================*/
32 #if defined (NEW_FRAME)
33
34 #include <string.h>
35 #include <stdlib.h>
36 #include <stddef.h>
37 #include "typedefs.h"
38 #include "pcm.h"
39 #include "pconst.cdg"
40 #include "mconst.cdg"
41 #include "message.h"
42 #include "ccdapi.h"
43 #include "vsi.h"
44 #include "custom.h"
45 #include "gsm.h"
46 #include "prim.h"
47 #include "cnf_mm.h"
48 #include "mon_mm.h"
49 #include "pei.h"
50 #include "tok.h"
51 #include "mm.h"
52
53 #else
54
55 #include <string.h>
56 #include <stdlib.h>
57 #include <stddef.h>
58 #include "stddefs.h"
59 #include "pcm.h"
60 #include "pconst.cdg"
61 #include "mconst.cdg"
62 #include "message.h"
63 #include "ccdapi.h"
64 #include "custom.h"
65 #include "gsm.h"
66 #include "prim.h"
67 #include "cnf_mm.h"
68 #include "mon_mm.h"
69 #include "vsi.h"
70 #include "pei.h"
71 #include "tok.h"
72 #include "mm.h"
73
74 #endif
75
76 /*==== EXPORT =====================================================*/
77
78 /*==== PRIVAT =====================================================*/
79
80 /*==== VARIABLES ==================================================*/
81
82 /*==== FUNCTIONS ==================================================*/
83
84 /*==== TEST =====================================================*/
85
86 /*
87 * -------------------------------------------------------------------
88 * PRIMITIVE Processing functions
89 * -------------------------------------------------------------------
90 */
91
92
93 #if 0
94 /*
95 +--------------------------------------------------------------------+
96 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
97 | STATE : code ROUTINE : for_init_mm_data |
98 +--------------------------------------------------------------------+
99
100 PURPOSE : Initialize the MM data for the module formatter.
101 This function is not referenced.
102
103 */
104
105 GLOBAL void for_init_mm_data (void)
106 {
107 TRACE_FUNCTION ("for_init_mm_data()");
108 }
109 #endif /* #if 0 */
110
111 /*
112 +--------------------------------------------------------------------+
113 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
114 | STATE : code ROUTINE : for_rr_data_ind |
115 +--------------------------------------------------------------------+
116
117 PURPOSE : Process the primitive RR_DATA_IND.
118
119 */
120
121 GLOBAL void for_rr_data_ind (T_RR_DATA_IND *rr_data_ind_org)
122 {
123 GET_INSTANCE_DATA;
124 UBYTE pd;
125 UBYTE ti;
126 U8 *payload;
127 U16 length;
128 /* Implements Measure#32: Row 14,...,24 */
129 PPASS (rr_data_ind_org, rr_data_ind, RR_DATA_IND);
130
131 TRACE_FUNCTION ("for_rr_data_ind()");
132 mm_data->error = 0;
133
134 GET_PD (rr_data_ind->sdu, pd);
135 GET_TI (rr_data_ind->sdu, ti);
136
137 if (pd EQ PD_MM)
138 {
139 if (! ti)
140 {
141 T_mob_class_2 mob_class_2;
142
143 csf_read_mobile_class_2 (&mob_class_2);
144
145 rr_data_ind->sdu.l_buf -= 8;
146 rr_data_ind->sdu.o_buf += 8;
147
148 if (ccd_decodeMsg (CCDENT_MM,
149 DOWNLINK,
150 (T_MSGBUF *) &rr_data_ind->sdu,
151 (UBYTE *) _decodedMsg,
152 NOT_PRESENT_8BIT) NEQ ccdOK)
153 {
154 U16 parlist [6];
155 U8 ccd_err;
156
157 memset (parlist,0, sizeof (parlist));
158 ccd_err = ccd_getFirstError (CCDENT_MM, parlist);
159
160 /*
161 * Error Handling
162 */
163
164 do /* Read errors */
165 {
166 switch (ccd_err)
167 {
168 case ERR_INVALID_MID: /* ignore message & send STATUS #97 */
169 mm_for_set_error (RC_MESSAGE_TYPE_NOT_IMPLEM);
170 break;
171 case ERR_MSG_LEN: /* will be activated soon by CCD; agreemen in RR
172 if decoding was continued outside MSG-buffer it
173 should be handled as mand. IE missing */
174 case ERR_MAND_ELEM_MISS: /* ignore message & send STATUS #96 */
175 case ERR_COMPREH_REQUIRED: /* ignore message & send STATUS #96 */
176 mm_for_set_error (RC_INVALID_MAND_MESSAGE);
177 break;
178 #if defined (WIN32) /* This part is interesting only in implementation
179 and testing; may be included if specific handling
180 for specific errors is required in future releases */
181 case ERR_IE_NOT_EXPECTED: /* ignore IE */
182 case ERR_IE_SEQUENCE: /* ignore IE */
183 case ERR_MAX_IE_EXCEED: /* ignore IE */
184 TRACE_EVENT_P1 ("IE ignored, CCD error code = %u", ccd_err);
185 break;
186 case ERR_PATTERN_MISMATCH:
187 case ERR_INVALID_TYPE:
188 TRACE_EVENT_P1 ("MNC decoding erroneous = %u", ccd_err);
189 break;
190 #endif /* #if defined (WIN32) */
191 default:
192 #if defined (WIN32)
193 TRACE_EVENT_P1 ("Unexpected warnings/errors = %u", ccd_err);
194 #endif /* #if defined (WIN32) */
195 break; /* No or non-interesting error */
196 }
197 ccd_err = ccd_getNextError (CCDENT_MM, parlist);
198 } while ( ccd_err NEQ ERR_NO_MORE_ERROR
199 AND !mm_check_critical_error() );
200 } /* if (ccd_ ... */
201
202 if (!mm_check_critical_error())
203 {
204 /* Implements Measure#32: Row 14,...,24 */
205 payload = &(rr_data_ind->sdu.buf[0]); /* beginning of buffer */
206 payload += ((rr_data_ind->sdu.o_buf) >> 3) - 1; /* plus offset (bytes) */
207 length = ((rr_data_ind->sdu.l_buf) >> 3) + 1; /* length (bytes, bits / 8) */
208
209
210 /* Implements Measure#32: Row 14,...,24 */
211 switch (_decodedMsg[0])
212 {
213 case D_AUTH_REJ:
214 TRACE_BINDUMP( mm_handle,
215 TC_USER4,
216 "Down Link: AUTHENTICATION REJECT",
217 payload,
218 length);
219 break;
220
221 case D_AUTH_REQ:
222 TRACE_BINDUMP( mm_handle,
223 TC_USER4,
224 "Down Link: AUTHENTICATION REQUEST",
225 payload,
226 length);
227 break;
228
229 case D_CM_SERV_ACCEPT:
230 TRACE_BINDUMP( mm_handle,
231 TC_USER4,
232 "Down Link: CM SERV ACCEPT",
233 payload,
234 length);
235 break;
236
237 case D_ABORT:
238 TRACE_BINDUMP( mm_handle,
239 TC_USER4,
240 "Down Link: ABORT",
241 payload,
242 length);
243 break;
244
245 case D_CM_SERV_REJ:
246 TRACE_BINDUMP( mm_handle,
247 TC_USER4,
248 "Down Link: CM SERVICE REJECT",
249 payload,
250 length);
251 break;
252
253 case D_IDENT_REQ:
254 TRACE_BINDUMP( mm_handle,
255 TC_USER4,
256 "Down Link: IDENTITY REQUEST",
257 payload,
258 length);
259 break;
260
261 case D_LOC_UPD_ACCEPT:
262 TRACE_BINDUMP( mm_handle,
263 TC_USER4,
264 "Down Link: LOC UPDATE ACCEPT",
265 payload,
266 length);
267 break;
268
269 case D_LOC_UPD_REJ:
270 TRACE_BINDUMP( mm_handle,
271 TC_USER4,
272 "Down Link: LOC UPDATE REJECT",
273 payload,
274 length);
275 break;
276
277 case B_MM_STATUS:
278 TRACE_BINDUMP( mm_handle,
279 TC_USER4,
280 "Down Link: MM STATUS",
281 payload,
282 length);
283 break;
284
285 case D_TMSI_REALLOC_CMD:
286 TRACE_BINDUMP( mm_handle,
287 TC_USER4,
288 "Down Link: TMSI REALLOC COMMAND",
289 payload,
290 length);
291 break;
292
293 case D_CM_SERVICE_PROMPT:
294 TRACE_BINDUMP( mm_handle,
295 TC_USER4,
296 "Down Link: CM SERVICE PROMPT",
297 payload,
298 length);
299 break;
300
301 case D_MM_INFORMATION:
302 TRACE_BINDUMP( mm_handle,
303 TC_USER4,
304 "Down Link: MM INFORMATION",
305 payload,
306 length);
307 break;
308
309 default:
310 /*
311 * message is unknown; if this happens, AIM does not match
312 * implementation
313 */
314 mm_for_set_error(RC_MESSAGE_TYPE_NOT_IMPLEM);
315 break;
316 } /* switch */
317 switch (_decodedMsg[0])
318 {
319 case D_AUTH_REJ:
320 mm_auth_rej ();
321 break;
322
323 case D_AUTH_REQ:
324 mm_auth_req ((T_D_AUTH_REQ *)_decodedMsg);
325 break;
326
327 case D_CM_SERV_ACCEPT:
328 mm_cm_serv_accept ();
329 break;
330
331 case D_ABORT:
332 mm_abort ((T_D_ABORT *)_decodedMsg);
333 break;
334
335 case D_CM_SERV_REJ:
336 mm_cm_serv_rej (MSG(D_CM_SERV_REJ));
337 break;
338
339 case D_IDENT_REQ:
340 mm_ident_req ((T_D_IDENT_REQ *)_decodedMsg);
341 break;
342
343 case D_LOC_UPD_ACCEPT:
344 mm_loc_upd_acc (MSG(D_LOC_UPD_ACCEPT));
345 break;
346
347 case D_LOC_UPD_REJ:
348 mm_lup_rej (MSG(D_LOC_UPD_REJ));
349 break;
350
351 case B_MM_STATUS:
352 mm_mm_status ();
353 break;
354
355 case D_TMSI_REALLOC_CMD:
356 mm_tmsi_realloc_cmd (MSG(D_TMSI_REALLOC_CMD));
357 break;
358
359 case D_CM_SERVICE_PROMPT:
360 mm_cm_service_prompt (MSG(D_CM_SERVICE_PROMPT));
361 break;
362
363 case D_MM_INFORMATION:
364 mm_mm_information (MSG(D_MM_INFORMATION));
365 break;
366
367 default:
368 /*
369 * message is unknown; if this happens, AIM does not match
370 * implementation
371 */
372 mm_for_set_error(RC_MESSAGE_TYPE_NOT_IMPLEM);
373 break;
374 } /* switch */
375 } /* if (!mm_check_critical_error() */
376 } /* if !ti */
377 } /* if pd EQ PD_MM */
378 else
379 {
380 if (ti >= 8)
381 ti -= 8;
382 else
383 ti += 8;
384 mm_cm_message (pd, ti, rr_data_ind);
385 return;
386 } /* else if pd EQ PD_MM */
387
388 mm_send_status_on_error(); /* handles critical errors preventing AIM from processing */
389 PFREE (rr_data_ind); /* the message pointer should be freed here */
390 }
391
392 #endif