comparison gsm-fw/g23m-gsm/mm/mm_forf.c @ 673:2f7df7a314f8

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