comparison g23m-gsm/mm/mm_forf.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_FORF
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_FORF_C
23 #define MM_FORF_C
24
25 #include "config.h"
26 #include "fixedconf.h"
27 #include "condat-features.h"
28
29 #define ENTITY_MM
30
31 /*==== INCLUDES ===================================================*/
32
33 #if defined (NEW_FRAME)
34
35 #include <string.h>
36 #include <stdlib.h>
37 #include <stddef.h>
38 #include "typedefs.h"
39 #include "pcm.h"
40 #include "pconst.cdg"
41 #include "mconst.cdg"
42 #include "message.h"
43 #include "ccdapi.h"
44 #include "vsi.h"
45 #include "custom.h"
46 #include "gsm.h"
47 #include "prim.h"
48 #include "cnf_mm.h"
49 #include "mon_mm.h"
50 #include "pei.h"
51 #include "tok.h"
52 #include "mm.h"
53
54 #else
55
56 #include <string.h>
57 #include <stdlib.h>
58 #include <stddef.h>
59 #include "stddefs.h"
60 #include "pcm.h"
61 #include "pconst.cdg"
62 #include "mconst.cdg"
63 #include "message.h"
64 #include "ccdapi.h"
65 #include "custom.h"
66 #include "gsm.h"
67 #include "prim.h"
68 #include "cnf_mm.h"
69 #include "mon_mm.h"
70 #include "vsi.h"
71 #include "pei.h"
72 #include "tok.h"
73 #include "mm.h"
74
75 #endif
76
77 /*==== EXPORT =====================================================*/
78
79 /*==== PRIVAT =====================================================*/
80
81 /*==== VARIABLES ==================================================*/
82
83 /*==== FUNCTIONS ==================================================*/
84
85 /*
86 * -------------------------------------------------------------------
87 * Procedures
88 * -------------------------------------------------------------------
89 */
90
91 /*
92 +--------------------------------------------------------------------+
93 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
94 | STATE : code ROUTINE : for_check_identity_type |
95 +--------------------------------------------------------------------+
96
97 PURPOSE :
98
99 */
100
101 GLOBAL BOOL for_check_identity_type (UBYTE id)
102 {
103 TRACE_FUNCTION ("for_check_identity_type()");
104
105 switch (id)
106 {
107 case ID_TYPE_IMSI:
108 case ID_TYPE_TMSI:
109 case ID_TYPE_IMEI:
110 case ID_TYPE_IMEISV:
111 return TRUE;
112 default:
113 return FALSE;
114 }
115 }
116
117 /*
118 +--------------------------------------------------------------------+
119 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
120 | STATE : code ROUTINE : for_check_mobile_identy |
121 +--------------------------------------------------------------------+
122
123 PURPOSE :
124
125 */
126
127 GLOBAL BOOL for_check_mobile_identity (T_mob_id *mob_ident)
128 {
129 TRACE_FUNCTION ("for_check_mobile_identity()");
130
131 return (for_check_identity_type (mob_ident->ident_type));
132 }
133
134 /*
135 +--------------------------------------------------------------------+
136 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
137 | STATE : code ROUTINE : for_check_reject_cause |
138 +--------------------------------------------------------------------+
139
140 PURPOSE : In this function it is checked whether a reject cause
141 received from the network is a valid MM cause. If this
142 is the case, this cause is returned as result
143 of the function. In case the reject cause is in the
144 range 0x30..0x3F, it is mapped to 0x30. If the reject
145 cause neither is a member of the table of valid causes
146 nor is in the range 0x30..0x3F, it is mapped to the
147 cause RC_SERVICE_ORDER.
148
149 */
150 LOCAL const UBYTE cause_table[MAX_DEFINED_CAUSES] =
151 {
152 RC_IMSI_IN_HLR, /* 0x02 */
153 RC_ILLEGAL_MS, /* 0x03 */
154 RC_IMSI_IN_VLR, /* 0x04 */
155 RC_IMEI_NOT_ACCEPTED, /* 0x05 */
156 RC_ILLEGAL_ME, /* 0x06 */
157 RC_PLMN_NOT_ALLOWED, /* 0x0B */
158 RC_LA_NOT_ALLOWED, /* 0x0C */
159 RC_ROAMING_NOT_ALLOWED, /* 0x0D */
160 #ifdef REL99
161 RC_NO_SUITABLE_CELL_IN_LA, /* 0x0f */
162 #endif
163 RC_NETWORK_FAILURE, /* 0x11 */
164 RC_CONGETION, /* 0x16 */
165 RC_SERVICE_NOT_SUPPORTED, /* 0x20 */
166 RC_SERVICE_NOT_SUBSCRIBED, /* 0x21 */
167 RC_SERVICE_ORDER, /* 0x22 */
168 RC_IDENTIFIY, /* 0x26 */
169 RC_INCORRECT_MESSAGE, /* 0x5F */
170 RC_INVALID_MAND_MESSAGE, /* 0x60 */
171 RC_MESSAGE_TYPE_NOT_IMPLEM, /* 0x61 */
172 RC_MESSAGE_TYPE_INCOMPAT, /* 0x62 */
173 RC_IE_NOT_IMPLEM, /* 0x63 */
174 RC_CONDITIONAL_IE, /* 0x64 */
175 RC_MESSAGE_INCOMPAT, /* 0x65 */
176 RC_UNSPECIFIED /* 0x6f */
177 };
178
179 GLOBAL UBYTE for_check_reject_cause (UBYTE cause)
180 {
181 UBYTE i;
182
183 TRACE_FUNCTION ("for_check_reject_cause()");
184
185 for (i = 0; i < MAX_DEFINED_CAUSES; i++)
186 {
187 if (cause EQ cause_table[i])
188 {
189 return cause;
190 }
191 }
192
193 /*
194 * cause value retry upon entry into a new cell
195 */
196 if (cause >= 0x30 AND
197 cause <= 0x3F)
198 return 0x30;
199
200 /*
201 * any other value shall be treated as service option
202 * temporarily out of order
203 */
204 return RC_SERVICE_ORDER;
205 }
206
207 /*
208 +--------------------------------------------------------------------+
209 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
210 | STATE : code ROUTINE : mm_for_set_error |
211 +--------------------------------------------------------------------+
212
213 PURPOSE : set an specified cause value
214
215 */
216
217 GLOBAL void mm_for_set_error (U8 cause)
218 {
219 GET_INSTANCE_DATA;
220 TRACE_FUNCTION ("mm_for_set_error()");
221 mm_data->error = cause;
222 }
223
224 #if 0 /* body bag; closed at 02.10.2003; clean up not before 04/2004 */
225
226 /*
227 +--------------------------------------------------------------------+
228 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
229 | STATE : code ROUTINE : for_set_mandatory_error |
230 +--------------------------------------------------------------------+
231
232 PURPOSE :
233
234 */
235
236 GLOBAL void for_set_mandatory_error (void)
237 {
238 TRACE_FUNCTION ("for_set_mandatory_error()");
239 mm_data->error = RC_INVALID_MAND_MESSAGE;
240 }
241
242
243 /*
244 +--------------------------------------------------------------------+
245 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
246 | STATE : code ROUTINE : for_set_content_error |
247 +--------------------------------------------------------------------+
248
249 PURPOSE : ?
250 This function is not referenced
251
252 */
253
254 GLOBAL void for_set_content_error (void)
255 {
256 TRACE_FUNCTION ("for_set_content_error()");
257
258 if (mm_data->error NEQ RC_INVALID_MAND_MESSAGE)
259 mm_data->error = RC_INCORRECT_MESSAGE;
260 }
261
262 /*
263 +--------------------------------------------------------------------+
264 | PROJECT : GSM-PS (6147) MODULE : MM_FOR |
265 | STATE : code ROUTINE : for_set_optional_error |
266 +--------------------------------------------------------------------+
267
268 PURPOSE : ?
269 This function is not referenced
270
271 */
272
273 GLOBAL void for_set_optional_error (UBYTE iei)
274 {
275 TRACE_FUNCTION ("for_set_optional_error()");
276
277 if (mm_data->error NEQ RC_INVALID_MAND_MESSAGE)
278 {
279 if (! (iei & 0xf0))
280 mm_for_set_error (RC_INVALID_MAND_MESSAGE);
281 else
282 mm_for_set_error (OPTIONAL_INFO_ERROR);
283 }
284 }
285 #endif /* #if 0 */
286
287 #endif