annotate src/g23m-gprs/sm/sm_dispatcher.c @ 303:f76436d19a7a default tip

!GPRS config: fix long-standing AT+COPS chance hanging bug There has been a long-standing bug in FreeCalypso going back years: sometimes in the AT command bring-up sequence of an ACI-only MS, the AT+COPS command would produce only a power scan followed by cessation of protocol stack activity (only L1 ADC traces), instead of the expected network search sequence. This behaviour was seen in different FC firmware versions going back to Citrine, and seemed to follow some law of chance, not reliably repeatable. This bug has been tracked down and found to be specific to !GPRS configuration, stemming from our TCS2/TCS3 hybrid and reconstruction of !GPRS support that was bitrotten in TCS3.2/LoCosto version. ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3 version and had to be pulled from TCS2 - but as it turns out, there is a new field in the MMR_REG_REQ primitive that needs to be set correctly, and that psa_mms.c module is the place where this initialization needed to be added.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 08:23:37 +0000
parents fa8dc04885d8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*----------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 | Project : 3G PS
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Module : SM
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 +-----------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 | Copyright 2003 Texas Instruments.
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | All rights reserved.
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 | This file is confidential and a trade secret of Texas
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | Instruments .
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | The receipt of or possession of this file does not convey
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | any rights to reproduce or disclose its contents or to
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | manufacture, use, or sell anything it may describe, in
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | whole, or in part, without the specific written consent of
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | Texas Instruments.
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 +-----------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 | Purpose: This module implements the process dispatcher
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | for the Session Management (SM) entity.
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 | For design details, see:
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 | 8010.908 SM Detailed Specification
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 +---------------------------------------------------------------------------*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 /*==== DECLARATION CONTROL =================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /*==== INCLUDES =============================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "sm.h"
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include "sm_sequencer.h"
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "sm_network_control.h"
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "sm_aci_output_handler.h"
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "sm_timer_handler.h"
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "sm_dispatcher.h"
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /*==== CONSTS ===============================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /*==== TYPES ================================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /*==== LOCALS ===============================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 /*==== PRIVATE FUNCTIONS ====================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 | Function : sm_disp_allocate_context
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 | Description : Allocate memory for a context data structure and initialize
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 | memory and state machines. Returns address of data structure.
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 | Parameters : nsapi - NSAPI of context to allocate
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 /*@null@*/ /*@only@*/static struct T_SM_CONTEXT_DATA *
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 sm_disp_allocate_context(int /*@alt U8@*/ nsapi)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 context = sm_allocate_context_data();
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 if (context != NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 memset(context, 0, sizeof(struct T_SM_CONTEXT_DATA));
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 context->nsapi = nsapi;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 sm_context_control_init (context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 sm_context_deactivate_control_init(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 sm_network_control_init (context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 sm_user_plane_control_init (context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 return context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 /*==== PUBLIC FUNCTIONS =====================================================*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 | Function : sm_disp_smreg_pdp_activate_req
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 | Description : Dispatch SMREG_PDP_ACTIVATE_REQ
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 void sm_disp_smreg_pdp_activate_req(T_SMREG_PDP_ACTIVATE_REQ *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 T_CAUSE_ps_cause cause;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 (void)TRACE_FUNCTION("sm_disp_smreg_pdp_activate_req");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 if (!sm_is_attached() OR
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 (sm_is_suspended() AND
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 (sm_data.sm_suspend_cause EQ CAUSE_MM_LIMITED_SERVICE OR
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 sm_data.sm_suspend_cause EQ CAUSE_MM_NO_SERVICE)))
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 /*In case of limited service or no service, where GPRS is not present,
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 SM should reject the request immediately T3380 rule is not followed.*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 (void)TRACE_ERROR("PDP Activation rejected - limited service or no service. ");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 cause.ctrl_value = CAUSE_is_from_nwsm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 cause.value.sm_cause = (U16)CAUSE_NWSM_ACTIVATE_REJECTED_UNSPECIFIED;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 send_smreg_pdp_activate_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 /* If context was MT activated, context data already exists for the TI. */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 if (prim->ti != (U8)SM_TI_NONE) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 context = sm_extract_mt_context_data(prim->ti);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 (void)TRACE_ERROR("Unable to find data structure allocated by MT activation request!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 cause.ctrl_value = CAUSE_is_from_nwsm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 cause.value.sm_cause = (U16)CAUSE_NWSM_INVALID_TI;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 send_smreg_pdp_activate_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 } else {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 context->nsapi = prim->nsapi;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 TRACE_ASSERT(context != NULL);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 } else {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 if (sm_get_context_data_from_nsapi(prim->nsapi) != NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 /* Context already exists: Reject */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 (void)TRACE_EVENT_P1("ERROR: Context already activated on NSAPI %d; "
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 "activation rejected...", (int)prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 cause.ctrl_value = CAUSE_is_from_nwsm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 cause.value.sm_cause = (U16)CAUSE_NWSM_NSAPI_IN_USE;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 send_smreg_pdp_activate_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 /* MO activation: Allocate new structure */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 context = sm_disp_allocate_context(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 (void)TRACE_ERROR("Unable to allocate data structure for new context!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 /*If this is not done comp params will not be passed to UPM*/
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 if ( (prim->comp_params.hcomp != NAS_HCOMP_OFF) ||
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 (prim->comp_params.dcomp != NAS_DCOMP_OFF) )
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 (void)TRACE_EVENT("Compression parameters included ");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 context->flags |= (U8)SM_CONTEXT_FLAG_COMP_PARAMS;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 if(prim->comp_params.msid == 0){
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 prim->comp_params.msid = 16;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 } else {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 (void)TRACE_EVENT("Compression parameters not included ");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 /* Set SM_CONTEXT_FLAG_STARTED_DURING_SUSPEND flag according to suspend status */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 sm_set_started_during_suspend(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 sm_assign_context_data_to_nsapi(context, prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 context = sm_get_context_data_from_nsapi(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 sm_context_control(context, SM_P_SMREG_PDP_ACTIVATE_REQ, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 | Function : sm_disp_smreg_pdp_activate_sec_req
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 | Description : Dispatch SMREG_PDP_ACTIVATE_SEC_REQ
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 void sm_disp_smreg_pdp_activate_sec_req(T_SMREG_PDP_ACTIVATE_SEC_REQ *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 T_CAUSE_ps_cause cause;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 (void)TRACE_FUNCTION("sm_disp_smreg_pdp_activate_req");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 if (sm_get_context_data_from_nsapi(prim->nsapi) != NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 /* Context already exists: Reject */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 (void)TRACE_EVENT_P1("ERROR: Context already activated on NSAPI %d; "
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 "activation rejected...", (int)prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 cause.ctrl_value = CAUSE_is_from_nwsm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 cause.value.sm_cause = (U16)CAUSE_NWSM_NSAPI_IN_USE;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 send_smreg_pdp_activate_sec_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 if (sm_get_current_nw_release() == PS_SGSN_98_OLDER) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 /* Secondary context activation is an R99-only procedure: Fail when in pre-R99! */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 (void)TRACE_ERROR("R99 procedure rejected while active in pre-R99 network!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 cause.ctrl_value = CAUSE_is_from_sm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 cause.value.sm_cause = (U16)CAUSE_SM_R99_PROCEDURE_REJECTED_IN_R97;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 send_smreg_pdp_activate_sec_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 if (sm_get_context_data_from_nsapi(prim->pri_nsapi) == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 (void)TRACE_ERROR("sm_disp_smreg_pdp_activate_req: Primary context referenced in primitive does not exist!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 cause.ctrl_value = CAUSE_is_from_nwsm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 cause.value.sm_cause = (U16)CAUSE_NWSM_UNKNOWN_LINKED_TI;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 send_smreg_pdp_activate_sec_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 /* Allocate new context data structure */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 context = sm_disp_allocate_context(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 (void)TRACE_ERROR("Unable to allocate data structure for new context!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 sm_set_secondary(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 /* Set SM_CONTEXT_FLAG_STARTED_DURING_SUSPEND flag according to suspend status */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 sm_set_started_during_suspend(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 sm_assign_context_data_to_nsapi(context, prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 context = sm_get_context_data_from_nsapi(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 sm_context_control(context, SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 | Function : sm_disp_smreg_pdp_deactivate_req
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 | Description : Dispatch SMREG_PDP_DEACTIVATE_REQ
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 void sm_disp_smreg_pdp_activate_rej_res(T_SMREG_PDP_ACTIVATE_REJ_RES *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 (void)TRACE_FUNCTION("sm_disp_smreg_pdp_activate_rej_res");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 /* Context was MT activated, context data already exists for the TI. */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 context = sm_extract_mt_context_data(prim->ti);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 (void)TRACE_ERROR("Unable to find data structure allocated by MT activation request!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 sm_context_control(context, SM_P_SMREG_PDP_ACTIVATE_REJ_RES, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 /* Free context data */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 sm_free_context_data(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 | Function : sm_disp_smreg_pdp_deactivate_req
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 | Description : Dispatch SMREG_PDP_DEACTIVATE_REQ
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 void sm_disp_smreg_pdp_deactivate_req(T_SMREG_PDP_DEACTIVATE_REQ *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 (void)TRACE_FUNCTION("sm_disp_smreg_pdp_deactivate_req");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 /* Forward to Sequencer */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 sm_sequencer(SM_P_SMREG_PDP_DEACTIVATE_REQ, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 | Function : sm_disp_smreg_pdp_modify_req
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 | Description : Dispatch SMREG_PDP_MODIFY_REQ
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 void sm_disp_smreg_pdp_modify_req(T_SMREG_PDP_MODIFY_REQ *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 (void)TRACE_FUNCTION("sm_disp_smreg_pdp_modify_req");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 context = sm_get_context_data_from_nsapi(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 T_CAUSE_ps_cause cause;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 (void)TRACE_ERROR("Non-existing context!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 cause.ctrl_value = CAUSE_is_from_sm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 cause.value.sm_cause = (U16)CAUSE_SM_INVALID_NSAPI;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 send_smreg_pdp_modify_rej(prim->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 } else if (sm_get_current_nw_release() == PS_SGSN_98_OLDER) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 /* MO Modify is an R99-only procedure: Fail when in pre-R99! */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 T_CAUSE_ps_cause cause;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 (void)TRACE_ERROR("R99 procedure rejected while active in pre-R99 network!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 cause.ctrl_value = CAUSE_is_from_sm;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 cause.value.sm_cause = (U16)CAUSE_SM_R99_PROCEDURE_REJECTED_IN_R97;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 send_smreg_pdp_modify_rej(context->nsapi, &cause);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 } else { /* context != NULL */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 /* Set SM_CONTEXT_FLAG_STARTED_DURING_SUSPEND flag according to suspend status */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 sm_set_started_during_suspend(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 /* Forward to Context Control */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 sm_context_control(context, SM_P_SMREG_PDP_MODIFY_REQ, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 | Function : sm_disp_sm_activate_res
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 | Description : Dispatch SM_ACTIVATE_RES
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 void sm_disp_sm_activate_res(T_SM_ACTIVATE_RES *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 (void)TRACE_FUNCTION("sm_disp_sm_activate_res");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 context = sm_get_context_data_from_nsapi(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 (void)TRACE_ERROR("Non-existing context!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 /* Forward to User Plane Control */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 sm_user_plane_control(context, SM_P_SM_ACTIVATE_RES, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 | Function : sm_disp_sm_deactivate_res
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 | Description : Dispatch SM_DEACTIVATE_RES
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 void sm_disp_sm_deactivate_res(T_SM_DEACTIVATE_RES *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 int nsapi;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 (void)TRACE_FUNCTION("sm_disp_sm_deactivate_res");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 for (nsapi = (int)NAS_NSAPI_5; nsapi < NAS_SIZE_NSAPI; nsapi++) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 if (sm_is_nsapi_in_nsapi_set(nsapi, prim->nsapi_set)) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 context = sm_get_context_data_from_nsapi(nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 /* Ignore non-existing contexts */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 continue;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 /* Forward to User Plane Control */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 sm_user_plane_control(context, SM_P_SM_DEACTIVATE_RES, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 /* If SM_DEACTIVATE_RES completed deactivation, free context data */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 if (sm_is_context_pending_deallocation(context)) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 sm_free_context_data_by_nsapi(context->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388 | Function : sm_disp_sm_modify_res
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390 | Description : Dispatch SM_MODIFY_RES
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 void sm_disp_sm_modify_res(T_SM_MODIFY_RES *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 (void)TRACE_FUNCTION("sm_disp_sm_modify_res");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 context = sm_get_context_data_from_nsapi(prim->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405 (void)TRACE_ERROR("Non-existing context!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 /* Forward to User Plane Control */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 sm_user_plane_control(context, SM_P_SM_MODIFY_RES, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 | Function : sm_disp_sm_status_req
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417 | Description : Dispatch SM_STATUS_REQ
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 void sm_disp_sm_status_req(T_SM_STATUS_REQ *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 (void)TRACE_FUNCTION("sm_disp_sm_status_req");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428 /* Forward to Sequencer */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429 sm_sequencer(SM_P_SM_STATUS_REQ, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434 | Function : sm_disp_mmpm_attach_ind
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
435 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436 | Description : Dispatch MMPM_ATTACH_IND
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 void sm_disp_mmpm_attach_ind(T_MMPM_ATTACH_IND *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 (void)TRACE_FUNCTION("sm_disp_mmpm_attach_ind");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447 sm_data.sm_attached = TRUE;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449 /* Forward to Sequencer */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
450 sm_sequencer(SM_P_MMPM_ATTACH_IND, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
451 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
452
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
453 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
454 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
455 | Function : sm_disp_mmpm_detach_ind
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
456 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
457 | Description : Dispatch MMPM_DETACH_IND
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
458 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
459 | Parameters : prim - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
460 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
462 void sm_disp_mmpm_detach_ind(T_MMPM_DETACH_IND *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
464 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465 (void)TRACE_FUNCTION("sm_disp_mmpm_detach_ind");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
466 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
468 sm_data.sm_attached = FALSE;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
470 /* Forward to Sequencer */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
471 sm_sequencer(SM_P_MMPM_DETACH_IND, prim);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476 | Function : sm_disp_mmpm_suspend_ind
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
478 | Description : Dispatch MMPM_SUSPEND_IND
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480 | Parameters : mm_suspend_ind - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483 void sm_disp_mmpm_suspend_ind(/*@unused@*/ T_MMPM_SUSPEND_IND *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485 int nsapi;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 (void)TRACE_FUNCTION("sm_disp_mmpm_suspend_ind");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 sm_data.sm_suspended = TRUE;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491 sm_data.sm_suspend_cause = prim->ps_cause.value.mm_cause;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493 for (nsapi = (int)NAS_NSAPI_5; nsapi < NAS_SIZE_NSAPI; nsapi++) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494 context = sm_get_context_data_from_nsapi(nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495 if (context != NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496 sm_network_control(context, SM_P_MMPM_SUSPEND_IND, NULL);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503 | Function : sm_disp_mmpm_resume_ind
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 | Description : Dispatch MMPM_RESUME_IND
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 | Parameters : mm_resume_ind - received primitive
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510 void sm_disp_mmpm_resume_ind(/*@unused@*/ T_MMPM_RESUME_IND *prim)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 int nsapi;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 (void)TRACE_FUNCTION("sm_disp_mmpm_resume_ind");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 sm_data.sm_suspended = FALSE;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 sm_data.sm_suspend_cause = CAUSE_MM_SUCCESS;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 for (nsapi = (int)NAS_NSAPI_5; nsapi < NAS_SIZE_NSAPI; nsapi++) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 context = sm_get_context_data_from_nsapi(nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523 if (context != NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 sm_network_control(context, SM_P_MMPM_RESUME_IND, NULL);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529 /*
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 | Function : sm_disp_pei_timeout
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 | Description : Dispatch pei_timeout
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 |
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 | Parameters : index - system timer index (index into sm_context_array)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536 +------------------------------------------------------------------------------
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 void sm_disp_pei_timeout(U16 index)
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540 int nsapi;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541 struct T_SM_CONTEXT_DATA *context;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 #ifdef DEBUG_VERBOSE
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 (void)TRACE_FUNCTION("sm_disp_pei_timeout");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 #endif
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546 if (index > (U16)SM_MAX_NSAPI_OFFSET) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
547 (void)TRACE_ERROR("Invalid timer index received!");
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551 nsapi = sm_index_to_nsapi((U8)index);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553 context = sm_get_context_data_from_nsapi(nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555 if (context == NULL) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 (void)TRACE_EVENT_P1("Warning! Received timeout on non-existing NSAPI #%d; ignored...", nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 if ((T_SM_TIMER_TYPE)context->active_timer == SM_TIMER_NONE) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 (void)TRACE_EVENT_P1("Warning! Received timeout on NSAPI #%d, which has no active timer; ignored...", nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565 if (context->timeouts == (U8)0) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 (void)TRACE_EVENT_P1("Warning! Received timeout on NSAPI #%d, which has no remaining timeouts; ignored...", nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570 /* Decrement remaining timeouts */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 context->timeouts -= (U8)1;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573 /* Check remaining timeouts */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
574 if (context->timeouts > (U8)0) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
575 T_SM_NETWORK_CONTROL_EVENT event;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 /* More timeouts remaining - restart timer */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
577 sm_timer_restart(context);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
579 /* Inform Network Control of the timeout */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580 switch (context->active_timer) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
581 case SM_TIMER_T3380: event = SM_T_T3380; break;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582 case SM_TIMER_T3381: event = SM_T_T3381; break;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
583 case SM_TIMER_T3390: event = SM_T_T3390; break;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584 default: return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
585 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586 sm_network_control(context, event, NULL);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
587 } else {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
588 T_SM_NETWORK_CONTROL_EVENT event;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589 /* No timeouts remaining - Inform Network Control of the timer expiry */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
590 switch (context->active_timer) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
591 case SM_TIMER_T3380: event = SM_T_T3380_MAX; break;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
592 case SM_TIMER_T3381: event = SM_T_T3381_MAX; break;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
593 case SM_TIMER_T3390: event = SM_T_T3390_MAX; break;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
594 default: return;
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
595 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
596 sm_network_control(context, event, NULL);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
597 } /* if */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
598
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
599 /* Deallocate context if it was marked for deactivation due to T3390 max
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
600 * This change is separately taken from TI DK. Context data is cleaned up
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
601 * after deactivation due to max T3390 expiry. If this is not done the next
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
602 * context activation on the same nsapi will fail.
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603 */
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
604 if (sm_is_context_pending_deallocation(context)) {
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
605 sm_free_context_data_by_nsapi(context->nsapi);
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
606 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
607 }
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
608
fa8dc04885d8 src/g23m-*: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
609 /*==== END OF FILE ==========================================================*/