comparison src/g23m-gprs/gmm/gmm_kernl.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
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 #ifdef REL99
804 routing_area_update_request->v_gmobile_identity = FALSE;
805 #endif
806 routing_area_update_request->v_ms_network_capability = FALSE;
807 #ifdef REL99
808 routing_area_update_request->v_pdp_context_status = FALSE;
809 #endif
810
811 if ( GMMREG_AT_GPRS != gmm_data->kern.attach_cap.attach_type
812 && GMMRR_NET_MODE_I == gmm_data->kern.sig_cell_info.net_mode)
813 /*
814 * <R.GMM.RCINIT.M.016>
815 *
816 * 24.008 9.4.1.3. TMSI Status
817 *
818 * This IE shall be included if the MS performs a
819 * combined GPRS attach and no valid TMSI is available
820 */
821 {
822 if (GMMRR_TMSI_INVALID == gmm_data->tmsi )
823 {
824 routing_area_update_request->v_tmsi_status = TRUE;
825 routing_area_update_request->tmsi_status.tmsi_flag = FALSE;
826 }
827 else
828 {
829 routing_area_update_request->v_tmsi_status = FALSE;
830 }
831 }
832 else
833 {
834 routing_area_update_request->v_tmsi_status = FALSE;
835 }
836
837
838 if (gmm_data->kern.timeout_t3312
839 && GMMREG_CLASS_CG != gmm_data->kern.attach_cap.mobile_class
840 && GMMREG_AT_IMSI != gmm_data->kern.attach_cap.attach_type
841 && GMMRR_NET_MODE_I == gmm_data->kern.sig_cell_info.net_mode
842 &&
843 (gmm_data->kern.attach_cap.mm_lau_attempted
844 || GMMRR_SERVICE_NONE== gmm_data->kern.old_sig_cell_info.gmm_status)
845 )
846 /*
847 * <R.GMM.RAUTIMER.M.018>
848 * The network does not know, that the mobile was IMSI attached in
849 * the old wrong cell, so that GMM has to IMSI-attach the MS if entering
850 * net mode I
851 */
852 {
853 /*
854 24.008 ch. 4.7.2.2:
855 If the MS is both IMSI attached for GPRS and non-GPRS services , and if the MS lost coverage of
856 the registered PLMN and timer T3312 expires, then:
857
858 a) if the MS returns to coverage in a cell that supports GPRS and that indicates that the network
859 is in network operation mode I, then the MS shall either perform the combined routing area
860 update procedure indicating "combined RA/LA updating with IMSI attach"; or
861 */
862 if (gmm_data->kern.attach_cap.mm_lau_attempted)
863 {
864 routing_area_update_request->update_type.update_type_value
865 = COMBINED_RAU_IMSI_ATTACH;
866 }
867 else
868 {
869 /*
870 * if (GMMRR_SERVICE_NONE== gmm_data->kern.old_sig_cell_info.gmm_status)
871 * Last cell had no GPRS covarage
872 */
873 routing_area_update_request->update_type.update_type_value
874 = COMBINED_RAU;
875 }
876
877 }
878 else
879 {
880 routing_area_update_request->update_type.update_type_value
881 = PERIODIC_RAU;
882 }
883 gmm_data->kern.attach_cap.update_proc_type = routing_area_update_request->update_type.update_type_value;
884
885 kern_llgmm_suspend(LLGMM_PERIODIC_RAU);
886 kern_rau_init();
887
888 }
889 GMM_RETURN;
890 } /* kern_periodic_rau () */
891
892 /*
893 +------------------------------------------------------------------------------
894 | Function : kern_enter_reg_normal
895 +------------------------------------------------------------------------------
896 | Description : The label ENTER_REG_NORMAL
897 |
898 | Parameters : void
899 |
900 +------------------------------------------------------------------------------
901 */
902 GLOBAL void kern_enter_reg_normal ( void )
903 {
904 GMM_TRACE_FUNCTION( "kern_enter_reg_normal" );
905
906 /*
907 * kern_llgmm_assign();
908 */
909 kern_llgmm_resume ();
910 SET_STATE ( KERN, KERN_GMM_REG_NORMAL_SERVICE );
911 #ifdef FF_EM_MODE
912 EM_GMM_SET_STATE(KERN_GMM_REG_NORMAL_SERVICE );
913 #endif
914 #ifndef GMM_TCS4
915 if ( gmm_data->kern.attach_cap.gmmsm )
916 {
917 PALLOC (gmmsm_establish_cnf, GMMSM_ESTABLISH_CNF);
918 gmm_data->kern.attach_cap.gmmsm = FALSE;
919 PSEND ( hCommSM, gmmsm_establish_cnf );
920 }
921 #endif
922 kern_gmmreg_attach_cnf((BYTE)(GMM_MM_REG_NORMAL_SERVICE==GET_STATE(MM)?
923 GMMREG_AT_COMB:GMMREG_AT_GPRS));
924
925 GMM_RETURN;
926 } /* kern_enter_reg_normal() */
927 /*
928 +------------------------------------------------------------------------------
929 | Function : kern_enter_reg_normal_upon_gmmrr_cell_ind
930 +------------------------------------------------------------------------------
931 | Description : The label ENTER_REG_NORMAL...
932 |
933 | Parameters : void
934 |
935 +------------------------------------------------------------------------------
936 */
937 GLOBAL void kern_enter_reg_normal_upon_gmmrr_cell_ind ( void )
938 {
939 GMM_TRACE_FUNCTION( "kern_enter_reg_normal_upon_gmmrr_cell_ind" );
940
941 kern_gmmrr_stop_waiting_for_transmission();
942 kern_enter_reg_normal();
943 GMM_RETURN;
944 } /* kern_enter_reg_normal() */
945
946 /*
947 +------------------------------------------------------------------------------
948 | Function : kern_normal_attach
949 +------------------------------------------------------------------------------
950 | Description : The label NORM_ATTACH
951 |
952 | MSC : 3.8 Attach
953 |
954 | MSC : 3.8.1 Normal Attach
955 | MSC : 3.8.1.1 Initiation
956 |
957 | Parameters : void
958 |
959 +------------------------------------------------------------------------------
960 */
961 GLOBAL void kern_norm_attach ( void )
962 {
963 GMM_TRACE_FUNCTION( "kern_norm_attach" );
964
965 gmm_data->kern.attach_cap.attach_proc_type = AT_GPRS;
966 TRACE_EVENT("Info: Normal ATTACH");
967 kern_attach_1 ();
968 GMM_RETURN;
969 } /* kern_norm_attach() */
970
971 /*
972 +------------------------------------------------------------------------------
973 | Function : kern_comb_attach
974 +------------------------------------------------------------------------------
975 | Description : The label COMB_ATTACH
976 |
977 | Parameters : void
978 |
979 +------------------------------------------------------------------------------
980 */
981 GLOBAL void kern_comb_attach ( void )
982 {
983 GMM_TRACE_FUNCTION( "kern_comb_attach" );
984
985 /*
986 * 19760: <gprs attach while imsi attached> shall not be used
987 * leave following code in case we need to switch back
988 *
989 switch (GET_STATE(MM))
990 {
991 default:
992 gmm_data->kern.attach_cap.attach_proc_type = AT_WHILE_IMSI_AT;
993 TRACE_EVENT("Info: Comb. ATTACH while IMSI attached");
994 break;
995 case GMM_MM_DEREG:
996 case GMM_MM_REG_INITATED_VIA_GPRS:
997 case GMM_MM_REG_UPDATE_NEEDED:
998 gmm_data->kern.attach_cap.attach_proc_type = AT_COMB;
999 TRACE_EVENT("Info: Comb. ATTACH");
1000 break;
1001 }
1002 *
1003 */
1004
1005 gmm_data->kern.attach_cap.attach_proc_type = AT_COMB;
1006 TRACE_EVENT("Info: Comb. ATTACH");
1007
1008 kern_mm_attach_started ();
1009 kern_attach_1();
1010
1011 GMM_RETURN;
1012 } /* kern_comb_attach() */
1013
1014 /*
1015 +------------------------------------------------------------------------------
1016 | Function : kern_attach
1017 +------------------------------------------------------------------------------
1018 | Description : The label ATTACH
1019 |
1020 | Parameters : void
1021 |
1022 +------------------------------------------------------------------------------
1023 */
1024 GLOBAL void kern_attach ( void )
1025 {
1026 GMM_TRACE_FUNCTION( "kern_attach" );
1027
1028 /* Set GRR in state to transmit user data if not aready done */
1029 kern_gmmrr_stop_waiting_for_transmission();
1030
1031 switch (gmm_data->kern.attach_cap.attach_type)
1032 {
1033 case GMMREG_AT_IMSI:
1034 if (gmm_data->sim_gprs_invalid)
1035 {
1036 SET_STATE(KERN,KERN_GMM_DEREG_NO_IMSI);
1037 #ifdef FF_EM_MODE
1038 EM_GMM_SET_STATE(KERN_GMM_DEREG_NO_IMSI);
1039 #endif
1040 }
1041 else
1042 {
1043 if (GMM_MM_DEREG == GET_STATE(MM)
1044 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status)
1045 {
1046 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING);
1047 #ifdef FF_EM_MODE
1048 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING);
1049 #endif
1050 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
1051 }
1052 else
1053 {
1054 SET_STATE(KERN,KERN_GMM_DEREG_PLMN_SEARCH);
1055 #ifdef FF_EM_MODE
1056 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
1057 #endif
1058 }
1059 }
1060 GMM_RETURN;
1061 case GMMREG_AT_COMB:
1062 if (GMM_GRR_STATE_OFF==gmm_data->kern.attach_cap.grr_state)
1063 {
1064 kern_gmmrr_enable();
1065 }
1066 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode
1067 && GMMREG_CLASS_BC== gmm_data->kern.attach_cap.mobile_class
1068 )
1069 {
1070 if( GMM_MM_DEREG == GET_STATE(MM)
1071 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status)
1072 {
1073 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
1074 #ifdef FF_EM_MODE
1075 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
1076 #endif
1077 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
1078 }
1079 else
1080 {
1081 SET_STATE(KERN,KERN_GMM_DEREG_PLMN_SEARCH);
1082 #ifdef FF_EM_MODE
1083 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
1084 #endif
1085 }
1086 GMM_RETURN;
1087 }
1088 break;
1089 default:
1090 if (GMM_GRR_STATE_OFF==gmm_data->kern.attach_cap.grr_state)
1091 {
1092 kern_gmmrr_enable();
1093 }
1094 break;
1095 }
1096
1097
1098
1099 /*
1100 * Upon some error causes MS has o rettach after RAU_REJ.
1101 * So procedure should be set to ATTACH
1102 */
1103 gmm_data->kern.attach_cap.rau_initiated = GMM_NO_RAU;
1104
1105 if ( GMMREG_CLASS_CG == gmm_data->kern.attach_cap.mobile_class
1106 || GMMREG_AT_GPRS == gmm_data->kern.attach_cap.attach_type)
1107 {
1108 kern_norm_attach();
1109 }
1110 else
1111 {
1112 switch ( gmm_data->kern.sig_cell_info.net_mode )
1113 {
1114 case GMMRR_NET_MODE_I:
1115
1116 kern_comb_attach();
1117 break;
1118 case GMMRR_NET_MODE_II:
1119 if ( GMM_MM_DEREG != GET_STATE(MM)
1120 || MMGMM_LIMITED_SERVICE == gmm_data->kern.sig_cell_info.mm_status)
1121 {
1122 kern_norm_attach ();
1123 }
1124 else
1125 {
1126 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
1127 #ifdef FF_EM_MODE
1128 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
1129 #endif
1130
1131 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
1132 }
1133 break;
1134 case GMMRR_NET_MODE_III:
1135 switch ( gmm_data->kern.attach_cap.mobile_class)
1136 {
1137 case GMMREG_CLASS_BG:
1138 if ( GMM_MM_DEREG != GET_STATE(MM))
1139 {
1140
1141 kern_imsi_detach_der_susp ();
1142 }
1143 else
1144 {
1145
1146 kern_norm_attach();
1147 }
1148 break;
1149 case GMMREG_CLASS_BC:
1150 if ( GMM_MM_DEREG == GET_STATE(MM)
1151 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status)
1152 {
1153 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
1154 #ifdef FF_EM_MODE
1155 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
1156 #endif
1157 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
1158 }
1159 else
1160 {
1161 SET_STATE(KERN, KERN_GMM_DEREG_PLMN_SEARCH);
1162 #ifdef FF_EM_MODE
1163 EM_GMM_SET_STATE(KERN_GMM_DEREG_PLMN_SEARCH);
1164 #endif
1165 }
1166 break;
1167 case GMMREG_CLASS_A:
1168 /*
1169 * react as in NMO II
1170 */
1171 if ( GMM_MM_DEREG != GET_STATE(MM)
1172 || MMGMM_LIMITED_SERVICE == gmm_data->kern.sig_cell_info.mm_status)
1173 {
1174 kern_norm_attach ();
1175 }
1176 else
1177 {
1178 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
1179 #ifdef FF_EM_MODE
1180 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
1181 #endif
1182 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
1183 }
1184 break;
1185 default:
1186 TRACE_ERROR ("unexpected MS class");
1187 break;
1188 }
1189 break;
1190 default:
1191 TRACE_ERROR ("unknown network mode");
1192 break;
1193 }
1194
1195 }
1196 GMM_RETURN;
1197 }
1198 /*
1199 +------------------------------------------------------------------------------
1200 | Function : kern_disable
1201 +------------------------------------------------------------------------------
1202 | Description : The label DISABLE
1203 |
1204 | Parameters : void
1205 |
1206 +------------------------------------------------------------------------------
1207 */
1208 GLOBAL void kern_disable ()
1209 {
1210 GMM_TRACE_FUNCTION( "kern_disable" );
1211 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_DISABLE_GPRS;
1212 kern_detach();
1213 GMM_RETURN;
1214 }
1215 /*
1216 +------------------------------------------------------------------------------
1217 | Function : kern_detach
1218 +------------------------------------------------------------------------------
1219 | Description : The label DETACH
1220 |
1221 |
1222 | Parameters : void
1223 | gmm_data->kern.detach_cap.detach_type MUST be set !
1224 |
1225 +------------------------------------------------------------------------------
1226 */
1227 GLOBAL void kern_detach()
1228 {
1229
1230 #ifdef REL99
1231 T_gmobile_identity gmobile_identity; /* TCS 4.0 */
1232 #endif
1233
1234 GMM_TRACE_FUNCTION( "kern_detach" );
1235 {
1236 MCAST ( u_detach_request, U_DETACH_REQUEST ); /* T_U_DETACH_REQUEST */
1237
1238 u_detach_request->u_detach_type.power_off = PO_NORMAL_DETACH;
1239
1240 switch ( gmm_data->kern.detach_cap.detach_type )
1241 {
1242 case GMMREG_DT_DISABLE_GPRS:
1243 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1244 /* NO break */
1245 case GMMREG_DT_GPRS:
1246 if ( GMM_MM_DEREG != GET_STATE(MM)
1247 && GMMRR_NET_MODE_I == gmm_data->kern.sig_cell_info.net_mode)
1248 {
1249 /*
1250 * <R.GMM.DINITM.M.007>
1251 */
1252 kern_mm_start_t3212 ();
1253 }
1254 /*
1255 * LABEL NORM_DETACH
1256 */
1257 u_detach_request->u_detach_type.u_type_of_detach = DT_GPRS;
1258 kern_llgmm_suspend(LLGMM_PERIODIC_RAU);
1259
1260 break;
1261
1262 case GMMREG_DT_COMB:
1263 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1264 if ( GMM_MM_DEREG == GET_STATE(MM)
1265 || GMMRR_NET_MODE_I != gmm_data->kern.sig_cell_info.net_mode)
1266 {
1267 gmm_data->kern.detach_cap.detach_type = DT_GPRS;
1268 /*
1269 * LABEL NORM_DETACH
1270 */
1271 u_detach_request->u_detach_type.u_type_of_detach = DT_GPRS;
1272 }
1273 else
1274 {
1275 /*
1276 * LABEL COMB_DETACH
1277 */
1278 u_detach_request->u_detach_type.u_type_of_detach = DT_COMB;
1279 }
1280 kern_llgmm_suspend(LLGMM_PERIODIC_RAU);
1281 break;
1282 /* break; */
1283 case GMMREG_DT_POWER_OFF:
1284 case GMMREG_DT_SOFT_OFF:
1285 u_detach_request->u_detach_type.power_off = PO_POWER_OFF;
1286 /* NO break; */
1287 case GMMREG_DT_LIMITED_SERVICE:
1288 case GMMREG_DT_SIM_REMOVED:
1289 gmm_data->kern.attach_cap.mobile_class = GMMREG_CLASS_CC;
1290 if ( GMM_MM_DEREG != GET_STATE(MM)
1291 && GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode)
1292 {
1293 /*
1294 * LABEL COMB_DETACH
1295 */
1296 u_detach_request->u_detach_type.u_type_of_detach = DT_COMB;
1297 }
1298 else
1299 {
1300 u_detach_request->u_detach_type.u_type_of_detach = DT_GPRS;
1301 }
1302 kern_llgmm_suspend(LLGMM_PERIODIC_RAU);
1303 break;
1304 case GMMREG_DT_IMSI:
1305 u_detach_request->u_detach_type.u_type_of_detach = DT_IMSI;
1306 break;
1307 default:
1308 TRACE_ERROR ( "Unexpected detach type in detach label" );
1309 break;
1310 }
1311 /*
1312 * <R.GMM.DINITM.M.005>
1313 */
1314 gmm_data->kern.ct3321 = 0; //44.2.2.1.3 Richard Byrne
1315
1316 #ifdef REL99
1317 /* Detach request sent to a Release 99 network has two addional
1318 * parameters. PTMSI and PTMSI signature
1319 */
1320 switch (gmm_data->kern.sig_cell_info.sgsnr_flag)/*!gmm_data->release99 =>old code*/ /* TCS 4.0 */
1321 {
1322 default:
1323 case PS_SGSN_UNKNOWN:
1324 case PS_SGSN_98_OLDER:
1325 u_detach_request->v_gmobile_identity = FALSE; /* TCS 4.0 */
1326 u_detach_request->v_p_tmsi_signature_2 = FALSE; /* TCS 4.0 */
1327 break;
1328 case PS_SGSN_99_ONWARDS:
1329 /*
1330 * PTMSI
1331 */
1332 kern_ulong2mobile_identity( gmm_data->ptmsi.current, &gmobile_identity ); /* TCS 4.0 */
1333 u_detach_request->v_gmobile_identity = TRUE; /* TCS 4.0 */
1334 u_detach_request->gmobile_identity = gmobile_identity; /* TCS 4.0 */
1335
1336 /*
1337 * PTMSI Signature
1338 */
1339 if(gmm_data->ptmsi_signature.available) /* TCS 4.0 */
1340 { /* TCS 4.0 */
1341 u_detach_request->v_p_tmsi_signature_2 =TRUE; /* TCS 4.0 */
1342 u_detach_request->p_tmsi_signature_2.p_tmsi_signature_value /* TCS 4.0 */
1343 = gmm_data->ptmsi_signature.value; /* TCS 4.0 */
1344 } /* TCS 4.0 */
1345 else /* TCS 4.0 */
1346 { /* TCS 4.0 */
1347 u_detach_request->v_p_tmsi_signature_2=FALSE; /* TCS 4.0 */
1348 } /* TCS 4.0 */
1349 break;
1350 }
1351 #endif
1352
1353
1354 kern_mm_detach_started ();
1355
1356 sig_kern_tx_data_req ( CURRENT_TLLI, U_DETACH_REQUEST );
1357
1358
1359 switch ( gmm_data->kern.detach_cap.detach_type )
1360 {
1361 case GMMREG_DT_IMSI:
1362 /*
1363 * <R.GMM.DINITM.M.006>,
1364 * <R.GMM.ORATIMSI.M.001>
1365 */
1366 SET_STATE ( KERN, KERN_GMM_REG_IMSI_DETACH_INITIATED );
1367 #ifdef FF_EM_MODE
1368 EM_GMM_SET_STATE(KERN_GMM_REG_IMSI_DETACH_INITIATED );
1369 #endif
1370 break;
1371 case GMMREG_DT_SOFT_OFF:
1372 /*
1373 * if mm_imsi attached is reset than MM is requested in function
1374 * mm_imsi_detach_ind to indicate detach_done
1375 */
1376 if(GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode)
1377 {
1378 SET_STATE ( MM, GMM_MM_DEREG );
1379 }
1380
1381 vsi_t_stop ( GMM_handle, kern_T3302);
1382 sig_kern_rdy_stop_t3302_req();
1383 vsi_t_stop ( GMM_handle, kern_T3310);
1384 vsi_t_stop ( GMM_handle, kern_T3311);
1385
1386 sig_kern_rdy_start_timer_req ( kern_TPOWER_OFF, TPOWER_OFF_VALUE );
1387 SET_STATE ( KERN, KERN_GMM_DEREG_INITIATED );
1388 #ifdef FF_EM_MODE
1389 EM_GMM_SET_STATE(KERN_GMM_DEREG_INITIATED );
1390 #endif
1391 break;
1392 case GMMREG_DT_POWER_OFF:
1393 /*
1394 * if mm_imsi attached is reset than MM is requested in function
1395 * mm_imsi_detach_ind to indicate detach_done
1396 */
1397 if(GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode)
1398 {
1399 SET_STATE ( MM, GMM_MM_DEREG );
1400 }
1401 vsi_t_stop ( GMM_handle, kern_T3302);
1402 sig_kern_rdy_stop_t3302_req();
1403 vsi_t_stop ( GMM_handle, kern_T3310);
1404 vsi_t_stop ( GMM_handle, kern_T3311);
1405 sig_kern_rdy_start_timer_req ( kern_TPOWER_OFF, TPOWER_OFF_VALUE );
1406 SET_STATE ( KERN, KERN_GMM_DEREG_INITIATED );
1407 #ifdef FF_EM_MODE
1408 EM_GMM_SET_STATE(KERN_GMM_DEREG_INITIATED );
1409 #endif
1410 break;
1411 case GMMREG_DT_LIMITED_SERVICE:
1412 kern_l_sim_rem_reg_lim ();
1413 break;
1414 default:
1415 TRACE_EVENT (" START T3321" );
1416 sig_kern_rdy_start_timer_req ( kern_T3321, gmm_data->kern.t3321_val );
1417
1418 SET_STATE ( KERN, KERN_GMM_DEREG_INITIATED );
1419 #ifdef FF_EM_MODE
1420 EM_GMM_SET_STATE(KERN_GMM_DEREG_INITIATED );
1421 #endif
1422 break;
1423 }
1424 }
1425 GMM_RETURN;
1426 } /* kern_detach() */
1427
1428 /*
1429 +------------------------------------------------------------------------------
1430 | Function : kern_rau
1431 +------------------------------------------------------------------------------
1432 | Description : The label RAU
1433 |
1434 | Parameters : void
1435 |
1436 +------------------------------------------------------------------------------
1437 */
1438 GLOBAL void kern_rau ( void )
1439 {
1440 GMM_TRACE_FUNCTION( "kern_rau" );
1441 {
1442
1443
1444 gmm_data->kern.attach_cap.rau_initiated = GMM_RAU;
1445 switch ( gmm_data->kern.sig_cell_info.net_mode )
1446 {
1447 case GMMRR_NET_MODE_I:
1448 kern_llgmm_suspend(LLGMM_RAU);
1449 break;
1450 case GMMRR_NET_MODE_II:
1451 if (kern_lau_needed()
1452 && !gmm_data->kern.detach_cap.gmmreg)
1453 {
1454 kern_llgmm_suspend(LLGMM_CALL);
1455 }
1456 else
1457 {
1458 kern_llgmm_suspend(LLGMM_RAU);
1459 }
1460 break;
1461 case GMMRR_NET_MODE_III:
1462 switch ( gmm_data->kern.attach_cap.mobile_class)
1463 {
1464 case GMMREG_CLASS_A:
1465 kern_llgmm_suspend(LLGMM_RAU);
1466 break;
1467 case GMMREG_CLASS_BG:
1468 if ( GMM_MM_DEREG != GET_STATE(MM)
1469 && MMGMM_LIMITED_SERVICE != gmm_data->kern.sig_cell_info.mm_status )
1470 {
1471 kern_llgmm_suspend(LLGMM_CALL);
1472 }
1473 else
1474 {
1475 kern_llgmm_suspend(LLGMM_RAU);
1476 }
1477 break;
1478 case GMMREG_CLASS_BC:
1479 if (GMMREG_AT_GPRS == gmm_data->kern.attach_cap.attach_type)
1480 {
1481 kern_llgmm_suspend(LLGMM_RAU);
1482 }
1483 else
1484 /*
1485 * GSM attach_type
1486 */
1487 {
1488 if (kern_lau_needed())
1489 {
1490 kern_llgmm_suspend(LLGMM_CALL);
1491 }
1492 else
1493 {
1494 if (kern_rai_changed())
1495 {
1496 kern_llgmm_suspend(LLGMM_RAU);
1497 }
1498 }
1499 }
1500 break;
1501 default:
1502 kern_llgmm_suspend(LLGMM_RAU);
1503 break;
1504 }
1505 break;
1506 default:
1507 TRACE_ERROR ("unkown net mode");
1508 break;
1509 }
1510 } /* PALLOC */
1511
1512 kern_rau_limited ();
1513 GMM_RETURN;
1514 } /* kern_rau() */
1515 /*
1516 +------------------------------------------------------------------------------
1517 | Function : kern_aac_over_5
1518 +------------------------------------------------------------------------------
1519 | Description : The label AAC_OVER_5
1520 |
1521 | Parameters : void
1522 |
1523 +------------------------------------------------------------------------------
1524 */
1525 void kern_aac_over_5 ( USHORT cause )
1526 {
1527 GMM_TRACE_FUNCTION( "kern_aac_over_5" );
1528
1529 /* <R.GMM.DDATMATT.M.001>
1530 * If entry into this state was caused by b) or d) of procedure <AGABNORM>
1531 * with cause 'Retry upon entry into a new cell', GPRS attach shall be
1532 * performed when a new cell is entered.
1533 */
1534
1535 /*if ( cause NEQ GMMCS_RETRY_IN_NEW_CELL ) TCS 2.1
1536 {*/
1537 /*
1538 * <R.GMM.AGABNORM.M.026>
1539 */
1540 TRACE_EVENT ( "Info: START: T3302" );
1541 TRACE_1_INFO ("ATTACH or RAU will be retried %.1f minutes later",
1542 gmm_data->kern.t3302_val/(60000.0));
1543
1544 vsi_t_start ( GMM_handle , kern_T3302, gmm_data->kern.t3302_val );
1545 sig_kern_rdy_start_t3302_req();
1546 /*}*/
1547
1548 gmm_data->gu = GU2_NOT_UPDATED;
1549 if (GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated)
1550 {
1551 kern_sim_del_locigprs ();
1552 }
1553 kern_sim_gmm_update();
1554
1555 if ((GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated &&
1556 AT_GPRS != gmm_data->kern.attach_cap.attach_proc_type )
1557 || (GMM_NO_RAU != gmm_data->kern.attach_cap.rau_initiated &&
1558 (COMBINED_RAU == gmm_data->kern.attach_cap.update_proc_type )
1559 || (COMBINED_RAU_IMSI_ATTACH == gmm_data->kern.attach_cap.update_proc_type )))
1560 {
1561 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated )
1562 /*
1563 * GMM is in state REG_INITIATED
1564 * we try to attach for GSM
1565 */
1566 {
1567
1568 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE;
1569
1570 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
1571
1572 kern_local_detach( cause, FALSE,
1573 GMM_LOCAL_DETACH_PROC_SUSP_LAU);
1574 }
1575 else
1576 /*
1577 * GMM is in state RAU_INITIATED
1578 * we try to start LAU
1579 */
1580 {
1581 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE;
1582 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
1583 #ifdef FF_EM_MODE
1584 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
1585 #endif
1586 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
1587 }
1588 kern_mm_attach_rej ( GMMCS_AAC_OVER_5); /* TCS 2.1 */
1589
1590 }
1591 else
1592 {
1593 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated )
1594 {
1595 /*
1596 * Optional: The MS may optionally enter state GMM-DEREG.PLMN-SEARCH
1597 * instead of GMM-DEREG.ATTEMPTING-TO-ATTACH. (Version 6.4.0)
1598 *
1599 * <R.GMM.AGABNORM.M.027>, <R.GMM.AGABNORM.M.030>
1600 */
1601 /*
1602 * SET_STATE ( KERN, KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH );
1603 */
1604 gmm_data->kern.attach_cap.enter_attempting_to_update_after_lau=TRUE;
1605
1606 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
1607
1608 kern_local_detach( cause, FALSE,
1609 GMM_LOCAL_DETACH_PROC_RESUME);
1610 }
1611 else
1612 {
1613 SET_STATE ( KERN, KERN_GMM_REG_ATTEMPTING_TO_UPDATE );
1614 #ifdef FF_EM_MODE
1615 EM_GMM_SET_STATE(KERN_GMM_REG_ATTEMPTING_TO_UPDATE );
1616 #endif
1617 }
1618 }
1619 GMM_RETURN;
1620
1621 } /* kern_aac_over_5() */
1622
1623 /*
1624 +------------------------------------------------------------------------------
1625 | Function : kern_l_sim_rem_reg_lim
1626 +------------------------------------------------------------------------------
1627 | Description : The label L_SIM_REM_REG_LIM
1628 | SIM removed in state GMM-REGISTERED in a limited substate
1629 +------------------------------------------------------------------------------
1630 */
1631 GLOBAL void kern_l_sim_rem_reg_lim ( void )
1632 {
1633 GMM_TRACE_FUNCTION( "kern_l_sim_rem_reg_lim" );
1634
1635 /*
1636 * local GPRS only detach with any error cause
1637 * 2.parameter is only used for attach procedure
1638 *
1639 * <R.GMM.DETACH.M.005>
1640 */
1641 /*
1642 * Optional: The MS may optionally enter state GMM-DEREG.PLMN-SEARCH
1643 * instead of GMM-DEREG.ATTEMPTING-TO-ATTACH. (Version 6.4.0)
1644 *
1645 * <R.GMM.AGABNORM.M.027>, <R.GMM.AGABNORM.M.030>
1646 *
1647 SET_STATE ( KERN, SET_STATE ( KERN, KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ ) );
1648 */
1649 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_LIMITED_SERVICE;
1650
1651 kern_local_detach( GMMCS_SIM_REMOVED, FALSE, /* TCS 2.1 */
1652 GMM_LOCAL_DETACH_PROC_ENTER_NULL_IMSI_LIMITED_SERVICE_REQ);
1653 /*
1654 * <R.GMM.DSUBFANO.M.003>
1655 */
1656
1657 GMM_RETURN;
1658 } /* kern_l_sim_rem_reg_lim() */
1659 /*
1660 +------------------------------------------------------------------------------
1661 | Function : kern_l_sim_rem_reg
1662 +------------------------------------------------------------------------------
1663 | Description : The label L_SIM_REM_REG
1664 | SIM removed in state GMM-REGISTERED
1665 +------------------------------------------------------------------------------
1666 */
1667 GLOBAL void kern_l_sim_rem_reg ( void )
1668 {
1669 GMM_TRACE_FUNCTION( "kern_l_sim_rem_reg" );
1670
1671 SET_STATE ( KERN, KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ );
1672 #ifdef FF_EM_MODE
1673 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI_LIMITED_SERVICE_REQ );
1674 #endif
1675
1676 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_LIMITED_SERVICE;
1677 kern_detach( );
1678
1679 GMM_RETURN;
1680 } /* kern_l_sim_rem_reg() */
1681
1682 /*
1683 +------------------------------------------------------------------------------
1684 | Function : kern_aac
1685 +------------------------------------------------------------------------------
1686 | Description : The label AAC
1687 |
1688 | Parameters : error_cause
1689 |
1690 +------------------------------------------------------------------------------
1691 */
1692 GLOBAL void kern_aac ( USHORT cause )
1693 {
1694 GMM_TRACE_FUNCTION( "kern_aac" );
1695 /* <R.GMM.AGABNORM.M.020> */
1696 gmm_data->kern.aac ++;
1697
1698 TRACE_1_INFO ("error cause: 0x%x",cause);
1699 TRACE_1_INFO(" aac: %d", gmm_data->kern.aac );
1700
1701 gmm_data->kern.detach_cap.error_cause = cause;
1702 /*
1703 * reset the counter for timer T3310
1704 */
1705 gmm_data->kern.ct3310 = 0;
1706 /*
1707 * <R.GMM.AGABNORM.M.021>
1708 */
1709 gmm_data->kern.attach_cap.t3310_value=0;
1710 vsi_t_stop ( GMM_handle , kern_T3310);
1711 if (GMM_NO_RAU==gmm_data->kern.attach_cap.rau_initiated)
1712 {
1713 kern_gmmreg_detach ( GMMREG_DT_GPRS,
1714 cause,
1715 GMMREG_SEARCH_RUNNING,
1716 cause);
1717 }
1718
1719 kern_gmmrr_attach_finished();
1720
1721 if ( gmm_data->kern.aac < MAX_AAC )
1722 /*
1723 * AAC_UNDER_5
1724 */
1725 {
1726 if ( AT_GPRS != gmm_data->kern.attach_cap.attach_proc_type )
1727 {
1728 if ( kern_lai_changed () )
1729 {
1730 /*
1731 * <R.GMM.ACABNORM.M.006>
1732 */
1733 kern_mm_attach_rej ( GMMCS_AAC_UNDER_5 ); /* TCS 2.1 */
1734 }
1735 }
1736
1737 /* <R.GMM.DDATMATT.M.001>
1738 * If entry into this state was caused by b) or d) of procedure <AGABNORM>
1739 * with cause 'Retry upon entry into a new cell', GPRS attach shall be
1740 * performed when a new cell is entered.
1741 */
1742 /* Richard Byrne 44.2.1.2.8 remove if ( cause NEQ GMMCS_RETRY_IN_NEW_CELL ) */ /* TCS 2.1 */
1743 {
1744 /*
1745 * <R.GMM.AGABNORM.M.022>
1746 */
1747 TRACE_EVENT ( "Info: START: T3311" );
1748 vsi_t_start ( GMM_handle , kern_T3311, gmm_data->kern.t3311_val );
1749 }
1750 switch ( gmm_data->kern.attach_cap.rau_initiated )
1751 {
1752 case GMM_NO_RAU:
1753 SET_STATE ( KERN, KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH );
1754 #ifdef FF_EM_MODE
1755 EM_GMM_SET_STATE(KERN_GMM_DEREG_ATTEMPTING_TO_ATTACH );
1756 #endif
1757 break;
1758 case GMM_RAU:
1759 /*
1760 * <R.GMM.AGABNORM.M.023>
1761 */
1762 SET_STATE ( KERN, KERN_GMM_REG_ATTEMPTING_TO_UPDATE );
1763 #ifdef FF_EM_MODE
1764 EM_GMM_SET_STATE(KERN_GMM_REG_ATTEMPTING_TO_UPDATE );
1765 #endif
1766 break;
1767 case GMM_PERIODIC_RAU:
1768 /*
1769 * <R.GMM.RNABNORM.M.022>
1770 */
1771 kern_enter_reg_normal();
1772 break;
1773 default:
1774 TRACE_ERROR ("unexcpected RAU case");
1775 break;
1776 }
1777
1778 }
1779 else
1780 /*
1781 * LABEL AAC_OVER_5
1782 *
1783 * acc expired
1784 */
1785 {
1786 kern_aac_over_5 (cause);
1787 }
1788 GMM_RETURN;
1789 } /* kern_aac() */
1790
1791
1792 /*
1793 +------------------------------------------------------------------------------
1794 | Function : kern_err_cause
1795 +------------------------------------------------------------------------------
1796 | Description : The label ERR_CAUSE
1797 |
1798 | Parameters : error_cause
1799 |
1800 +------------------------------------------------------------------------------
1801 */
1802 GLOBAL void kern_err_cause ( USHORT error_cause, BOOL det_acc_sent )
1803 {
1804 GMM_TRACE_FUNCTION( "kern_err_cause" );
1805
1806 gmm_data->kern.detach_cap.error_cause = error_cause;
1807
1808 TRACE_1_INFO ("error cause: %x",error_cause);
1809
1810 /*
1811 * <R.GMM.AGREJECT.M.003>, <R.GMM.AGREJECT.M.004>,
1812 * <R.GMM.AGREJECT.M.006>, <R.GMM.DSUBFANO.M.003>,
1813 * <R.GMM.AGREJECT.M.011>, <R.GMM.AGREJECT.M.012>,
1814 * <R.GMM.AGREJECT.M.029>, <R.GMM.AGREJECT.M.028>,
1815 * <R.GMM.AGREJECT.M.034>, <R.GMM.AGREJECT.M.015>,
1816 * <R.GMM.AGREJECT.M.016>, <R.GMM.DSUBFANO.M.013>
1817 */
1818
1819 switch ( error_cause )
1820 {
1821 case GMMCS_IMSI_UNKNOWN: /* TCS 2.1 */
1822 /* No SIM upate. GPRS is still available */
1823 /*
1824 * <R.GMM.DNACM.M.040>
1825 */
1826 /*
1827 * kern_mm_attach_rej ( error_cause );
1828 * called in kern_local_detach
1829 */
1830
1831 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_IMSI;
1832
1833 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_ENTER_REG_NORMAL);
1834
1835 break;
1836 case GMMCS_NO_MS_ID: /* TCS 2.1 */
1837 /*
1838 * This case can not be reached in attach_procedure,
1839 * so I may reset the attach parameters, the mobile
1840 * is just in state DEREGISTERED.
1841 */
1842 kern_sim_del_locigprs();
1843 gmm_data->gu = GU2_NOT_UPDATED;
1844 kern_sim_gmm_update();
1845 /*
1846 * <R.GMM.RCREJECT.M.016>, <R.GMM.RCREJECT.M.035>
1847 */
1848 gmm_data->kern.detach_cap.detach_type = GMM_DT_RE_ATTACH;
1849
1850 kern_local_detach ( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_RE_ATTACH);
1851 break;
1852 case GMMCS_IMPLICIT_DETACHED: /* TCS 2.1 */
1853 if ( GMMREG_AT_COMB==gmm_data->kern.attach_cap.attach_proc_type )
1854 {
1855 /*
1856 * <R.GMM.RCREJECT.M.036>
1857 */
1858 kern_mm_attach_rej ( error_cause );
1859
1860 /*
1861 * <R.GMM.RCREJECT.M.030>
1862 */
1863 kern_gmmreg_detach (GMMREG_DT_COMB,
1864 GMMCS_IMPLICIT_DETACHED, /* TCS 2.1 */
1865 GMMREG_SEARCH_RUNNING,
1866 error_cause);
1867 }
1868 else
1869 {
1870 kern_gmmreg_detach (GMMREG_DT_GPRS,
1871 GMMCS_IMPLICIT_DETACHED, /* TCS 2.1 */
1872 GMMREG_SEARCH_RUNNING,
1873 error_cause);
1874 }
1875 gmm_data->kern.detach_cap.detach_type = GMM_DT_RE_ATTACH;
1876 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_RE_ATTACH);
1877
1878 break;
1879 case GMMCS_GPRS_NOT_ALLOWED_IN_PLMN: /* TCS 2.1 */
1880 memcpy (gmm_data->kern.attach_cap.list_of_forbidden_plmns_for_gprs_service[0].mcc,
1881 gmm_data->kern.sig_cell_info.env.rai.plmn.mcc, SIZE_MCC);
1882 memcpy (gmm_data->kern.attach_cap.list_of_forbidden_plmns_for_gprs_service[0].mnc,
1883 gmm_data->kern.sig_cell_info.env.rai.plmn.mnc, SIZE_MNC);
1884
1885 gmm_data->kern.sig_cell_info.gmm_status=GMMRR_SERVICE_LIMITED;
1886
1887 kern_sim_del_locigprs();
1888 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED;
1889 kern_sim_gmm_update();
1890 kern_mm_attach_rej ( error_cause );
1891
1892
1893 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated
1894 && GMMREG_AT_COMB == gmm_data->kern.attach_cap.attach_proc_type
1895 && kern_lau_needed())
1896 /*
1897 * If GMM had tried to comb. attach then if MM is not registered it has
1898 * to do so.
1899 */
1900 {
1901 /*
1902 * <GMM.R.ACREJECT.M.014>
1903 */
1904 /*
1905 * <GMM.R.ACREJECT.M.015>
1906 * <GMM.R.ACREJECT.M.016>
1907 */
1908 gmm_data->kern.suspension_type |= GMM_SUSP_LAU;
1909 }
1910 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
1911 kern_local_detach( error_cause, det_acc_sent,
1912 GMM_LOCAL_DETACH_PROC_UNASSIGN);
1913
1914 break;
1915
1916 case GMMCS_GPRS_NOT_ALLOWED: /* TCS 2.1 */
1917 gmm_data->sim_gprs_invalid = TRUE;
1918 kern_sim_del_locigprs();
1919 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED;
1920 kern_sim_gmm_update();
1921 /*
1922 * LABEL ERRCS_GPRS_NOT_ALLOWED
1923 *
1924 * <R.DNACM.M.041>
1925 */
1926 /*
1927 * <GMM.R.RCREJECT.M.033>
1928 */
1929 kern_mm_start_t3212();
1930 /*
1931 * <R.GMM.RCREJECT.M.011>, <R.GMM.AGREJECT.M.013>
1932 * <R.GMM.ACREJECT.M.012>
1933 */
1934 /*
1935 * <GMM.R.ACREJECT.M.015>
1936 * <GMM.R.ACREJECT.M.016>
1937 */
1938 /* ANITE TC 44.2.1.2.6 */
1939 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
1940 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_DISABLE);
1941 break;
1942 case GMMCS_GSM_GPRS_NOT_ALLOWED: /* TCS 2.1 */
1943 gmm_data->sim_gprs_invalid = TRUE;
1944 kern_sim_del_locigprs();
1945 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED;
1946 kern_sim_gmm_update();
1947 /*
1948 * <R.GMM.AGREJECT.M.034>, <R.GMM.ACREJECT.M.009>
1949 * <R.GMM.DNACM.M.025>, <R.GMM.RCREJECT.M.009>
1950 */
1951 /*
1952 * kern_mm_attach_rej ( error_cause );
1953 * called in kern_local_detach
1954 */
1955 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB;
1956 kern_local_detach( error_cause, det_acc_sent,
1957 GMM_LOCAL_DETACH_PROC_COMB_DISABLE);
1958 break;
1959
1960 default:
1961 kern_sim_del_locigprs();
1962 gmm_data->gu = GU3_ROAMING_NOT_ALLOWED;
1963 kern_sim_gmm_update();
1964
1965 /*
1966 * LABEL ERR_CAUSE_2
1967 */
1968 /* NO break; */
1969 switch ( error_cause )
1970 {
1971 case GMMCS_PLMN_NOT_ALLOWED: /* TCS 2.1 */
1972 case GMMCS_ROAMING_NOT_ALLOWED: /* TCS 2.1 */
1973 /*
1974 * <R.GMM.AGREJECT.M.021>, <R.GMM.AGREJECT.M.022>
1975 */
1976 /*
1977 * MM knows, what is to do
1978 * because the cause is forwarded be the mmgmm_attach_rej_req
1979 * primitive
1980 */
1981 /* NO BREAK */
1982 case GMMCS_LA_NOT_ALLOWED: /* TCS 2.1 */
1983
1984 #ifdef REL99
1985 case GMMCS_NO_SUITABLE_CELL_IN_LA: /*Cause #15*/ /* TCS 4.0 */
1986 #endif
1987
1988 /*
1989 * sometimes GRR responses to GMMRR_RESUME_IND verry fast and does not know
1990 * that RR is in limited, so GMM will set state before.
1991 */
1992 gmm_data->kern.sig_cell_info.mm_status = MMGMM_LIMITED_SERVICE;
1993 sig_kern_sync_set_mm_state(MMGMM_LIMITED_SERVICE);
1994 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB;
1995 kern_local_detach( error_cause, det_acc_sent,
1996 GMM_LOCAL_DETACH_PROC_UNASSIGN);
1997 break;
1998 case GMMCS_ILLEGAL_ME: /* TCS 2.1 */
1999 case GMMCS_ILLEGAL_MS: /* TCS 2.1 */
2000 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB;
2001 kern_local_detach( error_cause, det_acc_sent,
2002 GMM_LOCAL_DETACH_PROC_COMB_DISABLE);
2003 break;
2004 default:
2005 /*
2006 * <R.GMM.ODNOIMSI.M.001>, <R.GMM.DSUBFANO.M.003>
2007 */
2008 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
2009 kern_local_detach( error_cause, det_acc_sent, GMM_LOCAL_DETACH_PROC_ENTER_NULL_NO_IMSI);
2010 break;
2011 }
2012 break;
2013 /* END of LABEL ERR_CAUSE_2 */
2014 }
2015 GMM_RETURN;
2016 } /* kern_err_cause() */
2017
2018 /*
2019 +------------------------------------------------------------------------------
2020 | Function : kern_enter_der
2021 +------------------------------------------------------------------------------
2022 | Description : The label ENTER_DER
2023 |
2024 | Parameters : void
2025 |
2026 +------------------------------------------------------------------------------
2027 */
2028 GLOBAL void kern_enter_der ( void )
2029 {
2030 GMM_TRACE_FUNCTION( "kern_enter_der" );
2031
2032 if (gmm_data->kern.attach_cap.mobile_class_changed
2033 && GMMREG_CLASS_CC!=gmm_data->kern.attach_cap.mobile_class)
2034 {
2035 gmm_data->kern.attach_cap.mobile_class_changed=FALSE;
2036 kern_gmmrr_enable();
2037 }
2038
2039
2040 kern_reset_cipher ();
2041
2042
2043 switch ( gmm_data->kern.detach_cap.detach_type )
2044 {
2045 case GMMREG_DT_POWER_OFF:
2046 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI);
2047 #ifdef FF_EM_MODE
2048 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2049 #endif
2050 break;
2051 case GMMREG_DT_SOFT_OFF:
2052 if (gmm_data->sim_gprs_invalid)
2053 {
2054 SET_STATE ( KERN,KERN_GMM_NULL_NO_IMSI);
2055 #ifdef FF_EM_MODE
2056 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2057 #endif
2058 }
2059 else
2060 {
2061 SET_STATE ( KERN,KERN_GMM_NULL_IMSI);
2062 #ifdef FF_EM_MODE
2063 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI);
2064 #endif
2065 }
2066 break;
2067 case GMMREG_DT_SIM_REMOVED:
2068 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI);
2069 #ifdef FF_EM_MODE
2070 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2071 #endif
2072 if (GMMRR_NET_MODE_I==gmm_data->kern.sig_cell_info.net_mode)
2073 {
2074 kern_mm_imsi_detach_ind (GMMCS_SIM_REMOVED, MMGMM_PERFORM_DETACH,
2075 GMMREG_DT_SIM_REMOVED ); /* TCS 2.1 */
2076 }
2077 break;
2078 case GMMREG_DT_DISABLE_GPRS:
2079 if (gmm_data->sim_gprs_invalid)
2080 {
2081 SET_STATE ( KERN,KERN_GMM_NULL_NO_IMSI);
2082 #ifdef FF_EM_MODE
2083 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2084 #endif
2085 }
2086 else
2087 {
2088 SET_STATE ( KERN,KERN_GMM_NULL_IMSI);
2089 #ifdef FF_EM_MODE
2090 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI);
2091 #endif
2092 }
2093 kern_mm_activate_mm ();
2094 break;
2095 default:
2096 if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode
2097 && GMMREG_CLASS_BC== gmm_data->kern.attach_cap.mobile_class
2098 && kern_lau_needed())
2099 {
2100 /* start attach GSM */
2101 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
2102 #ifdef FF_EM_MODE
2103 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
2104 #endif
2105 kern_gmmrr_suspend (GMMRR_NOT_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2106 break;
2107 }
2108 else
2109 {
2110 if (gmm_data->sim_gprs_invalid)
2111 {
2112 SET_STATE ( KERN, KERN_GMM_NULL_NO_IMSI);
2113 #ifdef FF_EM_MODE
2114 EM_GMM_SET_STATE(KERN_GMM_NULL_NO_IMSI);
2115 #endif
2116 }
2117 else
2118 {
2119 SET_STATE ( KERN, KERN_GMM_NULL_IMSI);
2120 #ifdef FF_EM_MODE
2121 EM_GMM_SET_STATE(KERN_GMM_NULL_IMSI);
2122 #endif
2123 }
2124 /* GPRS DISABLE */
2125 kern_gmmrr_disable();
2126 kern_mm_activate_mm ();
2127 }
2128 break;
2129 }
2130 /*
2131 * The used P-TMSI signature should be deleted
2132 */
2133 gmm_data->ptmsi_signature.available = FALSE;
2134 gmm_data->ptmsi_signature.value = INVALID_PTMSI_SIGNATURE;
2135
2136 GMM_RETURN;
2137 } /* kern_enter_der () */
2138
2139
2140 /*
2141 +------------------------------------------------------------------------------
2142 | Function : kern_attach_complete_end
2143 +------------------------------------------------------------------------------
2144 | Description : The label ATTACH_COMPLETE_END
2145 |
2146 | ATTACH accept procedure completion end
2147 |
2148 | Parameters : result_value - the returned attach type
2149 |
2150 +------------------------------------------------------------------------------
2151 */
2152 GLOBAL void kern_attach_complete_end ( UBYTE result_value )
2153 {
2154 GMM_TRACE_FUNCTION( "kern_attach_complete_end" );
2155
2156 kern_gmmrr_stop_waiting_for_transmission();
2157
2158 /*
2159 *<R.GMM.AGACCEPT.M.027>, <R.GMM.PATTCNF.M.001>
2160 */
2161 switch (result_value)
2162 {
2163 case NORMAL_ATTACHED:
2164 if (GMM_MM_REG_NORMAL_SERVICE != GET_STATE(MM))
2165 {
2166 if (GMMREG_AT_COMB==gmm_data->kern.attach_cap.attach_type
2167 && GMMRR_NET_MODE_III != gmm_data->kern.sig_cell_info.net_mode)
2168 {
2169 kern_gmmreg_attach_cnf_sr ( GMMREG_AT_GPRS, SEARCH_RUNNING );
2170 }
2171 else
2172 {
2173 kern_gmmreg_attach_cnf ( GMMREG_AT_GPRS );
2174 }
2175 break;
2176 }
2177 /* NO break */
2178 case COMBINED_ATTACHED:
2179 kern_gmmreg_attach_cnf ( GMMREG_AT_COMB );
2180 break;
2181 default:
2182 TRACE_ERROR ("unknown result value");
2183 break;
2184 }
2185
2186
2187 #ifndef GMM_TCS4
2188 if ( gmm_data->kern.attach_cap.gmmsm )
2189 {
2190 PALLOC (gmmsm_establish_cnf, GMMSM_ESTABLISH_CNF);
2191 gmm_data->kern.attach_cap.gmmsm = FALSE;
2192 PSEND ( hCommSM, gmmsm_establish_cnf );
2193 }
2194 #endif
2195 if (gmm_data->kern.attach_cap.attempting_to_update_mm )
2196 {
2197 SET_STATE ( KERN, KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM );
2198 #ifdef FF_EM_MODE
2199 EM_GMM_SET_STATE(KERN_GMM_REG_ATTEMPTING_TO_UPDATE_MM );
2200 #endif
2201 gmm_data->kern.attach_cap.attempting_to_update_mm = FALSE;
2202 }
2203 else
2204 {
2205 /* gmmrr_cell_res
2206 */
2207 SET_STATE(GU,GU_UPDATE_NOT_NEEDED);
2208 SET_STATE ( KERN, KERN_GMM_REG_NORMAL_SERVICE );
2209 #ifdef FF_EM_MODE
2210 EM_GMM_SET_STATE(KERN_GMM_REG_NORMAL_SERVICE );
2211 #endif
2212 }
2213 GMM_RETURN;
2214 } /* kern_attach_complete_end () */
2215
2216
2217
2218 /*
2219 +------------------------------------------------------------------------------
2220 | Function : kern_rau_complete_end
2221 +------------------------------------------------------------------------------
2222 | Description : The label RAU_COMPLETE_END
2223 |
2224 | RAU accept procedure completion end
2225 |
2226 | Parameters : void
2227 |
2228 +------------------------------------------------------------------------------
2229 */
2230 GLOBAL void kern_rau_complete_end ( UBYTE result_value )
2231 {
2232 GMM_TRACE_FUNCTION( "kern_rau_complete_end" );
2233
2234 /* gmmrr_cell_ind
2235 * is sent in kern_attach_complete_end
2236 */
2237 kern_llgmm_resume ();
2238
2239 gmm_data->kern.attach_cap.rau_initiated = GMM_NO_RAU;
2240
2241 if( gmm_data->sim_gprs_invalid)
2242 {
2243 TRACE_EVENT("Detach because SIM removed");
2244 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_COMB;
2245 kern_detach( );
2246 }
2247 else if ( gmm_data->kern.detach_cap.gmmreg )
2248 /*
2249 * MO DETACH was requested
2250 */
2251 {
2252 TRACE_0_INFO("Detach Request again");
2253 switch ( gmm_data->kern.detach_cap.detach_type )
2254 {
2255 case GMMREG_DT_IMSI:
2256 case GMMREG_DT_COMB:
2257 case GMMREG_DT_SIM_REMOVED:
2258 switch (gmm_data->kern.sig_cell_info.net_mode)
2259 {
2260 case GMMRR_NET_MODE_I:
2261 kern_detach( );
2262 break;
2263 case GMMRR_NET_MODE_II:
2264 /*
2265 * if deatch procedure collision and GSM is already detached we
2266 * are finished
2267 */
2268 if (GMM_MM_DEREG != GET_STATE(MM))
2269 {
2270 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING);
2271 #ifdef FF_EM_MODE
2272 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING);
2273 #endif
2274 kern_llgmm_suspend(LLGMM_CALL);
2275 kern_gmmrr_suspend(GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2276 }
2277 else
2278 {
2279 kern_detach( );
2280 }
2281 break;
2282 case GMMRR_NET_MODE_III:
2283 kern_detach( );
2284 break;
2285 default:
2286 TRACE_ERROR ("unknown net mode");
2287 break;
2288 }
2289 break;
2290 case GMMREG_DT_DISABLE_GPRS:
2291 kern_local_detach( GMMCS_INT_NOT_PRESENT, FALSE, GMM_LOCAL_DETACH_PROC_ENTER_DEREG); /* TCS 2.1 */
2292 break;
2293 case GMMREG_DT_GPRS:
2294 case GMMREG_DT_POWER_OFF:
2295 case GMMREG_DT_SOFT_OFF:
2296 kern_detach( );
2297 break;
2298 default:
2299 TRACE_ERROR ("Unexpected detach type in primitive GMMREG_DETACH_REQ");
2300 break;
2301 }
2302 }
2303 else if (GMMRR_NET_MODE_III==gmm_data->kern.sig_cell_info.net_mode
2304 && GMMRR_CLASS_BC == gmm_data->kern.attach_cap.mobile_class)
2305 {
2306 TRACE_EVENT("Detach because NMO III and BC");
2307 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
2308 kern_detach( );
2309 }
2310 else
2311 {
2312 kern_attach_complete_end(result_value);
2313 }
2314 GMM_RETURN;
2315 } /* kern_rau_complete_end () */
2316
2317 /*
2318 +------------------------------------------------------------------------------
2319 | Function : kern_rau_complete
2320 +------------------------------------------------------------------------------
2321 | Description : The label RAU_COMPLETE
2322 |
2323 | RAU accept procedure completion
2324 |
2325 | Parameters : result_value - the returned attach type
2326 |
2327 +------------------------------------------------------------------------------
2328 */
2329 GLOBAL void kern_rau_complete ( UBYTE result_value )
2330 {
2331 GMM_TRACE_FUNCTION( "kern_rau_complete" );
2332
2333 sig_kern_tx_data_req ( CURRENT_TLLI, ROUTING_AREA_UPDATE_COMPLETE );
2334
2335 #ifdef REL99
2336 /*
2337 * If Cell Notification is set in the RAU ACCEPT message, the
2338 * RAU COMPLETE if send, can be considered as the initial Cell Update.
2339 * The Next cell update can use LLC NULL frame.
2340 * Reference 3GPP TS 24.008 section 4.7.2.1.1
2341 */
2342 if (gmm_data->cell_notification EQ FIRST_CELL_NOTIFY)
2343 {
2344 gmm_data->cell_notification = NOT_FIRST_CELL_NOTIFY; /* TCS 4.0 */
2345 }
2346 #endif
2347
2348 kern_rau_complete_end(result_value);
2349 GMM_RETURN;
2350 } /* kern_rau_complete () */
2351
2352 /*
2353 +------------------------------------------------------------------------------
2354 | Function : kern_attach_complete
2355 +------------------------------------------------------------------------------
2356 | Description : The label ATTACH_COMPLETE
2357 |
2358 | ATTACH and RAU accept procedure completion
2359 |
2360 | Parameters : attach_complete - idicates whether AIR ATTACH-COMPLETE
2361 | message has to sent or not
2362 | receive_n_pdu_number_list
2363 |
2364 |
2365 +------------------------------------------------------------------------------
2366 */
2367 GLOBAL void kern_attach_complete (
2368 UBYTE result_value,
2369 BOOL attach_complete,
2370 BOOL v_receive_n_pdu_number_list,
2371 T_receive_n_pdu_number_list * receive_n_pdu_number_list)
2372 {
2373 GMM_TRACE_FUNCTION( "kern_attach_complete" );
2374 gmm_data->kern.attach_cap.attach_complete = attach_complete;
2375
2376 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated )
2377 /*
2378 * ATTACH procedure
2379 */
2380 {
2381 if ( attach_complete )
2382 {
2383 /*
2384 * <R.GMM.AGACCEPT.M.018>, <R.GMM.TLLIUSE.M011>
2385 */
2386 sig_kern_tx_data_req ( CURRENT_TLLI, ATTACH_COMPLETE );
2387
2388 #ifdef REL99
2389 /*
2390 * If Cell Notification is set in the ATTACH ACCEPT message, the
2391 * ATTACH COMPLETE if send, can be considered as the initial Cell Update.
2392 * The Next cell update can use LLC NULL frame.
2393 * Reference 3GPP TS 24.008 section 4.7.2.1.1
2394 */
2395 if (gmm_data->cell_notification EQ FIRST_CELL_NOTIFY)
2396 {
2397 gmm_data->cell_notification = NOT_FIRST_CELL_NOTIFY; /* TCS 4.0 */
2398 }
2399 #endif
2400
2401 }
2402 kern_attach_complete_end( result_value );
2403
2404 #ifdef GMM_TCS4
2405 {
2406 PALLOC (mmpm_attach_ind, MMPM_ATTACH_IND);
2407 PSEND ( hCommSM, mmpm_attach_ind );
2408 }
2409 #endif
2410
2411 }
2412 else
2413 /*
2414 * RAU procedure
2415 */
2416 {
2417 MCAST (routing_area_update_complete, ROUTING_AREA_UPDATE_COMPLETE);
2418 if (v_receive_n_pdu_number_list )
2419 {
2420 int i;
2421 #ifdef GMM_TCS4
2422 PALLOC (gmmsm_sequence_ind,MMPM_SEQUENCE_IND);
2423 #else
2424 PALLOC (gmmsm_sequence_ind,GMMSM_SEQUENCE_IND);
2425 #endif
2426 gmmsm_sequence_ind->c_npdu_list
2427 = receive_n_pdu_number_list->c_receive_n_pdu_number_list_val;
2428 for (i=0;i<receive_n_pdu_number_list->c_receive_n_pdu_number_list_val;i++)
2429 {
2430 gmmsm_sequence_ind->npdu_list[i].nsapi
2431 = receive_n_pdu_number_list->receive_n_pdu_number_list_val[i].nsapi;
2432 gmmsm_sequence_ind->npdu_list[i].receive_n_pdu_number_val
2433 = receive_n_pdu_number_list->receive_n_pdu_number_list_val[i].receive_n_pdu_number_val;
2434 }
2435 #ifdef GMM_TCS4
2436 PSEND ( hCommUPM, gmmsm_sequence_ind );
2437 #else
2438 PSEND ( hCommSM, gmmsm_sequence_ind );
2439 #endif
2440 SET_STATE ( KERN, KERN_GMM_RAU_WAIT_FOR_NPDU_LIST );
2441 #ifdef FF_EM_MODE
2442 EM_GMM_SET_STATE(KERN_GMM_RAU_WAIT_FOR_NPDU_LIST );
2443 #endif
2444 GMM_RETURN;
2445 }
2446 else
2447 {
2448 routing_area_update_complete->v_receive_n_pdu_number_list = 0;
2449 if ( attach_complete )
2450 {
2451 kern_rau_complete(result_value);
2452 }
2453 else
2454 {
2455 kern_rau_complete_end(result_value);
2456 }
2457 }
2458 }
2459 GMM_RETURN;
2460 } /* kern_attach_complete () */
2461
2462
2463
2464 /*
2465 +------------------------------------------------------------------------------
2466 | Function : kern_attach_accept
2467 +------------------------------------------------------------------------------
2468 | Description : The label ATTACH_ACCEPT
2469 |
2470 | ATTACH and RAU accept procedure
2471 |
2472 | This procedure is called when the attach or rau accepüt message
2473 | is received
2474 |
2475 | Parameters : message_id - RAU ACCEPT or ATTACH ACCEPT message
2476 |
2477 +------------------------------------------------------------------------------
2478 */
2479 GLOBAL void kern_attach_accept
2480 (
2481 T_result_gmm * result,
2482 T_force_to_standby * force_to_standby,
2483 T_rau_timer * rau_timer,
2484 /* attach: radio_priority */
2485 T_routing_area_identification *routing_area_identification,
2486 BOOL v_p_tmsi_signature,
2487 T_p_tmsi_signature * p_tmsi_signature,
2488 BOOL v_ready_timer,
2489 T_ready_timer * ready_timer,
2490 BOOL v_gmobile_identity,
2491 T_gmobile_identity * gmobile_identity,
2492 BOOL v_mobile_identity,
2493 T_mobile_identity * mobile_identity,
2494 /*
2495 * only RAU
2496 */
2497 BOOL v_receive_n_pdu_number_list,
2498 T_receive_n_pdu_number_list * receive_n_pdu_number_list,
2499 USHORT cause,
2500 BOOL v_eqv_plmn_list, /* TCS 2.1 */
2501 T_eqv_plmn_list * eqv_plmn_list, /* TCS 2.0 */
2502 BOOL v_t3302,
2503 T_t3302 * t3302,
2504 BOOL v_cell_notification
2505 )
2506 {
2507 GMM_TRACE_FUNCTION( "kern_attach_accept" );
2508
2509 TRACE_2_INFO("ACCEPT.rai.lac %#x rac %#x",
2510 routing_area_identification->lac,
2511 routing_area_identification->rac);
2512
2513 gmm_data->kern.attach_cap.attach_acc_after_po = TRUE;
2514 gmm_data->kern.timeout_t3312 = FALSE;
2515
2516 if (v_t3302)
2517 {
2518 gmm_data->kern.t3302_val = rdy_get_timer ( (T_rau_timer *)t3302 );
2519 }
2520
2521 #ifdef REL99
2522 /* If cell notification field is present GMM should update its
2523 * context with the information.
2524 * Whenever a LLGMM_TRIGGER_REQ is sent, this field should be
2525 * checked. If it indicates that cell notification is supported
2526 * GMM should inform this to LLC with a special cause value.
2527 * LLC, on receiving this special cause value can use NULL frame
2528 * for cell updates.
2529 * The first cell notification shouldn't use LLC NULL frame. The
2530 * values FIRST_CELL_NOTIFY and NOT_FIRST_CELL_NOTIFY are introduced
2531 * to take care of this
2532 */
2533 #endif
2534
2535
2536 if (v_cell_notification)
2537 {
2538
2539 #ifdef REL99
2540 gmm_data->cell_notification = FIRST_CELL_NOTIFY; /* TCS 4.0 */
2541 #else
2542 TRACE_0_INFO("R99: cell notification supported by network, but not supported by the MS");
2543 #endif
2544
2545 }
2546
2547 #ifdef REL99
2548 else /*SGSN doesn't support cell notification*/ /* TCS 4.0 */
2549 { /* TCS 4.0 */
2550 gmm_data->cell_notification = NO_CELL_NOTIFY; /* TCS 4.0 */
2551 }
2552
2553 /* The following #ifdef is added due to a limitation in TDC.
2554 * TDC in the current release(ver 14) doesn't support setting of T variables.
2555 * So until the next release (ver 15) of TDC is available, this fix is needed
2556 * for running GMM406X test cases.
2557 */
2558 #ifdef _SIMULATION_ /* TCS 4.0 */
2559 gmm_data->cell_notification = gmm_data->config.cell_notification; /* TCS 4.0 */
2560 #endif /*_SIMULATION_*/ /* TCS 4.0 */
2561 #endif /* REL99 */
2562
2563 /*
2564 * remove PLMN from forbiden list
2565 */
2566 kern_remove_plmn_from_forbidden_list(gmm_data->kern.sig_cell_info.env.rai.plmn);
2567
2568 kern_set_rai ( routing_area_identification );
2569
2570 if (GMM_NO_RAU != gmm_data->kern.attach_cap.rau_initiated)
2571 {
2572 result->result_value <<= 1;
2573 result->result_value |= 1;
2574
2575 }
2576 /*
2577 * the following is needed when calling kern_rau_complete() from
2578 * within kern_gmmsm_sequence_res():
2579 */
2580 gmm_data->kern.attach_cap.result_type = result->result_value;
2581
2582
2583 /*
2584 * Reset RAU and ATTACH attempt counter
2585 */
2586 if (!IS_CAUSE_INVALID (cause))
2587 {
2588 gmm_data->kern.detach_cap.error_cause = cause;
2589
2590 switch ( cause )
2591 {
2592 case GMMCS_MSC_TEMP_NOT_REACHABLE: /* TCS 2.1 */
2593 case GMMCS_NET_FAIL: /* TCS 2.1 */
2594 case GMMCS_CONGESTION: /* TCS 2.1 */
2595 if ( COMBINED_ATTACHED == result->result_value )
2596 {
2597 TRACE_0_INFO("#0x10 or #0x11 or #0x16 received together with COMBINED attach. Switched to NORMAL attached");
2598 result->result_value = NORMAL_ATTACHED;
2599 }
2600 /* 04.08 44.7.3.2.3.2 */
2601 /* special kern_attach_reset */
2602 gmm_data->kern.aac++;
2603 gmm_data->kern.ct3310 = 0;
2604 vsi_t_stop ( GMM_handle, kern_T3310);
2605 break;
2606 default:
2607 kern_attach_reset();
2608 break;
2609 }
2610 }
2611 else
2612 {
2613 gmm_data->kern.detach_cap.error_cause = GMMCS_INT_NOT_PRESENT; /* TCS 2.1 */
2614 kern_attach_reset();
2615 }
2616
2617 sig_kern_rdy_force_ie_req
2618 ( force_to_standby->force_to_standby_value ,
2619 v_mobile_identity || v_gmobile_identity);/*lint !e730 (Info -- Boolean argument to function) */
2620
2621 /*
2622 * force to standby function has to be called before handling of the ready timer, because cu
2623 * is not allowed upon force to standby
2624 */
2625 sig_kern_rdy_t3314_req
2626 ( (v_gmobile_identity && ID_TYPE_TMSI==gmobile_identity->type_of_identity)
2627 || (gmobile_identity && ID_TYPE_TMSI==mobile_identity->type_of_identity)
2628 || v_receive_n_pdu_number_list, /*lint !e730 (Info -- Boolean argument to function) *//*lint !e730 (Info -- Boolean argument to function) */
2629 v_ready_timer,
2630 ready_timer,
2631 rau_timer,
2632 v_mobile_identity || v_gmobile_identity);
2633
2634 /*
2635 * this procedure transmittes the GSIM_UPDATE_REQ message
2636 * and starts the kern_local_attach procedure
2637 *
2638 * <R.GMM.PATTCNF.M.001>
2639 */
2640 /* Delete old signature if no signatur is included in attach_accept
2641 or rau_accept primitive */
2642 if (!v_p_tmsi_signature)
2643 {
2644 gmm_data->ptmsi_signature.value = INVALID_PTMSI_SIGNATURE;
2645 gmm_data->ptmsi_signature.available = FALSE;
2646 }
2647 kern_tmsi_negotiated (
2648 v_mobile_identity,
2649 mobile_identity,
2650 v_gmobile_identity,
2651 gmobile_identity,
2652 v_p_tmsi_signature,
2653 p_tmsi_signature);
2654
2655
2656 if (!IS_CAUSE_INVALID (cause))
2657 /*
2658 * LABEL TMSI_CAUSE
2659 */
2660 /*
2661 * it is not required that i have to go to aac if an error cause
2662 * is received in normal attach/rau mode
2663 */
2664 {
2665 if ( GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated
2666 && AT_GPRS == gmm_data->kern.attach_cap.attach_proc_type )
2667 {
2668 SET_STATE ( MM, GMM_MM_DEREG );
2669 kern_aac (cause);
2670 GMM_RETURN;
2671 }
2672 switch ( cause )
2673 {
2674 case GMMCS_IMSI_UNKNOWN: /* TCS 2.1 */
2675 {
2676 gmm_data->tmsi = GMMRR_TMSI_INVALID;
2677 gmm_data->kern.sig_cell_info.mm_status = MMGMM_LIMITED_SERVICE;
2678 sig_kern_sync_set_mm_state(MMGMM_LIMITED_SERVICE);
2679
2680 kern_mm_attach_rej (cause);
2681 kern_attach_complete (
2682 result->result_value,
2683 v_gmobile_identity &&
2684 ID_TYPE_TMSI==gmobile_identity->type_of_identity, /*lint !e730 (Info -- Boolean argument to function) */
2685 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 '->') */
2686 break;
2687 }
2688 case GMMCS_MSC_TEMP_NOT_REACHABLE: /* TCS 2.1 */
2689 case GMMCS_NET_FAIL: /* TCS 2.1 */
2690 case GMMCS_CONGESTION: /* TCS 2.1 */
2691 /*
2692 * ERRCS_NETWORK_FAILURE
2693 */
2694
2695 TRACE_1_INFO(" aac: %d", gmm_data->kern.aac );
2696
2697 /* this is already done.
2698 */
2699
2700 if ( gmm_data->gu == GU1_UPDATED
2701 && !kern_rai_changed()
2702 && gmm_data->kern.aac < MAX_AAC )
2703 {
2704 TRACE_EVENT ( "Info: START: T3311" );
2705 vsi_t_start ( GMM_handle , kern_T3311, gmm_data->kern.t3311_val );
2706 kern_mm_attach_rej (cause);
2707 gmm_data->kern.attach_cap.attempting_to_update_mm = TRUE;
2708 kern_attach_complete (
2709 result->result_value,
2710 (v_gmobile_identity
2711 && ID_TYPE_TMSI==gmobile_identity->type_of_identity)
2712 ||
2713 (v_mobile_identity
2714 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */
2715 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 '->') */
2716 gmm_data->kern.attach_cap.rau_initiated=GMM_RAU;
2717 }
2718 else
2719 {
2720 vsi_t_start ( GMM_handle , kern_T3302, gmm_data->kern.t3302_val );
2721 sig_kern_rdy_start_t3302_req();
2722 TRACE_EVENT ( "Info: START: T3302" );
2723 TRACE_1_INFO ( "ATTACH or RAU will retried %.1f minutes later",
2724 (gmm_data->kern.t3302_val/(60000.0)));
2725
2726 switch ( gmm_data->kern.attach_cap.mobile_class)
2727 {
2728 case GMMREG_CLASS_A:
2729 /*
2730 * kern_mm_set_state ( MMGMM_ENTER_IDLE_MODE );
2731 */
2732 SET_STATE ( MM, GMM_MM_DEREG );
2733 kern_mm_lau();
2734
2735 kern_attach_complete (
2736 result->result_value,
2737 (v_gmobile_identity
2738 && ID_TYPE_TMSI==gmobile_identity->type_of_identity)
2739 ||
2740 (v_mobile_identity
2741 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */
2742 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 '->') */
2743 GMM_RETURN;
2744 default:
2745 TRACE_ERROR("unexpected MS class");
2746 /* NO break; */
2747 case GMMREG_CLASS_BG:
2748 case GMMREG_CLASS_BC:
2749 case GMMREG_CLASS_B:
2750 {
2751 /* rau_initiated will be reset in attah_complete()*/
2752 BOOL no_rau= (GMM_NO_RAU == gmm_data->kern.attach_cap.rau_initiated);
2753 kern_mm_attach_rej (cause);
2754
2755 gmm_data->kern.attach_cap.attempting_to_update_mm = TRUE;
2756
2757 kern_attach_complete (
2758 result->result_value,
2759 (v_gmobile_identity
2760 && ID_TYPE_TMSI==gmobile_identity->type_of_identity)
2761 ||
2762 (v_mobile_identity
2763 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */
2764 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 '->') */
2765
2766 if ((no_rau && AT_GPRS != gmm_data->kern.attach_cap.attach_proc_type )
2767 || (!no_rau &&
2768 (COMBINED_RAU == gmm_data->kern.attach_cap.update_proc_type )
2769 || (COMBINED_RAU_IMSI_ATTACH == gmm_data->kern.attach_cap.update_proc_type )))
2770 {
2771
2772 if (no_rau)
2773 {
2774 SET_STATE ( KERN, KERN_GMM_DEREG_SUSPENDING );
2775 #ifdef FF_EM_MODE
2776 EM_GMM_SET_STATE(KERN_GMM_DEREG_SUSPENDING );
2777 #endif
2778 }
2779 else
2780 {
2781 /* 04.08 ch. 4.7..2.3 The MM sublayer shall act as in network operation mode II as long as the
2782 combined GMM procedures are not successful and no new RA is entered. The new
2783 MM state is MM IDLE. */
2784 gmm_data->kern.sig_cell_info.net_mode= GMMRR_NET_MODE_II;
2785 TRACE_0_INFO ("changed to NMOII");
2786
2787 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
2788 #ifdef FF_EM_MODE
2789 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
2790 #endif
2791 kern_llgmm_suspend(LLGMM_CALL);
2792 }
2793 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
2794 }
2795 }
2796 break;
2797 case GMMREG_CLASS_CG:
2798 /*
2799 * <R.GMM.RCSUGPRS.M.020>
2800 */
2801 kern_mm_attach_rej (cause);
2802
2803 gmm_data->kern.attach_cap.attempting_to_update_mm = TRUE;
2804 kern_attach_complete (
2805 result->result_value,
2806 SEND_ATTACH_COMPLETE,
2807 v_receive_n_pdu_number_list, receive_n_pdu_number_list);
2808 break;
2809 }
2810
2811 }
2812 break;
2813 default:
2814 kern_aac (cause);
2815 break;
2816 }
2817 SET_STATE( MM, GMM_MM_DEREG );
2818 }
2819 else
2820 /*
2821 * LABEL TMSI_NO_CAUSE
2822 */
2823 {
2824 /*
2825 * <R.GMM.RCSUBOTH.M.019>
2826 */
2827 kern_mm_attach_acc ( v_mobile_identity, mobile_identity, /* TCS 2.1 */
2828 v_eqv_plmn_list, eqv_plmn_list ); /* TCS 2.1 */
2829
2830 if ( COMBINED_ATTACHED == result->result_value )
2831 {
2832 SET_STATE( MM, GMM_MM_REG_NORMAL_SERVICE );
2833 /*
2834 * mm_lau_attempt is reset. It is only set if lau has been performed
2835 * before via MM_procedures
2836 */
2837 gmm_data->kern.attach_cap.mm_lau_attempted=FALSE;
2838 }
2839 else
2840 {
2841 if (GMM_MM_REG_INITATED_VIA_GPRS == GET_STATE(MM))
2842 {
2843 TRACE_ERROR ("network has sent attach_accept (GPRS) w/o error cause but (COMB) has been requested");
2844 kern_mm_attach_rej(GMMCS_MESSAGE_INVALID); /* TCS 2.1 */
2845 }
2846 }
2847
2848 kern_attach_complete (
2849 result->result_value,
2850 (v_gmobile_identity
2851 && ID_TYPE_TMSI==gmobile_identity->type_of_identity)
2852 ||
2853 (v_mobile_identity
2854 && ID_TYPE_TMSI == mobile_identity->type_of_identity),/*lint !e730 (Info -- Boolean argument to function) */
2855 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 '->') */
2856 }
2857
2858 GMM_RETURN;
2859 } /* kern_attach_accept () */
2860
2861
2862 /*
2863 +------------------------------------------------------------------------------
2864 | Function : kern_norm_rau
2865 +------------------------------------------------------------------------------
2866 | Description : The label NORM_RAU
2867 |
2868 | Normal RAU
2869 |
2870 | Parameters : void
2871 |
2872 +------------------------------------------------------------------------------
2873 */
2874
2875 GLOBAL void kern_norm_rau ( void )
2876 {
2877 GMM_TRACE_FUNCTION( "kern_norm_rau" );
2878 if (gmm_data->kern.timeout_t3312)
2879 /*
2880 * 24.008:
2881 * If the MS is in other state than GMM-REGISTERED.NORMAL-SERVICE when the timer
2882 * expires the periodic routing area updating procedure is delayed until the MS
2883 * returns to GMM-REGISTERED.NORMAL-SERVICE.
2884 * In GSM, if the MS in MS operation mode B is in the state GMM-REGISTERED.
2885 * SUSPENDED when the timer expires the periodic routing area updating procedure
2886 * is delayed until the state is left.
2887 */
2888 {
2889 kern_periodic_rau();
2890 GMM_RETURN;
2891 }
2892
2893 {
2894 /* T_ROUTING_AREA_UPDATE_REQUEST */
2895 MCAST (routing_area_update_request,ROUTING_AREA_UPDATE_REQUEST);
2896
2897 #ifdef REL99
2898 routing_area_update_request->v_gmobile_identity = FALSE;
2899 #endif
2900 routing_area_update_request->v_ms_network_capability = FALSE;
2901 #ifdef REL99
2902 routing_area_update_request->v_pdp_context_status = FALSE;
2903 #endif
2904
2905 gmm_data->kern.attach_cap.update_proc_type = RAU;
2906
2907 routing_area_update_request->update_type.update_type_value
2908 = RAU;
2909 TRACE_EVENT("Info: Normal RAU");
2910
2911 kern_rau_init();
2912 }
2913
2914 GMM_RETURN;
2915 } /* kern_norm_rau () */
2916
2917
2918 /*
2919 +------------------------------------------------------------------------------
2920 | Function : kern_comb_rau
2921 +------------------------------------------------------------------------------
2922 | Description : The label COMB_RAU
2923 |
2924 | Combined RAU
2925 |
2926 | Parameters : void
2927 |
2928 +------------------------------------------------------------------------------
2929 */
2930
2931 GLOBAL void kern_comb_rau ( void )
2932 {
2933 GMM_TRACE_FUNCTION( "kern_comb_rau" );
2934 if (gmm_data->kern.timeout_t3312)
2935 /*
2936 * 24.008:
2937 * If the MS is in other state than GMM-REGISTERED.NORMAL-SERVICE when the timer
2938 * expires the periodic routing area updating procedure is delayed until the MS
2939 * returns to GMM-REGISTERED.NORMAL-SERVICE.
2940 * In GSM, if the MS in MS operation mode B is in the state GMM-REGISTERED.
2941 * SUSPENDED when the timer expires the periodic routing area updating procedure
2942 * is delayed until the state is left.
2943 */
2944 {
2945 kern_periodic_rau();
2946 GMM_RETURN;
2947 }
2948
2949 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU;
2950
2951 {
2952 /* T_ROUTING_AREA_UPDATE_REQUEST */
2953 MCAST (routing_area_update_request,ROUTING_AREA_UPDATE_REQUEST);
2954
2955 #ifdef REL99
2956 routing_area_update_request->v_gmobile_identity = FALSE;
2957 #endif
2958 routing_area_update_request->v_ms_network_capability = FALSE;
2959 #ifdef REL99
2960 routing_area_update_request->v_pdp_context_status = FALSE;
2961 #endif
2962
2963 if ( GMMREG_AT_GPRS != gmm_data->kern.attach_cap.attach_type
2964 && GMMRR_TMSI_INVALID == gmm_data->tmsi )
2965 /*
2966 * <R.GMM.RCINIT.M.016>
2967 *
2968 * 24.008 9.4.1.3. TMSI Status
2969 *
2970 * This IE shall be included if the MS performs a
2971 * combined GPRS attach and no valid TMSI is available
2972 */
2973 {
2974 routing_area_update_request->v_tmsi_status = TRUE;
2975 routing_area_update_request->tmsi_status.tmsi_flag = FALSE;
2976 }
2977 else
2978 {
2979 routing_area_update_request->v_tmsi_status = FALSE;
2980 }
2981
2982
2983 if ( GMM_MM_DEREG == GET_STATE(MM)
2984 || gmm_data->kern.attach_cap.mm_lau_attempted)
2985 {
2986 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU_IMSI_ATTACH;
2987 routing_area_update_request->update_type.update_type_value
2988 = COMBINED_RAU_IMSI_ATTACH;
2989 TRACE_EVENT("Info: Comb. RAU with IMSI attach");
2990 }
2991 else
2992 {
2993 gmm_data->kern.attach_cap.update_proc_type = COMBINED_RAU;
2994 routing_area_update_request->update_type.update_type_value
2995 = COMBINED_RAU;
2996 TRACE_EVENT("Info: Comb. RAU");
2997 }
2998 }
2999
3000 kern_mm_attach_started ();
3001 kern_rau_init();
3002 GMM_RETURN;
3003 } /* kern_comb_rau () */
3004
3005
3006 /*
3007 +------------------------------------------------------------------------------
3008 | Function : kern_rau_limited
3009 +------------------------------------------------------------------------------
3010 | Description : The label RAU_LIMITED
3011 |
3012 | Start of RAU without supention of the rest of the world
3013 | beacause the rest is already suspended
3014 |
3015 | Parameters : void
3016 |
3017 +------------------------------------------------------------------------------
3018 */
3019 GLOBAL void kern_rau_limited ( void )
3020 {
3021 GMM_TRACE_FUNCTION( "kern_rau_limited" );
3022
3023 switch ( gmm_data->kern.sig_cell_info.net_mode )
3024 {
3025 case GMMRR_NET_MODE_I:
3026 if (GMM_MM_DEREG != GET_STATE(MM)
3027 || GMMREG_AT_COMB==gmm_data->kern.attach_cap.attach_type)
3028 {
3029 kern_comb_rau();
3030 }
3031 else
3032 {
3033 kern_norm_rau();
3034 }
3035 break;
3036 case GMMRR_NET_MODE_II:
3037 if (kern_lau_needed())
3038 /*
3039 * if deatch procedure collision and GSM is already detached we can start
3040 * rau
3041 */
3042 {
3043 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3044 #ifdef FF_EM_MODE
3045 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3046 #endif
3047 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
3048 }
3049 else
3050 {
3051 kern_norm_rau();
3052 }
3053 break;
3054 case GMMRR_NET_MODE_III:
3055 switch ( gmm_data->kern.attach_cap.mobile_class)
3056 {
3057 case GMMREG_CLASS_A:
3058 TRACE_ERROR ("ClassA not supported");
3059 break;
3060 case GMMREG_CLASS_BG:
3061 if ( GMM_MM_DEREG != GET_STATE(MM) )
3062 {
3063 if (kern_lau_needed())
3064 /*
3065 * First update than detach!!!
3066 */
3067 {
3068 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3069 #ifdef FF_EM_MODE
3070 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3071 #endif
3072 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
3073 }
3074 else
3075 {
3076 kern_imsi_detach_reg_susp();
3077 }
3078 }
3079 else
3080 {
3081 kern_norm_rau();
3082 }
3083 break;
3084 case GMMREG_CLASS_BC:
3085 if (GMMREG_AT_GPRS == gmm_data->kern.attach_cap.attach_type)
3086 {
3087 kern_norm_rau();
3088 }
3089 else
3090 /*
3091 * GSM attach_type
3092 */
3093 {
3094 if ( kern_lau_needed())
3095 {
3096 SET_STATE ( KERN, KERN_GMM_REG_SUSPENDING );
3097 #ifdef FF_EM_MODE
3098 EM_GMM_SET_STATE(KERN_GMM_REG_SUSPENDING );
3099 #endif
3100 kern_gmmrr_suspend (GMMRR_SUSP_GPRS, GMMRR_NORMAL_RELEASE, GMM_SUSP_LAU);
3101 }
3102 else
3103 {
3104 if (kern_rai_changed())
3105 {
3106 kern_norm_rau();
3107 }
3108 else
3109 {
3110 gmm_data->kern.detach_cap.detach_type = GMMREG_DT_GPRS;
3111 kern_detach();
3112 }
3113 }
3114 }
3115 break;
3116 case GMMREG_CLASS_CG:
3117 kern_norm_rau();
3118 break;
3119 default:
3120 break;
3121 }
3122
3123 break;
3124 default:
3125 TRACE_ERROR ("unknown netmode");
3126 break;
3127 }
3128 GMM_RETURN;
3129 } /* kern_rau_limited () */