FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/gmm/gmm_kernl.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Oct 2016 04:24:13 +0000 |
parents | |
children | 907458d58a86 |
comparison
equal
deleted
inserted
replaced
182:f02d0a0e1849 | 183:219afcfc6250 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : gmm_kernl.c | |
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 is part of the entity GMM and implements all | |
18 | procedures and functions as described in the | |
19 | SDL-documentation (KERN-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 | |
24 #ifndef GMM_KERNF_C | |
25 #define GMM_KERNF_C | |
26 #endif | |
27 | |
28 #define ENTITY_GMM | |
29 | |
30 /*==== INCLUDES =============================================================*/ | |
31 | |
32 #include <stdio.h> | |
33 #include "typedefs.h" /* to get Condat data types */ | |
34 #include "vsi.h" /* to get a lot of macros */ | |
35 #include "macdef.h" | |
36 #include "gprs.h" | |
37 #include "gsm.h" /* to get a lot of macros */ | |
38 #include "ccdapi.h" /* to get CCD API */ | |
39 #include "cnf_gmm.h" /* to get cnf-definitions */ | |
40 #include "mon_gmm.h" /* to get mon-definitions */ | |
41 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
42 #include "gmm.h" /* to get the global entity definitions */ | |
43 | |
44 #include "gmm_f.h" /* to get global functions */ | |
45 #include "gmm_txs.h" /* to get some signals */ | |
46 #include "gmm_rdys.h" /* to get some signals */ | |
47 #include "gmm_kernp.h" /* to get kern_gmmreg_detach_req */ | |
48 #include "gmm_kernf.h" /* to get local functions */ | |
49 #include "gmm_kernl.h" /* to get local label functions */ | |
50 #include <string.h> /* to get memcpy() */ | |
51 #include "gmm_syncs.h" | |
52 #include "gmm_rdyf.h" | |
53 #include "gmm_em.h" /* To get Engineering Mode functions */ | |
54 | |
55 | |
56 /*==== CONST ================================================================*/ | |
57 | |
58 /*==== LOCAL VARS ===========================================================*/ | |
59 | |
60 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
61 | |
62 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
63 | |
64 /* | |
65 +------------------------------------------------------------------------------ | |
66 | Function : kern_attach_1 | |
67 +------------------------------------------------------------------------------ | |
68 | Description : The label ATTACH_1 | |
69 | | |
70 | Parameters : void | |
71 | | |
72 +------------------------------------------------------------------------------ | |
73 */ | |
74 GLOBAL void kern_attach_1 ( void ) | |
75 { | |
76 GMM_TRACE_FUNCTION( "kern_attach_1" ); | |
77 { | |
78 T_gmobile_identity gmobile_identity; | |
79 MCAST (attach_request, ATTACH_REQUEST); /* T_ATTACH_REQUEST */ | |
80 | |
81 kern_attach_rau_init(); | |
82 | |
83 if ( GMM_LLC_STATE_UNASSIGNED == gmm_data->kern.attach_cap.llc_state ) | |
84 { | |
85 /* | |
86 * If no TLLI has yet been assigned to the lower layers. If a valid P-TMSI | |
87 * is available, GMM derives a foreign TLLI from that P-TMSI, otherwise GMM | |
88 * generates a random TLLI. | |
89 */ | |
90 kern_local_attach( FOREIGN_TLLI, INVALID_TLLI ); | |
91 } | |
92 | |
93 kern_ulong2mobile_identity ( gmm_data->ptmsi.current, &gmobile_identity ); | |
94 | |
95 kern_build_ms_network_capability ( &attach_request->ms_network_capability ); | |
96 | |
97 if (gmm_data->config.cipher_on) | |
98 { | |
99 attach_request->ms_network_capability.gea_1 = GEA_1_YES; | |
100 TRACE_EVENT ("ciphering on requested"); | |
101 } | |
102 else | |
103 { | |
104 attach_request->ms_network_capability.gea_1 = GEA_1_NO; | |
105 TRACE_EVENT ("ciphering off requested"); | |
106 } | |
107 | |
108 attach_request-> | |
109 attach_type.type_of_attach = gmm_data->kern.attach_cap.attach_proc_type; | |
110 attach_request-> | |
111 ciphering_key_sequence_number.key_sequence | |
112 = gmm_data->kern.auth_cap.cksn; | |
113 attach_request->drx_parameter = gmm_data->drx_parameter; | |
114 attach_request->gmobile_identity = gmobile_identity; | |
115 | |
116 attach_request->routing_area_identification = gmm_data->kern.attach_cap.rai_accepted; | |
117 | |
118 /* Internally we work always with 3-digit-MNC, adapt this before coding */ | |
119 if (attach_request->routing_area_identification.mnc[2] EQ 0xf) | |
120 { | |
121 attach_request->routing_area_identification.c_mnc = 2; | |
122 } | |
123 else | |
124 { | |
125 attach_request->routing_area_identification.c_mnc = SIZE_MNC; | |
126 } | |
127 | |
128 rr_csf_get_radio_access_capability( &attach_request->ra_cap ); | |
129 | |
130 #ifdef TDSGEN | |
131 attach_request->ra_cap.acc_tech_typ=1; | |
132 attach_request->ra_cap.flag_ra_cap2=1; | |
133 attach_request->ra_cap.v_ra_cap2=1; | |
134 attach_request->ra_cap.ra_cap2.acc_cap.pow_class= 1; | |
135 attach_request->ra_cap.ra_cap2.acc_cap.v_a5_bits=0; | |
136 attach_request->ra_cap.ra_cap2.acc_cap.es_ind=1; | |
137 attach_request->ra_cap.ra_cap2.acc_cap.ps=0; | |
138 attach_request->ra_cap.ra_cap2.acc_cap.vgcs=0; | |
139 attach_request->ra_cap.ra_cap2.acc_cap.vbs=0; | |
140 attach_request->ra_cap.ra_cap2.acc_cap.v_ms_struct=0; | |
141 attach_request->ra_cap.ra_cap2.acc_tech_typ=3; | |
142 #endif | |
143 | |
144 /* | |
145 * The READY_TIMER is negotiated | |
146 * this parameter is optional and is used, if the MS wants to indicate a | |
147 * preferred value vor the ready timer | |
148 */ | |
149 attach_request->v_ready_timer = FALSE; | |
150 | |
151 switch (gmm_data->kern.attach_cap.attach_proc_type) | |
152 { | |
153 case AT_WHILE_IMSI_AT: | |
154 /* | |
155 * 44.2.1.2.8 | |
156 */ | |
157 if (GMMRR_TMSI_INVALID == gmm_data->tmsi) | |
158 /* | |
159 * <R.GMM.ACINIT.M.009> | |
160 */ | |
161 { | |
162 attach_request->v_tmsi_status = TRUE; | |
163 attach_request->tmsi_status.tmsi_flag = FALSE; | |
164 } | |
165 else | |
166 { | |
167 attach_request->v_tmsi_status = FALSE; | |
168 attach_request->tmsi_status.tmsi_flag = TRUE; | |
169 } | |
170 break; | |
171 | |
172 case AT_COMB: | |
173 attach_request->v_tmsi_status = TRUE; | |
174 if (GMMRR_TMSI_INVALID == gmm_data->tmsi) | |
175 /* | |
176 * <R.GMM.ACINIT.M.009> | |
177 */ | |
178 { | |
179 attach_request->tmsi_status.tmsi_flag = FALSE; | |
180 } | |
181 else | |
182 { | |
183 attach_request->tmsi_status.tmsi_flag = TRUE; | |
184 } | |
185 break; | |
186 case AT_GPRS: | |
187 default: | |
188 attach_request->v_tmsi_status = FALSE; | |
189 break; | |
190 } | |
191 | |
192 /* | |
193 * <R.GMM.AGINIT.M.004> | |
194 */ | |
195 if ( gmm_data->ptmsi_signature.available ) | |
196 { | |
197 attach_request->v_p_tmsi_signature = TRUE; | |
198 attach_request-> p_tmsi_signature.p_tmsi_signature_value | |
199 = gmm_data->ptmsi_signature.value; | |
200 } | |
201 else | |
202 { | |
203 attach_request->v_p_tmsi_signature = FALSE; | |
204 } | |
205 /* | |
206 * <R.GMM.AGINIT.M.007> | |
207 */ | |
208 TRACE_EVENT ( "Info: START: T3310" ); | |
209 sig_kern_rdy_start_timer_req ( kern_T3310, gmm_data->kern.t3310_val ); | |
210 /* | |
211 * increments th counter for T3310 | |
212 */ | |
213 gmm_data->kern.ct3310++; | |
214 | |
215 switch(GET_STATE(KERN)) | |
216 { | |
217 case KERN_GMM_REG_INITIATED: | |
218 break; | |
219 default: | |
220 kern_gmmrr_attach_started(); | |
221 break; | |
222 } | |
223 SET_STATE ( KERN, KERN_GMM_REG_INITIATED ); | |
224 #ifdef FF_EM_MODE | |
225 EM_GMM_SET_STATE(KERN_GMM_REG_INITIATED ); | |
226 #endif | |
227 /* | |
228 * CURRENT_TLLI is used instead of FOREIGN_TLLI, because | |
229 * in kern_local_attach it is possible the the RANDOM TLLI was used | |
230 */ | |
231 sig_kern_tx_data_req ( CURRENT_TLLI, ATTACH_REQUEST ); | |
232 } | |
233 GMM_RETURN; | |
234 } /* kern_attach_1() */ | |
235 | |
236 /* | |
237 +------------------------------------------------------------------------------ | |
238 | Function : kern_resume_grr_der | |
239 +------------------------------------------------------------------------------ | |
240 | Description : The LABEL KERN_RESUME_GRR_DER sends the resume primitive to GRR | |
241 | | |
242 | Parameters : void | |
243 | | |
244 +------------------------------------------------------------------------------ | |
245 */ | |
246 GLOBAL void kern_resume_grr_der ( void ) | |
247 { | |
248 GMM_TRACE_FUNCTION( "kern_resume_grr_der" ); | |
249 { | |
250 PALLOC ( gmmrr_resume_req, GMMRR_RESUME_REQ ); | |
251 /* | |
252 * GMM enters state DEGEG_SUSPENDED if it was in DEREG_NO_IMSI | |
253 * So I have to tae careto enter NO_IMSI again. | |
254 */ | |
255 if (gmm_data->sim_gprs_invalid) | |
256 { | |
257 SET_STATE (KERN, KERN_GMM_DEREG_NO_IMSI); | |
258 #ifdef FF_EM_MODE | |
259 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI); | |
260 #endif | |
261 } | |
262 else | |
263 { | |
264 SET_STATE (KERN, KERN_GMM_DEREG_RESUMING ); | |
265 #ifdef FF_EM_MODE | |
266 EM_GMM_SET_STATE(KERN_GMM_DEREG_RESUMING ); | |
267 #endif | |
268 } | |
269 gmm_data->kern.attach_cap.grr_state = GMM_GRR_STATE_ON; | |
270 gmm_data->kern.gmmrr_resume_sent=TRUE; | |
271 PSEND ( hCommGRR, gmmrr_resume_req ); | |
272 } | |
273 gmm_data->kern.suspension_type &= ~GMM_SUSP_LOCAL_DETACH; | |
274 GMM_RETURN; | |
275 } /* kern_resume_grr_der() */ | |
276 /* | |
277 +------------------------------------------------------------------------------ | |
278 | Function : kern_resume_grr_reg | |
279 +------------------------------------------------------------------------------ | |
280 | Description : The LABEL KERN_RESUME_GRR_DER sends the resume primitive to GRR | |
281 | | |
282 | Parameters : void | |
283 | | |
284 +------------------------------------------------------------------------------ | |
285 */ | |
286 GLOBAL void kern_resume_grr_reg ( void ) | |
287 { | |
288 GMM_TRACE_FUNCTION( "kern_resume_grr_reg" ); | |
289 { | |
290 PALLOC ( gmmrr_resume_req, GMMRR_RESUME_REQ ); | |
291 SET_STATE (KERN, KERN_GMM_REG_RESUMING); | |
292 #ifdef FF_EM_MODE | |
293 EM_GMM_SET_STATE(KERN_GMM_REG_RESUMING); | |
294 #endif | |
295 gmm_data->kern.gmmrr_resume_sent = TRUE; | |
296 gmm_data->kern.attach_cap.grr_state = GMM_GRR_STATE_ON; | |
297 PSEND ( hCommGRR, gmmrr_resume_req ); | |
298 } | |
299 GMM_RETURN; | |
300 } /* kern_resume_grr_reg() */ | |
301 | |
302 /* | |
303 +------------------------------------------------------------------------------ | |
304 | Function : kern_reg_at_local_disable | |
305 +------------------------------------------------------------------------------ | |
306 | Description : The label REG_AT_LOCAL_DISABLE | |
307 | is called, when GMM is in state GMM-REGISTERED.SUSPENDED | |
308 | and MMI has request GPRS_DISABLE | |
309 | | |
310 | Parameters : void | |
311 | | |
312 +------------------------------------------------------------------------------ | |
313 */ | |
314 GLOBAL void kern_reg_at_local_disable ( void ) | |
315 { | |
316 GMM_TRACE_FUNCTION( "kern_reg_at_local_disable" ); | |
317 | |
318 SET_STATE ( KERN, KERN_GMM_NULL_IMSI ); | |
319 #ifdef FF_EM_MODE | |
320 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI ); | |
321 #endif | |
322 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_DISABLE_GPRS; | |
323 | |
324 kern_local_detach( GMMCS_INT_PROTOCOL_ERROR, /* TCS 2.1 */ | |
325 FALSE, GMM_LOCAL_DETACH_PROC_ENTER_DEREG ); | |
326 | |
327 if ( GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM) ) | |
328 { | |
329 kern_gmmreg_attach_cnf ( GMMREG_AT_IMSI ); | |
330 } | |
331 GMM_RETURN; | |
332 } /* kern_reg_at_local_disable () */ | |
333 | |
334 /* | |
335 +------------------------------------------------------------------------------ | |
336 | Function : kern_imsi_detach_der_susp | |
337 +------------------------------------------------------------------------------ | |
338 | Description : The label IMSI_DETACH_DER_SUSP | |
339 | suspends GRR and enters the appropriate substate to wait for | |
340 | response from GRR | |
341 | | |
342 | Parameters : void | |
343 | | |
344 +------------------------------------------------------------------------------ | |
345 */ | |
346 GLOBAL void kern_imsi_detach_der_susp ( void ) | |
347 { | |
348 GMM_TRACE_FUNCTION( "kern_imsi_detach_der_susp" ); | |
349 | |
350 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING); | |
351 #ifdef FF_EM_MODE | |
352 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING); | |
353 #endif | |
354 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_IMSI_DETACH); | |
355 GMM_RETURN; | |
356 } /* kern_imsi_detach_der_susp() */ | |
357 /* | |
358 +------------------------------------------------------------------------------ | |
359 | Function : kern_imsi_detach_reg_susp | |
360 +------------------------------------------------------------------------------ | |
361 | Description : The label IMSI_DETACH_REG_SUSP | |
362 | suspends GRR and enters the appropriate substate to wait for | |
363 | response from GRR | |
364 | | |
365 | Parameters : void | |
366 | | |
367 +------------------------------------------------------------------------------ | |
368 */ | |
369 GLOBAL void kern_imsi_detach_reg_susp ( void ) | |
370 { | |
371 GMM_TRACE_FUNCTION( "kern_imsi_detach_reg_susp" ); | |
372 | |
373 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING); | |
374 #ifdef FF_EM_MODE | |
375 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING); | |
376 #endif | |
377 /* | |
378 * kern_llgmm_unassign(); | |
379 */ | |
380 kern_llgmm_suspend(LLGMM_CALL); | |
381 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE,GMM_SUSP_IMSI_DETACH); | |
382 GMM_RETURN; | |
383 } /* kern_imsi_detach_reg_susp() */ | |
384 | |
385 /* | |
386 +------------------------------------------------------------------------------ | |
387 | Function : kern_enter_reg_no_cell_limited | |
388 +------------------------------------------------------------------------------ | |
389 | Description : The label ENTER_REG_NO_CELL_LIMITED | |
390 | | |
391 | Parameters : void | |
392 | | |
393 +------------------------------------------------------------------------------ | |
394 */ | |
395 GLOBAL void kern_enter_reg_no_cell_limited ( void ) | |
396 { | |
397 GMM_TRACE_FUNCTION( "kern_enter_reg_no_cell_limited" ); | |
398 | |
399 SET_STATE ( KERN, KERN_GMM_REG_NO_CELL_AVAILABLE ); | |
400 #ifdef FF_EM_MODE | |
401 EM_GMM_SET_STATE(KERN_GMM_REG_NO_CELL_AVAILABLE ); | |
402 #endif | |
403 kern_llgmm_suspend(LLGMM_NO_GPRS_SERVICE); | |
404 GMM_RETURN; | |
405 } /* kern_enter_reg_no_cell_limited() */ | |
406 /* | |
407 +------------------------------------------------------------------------------ | |
408 | Function : kern_rau_susp | |
409 +------------------------------------------------------------------------------ | |
410 | Description : The label RAU_SUSP | |
411 | is the continuing of the gmmrr_cell_ind primitive in state | |
412 | GMM_DEREGISTERED_SUSPENDED | |
413 | | |
414 | Parameters : void | |
415 | | |
416 +------------------------------------------------------------------------------ | |
417 */ | |
418 GLOBAL void kern_rau_susp ( void ) | |
419 { | |
420 GMM_TRACE_FUNCTION( "kern_rau_susp" ); | |
421 | |
422 if ( gmm_data->kern.attach_cap.gmmreg ) | |
423 { | |
424 switch ( gmm_data->kern.attach_cap.mobile_class ) | |
425 { | |
426 case GMMREG_CLASS_CC: | |
427 kern_reg_at_local_disable(); | |
428 GMM_RETURN; | |
429 case GMMREG_CLASS_CG: | |
430 if ( GMM_MM_DEREG != GET_STATE(MM) ) | |
431 { | |
432 kern_imsi_detach_reg_susp(); | |
433 GMM_RETURN; | |
434 } | |
435 break; | |
436 default: | |
437 break; | |
438 } | |
439 } | |
440 | |
441 | |
442 | |
443 /* | |
444 * TLLI will be assigned in rau_init | |
445 * | |
446 * kern_llgmm_assign(); | |
447 */ | |
448 kern_rau(); | |
449 GMM_RETURN; | |
450 } /* kern_rau_susp() */ | |
451 /* | |
452 +------------------------------------------------------------------------------ | |
453 | Function : kern_enter_reg_limited_susp | |
454 +------------------------------------------------------------------------------ | |
455 | Description : The label ENTER_REG_LIMITED_SUSP | |
456 | is the continuing of the gmmrr_cell_ind primitive in state | |
457 | GMM_DEREGISTERED_SUSPENDED | |
458 | | |
459 | Parameters : void | |
460 | | |
461 +------------------------------------------------------------------------------ | |
462 */ | |
463 GLOBAL void kern_enter_reg_limited_susp ( void ) | |
464 { | |
465 GMM_TRACE_FUNCTION( "kern_enter_reg_limited_susp" ); | |
466 | |
467 if ( gmm_data->kern.attach_cap.gmmreg ) | |
468 { | |
469 switch ( gmm_data->kern.attach_cap.mobile_class ) | |
470 { | |
471 case GMMREG_CLASS_CC: | |
472 kern_reg_at_local_disable(); | |
473 GMM_RETURN; | |
474 case GMMREG_CLASS_CG: | |
475 if ( GMM_MM_REG_NORMAL_SERVICE != GET_STATE(MM) ) | |
476 { | |
477 kern_gmmreg_attach_cnf ( GMMREG_AT_GPRS ); | |
478 } | |
479 break; | |
480 default: | |
481 if ( GMM_MM_REG_NORMAL_SERVICE == GET_STATE(MM) ) | |
482 { | |
483 kern_gmmreg_attach_cnf ( GMMREG_AT_COMB ); | |
484 } | |
485 break; | |
486 } | |
487 } | |
488 kern_enter_reg_limited(); | |
489 GMM_RETURN; | |
490 } /* kern_enter_reg_limiied_susp() */ | |
491 | |
492 /* | |
493 +------------------------------------------------------------------------------ | |
494 | Function : kern_enter_reg_normal_susp | |
495 +------------------------------------------------------------------------------ | |
496 | Description : The label ENTER_REG_NORMAL_SUSP | |
497 | is the continuing of the gmmrr_cell_ind primitive in state | |
498 | GMM_DEREGISTERED_SUSPENDED | |
499 | | |
500 | Parameters : void | |
501 | | |
502 +------------------------------------------------------------------------------ | |
503 */ | |
504 GLOBAL void kern_enter_reg_normal_susp ( void ) | |
505 { | |
506 GMM_TRACE_FUNCTION( "kern_enter_reg_normal_susp" ); | |
507 | |
508 if ( gmm_data->kern.attach_cap.gmmreg ) | |
509 { | |
510 switch ( gmm_data->kern.attach_cap.mobile_class ) | |
511 { | |
512 case GMMREG_CLASS_CC: | |
513 kern_disable(); | |
514 break; | |
515 case GMMREG_CLASS_CG: | |
516 if ( GMM_MM_DEREG != GET_STATE(MM) ) | |
517 { | |
518 kern_imsi_detach_reg_susp(); | |
519 } | |
520 else | |
521 { | |
522 kern_enter_reg_normal(); | |
523 } | |
524 break; | |
525 default: | |
526 switch ( GET_STATE(MM) ) | |
527 { | |
528 case GMM_MM_DEREG: | |
529 case GMM_MM_REG_UPDATE_NEEDED: | |
530 /* Combined RAU | |
531 * MSC 3.4.3 IMSI attach while already GPRS attached | |
532 */ | |
533 kern_llgmm_assign (); | |
534 kern_rau (); | |
535 break; | |
536 default: | |
537 case GMM_MM_REG_NORMAL_SERVICE: | |
538 case GMM_MM_REG_NO_CELL_AVAILABLE: | |
539 case GMM_MM_REG_INITATED_VIA_GPRS: | |
540 kern_enter_reg_normal(); | |
541 break; | |
542 } | |
543 | |
544 break; | |
545 } | |
546 } | |
547 else | |
548 { | |
549 if ( gmm_data->kern.timeout_t3312 ) | |
550 { | |
551 /* | |
552 * <R.GMM.RAUTIMER.M.009> | |
553 */ | |
554 kern_periodic_rau(); | |
555 } | |
556 else | |
557 { | |
558 kern_gmmrr_stop_waiting_for_transmission(); | |
559 kern_enter_reg_normal(); | |
560 } | |
561 | |
562 } | |
563 GMM_RETURN; | |
564 } /* kern_enter_reg_normal_susp() */ | |
565 | |
566 | |
567 | |
568 /* | |
569 +------------------------------------------------------------------------------ | |
570 | Function : kern_enter_reg_limited | |
571 +------------------------------------------------------------------------------ | |
572 | Description : The label ENTER_REG_LIMITED | |
573 | | |
574 | Parameters : void | |
575 | | |
576 +------------------------------------------------------------------------------ | |
577 */ | |
578 GLOBAL void kern_enter_reg_limited ( void ) | |
579 { | |
580 GMM_TRACE_FUNCTION( "kern_enter_reg_limited" ); | |
581 | |
582 SET_STATE ( KERN, KERN_GMM_REG_LIMITED_SERVICE ); | |
583 #ifdef FF_EM_MODE | |
584 EM_GMM_SET_STATE(KERN_GMM_REG_LIMITED_SERVICE ); | |
585 #endif | |
586 kern_llgmm_suspend(LLGMM_LIMITED); | |
587 GMM_RETURN; | |
588 } /* kern_enter_reg_limited_service() */ | |
589 | |
590 /* | |
591 +------------------------------------------------------------------------------ | |
592 | Function : kern_rau_init | |
593 +------------------------------------------------------------------------------ | |
594 | Description : The label RAU_INIT | |
595 | | |
596 | RAU will have been initiated | |
597 | | |
598 | Parameters : void | |
599 | | |
600 +------------------------------------------------------------------------------ | |
601 */ | |
602 | |
603 GLOBAL void kern_rau_init ( void ) | |
604 { | |
605 | |
606 | |
607 | |
608 GMM_TRACE_FUNCTION( "kern_rau_init" ); | |
609 { | |
610 /* T_ROUTING_AREA_UPDATE_REQUEST */ | |
611 MCAST (routing_area_update_request, ROUTING_AREA_UPDATE_REQUEST); | |
612 | |
613 kern_attach_rau_init(); | |
614 | |
615 routing_area_update_request->ciphering_key_sequence_number.key_sequence | |
616 = gmm_data->kern.auth_cap.cksn; | |
617 | |
618 routing_area_update_request->v_drx_parameter = TRUE; | |
619 routing_area_update_request->drx_parameter | |
620 = gmm_data->drx_parameter; | |
621 | |
622 routing_area_update_request->routing_area_identification | |
623 = gmm_data->kern.attach_cap.rai_accepted; | |
624 | |
625 /* Internally we work always with 3-digit-MNC, adapt this before coding */ | |
626 if (routing_area_update_request->routing_area_identification.mnc[2] EQ 0xf) | |
627 routing_area_update_request->routing_area_identification.c_mnc = 2; | |
628 else | |
629 routing_area_update_request->routing_area_identification.c_mnc = SIZE_MNC; | |
630 | |
631 rr_csf_get_radio_access_capability( &routing_area_update_request->ra_cap ); | |
632 | |
633 #ifdef TDSGEN | |
634 routing_area_update_request->ra_cap.acc_tech_typ=1; | |
635 routing_area_update_request->ra_cap.flag_ra_cap2=1; | |
636 routing_area_update_request->ra_cap.v_ra_cap2=1; | |
637 routing_area_update_request->ra_cap.ra_cap2.acc_cap.pow_class= 1; | |
638 routing_area_update_request->ra_cap.ra_cap2.acc_cap.v_a5_bits=0; | |
639 routing_area_update_request->ra_cap.ra_cap2.acc_cap.es_ind=1; | |
640 routing_area_update_request->ra_cap.ra_cap2.acc_cap.ps=0; | |
641 routing_area_update_request->ra_cap.ra_cap2.acc_cap.vgcs=0; | |
642 routing_area_update_request->ra_cap.ra_cap2.acc_cap.vbs=0; | |
643 routing_area_update_request->ra_cap.ra_cap2.acc_cap.v_ms_struct=0; | |
644 routing_area_update_request->ra_cap.ra_cap2.acc_tech_typ=3; | |
645 #endif | |
646 | |
647 /* | |
648 * this parameter is optional and is used, if the MS wants to indicate | |
649 * a preferred value vor the ready timer | |
650 */ | |
651 routing_area_update_request->v_ready_timer = FALSE; | |
652 | |
653 if ( gmm_data->ptmsi_signature.available ) | |
654 { | |
655 routing_area_update_request->v_p_tmsi_signature = TRUE; | |
656 routing_area_update_request->p_tmsi_signature.p_tmsi_signature_value | |
657 = gmm_data->ptmsi_signature.value; | |
658 } | |
659 else | |
660 { | |
661 routing_area_update_request->v_p_tmsi_signature = FALSE; | |
662 } | |
663 | |
664 #ifdef REL99 | |
665 /* Routing area update request in Release 99 has one more | |
666 * optional fields - PDP context status. | |
667 * The mobile doesn't change its capabilities while in operation. | |
668 * So MS network capability need not be sent with the RAU request. | |
669 * The old SGSN will pass the MS network capability sent during attach | |
670 * to the new SGSN. The new SGSN reuses this value. | |
671 */ | |
672 routing_area_update_request->v_ms_network_capability = FALSE; /* TCS 4.0 */ | |
673 switch (gmm_data->kern.sig_cell_info.sgsnr_flag)/*!gmm_data->release99 =>old code*/ /* TCS 4.0 */ | |
674 { | |
675 default: | |
676 case PS_SGSN_UNKNOWN: | |
677 case PS_SGSN_98_OLDER: | |
678 routing_area_update_request->v_pdp_context_status = FALSE; /* TCS 4.0 */ | |
679 routing_area_update_request->v_gmobile_identity = FALSE; /* TCS 4.0 */ | |
680 break; | |
681 case PS_SGSN_99_ONWARDS: | |
682 /* | |
683 * PDP context status | |
684 */ | |
685 if (INVALID_PDP_CONTEXT_STATUS == gmm_data->kern.attach_cap.pdp_context_status) | |
686 { | |
687 /*GMM doesn't have valid pdp_context_status. Do not include it in RAU*/ | |
688 routing_area_update_request->v_pdp_context_status = FALSE; /* TCS 4.0 */ | |
689 } else { /*Valid pdp_context_status present*/ | |
690 routing_area_update_request->v_pdp_context_status = TRUE; /* TCS 4.0 */ | |
691 routing_area_update_request->pdp_context_status.nsapi_set = /* TCS 4.0 */ | |
692 gmm_data->kern.attach_cap.pdp_context_status; /* TCS 4.0 */ | |
693 } | |
694 | |
695 /* | |
696 * P-TMSI is required in case of UMTS only | |
697 */ | |
698 routing_area_update_request->v_gmobile_identity = FALSE; /* TCS 4.0 */ | |
699 | |
700 break; | |
701 } | |
702 #endif | |
703 | |
704 /* | |
705 * I used T3310 instead of T3330 | |
706 */ | |
707 TRACE_EVENT ( "Info: START: T3310 (instead of T3330)" ); | |
708 sig_kern_rdy_start_timer_req ( kern_T3310, gmm_data->kern.t3310_val ); | |
709 /* | |
710 * <R.GMM.RAUTIMER.M.021> | |
711 */ | |
712 sig_kern_rdy_start_t3312_req (); | |
713 /* | |
714 * increments the counter for T3310 | |
715 */ | |
716 gmm_data->kern.ct3310++; | |
717 | |
718 | |
719 /* | |
720 * <R.GMM.TLLIUSE.M.003> | |
721 * if not GMM_PERIODIC_RAU then forein TLLI has o be used | |
722 */ | |
723 switch ( gmm_data->tlli.current_type) | |
724 { | |
725 case INVALID_TLLI: | |
726 if (kern_rai_changed()) | |
727 { | |
728 kern_local_attach ( FOREIGN_TLLI, OLD_TLLI ); | |
729 } | |
730 else | |
731 { | |
732 kern_local_attach ( LOCAL_TLLI, OLD_TLLI ); | |
733 } | |
734 break; | |
735 case LOCAL_TLLI: | |
736 case CURRENT_TLLI: | |
737 case OLD_TLLI: | |
738 /* | |
739 * only set to foreign TLLI if it is not done already | |
740 */ | |
741 if (kern_rai_changed ()) | |
742 /* | |
743 * set to foreign TLLI if RA is crossed or if not updated yet | |
744 */ | |
745 { | |
746 kern_local_attach ( FOREIGN_TLLI, OLD_TLLI ); | |
747 } | |
748 break; | |
749 case FOREIGN_TLLI: | |
750 case RANDOM_TLLI: | |
751 default: | |
752 break; | |
753 } | |
754 | |
755 /* | |
756 * #5900 | |
757 * PATCH UBUOB 3.4.02: in cases of repetition of RAU, no ATTACH_STARTED_REQ should be | |
758 * sent; therefore check state before sending the primitive | |
759 */ | |
760 switch(GET_STATE(KERN)) | |
761 { | |
762 case KERN_GMM_RAU_INITIATED: | |
763 /* do not repeat ATTACH_STARTED_REQ in this state! */ | |
764 break; | |
765 default: | |
766 kern_gmmrr_attach_started(); | |
767 break; | |
768 } | |
769 /* end patch */ | |
770 SET_STATE ( KERN, KERN_GMM_RAU_INITIATED ); | |
771 #ifdef FF_EM_MODE | |
772 EM_GMM_SET_STATE(KERN_GMM_RAU_INITIATED ); | |
773 #endif | |
774 | |
775 sig_kern_tx_data_req (CURRENT_TLLI,ROUTING_AREA_UPDATE_REQUEST); | |
776 } | |
777 GMM_RETURN; | |
778 } /* kern_rau_init () */ | |
779 | |
780 /* | |
781 +------------------------------------------------------------------------------ | |
782 | Function : kern_periodic_rau | |
783 +------------------------------------------------------------------------------ | |
784 | Description : The label PERIODIC_RAU | |
785 | | |
786 | Periodic RAU | |
787 | | |
788 | Parameters : void | |
789 | | |
790 +------------------------------------------------------------------------------ | |
791 */ | |
792 | |
793 GLOBAL void kern_periodic_rau ( void ) | |
794 { | |
795 GMM_TRACE_FUNCTION( "kern_periodic_rau" ); | |
796 | |
797 gmm_data->kern.attach_cap.rau_initiated = GMM_PERIODIC_RAU; | |
798 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU; | |
799 { | |
800 /* T_ROUTING_AREA_UPDATE_REQUEST */ | |
801 MCAST (routing_area_update_request, ROUTING_AREA_UPDATE_REQUEST); | |
802 | |
803 routing_area_update_request->v_gmobile_identity = FALSE; | |
804 routing_area_update_request->v_ms_network_capability = FALSE; | |
805 routing_area_update_request->v_pdp_context_status = FALSE; | |
806 | |
807 if ( GMMREG_AT_GPRS != gmm_data->kern.attach_cap.attach_type | |
808 && GMMRR_NET_MODE_I == gmm_data->kern.sig_cell_info.net_mode) | |
809 /* | |
810 * <R.GMM.RCINIT.M.016> | |
811 * | |
812 * 24.008 9.4.1.3. TMSI Status | |
813 * | |
814 * This IE shall be included if the MS performs a | |
815 * combined GPRS attach and no valid TMSI is available | |
816 */ | |
817 { | |
818 if (GMMRR_TMSI_INVALID == gmm_data->tmsi ) | |
819 { | |
820 routing_area_update_request->v_tmsi_status = TRUE; | |
821 routing_area_update_request->tmsi_status.tmsi_flag = FALSE; | |
822 } | |
823 else | |
824 { | |
825 routing_area_update_request->v_tmsi_status = FALSE; | |
826 } | |
827 } | |
828 else | |
829 { | |
830 routing_area_update_request->v_tmsi_status = FALSE; | |
831 } | |
832 | |
833 | |
834 if (gmm_data->kern.timeout_t3312 | |
835 && GMMREG_CLASS_CG != gmm_data->kern.attach_cap.mobile_class | |
836 && GMMREG_AT_IMSI != gmm_data->kern.attach_cap.attach_type | |
837 && GMMRR_NET_MODE_I == gmm_data->kern.sig_cell_info.net_mode | |
838 && | |
839 (gmm_data->kern.attach_cap.mm_lau_attempted | |
840 || GMMRR_SERVICE_NONE== gmm_data->kern.old_sig_cell_info.gmm_status) | |
841 ) | |
842 /* | |
843 * <R.GMM.RAUTIMER.M.018> | |
844 * The network does not know, that the mobile was IMSI attached in | |
845 * the old wrong cell, so that GMM has to IMSI-attach the MS if entering | |
846 * net mode I | |
847 */ | |
848 { | |
849 /* | |
850 24.008 ch. 4.7.2.2: | |
851 If the MS is both IMSI attached for GPRS and non-GPRS services , and if the MS lost coverage of | |
852 the registered PLMN and timer T3312 expires, then: | |
853 | |
854 a) if the MS returns to coverage in a cell that supports GPRS and that indicates that the network | |
855 is in network operation mode I, then the MS shall either perform the combined routing area | |
856 update procedure indicating "combined RA/LA updating with IMSI attach"; or | |
857 */ | |
858 if (gmm_data->kern.attach_cap.mm_lau_attempted) | |
859 { | |
860 routing_area_update_request->update_type.update_type_value | |
861 = COMBINED_RAU_IMSI_ATTACH; | |
862 } | |
863 else | |
864 { | |
865 /* | |
866 * if (GMMRR_SERVICE_NONE== gmm_data->kern.old_sig_cell_info.gmm_status) | |
867 * Last cell had no GPRS covarage | |
868 */ | |
869 routing_area_update_request->update_type.update_type_value | |
870 = COMBINED_RAU; | |
871 } | |
872 | |
873 } | |
874 else | |
875 { | |
876 routing_area_update_request->update_type.update_type_value | |
877 = PERIODIC_RAU; | |
878 } | |
879 gmm_data->kern.attach_cap.update_proc_type = routing_area_update_request->update_type.update_type_value; | |
880 | |
881 kern_llgmm_suspend(LLGMM_PERIODIC_RAU); | |
882 kern_rau_init(); | |
883 | |
884 } | |
885 GMM_RETURN; | |
886 } /* kern_periodic_rau () */ | |
887 | |
888 /* | |
889 +------------------------------------------------------------------------------ | |
890 | Function : kern_enter_reg_normal | |
891 +------------------------------------------------------------------------------ | |
892 | Description : The label ENTER_REG_NORMAL | |
893 | | |
894 | Parameters : void | |
895 | | |
896 +------------------------------------------------------------------------------ | |
897 */ | |
898 GLOBAL void kern_enter_reg_normal ( void ) | |
899 { | |
900 GMM_TRACE_FUNCTION( "kern_enter_reg_normal" ); | |
901 | |
902 /* | |
903 * kern_llgmm_assign(); | |
904 */ | |
905 kern_llgmm_resume (); | |
906 SET_STATE ( KERN, KERN_GMM_REG_NORMAL_SERVICE ); | |
907 #ifdef FF_EM_MODE | |
908 EM_GMM_SET_STATE(KERN_GMM_REG_NORMAL_SERVICE ); | |
909 #endif | |
910 #ifndef GMM_TCS4 | |
911 if ( gmm_data->kern.attach_cap.gmmsm ) | |
912 { | |
913 PALLOC (gmmsm_establish_cnf, GMMSM_ESTABLISH_CNF); | |
914 gmm_data->kern.attach_cap.gmmsm = FALSE; | |
915 PSEND ( hCommSM, gmmsm_establish_cnf ); | |
916 } | |
917 #endif | |
918 kern_gmmreg_attach_cnf((BYTE)(GMM_MM_REG_NORMAL_SERVICE==GET_STATE(MM)? | |
919 GMMREG_AT_COMB:GMMREG_AT_GPRS)); | |
920 | |
921 GMM_RETURN; | |
922 } /* kern_enter_reg_normal() */ | |
923 /* | |
924 +------------------------------------------------------------------------------ | |
925 | Function : kern_enter_reg_normal_upon_gmmrr_cell_ind | |
926 +------------------------------------------------------------------------------ | |
927 | Description : The label ENTER_REG_NORMAL... | |
928 | | |
929 | Parameters : void | |
930 | | |
931 +------------------------------------------------------------------------------ | |
932 */ | |
933 GLOBAL void kern_enter_reg_normal_upon_gmmrr_cell_ind ( void ) | |
934 { | |
935 GMM_TRACE_FUNCTION( "kern_enter_reg_normal_upon_gmmrr_cell_ind" ); | |
936 | |
937 kern_gmmrr_stop_waiting_for_transmission(); | |
938 kern_enter_reg_normal(); | |
939 GMM_RETURN; | |
940 } /* kern_enter_reg_normal() */ | |
941 | |
942 /* | |
943 +------------------------------------------------------------------------------ | |
944 | Function : kern_normal_attach | |
945 +------------------------------------------------------------------------------ | |
946 | Description : The label NORM_ATTACH | |
947 | | |
948 | MSC : 3.8 Attach | |
949 | | |
950 | MSC : 3.8.1 Normal Attach | |
951 | MSC : 3.8.1.1 Initiation | |
952 | | |
953 | Parameters : void | |
954 | | |
955 +------------------------------------------------------------------------------ | |
956 */ | |
957 GLOBAL void kern_norm_attach ( void ) | |
958 { | |
959 GMM_TRACE_FUNCTION( "kern_norm_attach" ); | |
960 | |
961 gmm_data->kern.attach_cap.attach_proc_type = AT_GPRS; | |
962 TRACE_EVENT("Info: Normal ATTACH"); | |
963 kern_attach_1 (); | |
964 GMM_RETURN; | |
965 } /* kern_norm_attach() */ | |
966 | |
967 /* | |
968 +------------------------------------------------------------------------------ | |
969 | Function : kern_comb_attach | |
970 +------------------------------------------------------------------------------ | |
971 | Description : The label COMB_ATTACH | |
972 | | |
973 | Parameters : void | |
974 | | |
975 +------------------------------------------------------------------------------ | |
976 */ | |
977 GLOBAL void kern_comb_attach ( void ) | |
978 { | |
979 GMM_TRACE_FUNCTION( "kern_comb_attach" ); | |
980 | |
981 /* | |
982 * 19760: <gprs attach while imsi attached> shall not be used | |
983 * leave following code in case we need to switch back | |
984 * | |
985 switch (GET_STATE(MM)) | |
986 { | |
987 default: | |
988 gmm_data->kern.attach_cap.attach_proc_type = AT_WHILE_IMSI_AT; | |
989 TRACE_EVENT("Info: Comb. ATTACH while IMSI attached"); | |
990 break; | |
991 case GMM_MM_DEREG: | |
992 case GMM_MM_REG_INITATED_VIA_GPRS: | |
993 case GMM_MM_REG_UPDATE_NEEDED: | |
994 gmm_data->kern.attach_cap.attach_proc_type = AT_COMB; | |
995 TRACE_EVENT("Info: Comb. ATTACH"); | |
996 break; | |
997 } | |
998 * | |
999 */ | |
1000 | |
1001 gmm_data->kern.attach_cap.attach_proc_type = AT_COMB; | |
1002 TRACE_EVENT("Info: Comb. ATTACH"); | |
1003 | |
1004 kern_mm_attach_started (); | |
1005 kern_attach_1(); | |
1006 | |
1007 GMM_RETURN; | |
1008 } /* kern_comb_attach() */ | |
1009 | |
1010 /* | |
1011 +------------------------------------------------------------------------------ | |
1012 | Function : kern_attach | |
1013 +------------------------------------------------------------------------------ | |
1014 | Description : The label ATTACH | |
1015 | | |
1016 | Parameters : void | |
1017 | | |
1018 +------------------------------------------------------------------------------ | |
1019 */ | |
1020 GLOBAL void kern_attach ( void ) | |
1021 { | |
1022 GMM_TRACE_FUNCTION( "kern_attach" ); | |
1023 | |
1024 /* Set GRR in state to transmit user data if not aready done */ | |
1025 kern_gmmrr_stop_waiting_for_transmission(); | |
1026 | |
1027 switch (gmm_data->kern.attach_cap.attach_type) | |
1028 { | |
1029 case GMMREG_AT_IMSI: | |
1030 if (gmm_data->sim_gprs_invalid) | |
1031 { | |
1032 SET_STATE(KERN,KERN_GMM_DEREG_NO_IMSI); | |
1033 #ifdef FF_EM_MODE | |
1034 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI); | |
1035 #endif | |
1036 } | |
1037 else | |
1038 { | |
1039 if (GMM_MM_DEREG == GET_STATE(MM) | |
1040 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status) | |
1041 { | |
1042 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING); | |
1043 #ifdef FF_EM_MODE | |
1044 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING); | |
1045 #endif | |
1046 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
1047 } | |
1048 else | |
1049 { | |
1050 SET_STATE(KERN,KERN_GMM_DEREG_PLMN_SEARCH); | |
1051 #ifdef FF_EM_MODE | |
1052 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH); | |
1053 #endif | |
1054 } | |
1055 } | |
1056 GMM_RETURN; | |
1057 case GMMREG_AT_COMB: | |
1058 if (GMM_GRR_STATE_OFF==gmm_data->kern.attach_cap.grr_state) | |
1059 { | |
1060 kern_gmmrr_enable(); | |
1061 } | |
1062 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode | |
1063 && GMMREG_CLASS_BC== gmm_data->kern.attach_cap.mobile_class | |
1064 ) | |
1065 { | |
1066 if( GMM_MM_DEREG == GET_STATE(MM) | |
1067 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status) | |
1068 { | |
1069 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING ); | |
1070 #ifdef FF_EM_MODE | |
1071 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING ); | |
1072 #endif | |
1073 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
1074 } | |
1075 else | |
1076 { | |
1077 SET_STATE(KERN,KERN_GMM_DEREG_PLMN_SEARCH); | |
1078 #ifdef FF_EM_MODE | |
1079 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH); | |
1080 #endif | |
1081 } | |
1082 GMM_RETURN; | |
1083 } | |
1084 break; | |
1085 default: | |
1086 if (GMM_GRR_STATE_OFF==gmm_data->kern.attach_cap.grr_state) | |
1087 { | |
1088 kern_gmmrr_enable(); | |
1089 } | |
1090 break; | |
1091 } | |
1092 | |
1093 | |
1094 | |
1095 /* | |
1096 * Upon some error causes MS has o rettach after RAU_REJ. | |
1097 * So procedure should be set to ATTACH | |
1098 */ | |
1099 gmm_data->kern.attach_cap.rau_initiated = GMM_NO_RAU; | |
1100 | |
1101 if ( GMMREG_CLASS_CG == gmm_data->kern.attach_cap.mobile_class | |
1102 || GMMREG_AT_GPRS == gmm_data->kern.attach_cap.attach_type) | |
1103 { | |
1104 kern_norm_attach(); | |
1105 } | |
1106 else | |
1107 { | |
1108 switch ( gmm_data->kern.sig_cell_info.net_mode ) | |
1109 { | |
1110 case GMMRR_NET_MODE_I: | |
1111 | |
1112 kern_comb_attach(); | |
1113 break; | |
1114 case GMMRR_NET_MODE_II: | |
1115 if ( GMM_MM_DEREG != GET_STATE(MM) | |
1116 || MMGMM_LIMITED_SERVICE == gmm_data->kern.sig_cell_info.mm_status) | |
1117 { | |
1118 kern_norm_attach (); | |
1119 } | |
1120 else | |
1121 { | |
1122 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING ); | |
1123 #ifdef FF_EM_MODE | |
1124 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING ); | |
1125 #endif | |
1126 | |
1127 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
1128 } | |
1129 break; | |
1130 case GMMRR_NET_MODE_III: | |
1131 switch ( gmm_data->kern.attach_cap.mobile_class) | |
1132 { | |
1133 case GMMREG_CLASS_BG: | |
1134 if ( GMM_MM_DEREG != GET_STATE(MM)) | |
1135 { | |
1136 | |
1137 kern_imsi_detach_der_susp (); | |
1138 } | |
1139 else | |
1140 { | |
1141 | |
1142 kern_norm_attach(); | |
1143 } | |
1144 break; | |
1145 case GMMREG_CLASS_BC: | |
1146 if ( GMM_MM_DEREG == GET_STATE(MM) | |
1147 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status) | |
1148 { | |
1149 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING ); | |
1150 #ifdef FF_EM_MODE | |
1151 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING ); | |
1152 #endif | |
1153 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
1154 } | |
1155 else | |
1156 { | |
1157 SET_STATE(KERN, KERN_GMM_DEREG_PLMN_SEARCH); | |
1158 #ifdef FF_EM_MODE | |
1159 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH); | |
1160 #endif | |
1161 } | |
1162 break; | |
1163 case GMMREG_CLASS_A: | |
1164 /* | |
1165 * react as in NMO II | |
1166 */ | |
1167 if ( GMM_MM_DEREG != GET_STATE(MM) | |
1168 || MMGMM_LIMITED_SERVICE == gmm_data->kern.sig_cell_info.mm_status) | |
1169 { | |
1170 kern_norm_attach (); | |
1171 } | |
1172 else | |
1173 { | |
1174 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING ); | |
1175 #ifdef FF_EM_MODE | |
1176 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING ); | |
1177 #endif | |
1178 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
1179 } | |
1180 break; | |
1181 default: | |
1182 TRACE_ERROR ("unexpected MS class"); | |
1183 break; | |
1184 } | |
1185 break; | |
1186 default: | |
1187 TRACE_ERROR ("unknown network mode"); | |
1188 break; | |
1189 } | |
1190 | |
1191 } | |
1192 GMM_RETURN; | |
1193 } | |
1194 /* | |
1195 +------------------------------------------------------------------------------ | |
1196 | Function : kern_disable | |
1197 +------------------------------------------------------------------------------ | |
1198 | Description : The label DISABLE | |
1199 | | |
1200 | Parameters : void | |
1201 | | |
1202 +------------------------------------------------------------------------------ | |
1203 */ | |
1204 GLOBAL void kern_disable () | |
1205 { | |
1206 GMM_TRACE_FUNCTION( "kern_disable" ); | |
1207 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_DISABLE_GPRS; | |
1208 kern_detach(); | |
1209 GMM_RETURN; | |
1210 } | |
1211 /* | |
1212 +------------------------------------------------------------------------------ | |
1213 | Function : kern_detach | |
1214 +------------------------------------------------------------------------------ | |
1215 | Description : The label DETACH | |
1216 | | |
1217 | | |
1218 | Parameters : void | |
1219 | gmm_data->kern.detach_cap.detach_type MUST be set ! | |
1220 | | |
1221 +------------------------------------------------------------------------------ | |
1222 */ | |
1223 GLOBAL void kern_detach() | |
1224 { | |
1225 | |
1226 #ifdef REL99 | |
1227 T_gmobile_identity gmobile_identity; /* TCS 4.0 */ | |
1228 #endif | |
1229 | |
1230 GMM_TRACE_FUNCTION( "kern_detach" ); | |
1231 { | |
1232 MCAST ( u_detach_request, U_DETACH_REQUEST ); /* T_U_DETACH_REQUEST */ | |
1233 | |
1234 u_detach_request->u_detach_type.power_off = PO_NORMAL_DETACH; | |
1235 | |
1236 switch ( gmm_data->kern.detach_cap.detach_type ) | |
1237 { | |
1238 case GMMREG_DT_DISABLE_GPRS: | |
1239 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC; | |
1240 /* NO break */ | |
1241 case GMMREG_DT_GPRS: | |
1242 if ( GMM_MM_DEREG != GET_STATE(MM) | |
1243 && GMMRR_NET_MODE_I == gmm_data->kern.sig_cell_info.net_mode) | |
1244 { | |
1245 /* | |
1246 * <R.GMM.DINITM.M.007> | |
1247 */ | |
1248 kern_mm_start_t3212 (); | |
1249 } | |
1250 /* | |
1251 * LABEL NORM_DETACH | |
1252 */ | |
1253 u_detach_request->u_detach_type.u_type_of_detach = DT_GPRS; | |
1254 kern_llgmm_suspend(LLGMM_PERIODIC_RAU); | |
1255 | |
1256 break; | |
1257 | |
1258 case GMMREG_DT_COMB: | |
1259 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC; | |
1260 if ( GMM_MM_DEREG == GET_STATE(MM) | |
1261 || GMMRR_NET_MODE_I != gmm_data->kern.sig_cell_info.net_mode) | |
1262 { | |
1263 gmm_data->kern.detach_cap.detach_type = DT_GPRS; | |
1264 /* | |
1265 * LABEL NORM_DETACH | |
1266 */ | |
1267 u_detach_request->u_detach_type.u_type_of_detach = DT_GPRS; | |
1268 } | |
1269 else | |
1270 { | |
1271 /* | |
1272 * LABEL COMB_DETACH | |
1273 */ | |
1274 u_detach_request->u_detach_type.u_type_of_detach = DT_COMB; | |
1275 } | |
1276 kern_llgmm_suspend(LLGMM_PERIODIC_RAU); | |
1277 break; | |
1278 /* break; */ | |
1279 case GMMREG_DT_POWER_OFF: | |
1280 case GMMREG_DT_SOFT_OFF: | |
1281 u_detach_request->u_detach_type.power_off = PO_POWER_OFF; | |
1282 /* NO break; */ | |
1283 case GMMREG_DT_LIMITED_SERVICE: | |
1284 case GMMREG_DT_SIM_REMOVED: | |
1285 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC; | |
1286 if ( GMM_MM_DEREG != GET_STATE(MM) | |
1287 && GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode) | |
1288 { | |
1289 /* | |
1290 * LABEL COMB_DETACH | |
1291 */ | |
1292 u_detach_request->u_detach_type.u_type_of_detach = DT_COMB; | |
1293 } | |
1294 else | |
1295 { | |
1296 u_detach_request->u_detach_type.u_type_of_detach = DT_GPRS; | |
1297 } | |
1298 kern_llgmm_suspend(LLGMM_PERIODIC_RAU); | |
1299 break; | |
1300 case GMMREG_DT_IMSI: | |
1301 u_detach_request->u_detach_type.u_type_of_detach = DT_IMSI; | |
1302 break; | |
1303 default: | |
1304 TRACE_ERROR ( "Unexpected detach type in detach label" ); | |
1305 break; | |
1306 } | |
1307 /* | |
1308 * <R.GMM.DINITM.M.005> | |
1309 */ | |
1310 gmm_data->kern.ct3321 = 0; //44.2.2.1.3 Richard Byrne | |
1311 | |
1312 #ifdef REL99 | |
1313 /* Detach request sent to a Release 99 network has two addional | |
1314 * parameters. PTMSI and PTMSI signature | |
1315 */ | |
1316 switch (gmm_data->kern.sig_cell_info.sgsnr_flag)/*!gmm_data->release99 =>old code*/ /* TCS 4.0 */ | |
1317 { | |
1318 default: | |
1319 case PS_SGSN_UNKNOWN: | |
1320 case PS_SGSN_98_OLDER: | |
1321 u_detach_request->v_gmobile_identity = FALSE; /* TCS 4.0 */ | |
1322 u_detach_request->v_p_tmsi_signature_2 = FALSE; /* TCS 4.0 */ | |
1323 break; | |
1324 case PS_SGSN_99_ONWARDS: | |
1325 /* | |
1326 * PTMSI | |
1327 */ | |
1328 kern_ulong2mobile_identity( gmm_data->ptmsi.current, &gmobile_identity ); /* TCS 4.0 */ | |
1329 u_detach_request->v_gmobile_identity = TRUE; /* TCS 4.0 */ | |
1330 u_detach_request->gmobile_identity = gmobile_identity; /* TCS 4.0 */ | |
1331 | |
1332 /* | |
1333 * PTMSI Signature | |
1334 */ | |
1335 if(gmm_data->ptmsi_signature.available) /* TCS 4.0 */ | |
1336 { /* TCS 4.0 */ | |
1337 u_detach_request->v_p_tmsi_signature_2 =TRUE; /* TCS 4.0 */ | |
1338 u_detach_request->p_tmsi_signature_2.p_tmsi_signature_value /* TCS 4.0 */ | |
1339 = gmm_data->ptmsi_signature.value; /* TCS 4.0 */ | |
1340 } /* TCS 4.0 */ | |
1341 else /* TCS 4.0 */ | |
1342 { /* TCS 4.0 */ | |
1343 u_detach_request->v_p_tmsi_signature_2=FALSE; /* TCS 4.0 */ | |
1344 } /* TCS 4.0 */ | |
1345 break; | |
1346 } | |
1347 #endif | |
1348 | |
1349 | |
1350 kern_mm_detach_started (); | |
1351 | |
1352 sig_kern_tx_data_req ( CURRENT_TLLI, U_DETACH_REQUEST ); | |
1353 | |
1354 | |
1355 switch ( gmm_data->kern.detach_cap.detach_type ) | |
1356 { | |
1357 case GMMREG_DT_IMSI: | |
1358 /* | |
1359 * <R.GMM.DINITM.M.006>, | |
1360 * <R.GMM.ORATIMSI.M.001> | |
1361 */ | |
1362 SET_STATE ( KERN, KERN_GMM_REG_IMSI_DETACH_INITIATED ); | |
1363 #ifdef FF_EM_MODE | |
1364 EM_GMM_SET_STATE(KERN_GMM_REG_IMSI_DETACH_INITIATED ); | |
1365 #endif | |
1366 break; | |
1367 case GMMREG_DT_SOFT_OFF: | |
1368 /* | |
1369 * if mm_imsi attached is reset than MM is requested in function | |
1370 * mm_imsi_detach_ind to indicate detach_done | |
1371 */ | |
1372 if(GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode) | |
1373 { | |
1374 SET_STATE ( MM, GMM_MM_DEREG ); | |
1375 } | |
1376 | |
1377 vsi_t_stop ( GMM_handle, kern_T3302); | |
1378 sig_kern_rdy_stop_t3302_req(); | |
1379 vsi_t_stop ( GMM_handle, kern_T3310); | |
1380 vsi_t_stop ( GMM_handle, kern_T3311); | |
1381 | |
1382 sig_kern_rdy_start_timer_req ( kern_TPOWER_OFF, TPOWER_OFF_VALUE ); | |
1383 SET_STATE ( KERN, KERN_GMM_DEREG_INITIATED ); | |
1384 #ifdef FF_EM_MODE | |
1385 EM_GMM_SET_STATE(KERN_GMM_DEREG_INITIATED ); | |
1386 #endif | |
1387 break; | |
1388 case GMMREG_DT_POWER_OFF: | |
1389 /* | |
1390 * if mm_imsi attached is reset than MM is requested in function | |
1391 * mm_imsi_detach_ind to indicate detach_done | |
1392 */ | |
1393 if(GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode) | |
1394 { | |
1395 SET_STATE ( MM, GMM_MM_DEREG ); | |
1396 } | |
1397 vsi_t_stop ( GMM_handle, kern_T3302); | |
1398 sig_kern_rdy_stop_t3302_req(); | |
1399 vsi_t_stop ( GMM_handle, kern_T3310); | |
1400 vsi_t_stop ( GMM_handle, kern_T3311); | |
1401 sig_kern_rdy_start_timer_req ( kern_TPOWER_OFF, TPOWER_OFF_VALUE ); | |
1402 SET_STATE ( KERN, KERN_GMM_DEREG_INITIATED ); | |
1403 #ifdef FF_EM_MODE | |
1404 EM_GMM_SET_STATE(KERN_GMM_DEREG_INITIATED ); | |
1405 #endif | |
1406 break; | |
1407 case GMMREG_DT_LIMITED_SERVICE: | |
1408 kern_l_sim_rem_reg_lim (); | |
1409 break; | |
1410 default: | |
1411 TRACE_EVENT (" START T3321" ); | |
1412 sig_kern_rdy_start_timer_req ( kern_T3321, gmm_data->kern.t3321_val ); | |
1413 | |
1414 SET_STATE ( KERN, KERN_GMM_DEREG_INITIATED ); | |
1415 #ifdef FF_EM_MODE | |
1416 EM_GMM_SET_STATE(KERN_GMM_DEREG_INITIATED ); | |
1417 #endif | |
1418 break; | |
1419 } | |
1420 } | |
1421 GMM_RETURN; | |
1422 } /* kern_detach() */ | |
1423 | |
1424 /* | |
1425 +------------------------------------------------------------------------------ | |
1426 | Function : kern_rau | |
1427 +------------------------------------------------------------------------------ | |
1428 | Description : The label RAU | |
1429 | | |
1430 | Parameters : void | |
1431 | | |
1432 +------------------------------------------------------------------------------ | |
1433 */ | |
1434 GLOBAL void kern_rau ( void ) | |
1435 { | |
1436 GMM_TRACE_FUNCTION( "kern_rau" ); | |
1437 { | |
1438 | |
1439 | |
1440 gmm_data->kern.attach_cap.rau_initiated = GMM_RAU; | |
1441 switch ( gmm_data->kern.sig_cell_info.net_mode ) | |
1442 { | |
1443 case GMMRR_NET_MODE_I: | |
1444 kern_llgmm_suspend(LLGMM_RAU); | |
1445 break; | |
1446 case GMMRR_NET_MODE_II: | |
1447 if (kern_lau_needed() | |
1448 && !gmm_data->kern.detach_cap.gmmreg) | |
1449 { | |
1450 kern_llgmm_suspend(LLGMM_CALL); | |
1451 } | |
1452 else | |
1453 { | |
1454 kern_llgmm_suspend(LLGMM_RAU); | |
1455 } | |
1456 break; | |
1457 case GMMRR_NET_MODE_III: | |
1458 switch ( gmm_data->kern.attach_cap.mobile_class) | |
1459 { | |
1460 case GMMREG_CLASS_A: | |
1461 kern_llgmm_suspend(LLGMM_RAU); | |
1462 break; | |
1463 case GMMREG_CLASS_BG: | |
1464 if ( GMM_MM_DEREG != GET_STATE(MM) | |
1465 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status ) | |
1466 { | |
1467 kern_llgmm_suspend(LLGMM_CALL); | |
1468 } | |
1469 else | |
1470 { | |
1471 kern_llgmm_suspend(LLGMM_RAU); | |
1472 } | |
1473 break; | |
1474 case GMMREG_CLASS_BC: | |
1475 if (GMMREG_AT_GPRS == gmm_data->kern.attach_cap.attach_type) | |
1476 { | |
1477 kern_llgmm_suspend(LLGMM_RAU); | |
1478 } | |
1479 else | |
1480 /* | |
1481 * GSM attach_type | |
1482 */ | |
1483 { | |
1484 if (kern_lau_needed()) | |
1485 { | |
1486 kern_llgmm_suspend(LLGMM_CALL); | |
1487 } | |
1488 else | |
1489 { | |
1490 if (kern_rai_changed()) | |
1491 { | |
1492 kern_llgmm_suspend(LLGMM_RAU); | |
1493 } | |
1494 } | |
1495 } | |
1496 break; | |
1497 default: | |
1498 kern_llgmm_suspend(LLGMM_RAU); | |
1499 break; | |
1500 } | |
1501 break; | |
1502 default: | |
1503 TRACE_ERROR ("unkown net mode"); | |
1504 break; | |
1505 } | |
1506 } /* PALLOC */ | |
1507 | |
1508 kern_rau_limited (); | |
1509 GMM_RETURN; | |
1510 } /* kern_rau() */ | |
1511 /* | |
1512 +------------------------------------------------------------------------------ | |
1513 | Function : kern_aac_over_5 | |
1514 +------------------------------------------------------------------------------ | |
1515 | Description : The label AAC_OVER_5 | |
1516 | | |
1517 | Parameters : void | |
1518 | | |
1519 +------------------------------------------------------------------------------ | |
1520 */ | |
1521 void kern_aac_over_5 ( USHORT cause ) | |
1522 { | |
1523 GMM_TRACE_FUNCTION( "kern_aac_over_5" ); | |
1524 | |
1525 /* <R.GMM.DDATMATT.M.001> | |
1526 * If entry into this state was caused by b) or d) of procedure <AGABNORM> | |
1527 * with cause 'Retry upon entry into a new cell', GPRS attach shall be | |
1528 * performed when a new cell is entered. | |
1529 */ | |
1530 | |
1531 /*if ( cause NEQ GMMCS_RETRY_IN_NEW_CELL ) TCS 2.1 | |
1532 {*/ | |
1533 /* | |
1534 * <R.GMM.AGABNORM.M.026> | |
1535 */ | |
1536 TRACE_EVENT ( "Info: START: T3302" ); | |
1537 TRACE_1_INFO ("ATTACH or RAU will be retried %.1f minutes later", | |
1538 gmm_data->kern.t3302_val/(60000.0)); | |
1539 | |
1540 vsi_t_start ( GMM_handle , kern_T3302, gmm_data->kern.t3302_val ); | |
1541 sig_kern_rdy_start_t3302_req(); | |
1542 /*}*/ | |
1543 | |
1544 gmm_data->gu = GU2_NOT_UPDATED; | |
1545 if (GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated) | |
1546 { | |
1547 kern_sim_del_locigprs (); | |
1548 } | |
1549 kern_sim_gmm_update(); | |
1550 | |
1551 if ((GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated && | |
1552 AT_GPRS != gmm_data->kern.attach_cap.attach_proc_type ) | |
1553 || (GMM_NO_RAU != gmm_data->kern.attach_cap.rau_initiated && | |
1554 (COMBINED_RAU == gmm_data->kern.attach_cap.update_proc_type ) | |
1555 || (COMBINED_RAU_IMSI_ATTACH == gmm_data->kern.attach_cap.update_proc_type ))) | |
1556 { | |
1557 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated ) | |
1558 /* | |
1559 * GMM is in state REG_INITIATED | |
1560 * we try to attach for GSM | |
1561 */ | |
1562 { | |
1563 | |
1564 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE; | |
1565 | |
1566 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
1567 | |
1568 kern_local_detach( cause, FALSE, | |
1569 GMM_LOCAL_DETACH_PROC_SUSP_LAU); | |
1570 } | |
1571 else | |
1572 /* | |
1573 * GMM is in state RAU_INITIATED | |
1574 * we try to start LAU | |
1575 */ | |
1576 { | |
1577 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE; | |
1578 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING ); | |
1579 #ifdef FF_EM_MODE | |
1580 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING ); | |
1581 #endif | |
1582 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
1583 } | |
1584 kern_mm_attach_rej ( GMMCS_AAC_OVER_5); /* TCS 2.1 */ | |
1585 | |
1586 } | |
1587 else | |
1588 { | |
1589 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated ) | |
1590 { | |
1591 /* | |
1592 * Optional: The MS may optionally enter state GMM-DEREG.PLMN-SEARCH | |
1593 * instead of GMM-DEREG.ATTEMPTING-TO-ATTACH. (Version 6.4.0) | |
1594 * | |
1595 * <R.GMM.AGABNORM.M.027>, <R.GMM.AGABNORM.M.030> | |
1596 */ | |
1597 /* | |
1598 * SET_STATE ( KERN, KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH ); | |
1599 */ | |
1600 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE; | |
1601 | |
1602 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
1603 | |
1604 kern_local_detach( cause, FALSE, | |
1605 GMM_LOCAL_DETACH_PROC_RESUME); | |
1606 } | |
1607 else | |
1608 { | |
1609 SET_STATE ( KERN, KERN_GMM_REG_ATTEMPTING_TO_UPDATE ); | |
1610 #ifdef FF_EM_MODE | |
1611 EM_GMM_SET_STATE(KERN_GMM_REG_ATTEMPTING_TO_UPDATE ); | |
1612 #endif | |
1613 } | |
1614 } | |
1615 GMM_RETURN; | |
1616 | |
1617 } /* kern_aac_over_5() */ | |
1618 | |
1619 /* | |
1620 +------------------------------------------------------------------------------ | |
1621 | Function : kern_l_sim_rem_reg_lim | |
1622 +------------------------------------------------------------------------------ | |
1623 | Description : The label L_SIM_REM_REG_LIM | |
1624 | SIM removed in state GMM-REGISTERED in a limited substate | |
1625 +------------------------------------------------------------------------------ | |
1626 */ | |
1627 GLOBAL void kern_l_sim_rem_reg_lim ( void ) | |
1628 { | |
1629 GMM_TRACE_FUNCTION( "kern_l_sim_rem_reg_lim" ); | |
1630 | |
1631 /* | |
1632 * local GPRS only detach with any error cause | |
1633 * 2.parameter is only used for attach procedure | |
1634 * | |
1635 * <R.GMM.DETACH.M.005> | |
1636 */ | |
1637 /* | |
1638 * Optional: The MS may optionally enter state GMM-DEREG.PLMN-SEARCH | |
1639 * instead of GMM-DEREG.ATTEMPTING-TO-ATTACH. (Version 6.4.0) | |
1640 * | |
1641 * <R.GMM.AGABNORM.M.027>, <R.GMM.AGABNORM.M.030> | |
1642 * | |
1643 SET_STATE ( KERN, SET_STATE ( KERN, KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ ) ); | |
1644 */ | |
1645 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_LIMITED_SERVICE; | |
1646 | |
1647 kern_local_detach( GMMCS_SIM_REMOVED, FALSE, /* TCS 2.1 */ | |
1648 GMM_LOCAL_DETACH_PROC_ENTER_NULL_IMSI_LIMITED_SERVICE_REQ); | |
1649 /* | |
1650 * <R.GMM.DSUBFANO.M.003> | |
1651 */ | |
1652 | |
1653 GMM_RETURN; | |
1654 } /* kern_l_sim_rem_reg_lim() */ | |
1655 /* | |
1656 +------------------------------------------------------------------------------ | |
1657 | Function : kern_l_sim_rem_reg | |
1658 +------------------------------------------------------------------------------ | |
1659 | Description : The label L_SIM_REM_REG | |
1660 | SIM removed in state GMM-REGISTERED | |
1661 +------------------------------------------------------------------------------ | |
1662 */ | |
1663 GLOBAL void kern_l_sim_rem_reg ( void ) | |
1664 { | |
1665 GMM_TRACE_FUNCTION( "kern_l_sim_rem_reg" ); | |
1666 | |
1667 SET_STATE ( KERN, KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ ); | |
1668 #ifdef FF_EM_MODE | |
1669 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ ); | |
1670 #endif | |
1671 | |
1672 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_LIMITED_SERVICE; | |
1673 kern_detach( ); | |
1674 | |
1675 GMM_RETURN; | |
1676 } /* kern_l_sim_rem_reg() */ | |
1677 | |
1678 /* | |
1679 +------------------------------------------------------------------------------ | |
1680 | Function : kern_aac | |
1681 +------------------------------------------------------------------------------ | |
1682 | Description : The label AAC | |
1683 | | |
1684 | Parameters : error_cause | |
1685 | | |
1686 +------------------------------------------------------------------------------ | |
1687 */ | |
1688 GLOBAL void kern_aac ( USHORT cause ) | |
1689 { | |
1690 GMM_TRACE_FUNCTION( "kern_aac" ); | |
1691 /* <R.GMM.AGABNORM.M.020> */ | |
1692 gmm_data->kern.aac ++; | |
1693 | |
1694 TRACE_1_INFO ("error cause: 0x%x",cause); | |
1695 TRACE_1_INFO(" aac: %d", gmm_data->kern.aac ); | |
1696 | |
1697 gmm_data->kern.detach_cap.error_cause = cause; | |
1698 /* | |
1699 * reset the counter for timer T3310 | |
1700 */ | |
1701 gmm_data->kern.ct3310 = 0; | |
1702 /* | |
1703 * <R.GMM.AGABNORM.M.021> | |
1704 */ | |
1705 gmm_data->kern.attach_cap.t3310_value=0; | |
1706 vsi_t_stop ( GMM_handle , kern_T3310); | |
1707 if (GMM_NO_RAU==gmm_data->kern.attach_cap.rau_initiated) | |
1708 { | |
1709 kern_gmmreg_detach ( GMMREG_DT_GPRS, | |
1710 cause, | |
1711 GMMREG_SEARCH_RUNNING, | |
1712 cause); | |
1713 } | |
1714 | |
1715 kern_gmmrr_attach_finished(); | |
1716 | |
1717 if ( gmm_data->kern.aac < MAX_AAC ) | |
1718 /* | |
1719 * AAC_UNDER_5 | |
1720 */ | |
1721 { | |
1722 if ( AT_GPRS != gmm_data->kern.attach_cap.attach_proc_type ) | |
1723 { | |
1724 if ( kern_lai_changed () ) | |
1725 { | |
1726 /* | |
1727 * <R.GMM.ACABNORM.M.006> | |
1728 */ | |
1729 kern_mm_attach_rej ( GMMCS_AAC_UNDER_5 ); /* TCS 2.1 */ | |
1730 } | |
1731 } | |
1732 | |
1733 /* <R.GMM.DDATMATT.M.001> | |
1734 * If entry into this state was caused by b) or d) of procedure <AGABNORM> | |
1735 * with cause 'Retry upon entry into a new cell', GPRS attach shall be | |
1736 * performed when a new cell is entered. | |
1737 */ | |
1738 /* Richard Byrne 44.2.1.2.8 remove if ( cause NEQ GMMCS_RETRY_IN_NEW_CELL ) */ /* TCS 2.1 */ | |
1739 { | |
1740 /* | |
1741 * <R.GMM.AGABNORM.M.022> | |
1742 */ | |
1743 TRACE_EVENT ( "Info: START: T3311" ); | |
1744 vsi_t_start ( GMM_handle , kern_T3311, gmm_data->kern.t3311_val ); | |
1745 } | |
1746 switch ( gmm_data->kern.attach_cap.rau_initiated ) | |
1747 { | |
1748 case GMM_NO_RAU: | |
1749 SET_STATE ( KERN, KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH ); | |
1750 #ifdef FF_EM_MODE | |
1751 EM_GMM_SET_STATE(KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH ); | |
1752 #endif | |
1753 break; | |
1754 case GMM_RAU: | |
1755 /* | |
1756 * <R.GMM.AGABNORM.M.023> | |
1757 */ | |
1758 SET_STATE ( KERN, KERN_GMM_REG_ATTEMPTING_TO_UPDATE ); | |
1759 #ifdef FF_EM_MODE | |
1760 EM_GMM_SET_STATE(KERN_GMM_REG_ATTEMPTING_TO_UPDATE ); | |
1761 #endif | |
1762 break; | |
1763 case GMM_PERIODIC_RAU: | |
1764 /* | |
1765 * <R.GMM.RNABNORM.M.022> | |
1766 */ | |
1767 kern_enter_reg_normal(); | |
1768 break; | |
1769 default: | |
1770 TRACE_ERROR ("unexcpected RAU case"); | |
1771 break; | |
1772 } | |
1773 | |
1774 } | |
1775 else | |
1776 /* | |
1777 * LABEL AAC_OVER_5 | |
1778 * | |
1779 * acc expired | |
1780 */ | |
1781 { | |
1782 kern_aac_over_5 (cause); | |
1783 } | |
1784 GMM_RETURN; | |
1785 } /* kern_aac() */ | |
1786 | |
1787 | |
1788 /* | |
1789 +------------------------------------------------------------------------------ | |
1790 | Function : kern_err_cause | |
1791 +------------------------------------------------------------------------------ | |
1792 | Description : The label ERR_CAUSE | |
1793 | | |
1794 | Parameters : error_cause | |
1795 | | |
1796 +------------------------------------------------------------------------------ | |
1797 */ | |
1798 GLOBAL void kern_err_cause ( USHORT error_cause, BOOL det_acc_sent ) | |
1799 { | |
1800 GMM_TRACE_FUNCTION( "kern_err_cause" ); | |
1801 | |
1802 gmm_data->kern.detach_cap.error_cause = error_cause; | |
1803 | |
1804 TRACE_1_INFO ("error cause: %x",error_cause); | |
1805 | |
1806 /* | |
1807 * <R.GMM.AGREJECT.M.003>, <R.GMM.AGREJECT.M.004>, | |
1808 * <R.GMM.AGREJECT.M.006>, <R.GMM.DSUBFANO.M.003>, | |
1809 * <R.GMM.AGREJECT.M.011>, <R.GMM.AGREJECT.M.012>, | |
1810 * <R.GMM.AGREJECT.M.029>, <R.GMM.AGREJECT.M.028>, | |
1811 * <R.GMM.AGREJECT.M.034>, <R.GMM.AGREJECT.M.015>, | |
1812 * <R.GMM.AGREJECT.M.016>, <R.GMM.DSUBFANO.M.013> | |
1813 */ | |
1814 | |
1815 switch ( error_cause ) | |
1816 { | |
1817 case GMMCS_IMSI_UNKNOWN: /* TCS 2.1 */ | |
1818 /* No SIM upate. GPRS is still available */ | |
1819 /* | |
1820 * <R.GMM.DNACM.M.040> | |
1821 */ | |
1822 /* | |
1823 * kern_mm_attach_rej ( error_cause ); | |
1824 * called in kern_local_detach | |
1825 */ | |
1826 | |
1827 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_IMSI; | |
1828 | |
1829 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_ENTER_REG_NORMAL); | |
1830 | |
1831 break; | |
1832 case GMMCS_NO_MS_ID: /* TCS 2.1 */ | |
1833 /* | |
1834 * This case can not be reached in attach_procedure, | |
1835 * so I may reset the attach parameters, the mobile | |
1836 * is just in state DEREGISTERED. | |
1837 */ | |
1838 kern_sim_del_locigprs(); | |
1839 gmm_data->gu = GU2_NOT_UPDATED; | |
1840 kern_sim_gmm_update(); | |
1841 /* | |
1842 * <R.GMM.RCREJECT.M.016>, <R.GMM.RCREJECT.M.035> | |
1843 */ | |
1844 gmm_data->kern.detach_cap.detach_type = GMM_DT_RE_ATTACH; | |
1845 | |
1846 kern_local_detach ( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_RE_ATTACH); | |
1847 break; | |
1848 case GMMCS_IMPLICIT_DETACHED: /* TCS 2.1 */ | |
1849 if ( GMMREG_AT_COMB==gmm_data->kern.attach_cap.attach_proc_type ) | |
1850 { | |
1851 /* | |
1852 * <R.GMM.RCREJECT.M.036> | |
1853 */ | |
1854 kern_mm_attach_rej ( error_cause ); | |
1855 | |
1856 /* | |
1857 * <R.GMM.RCREJECT.M.030> | |
1858 */ | |
1859 kern_gmmreg_detach (GMMREG_DT_COMB, | |
1860 GMMCS_IMPLICIT_DETACHED, /* TCS 2.1 */ | |
1861 GMMREG_SEARCH_RUNNING, | |
1862 error_cause); | |
1863 } | |
1864 else | |
1865 { | |
1866 kern_gmmreg_detach (GMMREG_DT_GPRS, | |
1867 GMMCS_IMPLICIT_DETACHED, /* TCS 2.1 */ | |
1868 GMMREG_SEARCH_RUNNING, | |
1869 error_cause); | |
1870 } | |
1871 gmm_data->kern.detach_cap.detach_type = GMM_DT_RE_ATTACH; | |
1872 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_RE_ATTACH); | |
1873 | |
1874 break; | |
1875 case GMMCS_GPRS_NOT_ALLOWED_IN_PLMN: /* TCS 2.1 */ | |
1876 memcpy (gmm_data->kern.attach_cap.list_of_forbidden_plmns_for_gprs_service[0].mcc, | |
1877 gmm_data->kern.sig_cell_info.env.rai.plmn.mcc, SIZE_MCC); | |
1878 memcpy (gmm_data->kern.attach_cap.list_of_forbidden_plmns_for_gprs_service[0].mnc, | |
1879 gmm_data->kern.sig_cell_info.env.rai.plmn.mnc, SIZE_MNC); | |
1880 | |
1881 gmm_data->kern.sig_cell_info.gmm_status=GMMRR_SERVICE_LIMITED; | |
1882 | |
1883 kern_sim_del_locigprs(); | |
1884 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED; | |
1885 kern_sim_gmm_update(); | |
1886 kern_mm_attach_rej ( error_cause ); | |
1887 | |
1888 | |
1889 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated | |
1890 && GMMREG_AT_COMB == gmm_data->kern.attach_cap.attach_proc_type | |
1891 && kern_lau_needed()) | |
1892 /* | |
1893 * If GMM had tried to comb. attach then if MM is not registered it has | |
1894 * to do so. | |
1895 */ | |
1896 { | |
1897 /* | |
1898 * <GMM.R.ACREJECT.M.014> | |
1899 */ | |
1900 /* | |
1901 * <GMM.R.ACREJECT.M.015> | |
1902 * <GMM.R.ACREJECT.M.016> | |
1903 */ | |
1904 gmm_data->kern.suspension_type |= GMM_SUSP_LAU; | |
1905 } | |
1906 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
1907 kern_local_detach( error_cause, det_acc_sent, | |
1908 GMM_LOCAL_DETACH_PROC_UNASSIGN); | |
1909 | |
1910 break; | |
1911 | |
1912 case GMMCS_GPRS_NOT_ALLOWED: /* TCS 2.1 */ | |
1913 gmm_data->sim_gprs_invalid = TRUE; | |
1914 kern_sim_del_locigprs(); | |
1915 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED; | |
1916 kern_sim_gmm_update(); | |
1917 /* | |
1918 * LABEL ERRCS_GPRS_NOT_ALLOWED | |
1919 * | |
1920 * <R.DNACM.M.041> | |
1921 */ | |
1922 /* | |
1923 * <GMM.R.RCREJECT.M.033> | |
1924 */ | |
1925 kern_mm_start_t3212(); | |
1926 /* | |
1927 * <R.GMM.RCREJECT.M.011>, <R.GMM.AGREJECT.M.013> | |
1928 * <R.GMM.ACREJECT.M.012> | |
1929 */ | |
1930 /* | |
1931 * <GMM.R.ACREJECT.M.015> | |
1932 * <GMM.R.ACREJECT.M.016> | |
1933 */ | |
1934 /* ANITE TC 44.2.1.2.6 */ | |
1935 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
1936 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_DISABLE); | |
1937 break; | |
1938 case GMMCS_GSM_GPRS_NOT_ALLOWED: /* TCS 2.1 */ | |
1939 gmm_data->sim_gprs_invalid = TRUE; | |
1940 kern_sim_del_locigprs(); | |
1941 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED; | |
1942 kern_sim_gmm_update(); | |
1943 /* | |
1944 * <R.GMM.AGREJECT.M.034>, <R.GMM.ACREJECT.M.009> | |
1945 * <R.GMM.DNACM.M.025>, <R.GMM.RCREJECT.M.009> | |
1946 */ | |
1947 /* | |
1948 * kern_mm_attach_rej ( error_cause ); | |
1949 * called in kern_local_detach | |
1950 */ | |
1951 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB; | |
1952 kern_local_detach( error_cause, det_acc_sent, | |
1953 GMM_LOCAL_DETACH_PROC_COMB_DISABLE); | |
1954 break; | |
1955 | |
1956 default: | |
1957 kern_sim_del_locigprs(); | |
1958 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED; | |
1959 kern_sim_gmm_update(); | |
1960 | |
1961 /* | |
1962 * LABEL ERR_CAUSE_2 | |
1963 */ | |
1964 /* NO break; */ | |
1965 switch ( error_cause ) | |
1966 { | |
1967 case GMMCS_PLMN_NOT_ALLOWED: /* TCS 2.1 */ | |
1968 case GMMCS_ROAMING_NOT_ALLOWED: /* TCS 2.1 */ | |
1969 /* | |
1970 * <R.GMM.AGREJECT.M.021>, <R.GMM.AGREJECT.M.022> | |
1971 */ | |
1972 /* | |
1973 * MM knows, what is to do | |
1974 * because the cause is forwarded be the mmgmm_attach_rej_req | |
1975 * primitive | |
1976 */ | |
1977 /* NO BREAK */ | |
1978 case GMMCS_LA_NOT_ALLOWED: /* TCS 2.1 */ | |
1979 | |
1980 #ifdef REL99 | |
1981 case GMMCS_NO_SUITABLE_CELL_IN_LA: /*Cause #15*/ /* TCS 4.0 */ | |
1982 #endif | |
1983 | |
1984 /* | |
1985 * sometimes GRR responses to GMMRR_RESUME_IND verry fast and does not know | |
1986 * that RR is in limited, so GMM will set state before. | |
1987 */ | |
1988 gmm_data->kern.sig_cell_info.mm_status = MMGMM_LIMITED_SERVICE; | |
1989 sig_kern_sync_set_mm_state(MMGMM_LIMITED_SERVICE); | |
1990 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB; | |
1991 kern_local_detach( error_cause, det_acc_sent, | |
1992 GMM_LOCAL_DETACH_PROC_UNASSIGN); | |
1993 break; | |
1994 case GMMCS_ILLEGAL_ME: /* TCS 2.1 */ | |
1995 case GMMCS_ILLEGAL_MS: /* TCS 2.1 */ | |
1996 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB; | |
1997 kern_local_detach( error_cause, det_acc_sent, | |
1998 GMM_LOCAL_DETACH_PROC_COMB_DISABLE); | |
1999 break; | |
2000 default: | |
2001 /* | |
2002 * <R.GMM.ODNOIMSI.M.001>, <R.GMM.DSUBFANO.M.003> | |
2003 */ | |
2004 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
2005 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_ENTER_NULL_NO_IMSI); | |
2006 break; | |
2007 } | |
2008 break; | |
2009 /* END of LABEL ERR_CAUSE_2 */ | |
2010 } | |
2011 GMM_RETURN; | |
2012 } /* kern_err_cause() */ | |
2013 | |
2014 /* | |
2015 +------------------------------------------------------------------------------ | |
2016 | Function : kern_enter_der | |
2017 +------------------------------------------------------------------------------ | |
2018 | Description : The label ENTER_DER | |
2019 | | |
2020 | Parameters : void | |
2021 | | |
2022 +------------------------------------------------------------------------------ | |
2023 */ | |
2024 GLOBAL void kern_enter_der ( void ) | |
2025 { | |
2026 GMM_TRACE_FUNCTION( "kern_enter_der" ); | |
2027 | |
2028 if (gmm_data->kern.attach_cap.mobile_class_changed | |
2029 && GMMREG_CLASS_CC!=gmm_data->kern.attach_cap.mobile_class) | |
2030 { | |
2031 gmm_data->kern.attach_cap.mobile_class_changed=FALSE; | |
2032 kern_gmmrr_enable(); | |
2033 } | |
2034 | |
2035 | |
2036 kern_reset_cipher (); | |
2037 | |
2038 | |
2039 switch ( gmm_data->kern.detach_cap.detach_type ) | |
2040 { | |
2041 case GMMREG_DT_POWER_OFF: | |
2042 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI); | |
2043 #ifdef FF_EM_MODE | |
2044 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI); | |
2045 #endif | |
2046 break; | |
2047 case GMMREG_DT_SOFT_OFF: | |
2048 if (gmm_data->sim_gprs_invalid) | |
2049 { | |
2050 SET_STATE ( KERN,KERN_GMM_NULL_NO_IMSI); | |
2051 #ifdef FF_EM_MODE | |
2052 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI); | |
2053 #endif | |
2054 } | |
2055 else | |
2056 { | |
2057 SET_STATE ( KERN,KERN_GMM_NULL_IMSI); | |
2058 #ifdef FF_EM_MODE | |
2059 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI); | |
2060 #endif | |
2061 } | |
2062 break; | |
2063 case GMMREG_DT_SIM_REMOVED: | |
2064 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI); | |
2065 #ifdef FF_EM_MODE | |
2066 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI); | |
2067 #endif | |
2068 if (GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode) | |
2069 { | |
2070 kern_mm_imsi_detach_ind (GMMCS_SIM_REMOVED, MMGMM_PERFORM_DETACH, | |
2071 GMMREG_DT_SIM_REMOVED ); /* TCS 2.1 */ | |
2072 } | |
2073 break; | |
2074 case GMMREG_DT_DISABLE_GPRS: | |
2075 if (gmm_data->sim_gprs_invalid) | |
2076 { | |
2077 SET_STATE ( KERN,KERN_GMM_NULL_NO_IMSI); | |
2078 #ifdef FF_EM_MODE | |
2079 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI); | |
2080 #endif | |
2081 } | |
2082 else | |
2083 { | |
2084 SET_STATE ( KERN,KERN_GMM_NULL_IMSI); | |
2085 #ifdef FF_EM_MODE | |
2086 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI); | |
2087 #endif | |
2088 } | |
2089 kern_mm_activate_mm (); | |
2090 break; | |
2091 default: | |
2092 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode | |
2093 && GMMREG_CLASS_BC== gmm_data->kern.attach_cap.mobile_class | |
2094 && kern_lau_needed()) | |
2095 { | |
2096 /* start attach GSM */ | |
2097 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING ); | |
2098 #ifdef FF_EM_MODE | |
2099 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING ); | |
2100 #endif | |
2101 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
2102 break; | |
2103 } | |
2104 else | |
2105 { | |
2106 if (gmm_data->sim_gprs_invalid) | |
2107 { | |
2108 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI); | |
2109 #ifdef FF_EM_MODE | |
2110 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI); | |
2111 #endif | |
2112 } | |
2113 else | |
2114 { | |
2115 SET_STATE ( KERN, KERN_GMM_NULL_IMSI); | |
2116 #ifdef FF_EM_MODE | |
2117 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI); | |
2118 #endif | |
2119 } | |
2120 /* GPRS DISABLE */ | |
2121 kern_gmmrr_disable(); | |
2122 kern_mm_activate_mm (); | |
2123 } | |
2124 break; | |
2125 } | |
2126 /* | |
2127 * The used P-TMSI signature should be deleted | |
2128 */ | |
2129 gmm_data->ptmsi_signature.available = FALSE; | |
2130 gmm_data->ptmsi_signature.value = INVALID_PTMSI_SIGNATURE; | |
2131 | |
2132 GMM_RETURN; | |
2133 } /* kern_enter_der () */ | |
2134 | |
2135 | |
2136 /* | |
2137 +------------------------------------------------------------------------------ | |
2138 | Function : kern_attach_complete_end | |
2139 +------------------------------------------------------------------------------ | |
2140 | Description : The label ATTACH_COMPLETE_END | |
2141 | | |
2142 | ATTACH accept procedure completion end | |
2143 | | |
2144 | Parameters : result_value - the returned attach type | |
2145 | | |
2146 +------------------------------------------------------------------------------ | |
2147 */ | |
2148 GLOBAL void kern_attach_complete_end ( UBYTE result_value ) | |
2149 { | |
2150 GMM_TRACE_FUNCTION( "kern_attach_complete_end" ); | |
2151 | |
2152 kern_gmmrr_stop_waiting_for_transmission(); | |
2153 | |
2154 /* | |
2155 *<R.GMM.AGACCEPT.M.027>, <R.GMM.PATTCNF.M.001> | |
2156 */ | |
2157 switch (result_value) | |
2158 { | |
2159 case NORMAL_ATTACHED: | |
2160 if (GMM_MM_REG_NORMAL_SERVICE != GET_STATE(MM)) | |
2161 { | |
2162 if (GMMREG_AT_COMB==gmm_data->kern.attach_cap.attach_type | |
2163 && GMMRR_NET_MODE_III != gmm_data->kern.sig_cell_info.net_mode) | |
2164 { | |
2165 kern_gmmreg_attach_cnf_sr ( GMMREG_AT_GPRS, SEARCH_RUNNING ); | |
2166 } | |
2167 else | |
2168 { | |
2169 kern_gmmreg_attach_cnf ( GMMREG_AT_GPRS ); | |
2170 } | |
2171 break; | |
2172 } | |
2173 /* NO break */ | |
2174 case COMBINED_ATTACHED: | |
2175 kern_gmmreg_attach_cnf ( GMMREG_AT_COMB ); | |
2176 break; | |
2177 default: | |
2178 TRACE_ERROR ("unknown result value"); | |
2179 break; | |
2180 } | |
2181 | |
2182 | |
2183 #ifndef GMM_TCS4 | |
2184 if ( gmm_data->kern.attach_cap.gmmsm ) | |
2185 { | |
2186 PALLOC (gmmsm_establish_cnf, GMMSM_ESTABLISH_CNF); | |
2187 gmm_data->kern.attach_cap.gmmsm = FALSE; | |
2188 PSEND ( hCommSM, gmmsm_establish_cnf ); | |
2189 } | |
2190 #endif | |
2191 if (gmm_data->kern.attach_cap.attempting_to_update_mm ) | |
2192 { | |
2193 SET_STATE ( KERN, KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM ); | |
2194 #ifdef FF_EM_MODE | |
2195 EM_GMM_SET_STATE(KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM ); | |
2196 #endif | |
2197 gmm_data->kern.attach_cap.attempting_to_update_mm = FALSE; | |
2198 } | |
2199 else | |
2200 { | |
2201 /* gmmrr_cell_res | |
2202 */ | |
2203 SET_STATE(GU,GU_UPDATE_NOT_NEEDED); | |
2204 SET_STATE ( KERN, KERN_GMM_REG_NORMAL_SERVICE ); | |
2205 #ifdef FF_EM_MODE | |
2206 EM_GMM_SET_STATE(KERN_GMM_REG_NORMAL_SERVICE ); | |
2207 #endif | |
2208 } | |
2209 GMM_RETURN; | |
2210 } /* kern_attach_complete_end () */ | |
2211 | |
2212 | |
2213 | |
2214 /* | |
2215 +------------------------------------------------------------------------------ | |
2216 | Function : kern_rau_complete_end | |
2217 +------------------------------------------------------------------------------ | |
2218 | Description : The label RAU_COMPLETE_END | |
2219 | | |
2220 | RAU accept procedure completion end | |
2221 | | |
2222 | Parameters : void | |
2223 | | |
2224 +------------------------------------------------------------------------------ | |
2225 */ | |
2226 GLOBAL void kern_rau_complete_end ( UBYTE result_value ) | |
2227 { | |
2228 GMM_TRACE_FUNCTION( "kern_rau_complete_end" ); | |
2229 | |
2230 /* gmmrr_cell_ind | |
2231 * is sent in kern_attach_complete_end | |
2232 */ | |
2233 kern_llgmm_resume (); | |
2234 | |
2235 gmm_data->kern.attach_cap.rau_initiated = GMM_NO_RAU; | |
2236 | |
2237 if( gmm_data->sim_gprs_invalid) | |
2238 { | |
2239 TRACE_EVENT("Detach because SIM removed"); | |
2240 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB; | |
2241 kern_detach( ); | |
2242 } | |
2243 else if ( gmm_data->kern.detach_cap.gmmreg ) | |
2244 /* | |
2245 * MO DETACH was requested | |
2246 */ | |
2247 { | |
2248 TRACE_0_INFO("Detach Request again"); | |
2249 switch ( gmm_data->kern.detach_cap.detach_type ) | |
2250 { | |
2251 case GMMREG_DT_IMSI: | |
2252 case GMMREG_DT_COMB: | |
2253 case GMMREG_DT_SIM_REMOVED: | |
2254 switch (gmm_data->kern.sig_cell_info.net_mode) | |
2255 { | |
2256 case GMMRR_NET_MODE_I: | |
2257 kern_detach( ); | |
2258 break; | |
2259 case GMMRR_NET_MODE_II: | |
2260 /* | |
2261 * if deatch procedure collision and GSM is already detached we | |
2262 * are finished | |
2263 */ | |
2264 if (GMM_MM_DEREG != GET_STATE(MM)) | |
2265 { | |
2266 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING); | |
2267 #ifdef FF_EM_MODE | |
2268 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING); | |
2269 #endif | |
2270 kern_llgmm_suspend(LLGMM_CALL); | |
2271 kern_gmmrr_suspend(GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
2272 } | |
2273 else | |
2274 { | |
2275 kern_detach( ); | |
2276 } | |
2277 break; | |
2278 case GMMRR_NET_MODE_III: | |
2279 kern_detach( ); | |
2280 break; | |
2281 default: | |
2282 TRACE_ERROR ("unknown net mode"); | |
2283 break; | |
2284 } | |
2285 break; | |
2286 case GMMREG_DT_DISABLE_GPRS: | |
2287 kern_local_detach( GMMCS_INT_NOT_PRESENT, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_DEREG); /* TCS 2.1 */ | |
2288 break; | |
2289 case GMMREG_DT_GPRS: | |
2290 case GMMREG_DT_POWER_OFF: | |
2291 case GMMREG_DT_SOFT_OFF: | |
2292 kern_detach( ); | |
2293 break; | |
2294 default: | |
2295 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ"); | |
2296 break; | |
2297 } | |
2298 } | |
2299 else if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode | |
2300 && GMMRR_CLASS_BC == gmm_data->kern.attach_cap.mobile_class) | |
2301 { | |
2302 TRACE_EVENT("Detach because NMO III and BC"); | |
2303 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
2304 kern_detach( ); | |
2305 } | |
2306 else | |
2307 { | |
2308 kern_attach_complete_end(result_value); | |
2309 } | |
2310 GMM_RETURN; | |
2311 } /* kern_rau_complete_end () */ | |
2312 | |
2313 /* | |
2314 +------------------------------------------------------------------------------ | |
2315 | Function : kern_rau_complete | |
2316 +------------------------------------------------------------------------------ | |
2317 | Description : The label RAU_COMPLETE | |
2318 | | |
2319 | RAU accept procedure completion | |
2320 | | |
2321 | Parameters : result_value - the returned attach type | |
2322 | | |
2323 +------------------------------------------------------------------------------ | |
2324 */ | |
2325 GLOBAL void kern_rau_complete ( UBYTE result_value ) | |
2326 { | |
2327 GMM_TRACE_FUNCTION( "kern_rau_complete" ); | |
2328 | |
2329 sig_kern_tx_data_req ( CURRENT_TLLI, ROUTING_AREA_UPDATE_COMPLETE ); | |
2330 | |
2331 /* | |
2332 * If Cell Notification is set in the RAU ACCEPT message, the | |
2333 * RAU COMPLETE if send, can be considered as the initial Cell Update. | |
2334 * The Next cell update can use LLC NULL frame. | |
2335 * Reference 3GPP TS 24.008 section 4.7.2.1.1 | |
2336 */ | |
2337 if (gmm_data->cell_notification EQ FIRST_CELL_NOTIFY) | |
2338 { | |
2339 gmm_data->cell_notification = NOT_FIRST_CELL_NOTIFY; /* TCS 4.0 */ | |
2340 } | |
2341 | |
2342 kern_rau_complete_end(result_value); | |
2343 GMM_RETURN; | |
2344 } /* kern_rau_complete () */ | |
2345 | |
2346 /* | |
2347 +------------------------------------------------------------------------------ | |
2348 | Function : kern_attach_complete | |
2349 +------------------------------------------------------------------------------ | |
2350 | Description : The label ATTACH_COMPLETE | |
2351 | | |
2352 | ATTACH and RAU accept procedure completion | |
2353 | | |
2354 | Parameters : attach_complete - idicates whether AIR ATTACH-COMPLETE | |
2355 | message has to sent or not | |
2356 | receive_n_pdu_number_list | |
2357 | | |
2358 | | |
2359 +------------------------------------------------------------------------------ | |
2360 */ | |
2361 GLOBAL void kern_attach_complete ( | |
2362 UBYTE result_value, | |
2363 BOOL attach_complete, | |
2364 BOOL v_receive_n_pdu_number_list, | |
2365 T_receive_n_pdu_number_list * receive_n_pdu_number_list) | |
2366 { | |
2367 GMM_TRACE_FUNCTION( "kern_attach_complete" ); | |
2368 gmm_data->kern.attach_cap.attach_complete = attach_complete; | |
2369 | |
2370 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated ) | |
2371 /* | |
2372 * ATTACH procedure | |
2373 */ | |
2374 { | |
2375 if ( attach_complete ) | |
2376 { | |
2377 /* | |
2378 * <R.GMM.AGACCEPT.M.018>, <R.GMM.TLLIUSE.M011> | |
2379 */ | |
2380 sig_kern_tx_data_req ( CURRENT_TLLI, ATTACH_COMPLETE ); | |
2381 | |
2382 /* | |
2383 * If Cell Notification is set in the ATTACH ACCEPT message, the | |
2384 * ATTACH COMPLETE if send, can be considered as the initial Cell Update. | |
2385 * The Next cell update can use LLC NULL frame. | |
2386 * Reference 3GPP TS 24.008 section 4.7.2.1.1 | |
2387 */ | |
2388 if (gmm_data->cell_notification EQ FIRST_CELL_NOTIFY) | |
2389 { | |
2390 gmm_data->cell_notification = NOT_FIRST_CELL_NOTIFY; /* TCS 4.0 */ | |
2391 } | |
2392 | |
2393 } | |
2394 kern_attach_complete_end( result_value ); | |
2395 | |
2396 #ifdef GMM_TCS4 | |
2397 { | |
2398 PALLOC (mmpm_attach_ind, MMPM_ATTACH_IND); | |
2399 PSEND ( hCommSM, mmpm_attach_ind ); | |
2400 } | |
2401 #endif | |
2402 | |
2403 } | |
2404 else | |
2405 /* | |
2406 * RAU procedure | |
2407 */ | |
2408 { | |
2409 MCAST (routing_area_update_complete, ROUTING_AREA_UPDATE_COMPLETE); | |
2410 if (v_receive_n_pdu_number_list ) | |
2411 { | |
2412 int i; | |
2413 #ifdef GMM_TCS4 | |
2414 PALLOC (gmmsm_sequence_ind,MMPM_SEQUENCE_IND); | |
2415 #else | |
2416 PALLOC (gmmsm_sequence_ind,GMMSM_SEQUENCE_IND); | |
2417 #endif | |
2418 gmmsm_sequence_ind->c_npdu_list | |
2419 = receive_n_pdu_number_list->c_receive_n_pdu_number_list_val; | |
2420 for (i=0;i<receive_n_pdu_number_list->c_receive_n_pdu_number_list_val;i++) | |
2421 { | |
2422 gmmsm_sequence_ind->npdu_list[i].nsapi | |
2423 = receive_n_pdu_number_list->receive_n_pdu_number_list_val[i].nsapi; | |
2424 gmmsm_sequence_ind->npdu_list[i].receive_n_pdu_number_val | |
2425 = receive_n_pdu_number_list->receive_n_pdu_number_list_val[i].receive_n_pdu_number_val; | |
2426 } | |
2427 #ifdef GMM_TCS4 | |
2428 PSEND ( hCommUPM, gmmsm_sequence_ind ); | |
2429 #else | |
2430 PSEND ( hCommSM, gmmsm_sequence_ind ); | |
2431 #endif | |
2432 SET_STATE ( KERN, KERN_GMM_RAU_WAIT_FOR_NPDU_LIST ); | |
2433 #ifdef FF_EM_MODE | |
2434 EM_GMM_SET_STATE(KERN_GMM_RAU_WAIT_FOR_NPDU_LIST ); | |
2435 #endif | |
2436 GMM_RETURN; | |
2437 } | |
2438 else | |
2439 { | |
2440 routing_area_update_complete->v_receive_n_pdu_number_list = 0; | |
2441 if ( attach_complete ) | |
2442 { | |
2443 kern_rau_complete(result_value); | |
2444 } | |
2445 else | |
2446 { | |
2447 kern_rau_complete_end(result_value); | |
2448 } | |
2449 } | |
2450 } | |
2451 GMM_RETURN; | |
2452 } /* kern_attach_complete () */ | |
2453 | |
2454 | |
2455 | |
2456 /* | |
2457 +------------------------------------------------------------------------------ | |
2458 | Function : kern_attach_accept | |
2459 +------------------------------------------------------------------------------ | |
2460 | Description : The label ATTACH_ACCEPT | |
2461 | | |
2462 | ATTACH and RAU accept procedure | |
2463 | | |
2464 | This procedure is called when the attach or rau accepüt message | |
2465 | is received | |
2466 | | |
2467 | Parameters : message_id - RAU ACCEPT or ATTACH ACCEPT message | |
2468 | | |
2469 +------------------------------------------------------------------------------ | |
2470 */ | |
2471 GLOBAL void kern_attach_accept | |
2472 ( | |
2473 T_result_gmm * result, | |
2474 T_force_to_standby * force_to_standby, | |
2475 T_rau_timer * rau_timer, | |
2476 /* attach: radio_priority */ | |
2477 T_routing_area_identification *routing_area_identification, | |
2478 BOOL v_p_tmsi_signature, | |
2479 T_p_tmsi_signature * p_tmsi_signature, | |
2480 BOOL v_ready_timer, | |
2481 T_ready_timer * ready_timer, | |
2482 BOOL v_gmobile_identity, | |
2483 T_gmobile_identity * gmobile_identity, | |
2484 BOOL v_mobile_identity, | |
2485 T_mobile_identity * mobile_identity, | |
2486 /* | |
2487 * only RAU | |
2488 */ | |
2489 BOOL v_receive_n_pdu_number_list, | |
2490 T_receive_n_pdu_number_list * receive_n_pdu_number_list, | |
2491 USHORT cause, | |
2492 BOOL v_eqv_plmn_list, /* TCS 2.1 */ | |
2493 T_eqv_plmn_list * eqv_plmn_list, /* TCS 2.0 */ | |
2494 BOOL v_t3302, | |
2495 T_t3302 * t3302, | |
2496 BOOL v_cell_notification | |
2497 ) | |
2498 { | |
2499 GMM_TRACE_FUNCTION( "kern_attach_accept" ); | |
2500 | |
2501 TRACE_2_INFO("ACCEPT.rai.lac %#x rac %#x", | |
2502 routing_area_identification->lac, | |
2503 routing_area_identification->rac); | |
2504 | |
2505 gmm_data->kern.attach_cap.attach_acc_after_po = TRUE; | |
2506 gmm_data->kern.timeout_t3312 = FALSE; | |
2507 | |
2508 if (v_t3302) | |
2509 { | |
2510 gmm_data->kern.t3302_val = rdy_get_timer ( (T_rau_timer *)t3302 ); | |
2511 } | |
2512 | |
2513 #ifdef REL99 | |
2514 /* If cell notification field is present GMM should update its | |
2515 * context with the information. | |
2516 * Whenever a LLGMM_TRIGGER_REQ is sent, this field should be | |
2517 * checked. If it indicates that cell notification is supported | |
2518 * GMM should inform this to LLC with a special cause value. | |
2519 * LLC, on receiving this special cause value can use NULL frame | |
2520 * for cell updates. | |
2521 * The first cell notification shouldn't use LLC NULL frame. The | |
2522 * values FIRST_CELL_NOTIFY and NOT_FIRST_CELL_NOTIFY are introduced | |
2523 * to take care of this | |
2524 */ | |
2525 #endif | |
2526 | |
2527 | |
2528 if (v_cell_notification) | |
2529 { | |
2530 | |
2531 #ifdef REL99 | |
2532 gmm_data->cell_notification = FIRST_CELL_NOTIFY; /* TCS 4.0 */ | |
2533 #else | |
2534 TRACE_0_INFO("R99: cell notification supported by network, but not supported by the MS"); | |
2535 #endif | |
2536 | |
2537 } | |
2538 | |
2539 #ifdef REL99 | |
2540 else /*SGSN doesn't support cell notification*/ /* TCS 4.0 */ | |
2541 { /* TCS 4.0 */ | |
2542 gmm_data->cell_notification = NO_CELL_NOTIFY; /* TCS 4.0 */ | |
2543 } | |
2544 | |
2545 /* The following #ifdef is added due to a limitation in TDC. | |
2546 * TDC in the current release(ver 14) doesn't support setting of T variables. | |
2547 * So until the next release (ver 15) of TDC is available, this fix is needed | |
2548 * for running GMM406X test cases. | |
2549 */ | |
2550 #ifdef _SIMULATION_ /* TCS 4.0 */ | |
2551 gmm_data->cell_notification = gmm_data->config.cell_notification; /* TCS 4.0 */ | |
2552 #endif /*_SIMULATION_*/ /* TCS 4.0 */ | |
2553 #endif /* REL99 */ | |
2554 | |
2555 /* | |
2556 * remove PLMN from forbiden list | |
2557 */ | |
2558 kern_remove_plmn_from_forbidden_list(gmm_data->kern.sig_cell_info.env.rai.plmn); | |
2559 | |
2560 kern_set_rai ( routing_area_identification ); | |
2561 | |
2562 if (GMM_NO_RAU != gmm_data->kern.attach_cap.rau_initiated) | |
2563 { | |
2564 result->result_value <<= 1; | |
2565 result->result_value |= 1; | |
2566 | |
2567 } | |
2568 /* | |
2569 * the following is needed when calling kern_rau_complete() from | |
2570 * within kern_gmmsm_sequence_res(): | |
2571 */ | |
2572 gmm_data->kern.attach_cap.result_type = result->result_value; | |
2573 | |
2574 | |
2575 /* | |
2576 * Reset RAU and ATTACH attempt counter | |
2577 */ | |
2578 if (!IS_CAUSE_INVALID (cause)) | |
2579 { | |
2580 gmm_data->kern.detach_cap.error_cause = cause; | |
2581 | |
2582 switch ( cause ) | |
2583 { | |
2584 case GMMCS_MSC_TEMP_NOT_REACHABLE: /* TCS 2.1 */ | |
2585 case GMMCS_NET_FAIL: /* TCS 2.1 */ | |
2586 case GMMCS_CONGESTION: /* TCS 2.1 */ | |
2587 if ( COMBINED_ATTACHED == result->result_value ) | |
2588 { | |
2589 TRACE_0_INFO("#0x10 or #0x11 or #0x16 received together with COMBINED attach. Switched to NORMAL attached"); | |
2590 result->result_value = NORMAL_ATTACHED; | |
2591 } | |
2592 /* 04.08 44.7.3.2.3.2 */ | |
2593 /* special kern_attach_reset */ | |
2594 gmm_data->kern.aac++; | |
2595 gmm_data->kern.ct3310 = 0; | |
2596 vsi_t_stop ( GMM_handle, kern_T3310); | |
2597 break; | |
2598 default: | |
2599 kern_attach_reset(); | |
2600 break; | |
2601 } | |
2602 } | |
2603 else | |
2604 { | |
2605 gmm_data->kern.detach_cap.error_cause = GMMCS_INT_NOT_PRESENT; /* TCS 2.1 */ | |
2606 kern_attach_reset(); | |
2607 } | |
2608 | |
2609 sig_kern_rdy_force_ie_req | |
2610 ( force_to_standby->force_to_standby_value , | |
2611 v_mobile_identity || v_gmobile_identity);/*lint !e730 (Info -- Boolean argument to function) */ | |
2612 | |
2613 /* | |
2614 * force to standby function has to be called before handling of the ready timer, because cu | |
2615 * is not allowed upon force to standby | |
2616 */ | |
2617 sig_kern_rdy_t3314_req | |
2618 ( (v_gmobile_identity && ID_TYPE_TMSI==gmobile_identity->type_of_identity) | |
2619 || (gmobile_identity && ID_TYPE_TMSI==mobile_identity->type_of_identity) | |
2620 || v_receive_n_pdu_number_list, /*lint !e730 (Info -- Boolean argument to function) *//*lint !e730 (Info -- Boolean argument to function) */ | |
2621 v_ready_timer, | |
2622 ready_timer, | |
2623 rau_timer, | |
2624 v_mobile_identity || v_gmobile_identity); | |
2625 | |
2626 /* | |
2627 * this procedure transmittes the GSIM_UPDATE_REQ message | |
2628 * and starts the kern_local_attach procedure | |
2629 * | |
2630 * <R.GMM.PATTCNF.M.001> | |
2631 */ | |
2632 /* Delete old signature if no signatur is included in attach_accept | |
2633 or rau_accept primitive */ | |
2634 if (!v_p_tmsi_signature) | |
2635 { | |
2636 gmm_data->ptmsi_signature.value = INVALID_PTMSI_SIGNATURE; | |
2637 gmm_data->ptmsi_signature.available = FALSE; | |
2638 } | |
2639 kern_tmsi_negotiated ( | |
2640 v_mobile_identity, | |
2641 mobile_identity, | |
2642 v_gmobile_identity, | |
2643 gmobile_identity, | |
2644 v_p_tmsi_signature, | |
2645 p_tmsi_signature); | |
2646 | |
2647 | |
2648 if (!IS_CAUSE_INVALID (cause)) | |
2649 /* | |
2650 * LABEL TMSI_CAUSE | |
2651 */ | |
2652 /* | |
2653 * it is not required that i have to go to aac if an error cause | |
2654 * is received in normal attach/rau mode | |
2655 */ | |
2656 { | |
2657 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated | |
2658 && AT_GPRS == gmm_data->kern.attach_cap.attach_proc_type ) | |
2659 { | |
2660 SET_STATE ( MM, GMM_MM_DEREG ); | |
2661 kern_aac (cause); | |
2662 GMM_RETURN; | |
2663 } | |
2664 switch ( cause ) | |
2665 { | |
2666 case GMMCS_IMSI_UNKNOWN: /* TCS 2.1 */ | |
2667 { | |
2668 gmm_data->tmsi = GMMRR_TMSI_INVALID; | |
2669 gmm_data->kern.sig_cell_info.mm_status = MMGMM_LIMITED_SERVICE; | |
2670 sig_kern_sync_set_mm_state(MMGMM_LIMITED_SERVICE); | |
2671 | |
2672 kern_mm_attach_rej (cause); | |
2673 kern_attach_complete ( | |
2674 result->result_value, | |
2675 v_gmobile_identity && | |
2676 ID_TYPE_TMSI==gmobile_identity->type_of_identity, /*lint !e730 (Info -- Boolean argument to function) */ | |
2677 v_receive_n_pdu_number_list, receive_n_pdu_number_list );/*lint !e613 (Warning -- Possible use of null pointer 'gmobile_identity' in left argument to operator '->') */ | |
2678 break; | |
2679 } | |
2680 case GMMCS_MSC_TEMP_NOT_REACHABLE: /* TCS 2.1 */ | |
2681 case GMMCS_NET_FAIL: /* TCS 2.1 */ | |
2682 case GMMCS_CONGESTION: /* TCS 2.1 */ | |
2683 /* | |
2684 * ERRCS_NETWORK_FAILURE | |
2685 */ | |
2686 | |
2687 TRACE_1_INFO(" aac: %d", gmm_data->kern.aac ); | |
2688 | |
2689 /* this is already done. | |
2690 */ | |
2691 | |
2692 if ( gmm_data->gu == GU1_UPDATED | |
2693 && !kern_rai_changed() | |
2694 && gmm_data->kern.aac < MAX_AAC ) | |
2695 { | |
2696 TRACE_EVENT ( "Info: START: T3311" ); | |
2697 vsi_t_start ( GMM_handle , kern_T3311, gmm_data->kern.t3311_val ); | |
2698 kern_mm_attach_rej (cause); | |
2699 gmm_data->kern.attach_cap.attempting_to_update_mm = TRUE; | |
2700 kern_attach_complete ( | |
2701 result->result_value, | |
2702 (v_gmobile_identity | |
2703 && ID_TYPE_TMSI==gmobile_identity->type_of_identity) | |
2704 || | |
2705 (v_mobile_identity | |
2706 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */ | |
2707 v_receive_n_pdu_number_list, receive_n_pdu_number_list);/*lint !e613 (Warning -- Possible use of null pointer 'gmobile_identity' in left argument to operator '->') */ | |
2708 gmm_data->kern.attach_cap.rau_initiated=GMM_RAU; | |
2709 } | |
2710 else | |
2711 { | |
2712 vsi_t_start ( GMM_handle , kern_T3302, gmm_data->kern.t3302_val ); | |
2713 sig_kern_rdy_start_t3302_req(); | |
2714 TRACE_EVENT ( "Info: START: T3302" ); | |
2715 TRACE_1_INFO ( "ATTACH or RAU will retried %.1f minutes later", | |
2716 (gmm_data->kern.t3302_val/(60000.0))); | |
2717 | |
2718 switch ( gmm_data->kern.attach_cap.mobile_class) | |
2719 { | |
2720 case GMMREG_CLASS_A: | |
2721 /* | |
2722 * kern_mm_set_state ( MMGMM_ENTER_IDLE_MODE ); | |
2723 */ | |
2724 SET_STATE ( MM, GMM_MM_DEREG ); | |
2725 kern_mm_lau(); | |
2726 | |
2727 kern_attach_complete ( | |
2728 result->result_value, | |
2729 (v_gmobile_identity | |
2730 && ID_TYPE_TMSI==gmobile_identity->type_of_identity) | |
2731 || | |
2732 (v_mobile_identity | |
2733 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */ | |
2734 v_receive_n_pdu_number_list, receive_n_pdu_number_list);/*lint !e613 (Warning -- Possible use of null pointer 'gmobile_identity' in left argument to operator '->') */ | |
2735 GMM_RETURN; | |
2736 default: | |
2737 TRACE_ERROR("unexpected MS class"); | |
2738 /* NO break; */ | |
2739 case GMMREG_CLASS_BG: | |
2740 case GMMREG_CLASS_BC: | |
2741 case GMMREG_CLASS_B: | |
2742 { | |
2743 /* rau_initiated will be reset in attah_complete()*/ | |
2744 BOOL no_rau= (GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated); | |
2745 kern_mm_attach_rej (cause); | |
2746 | |
2747 gmm_data->kern.attach_cap.attempting_to_update_mm = TRUE; | |
2748 | |
2749 kern_attach_complete ( | |
2750 result->result_value, | |
2751 (v_gmobile_identity | |
2752 && ID_TYPE_TMSI==gmobile_identity->type_of_identity) | |
2753 || | |
2754 (v_mobile_identity | |
2755 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */ | |
2756 v_receive_n_pdu_number_list, receive_n_pdu_number_list);/*lint !e613 (Warning -- Possible use of null pointer 'gmobile_identity' in left argument to operator '->') */ | |
2757 | |
2758 if ((no_rau && AT_GPRS != gmm_data->kern.attach_cap.attach_proc_type ) | |
2759 || (!no_rau && | |
2760 (COMBINED_RAU == gmm_data->kern.attach_cap.update_proc_type ) | |
2761 || (COMBINED_RAU_IMSI_ATTACH == gmm_data->kern.attach_cap.update_proc_type ))) | |
2762 { | |
2763 | |
2764 if (no_rau) | |
2765 { | |
2766 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING ); | |
2767 #ifdef FF_EM_MODE | |
2768 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING ); | |
2769 #endif | |
2770 } | |
2771 else | |
2772 { | |
2773 /* 04.08 ch. 4.7..2.3 The MM sublayer shall act as in network operation mode II as long as the | |
2774 combined GMM procedures are not successful and no new RA is entered. The new | |
2775 MM state is MM IDLE. */ | |
2776 gmm_data->kern.sig_cell_info.net_mode= GMMRR_NET_MODE_II; | |
2777 TRACE_0_INFO ("changed to NMOII"); | |
2778 | |
2779 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING ); | |
2780 #ifdef FF_EM_MODE | |
2781 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING ); | |
2782 #endif | |
2783 kern_llgmm_suspend(LLGMM_CALL); | |
2784 } | |
2785 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
2786 } | |
2787 } | |
2788 break; | |
2789 case GMMREG_CLASS_CG: | |
2790 /* | |
2791 * <R.GMM.RCSUGPRS.M.020> | |
2792 */ | |
2793 kern_mm_attach_rej (cause); | |
2794 | |
2795 gmm_data->kern.attach_cap.attempting_to_update_mm = TRUE; | |
2796 kern_attach_complete ( | |
2797 result->result_value, | |
2798 SEND_ATTACH_COMPLETE, | |
2799 v_receive_n_pdu_number_list, receive_n_pdu_number_list); | |
2800 break; | |
2801 } | |
2802 | |
2803 } | |
2804 break; | |
2805 default: | |
2806 kern_aac (cause); | |
2807 break; | |
2808 } | |
2809 SET_STATE( MM, GMM_MM_DEREG ); | |
2810 } | |
2811 else | |
2812 /* | |
2813 * LABEL TMSI_NO_CAUSE | |
2814 */ | |
2815 { | |
2816 /* | |
2817 * <R.GMM.RCSUBOTH.M.019> | |
2818 */ | |
2819 kern_mm_attach_acc ( v_mobile_identity, mobile_identity, /* TCS 2.1 */ | |
2820 v_eqv_plmn_list, eqv_plmn_list ); /* TCS 2.1 */ | |
2821 | |
2822 if ( COMBINED_ATTACHED == result->result_value ) | |
2823 { | |
2824 SET_STATE( MM, GMM_MM_REG_NORMAL_SERVICE ); | |
2825 /* | |
2826 * mm_lau_attempt is reset. It is only set if lau has been performed | |
2827 * before via MM_procedures | |
2828 */ | |
2829 gmm_data->kern.attach_cap.mm_lau_attempted=FALSE; | |
2830 } | |
2831 else | |
2832 { | |
2833 if (GMM_MM_REG_INITATED_VIA_GPRS == GET_STATE(MM)) | |
2834 { | |
2835 TRACE_ERROR ("network has sent attach_accept (GPRS) w/o error cause but (COMB) has been requested"); | |
2836 kern_mm_attach_rej(GMMCS_MESSAGE_INVALID); /* TCS 2.1 */ | |
2837 } | |
2838 } | |
2839 | |
2840 kern_attach_complete ( | |
2841 result->result_value, | |
2842 (v_gmobile_identity | |
2843 && ID_TYPE_TMSI==gmobile_identity->type_of_identity) | |
2844 || | |
2845 (v_mobile_identity | |
2846 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */ | |
2847 v_receive_n_pdu_number_list, receive_n_pdu_number_list);/*lint !e613 (Warning -- Possible use of null pointer 'gmobile_identity' in left argument to operator '->') */ | |
2848 } | |
2849 | |
2850 GMM_RETURN; | |
2851 } /* kern_attach_accept () */ | |
2852 | |
2853 | |
2854 /* | |
2855 +------------------------------------------------------------------------------ | |
2856 | Function : kern_norm_rau | |
2857 +------------------------------------------------------------------------------ | |
2858 | Description : The label NORM_RAU | |
2859 | | |
2860 | Normal RAU | |
2861 | | |
2862 | Parameters : void | |
2863 | | |
2864 +------------------------------------------------------------------------------ | |
2865 */ | |
2866 | |
2867 GLOBAL void kern_norm_rau ( void ) | |
2868 { | |
2869 GMM_TRACE_FUNCTION( "kern_norm_rau" ); | |
2870 if (gmm_data->kern.timeout_t3312) | |
2871 /* | |
2872 * 24.008: | |
2873 * If the MS is in other state than GMM-REGISTERED.NORMAL-SERVICE when the timer | |
2874 * expires the periodic routing area updating procedure is delayed until the MS | |
2875 * returns to GMM-REGISTERED.NORMAL-SERVICE. | |
2876 * In GSM, if the MS in MS operation mode B is in the state GMM-REGISTERED. | |
2877 * SUSPENDED when the timer expires the periodic routing area updating procedure | |
2878 * is delayed until the state is left. | |
2879 */ | |
2880 { | |
2881 kern_periodic_rau(); | |
2882 GMM_RETURN; | |
2883 } | |
2884 | |
2885 { | |
2886 /* T_ROUTING_AREA_UPDATE_REQUEST */ | |
2887 MCAST (routing_area_update_request,ROUTING_AREA_UPDATE_REQUEST); | |
2888 | |
2889 routing_area_update_request->v_gmobile_identity = FALSE; | |
2890 routing_area_update_request->v_ms_network_capability = FALSE; | |
2891 routing_area_update_request->v_pdp_context_status = FALSE; | |
2892 | |
2893 gmm_data->kern.attach_cap.update_proc_type = RAU; | |
2894 | |
2895 routing_area_update_request->update_type.update_type_value | |
2896 = RAU; | |
2897 TRACE_EVENT("Info: Normal RAU"); | |
2898 | |
2899 kern_rau_init(); | |
2900 } | |
2901 | |
2902 GMM_RETURN; | |
2903 } /* kern_norm_rau () */ | |
2904 | |
2905 | |
2906 /* | |
2907 +------------------------------------------------------------------------------ | |
2908 | Function : kern_comb_rau | |
2909 +------------------------------------------------------------------------------ | |
2910 | Description : The label COMB_RAU | |
2911 | | |
2912 | Combined RAU | |
2913 | | |
2914 | Parameters : void | |
2915 | | |
2916 +------------------------------------------------------------------------------ | |
2917 */ | |
2918 | |
2919 GLOBAL void kern_comb_rau ( void ) | |
2920 { | |
2921 GMM_TRACE_FUNCTION( "kern_comb_rau" ); | |
2922 if (gmm_data->kern.timeout_t3312) | |
2923 /* | |
2924 * 24.008: | |
2925 * If the MS is in other state than GMM-REGISTERED.NORMAL-SERVICE when the timer | |
2926 * expires the periodic routing area updating procedure is delayed until the MS | |
2927 * returns to GMM-REGISTERED.NORMAL-SERVICE. | |
2928 * In GSM, if the MS in MS operation mode B is in the state GMM-REGISTERED. | |
2929 * SUSPENDED when the timer expires the periodic routing area updating procedure | |
2930 * is delayed until the state is left. | |
2931 */ | |
2932 { | |
2933 kern_periodic_rau(); | |
2934 GMM_RETURN; | |
2935 } | |
2936 | |
2937 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU; | |
2938 | |
2939 { | |
2940 /* T_ROUTING_AREA_UPDATE_REQUEST */ | |
2941 MCAST (routing_area_update_request,ROUTING_AREA_UPDATE_REQUEST); | |
2942 | |
2943 routing_area_update_request->v_gmobile_identity = FALSE; | |
2944 routing_area_update_request->v_ms_network_capability = FALSE; | |
2945 routing_area_update_request->v_pdp_context_status = FALSE; | |
2946 | |
2947 if ( GMMREG_AT_GPRS != gmm_data->kern.attach_cap.attach_type | |
2948 && GMMRR_TMSI_INVALID == gmm_data->tmsi ) | |
2949 /* | |
2950 * <R.GMM.RCINIT.M.016> | |
2951 * | |
2952 * 24.008 9.4.1.3. TMSI Status | |
2953 * | |
2954 * This IE shall be included if the MS performs a | |
2955 * combined GPRS attach and no valid TMSI is available | |
2956 */ | |
2957 { | |
2958 routing_area_update_request->v_tmsi_status = TRUE; | |
2959 routing_area_update_request->tmsi_status.tmsi_flag = FALSE; | |
2960 } | |
2961 else | |
2962 { | |
2963 routing_area_update_request->v_tmsi_status = FALSE; | |
2964 } | |
2965 | |
2966 | |
2967 if ( GMM_MM_DEREG == GET_STATE(MM) | |
2968 || gmm_data->kern.attach_cap.mm_lau_attempted) | |
2969 { | |
2970 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU_IMSI_ATTACH; | |
2971 routing_area_update_request->update_type.update_type_value | |
2972 = COMBINED_RAU_IMSI_ATTACH; | |
2973 TRACE_EVENT("Info: Comb. RAU with IMSI attach"); | |
2974 } | |
2975 else | |
2976 { | |
2977 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU; | |
2978 routing_area_update_request->update_type.update_type_value | |
2979 = COMBINED_RAU; | |
2980 TRACE_EVENT("Info: Comb. RAU"); | |
2981 } | |
2982 } | |
2983 | |
2984 kern_mm_attach_started (); | |
2985 kern_rau_init(); | |
2986 GMM_RETURN; | |
2987 } /* kern_comb_rau () */ | |
2988 | |
2989 | |
2990 /* | |
2991 +------------------------------------------------------------------------------ | |
2992 | Function : kern_rau_limited | |
2993 +------------------------------------------------------------------------------ | |
2994 | Description : The label RAU_LIMITED | |
2995 | | |
2996 | Start of RAU without supention of the rest of the world | |
2997 | beacause the rest is already suspended | |
2998 | | |
2999 | Parameters : void | |
3000 | | |
3001 +------------------------------------------------------------------------------ | |
3002 */ | |
3003 GLOBAL void kern_rau_limited ( void ) | |
3004 { | |
3005 GMM_TRACE_FUNCTION( "kern_rau_limited" ); | |
3006 | |
3007 switch ( gmm_data->kern.sig_cell_info.net_mode ) | |
3008 { | |
3009 case GMMRR_NET_MODE_I: | |
3010 if (GMM_MM_DEREG != GET_STATE(MM) | |
3011 || GMMREG_AT_COMB==gmm_data->kern.attach_cap.attach_type) | |
3012 { | |
3013 kern_comb_rau(); | |
3014 } | |
3015 else | |
3016 { | |
3017 kern_norm_rau(); | |
3018 } | |
3019 break; | |
3020 case GMMRR_NET_MODE_II: | |
3021 if (kern_lau_needed()) | |
3022 /* | |
3023 * if deatch procedure collision and GSM is already detached we can start | |
3024 * rau | |
3025 */ | |
3026 { | |
3027 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING ); | |
3028 #ifdef FF_EM_MODE | |
3029 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING ); | |
3030 #endif | |
3031 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
3032 } | |
3033 else | |
3034 { | |
3035 kern_norm_rau(); | |
3036 } | |
3037 break; | |
3038 case GMMRR_NET_MODE_III: | |
3039 switch ( gmm_data->kern.attach_cap.mobile_class) | |
3040 { | |
3041 case GMMREG_CLASS_A: | |
3042 TRACE_ERROR ("ClassA not supported"); | |
3043 break; | |
3044 case GMMREG_CLASS_BG: | |
3045 if ( GMM_MM_DEREG != GET_STATE(MM) ) | |
3046 { | |
3047 if (kern_lau_needed()) | |
3048 /* | |
3049 * First update than detach!!! | |
3050 */ | |
3051 { | |
3052 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING ); | |
3053 #ifdef FF_EM_MODE | |
3054 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING ); | |
3055 #endif | |
3056 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
3057 } | |
3058 else | |
3059 { | |
3060 kern_imsi_detach_reg_susp(); | |
3061 } | |
3062 } | |
3063 else | |
3064 { | |
3065 kern_norm_rau(); | |
3066 } | |
3067 break; | |
3068 case GMMREG_CLASS_BC: | |
3069 if (GMMREG_AT_GPRS == gmm_data->kern.attach_cap.attach_type) | |
3070 { | |
3071 kern_norm_rau(); | |
3072 } | |
3073 else | |
3074 /* | |
3075 * GSM attach_type | |
3076 */ | |
3077 { | |
3078 if ( kern_lau_needed()) | |
3079 { | |
3080 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING ); | |
3081 #ifdef FF_EM_MODE | |
3082 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING ); | |
3083 #endif | |
3084 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU); | |
3085 } | |
3086 else | |
3087 { | |
3088 if (kern_rai_changed()) | |
3089 { | |
3090 kern_norm_rau(); | |
3091 } | |
3092 else | |
3093 { | |
3094 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS; | |
3095 kern_detach(); | |
3096 } | |
3097 } | |
3098 } | |
3099 break; | |
3100 case GMMREG_CLASS_CG: | |
3101 kern_norm_rau(); | |
3102 break; | |
3103 default: | |
3104 break; | |
3105 } | |
3106 | |
3107 break; | |
3108 default: | |
3109 TRACE_ERROR ("unknown netmode"); | |
3110 break; | |
3111 } | |
3112 GMM_RETURN; | |
3113 } /* kern_rau_limited () */ |