comparison src/g23m-gprs/sm/sm_context_control.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*----------------------------------------------------------------------------
2 | Project : 3G PS
3 | Module : SM
4 +-----------------------------------------------------------------------------
5 | Copyright 2003 Texas Instruments.
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments .
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments.
15 +-----------------------------------------------------------------------------
16 | Purpose: Context Control state machine implementation in the SM entity.
17 | For design details, see:
18 | 8010.908 SM Detailed Specification
19 +---------------------------------------------------------------------------*/
20
21 /*==== DECLARATION CONTROL =================================================*/
22
23 /*==== INCLUDES =============================================================*/
24
25 #include "sm.h"
26
27 #include "sm_context_control.h"
28 #include "sm_network_control.h"
29 #include "sm_user_plane_control.h"
30 #include "sm_sequencer.h"
31
32 #include "sm_aci_output_handler.h"
33
34 /*==== CONSTS ===============================================================*/
35
36 /*==== TYPES ================================================================*/
37
38 typedef void (*T_SM_CONTEXT_CONTROL_TRANSITION_FUNC)(struct T_SM_CONTEXT_DATA *ptr_context_data, /*@null@*/ void *data);
39
40 typedef struct {
41 #ifdef DEBUG
42 T_SM_CONTEXT_CONTROL_EVENT event;
43 #endif /* DEBUG */
44 T_SM_CONTEXT_CONTROL_TRANSITION_FUNC func;
45 } T_SM_CONTEXT_CONTROL_TRANSITION;
46
47 /*==== LOCALS ===============================================================*/
48
49 static void state_event_error(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
50 static void go_to_S5 (struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
51 static void go_to_S15 (struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
52
53 static void handle_smreg_pdp_activate_req(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
54 static void handle_smreg_pdp_activate_sec_req(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
55 static void handle_smreg_pdp_activate_rej_res(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
56 static void handle_smreg_pdp_modify_req(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
57
58 static void handle_network_request_activation_in_S0(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
59 static void handle_network_request_activation_in_S1(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
60 static void handle_network_request_activation_override(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
61 static void handle_network_request_deactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
62
63 static void handle_network_activate_completed_in_S2(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
64 static void handle_network_activate_completed_in_S6(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
65 static void handle_network_activate_completed_in_S12(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
66 static void handle_network_activate_rejected_in_S2(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
67 static void handle_network_activate_rejected_in_S6(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
68 static void handle_network_activate_rejected_in_S12(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
69
70 static void handle_network_modify_completed_in_S7(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
71 static void handle_network_modify_completed_in_S10(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
72 static void handle_network_modify_rejected_in_S7(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
73 static void handle_network_modify_rejected_in_S10(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
74
75 static void handle_network_request_modify(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
76 static void handle_network_request_modify_failed(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
77
78 static void handle_user_plane_activated_in_S3(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
79 static void handle_user_plane_activated_in_S13(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
80 static void handle_user_plane_error_in_S3(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
81 static void handle_user_plane_error_while_active(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
82 static void handle_user_plane_modified_in_S8(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
83 static void handle_user_plane_deactivated_in_S11(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
84
85 static void handle_deactivate_completed_in_S0(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
86 static void handle_deactivate_completed_in_S4(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
87 static void handle_deactivate_completed_in_S14(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
88 static void handle_deactivate_completed_in_S15(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
89
90 static void handle_context_upgrade(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
91
92 static void handle_context_deactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
93 static void handle_context_deactivate_in_S0(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
94 static void handle_context_reactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
95 static void handle_local_deactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
96
97 static void forward_network_deactivate_completed(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
98 static void forward_user_plane_deactivated(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data);
99
100 /***********************************************************************
101 * State/Transition Table
102 */
103 static const T_SM_CONTEXT_CONTROL_TRANSITION
104 transition[SM_CONTEXT_CONTROL_NUMBER_OF_STATES][SM_CONTEXT_CONTROL_NUMBER_OF_EVENTS] =
105 {
106 { /* S0: SM_CONTEXT_DEACTIVATED */
107 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, handle_smreg_pdp_activate_req),
108 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
109 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, handle_smreg_pdp_activate_sec_req),
110 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
111 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate_in_S0),
112 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_context_deactivate_in_S0),
113 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, handle_context_reactivate),
114 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
115 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
116 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
117 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
118 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
119 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
120 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
121 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, handle_network_request_activation_in_S0),
122 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
123 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
124 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
125 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
126 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
127 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, forward_user_plane_deactivated),
128 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
129 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, handle_deactivate_completed_in_S0)
130 },
131 { /* S1: SM_CONTEXT_ACTIVATING_MT */
132 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, handle_smreg_pdp_activate_req),
133 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, handle_smreg_pdp_activate_rej_res),
134 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
135 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
136 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
137 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
138 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
139 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
140 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
141 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
142 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
143 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
144 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
145 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
146 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, handle_network_request_activation_in_S1),
147 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
148 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
149 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
150 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
151 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
152 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
153 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
154 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
155 },
156 { /* S2: SM_CONTEXT_ACTIVATING_NETWORK */
157 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
158 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
159 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
160 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
161 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
162 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
163 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
164 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
165 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
166 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, handle_network_activate_completed_in_S2),
167 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, handle_network_activate_rejected_in_S2),
168 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
169 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
170 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
171 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
172 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
173 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
174 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
175 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
176 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
177 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
178 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
179 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
180 },
181 { /* S3: SM_CONTEXT_ACTIVATING_USER_PLANE */
182 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
183 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
184 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
185 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
186 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
187 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
188 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
189 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
190 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_in_S3),
191 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
192 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
193 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
194 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
195 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
196 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
197 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
198 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
199 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
200 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
201 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, handle_user_plane_activated_in_S3),
202 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
203 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
204 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
205 },
206 { /* S4: SM_CONTEXT_ACTIVATE_FAILED_DEACTIVATING */
207 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
208 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
209 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
210 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
211 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
212 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
213 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
214 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
215 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
216 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
217 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
218 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, forward_network_deactivate_completed),
219 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
220 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
221 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
222 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
223 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
224 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
225 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
226 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
227 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, forward_user_plane_deactivated),
228 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
229 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, handle_deactivate_completed_in_S4)
230 },
231 { /* S5: SM_CONTEXT_ACTIVATED */
232 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
233 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
234 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
235 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, handle_smreg_pdp_modify_req),
236 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
237 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
238 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
239 M_TRANSITION(SM_I_CONTEXT_UPGRADE, handle_context_upgrade),
240 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
241 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
242 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
243 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
244 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
245 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
246 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
247 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, handle_network_request_activation_override),
248 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, handle_network_request_deactivate),
249 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, handle_network_request_modify),
250 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, handle_network_request_modify_failed),
251 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
252 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
253 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
254 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
255 },
256 { /* S6: SM_CONTEXT_ACTIVATION_OVERRIDE */
257 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
258 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
259 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
260 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
261 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
262 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
263 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
264 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
265 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
266 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, handle_network_activate_completed_in_S6),
267 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, handle_network_activate_rejected_in_S6),
268 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
269 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
270 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
271 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
272 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, handle_network_request_activation_override),
273 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
274 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
275 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
276 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
277 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
278 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
279 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
280 },
281 { /* S7: SM_CONTEXT_MODIFYING_IN_NETWORK */
282 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
283 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
284 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
285 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
286 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
287 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
288 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
289 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
290 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
291 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
292 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
293 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
294 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, handle_network_modify_rejected_in_S7),
295 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, handle_network_modify_completed_in_S7),
296 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
297 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
298 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
299 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
300 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, handle_network_request_modify_failed),
301 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
302 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
303 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
304 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
305 },
306 { /* S8: SM_CONTEXT_MODIFYING_USER_PLANE */
307 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
308 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
309 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
310 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
311 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
312 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
313 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
314 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
315 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
316 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
317 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
318 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
319 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
320 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
321 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
322 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
323 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
324 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
325 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
326 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
327 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
328 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, handle_user_plane_modified_in_S8),
329 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
330 },
331 { /* S9: SM_CONTEXT_MODIFYING_USER_PLANE_MT */
332 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
333 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
334 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
335 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
336 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
337 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
338 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
339 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
340 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
341 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
342 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
343 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
344 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
345 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
346 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
347 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
348 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
349 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
350 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
351 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
352 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
353 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, go_to_S5),
354 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
355 },
356 { /* S10: SM_CONTEXT_UPGRADING_IN_NETWORK */
357 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
358 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
359 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
360 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
361 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
362 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
363 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
364 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
365 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
366 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
367 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
368 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
369 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, handle_network_modify_rejected_in_S10),
370 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, handle_network_modify_completed_in_S10),
371 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
372 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
373 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
374 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
375 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
376 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
377 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
378 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
379 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
380 },
381 { /* S11: SM_CONTEXT_REACTIVATING_DEACTIVATING_USER_PLANE */
382 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
383 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
384 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
385 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
386 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
387 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
388 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
389 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
390 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
391 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
392 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
393 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
394 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
395 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
396 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
397 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
398 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
399 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
400 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
401 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
402 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, forward_user_plane_deactivated),
403 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
404 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, handle_user_plane_deactivated_in_S11)
405 },
406 { /* S12: SM_CONTEXT_REACTIVATING_IN_NETWORK */
407 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
408 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
409 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
410 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
411 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
412 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
413 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
414 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
415 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
416 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, handle_network_activate_completed_in_S12),
417 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, handle_network_activate_rejected_in_S12),
418 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
419 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
420 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
421 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
422 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
423 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
424 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
425 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
426 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
427 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
428 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
429 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
430 },
431 { /* S13: SM_CONTEXT_REACTIVATING_USER_PLANE */
432 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
433 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
434 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
435 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
436 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, handle_context_deactivate),
437 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
438 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
439 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
440 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, handle_user_plane_error_while_active),
441 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
442 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
443 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, state_event_error),
444 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
445 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
446 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
447 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
448 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
449 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
450 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
451 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, handle_user_plane_activated_in_S13),
452 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, state_event_error),
453 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
454 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, state_event_error)
455 },
456 { /* S14: SM_CONTEXT_DEACTIVATING */
457 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
458 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
459 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
460 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
461 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, go_to_S15),
462 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, state_event_error),
463 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
464 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
465 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
466 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
467 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
468 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, forward_network_deactivate_completed),
469 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
470 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
471 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
472 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
473 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
474 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
475 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
476 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
477 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, forward_user_plane_deactivated),
478 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
479 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, handle_deactivate_completed_in_S14)
480 },
481 { /* S15: SM_CONTEXT_DEACTIVATING_SEQUENCED */
482 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REQ, state_event_error),
483 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_REJ_RES, state_event_error),
484 M_TRANSITION(SM_P_SMREG_PDP_ACTIVATE_SEC_REQ, state_event_error),
485 M_TRANSITION(SM_P_SMREG_PDP_MODIFY_REQ, state_event_error),
486 M_TRANSITION(SM_I_CONTEXT_DEACTIVATE, state_event_error),
487 M_TRANSITION(SM_I_CONTEXT_LOCAL_DEACTIVATE, handle_local_deactivate),
488 M_TRANSITION(SM_I_CONTEXT_REACTIVATE, state_event_error),
489 M_TRANSITION(SM_I_CONTEXT_UPGRADE, state_event_error),
490 M_TRANSITION(SM_I_CONTEXT_USER_PLANE_ERROR, state_event_error),
491 M_TRANSITION(SM_I_NETWORK_ACTIVATE_COMPLETED, state_event_error),
492 M_TRANSITION(SM_I_NETWORK_ACTIVATE_REJECTED, state_event_error),
493 M_TRANSITION(SM_I_NETWORK_DEACTIVATE_COMPLETED, forward_network_deactivate_completed),
494 M_TRANSITION(SM_I_NETWORK_MODIFY_REJECTED, state_event_error),
495 M_TRANSITION(SM_I_NETWORK_MODIFY_COMPLETED, state_event_error),
496 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION, state_event_error),
497 M_TRANSITION(SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE, state_event_error),
498 M_TRANSITION(SM_I_NETWORK_REQUEST_DEACTIVATE, state_event_error),
499 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY, state_event_error),
500 M_TRANSITION(SM_I_NETWORK_REQUEST_MODIFY_FAILED, state_event_error),
501 M_TRANSITION(SM_I_USER_PLANE_ACTIVATED, state_event_error),
502 M_TRANSITION(SM_I_USER_PLANE_DEACTIVATED, forward_user_plane_deactivated),
503 M_TRANSITION(SM_I_USER_PLANE_MODIFIED, state_event_error),
504 M_TRANSITION(SM_I_DEACTIVATE_COMPLETED, handle_deactivate_completed_in_S15)
505 }
506 };
507
508 /*==== PRIVATE FUNCTIONS ====================================================*/
509
510 /*
511 +------------------------------------------------------------------------------
512 | Function : state_event_error
513 +------------------------------------------------------------------------------
514 | Description : General function used to report state event errors.
515 |
516 | Parameters : context - Not used
517 | data - Not used
518 +------------------------------------------------------------------------------
519 */
520 static void state_event_error(/*@unused@*/ struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
521 {
522 (void)TRACE_ERROR("SM Context Control: STATE EVENT ERROR!");
523 }
524
525 /*
526 +------------------------------------------------------------------------------
527 | Function : go_to_S*
528 +------------------------------------------------------------------------------
529 | Description : General function used for simple state transitions with no
530 | actions.
531 |
532 | Parameters : context - Context data
533 | data - Not used
534 +------------------------------------------------------------------------------
535 */
536 static void go_to_S5(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
537 {
538 context->context_control_state = SM_CONTEXT_ACTIVATED;
539 }
540
541 static void go_to_S15(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
542 {
543 context->context_control_state = SM_CONTEXT_DEACTIVATING_SEQUENCED;
544 }
545
546 /*
547 +------------------------------------------------------------------------------
548 | Function : forward_network_deactivate_completed,
549 | forward_user_plane_deactivated
550 +------------------------------------------------------------------------------
551 | Description : Functions used for forwarding deactivation primitives to
552 | Context Deactivate Control
553 |
554 | Parameters : context - Context data
555 | data - Not used
556 +------------------------------------------------------------------------------
557 */
558 static void forward_network_deactivate_completed(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
559 {
560 sm_context_deactivate_control(context, SM_I_DEACTIVATE_NETWORK_COMPLETED, NULL);
561 }
562
563 static void forward_user_plane_deactivated(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
564 {
565 sm_context_deactivate_control(context, SM_I_DEACTIVATE_USER_PLANE_COMPLETED, NULL);
566 }
567
568 /*
569 +------------------------------------------------------------------------------
570 | Function : handle_smreg_pdp_activate_req
571 +------------------------------------------------------------------------------
572 | Description : Handle event SM_P_SMREG_PDP_ACTIVATE_REQ in S0 and S1
573 |
574 | Parameters : context - Context data
575 | data - T_SMREG_PDP_ACTIVATE_REQ *
576 +------------------------------------------------------------------------------
577 */
578 static void handle_smreg_pdp_activate_req(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
579 {
580 (void)TRACE_FUNCTION("handle_smreg_pdp_activate_req");
581
582 /* Go to state SM CONTEXT ACTIVATING NETWORK */
583 context->context_control_state = SM_CONTEXT_ACTIVATING_NETWORK;
584
585 /* Start primary context activation towards network */
586 sm_network_control(context, SM_I_NETWORK_ACTIVATE_PRIMARY, data);
587
588 /* Inform User Plane Control of pending context activation */
589 sm_user_plane_control(context, SM_I_USER_PLANE_ACTIVATE_START, data);
590 }
591
592 /*
593 +------------------------------------------------------------------------------
594 | Function : handle_smreg_pdp_activate_sec_req
595 +------------------------------------------------------------------------------
596 | Description : Handle event SM_P_SMREG_PDP_ACTIVATE_SEC_REQ
597 |
598 | Parameters : context - Context data
599 | data - T_SMREG_PDP_ACTIVATE_SEC_REQ *
600 +------------------------------------------------------------------------------
601 */
602 static void handle_smreg_pdp_activate_sec_req(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
603 {
604 (void)TRACE_FUNCTION("handle_smreg_pdp_activate_sec_req");
605
606 /* Go to state SM CONTEXT ACTIVATING NETWORK */
607 context->context_control_state = SM_CONTEXT_ACTIVATING_NETWORK;
608
609 /* Start secondary context activation towards network */
610 sm_network_control(context, SM_I_NETWORK_ACTIVATE_SECONDARY, data);
611
612 /* Inform User Plane Control of pending context activation */
613 sm_user_plane_control(context, SM_I_USER_PLANE_ACTIVATE_START, data);
614 }
615
616 /*
617 +------------------------------------------------------------------------------
618 | Function : handle_smreg_pdp_activate_rej_res
619 +------------------------------------------------------------------------------
620 | Description : Handle event SM_P_SMREG_PDP_ACTIVATE_REJ_RES
621 |
622 | Parameters : context - Context data
623 | data - T_SMREG_PDP_ACTIVATE_REJ_RES *
624 +------------------------------------------------------------------------------
625 */
626 static void handle_smreg_pdp_activate_rej_res(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
627 {
628 T_SMREG_PDP_ACTIVATE_REJ_RES *prim = (T_SMREG_PDP_ACTIVATE_REJ_RES *)data;
629 (void)TRACE_FUNCTION("handle_smreg_pdp_activate_rej_res");
630
631 TRACE_ASSERT(prim != NULL);
632 /*lint -e613 (Possible use of null pointer 'prim' in left argument to operator '->') */
633 sm_set_nw_cause(context, prim->ps_cause.ctrl_value, prim->ps_cause.value.nwsm_cause);
634
635 /* Reject MT activation attempt towards the network */
636 sm_network_control(context, SM_I_NETWORK_REQUEST_ACTIVATION_REJECT, NULL);
637 /*lint +e613 (Possible use of null pointer 'prim' in left argument to operator '->') */
638 }
639
640 /*
641 +------------------------------------------------------------------------------
642 | Function : handle_smreg_pdp_modify_req
643 +------------------------------------------------------------------------------
644 | Description : Handle event SM_P_SMREG_PDP_MODIFY_REQ
645 |
646 | Parameters : context - Context data
647 | data - T_SMREG_PDP_MODIFY_REQ *
648 +------------------------------------------------------------------------------
649 */
650 static void handle_smreg_pdp_modify_req(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
651 {
652 T_SMREG_PDP_MODIFY_REQ *prim = (T_SMREG_PDP_MODIFY_REQ *)data;
653 (void)TRACE_FUNCTION("handle_smreg_pdp_modify_req");
654
655 TRACE_ASSERT(prim != NULL);
656
657 /* Go to state SM CONTEXT MODIFYING IN NETWORK */
658 context->context_control_state = SM_CONTEXT_MODIFYING_IN_NETWORK;
659
660 /*lint +e613 (Possible use of null pointer 'prim' in left argument to operator '->') */
661 /* Start modification in network */
662 sm_network_control(context, SM_I_NETWORK_MODIFY, prim);
663 }
664
665 /*
666 +------------------------------------------------------------------------------
667 | Function : handle_network_request_activation_in_S0
668 +------------------------------------------------------------------------------
669 | Description : Handle event SM_I_NETWORK_REQUEST_ACTIVATION in state S0
670 |
671 | Parameters : context - Context data
672 | data - Not used
673 +------------------------------------------------------------------------------
674 */
675 static void handle_network_request_activation_in_S0(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
676 {
677 (void)TRACE_FUNCTION("handle_network_request_activation_in_S0");
678
679 /* Go to state SM CONTEXT ACTIVATING MT */
680 context->context_control_state = SM_CONTEXT_ACTIVATING_MT;
681
682 /* Send SMREG_PDP_ACTIVATE_IND to ACI */
683 send_smreg_pdp_activate_ind(context);
684 }
685
686 /*
687 +------------------------------------------------------------------------------
688 | Function : handle_network_request_activation_in_S1
689 +------------------------------------------------------------------------------
690 | Description : Handle event SM_I_NETWORK_REQUEST_ACTIVATION in state S1
691 |
692 | Parameters : context - Context data
693 | data - T_REQUEST_PDP_CONTEXT_ACTIVATION *
694 +------------------------------------------------------------------------------
695 */
696 static void handle_network_request_activation_in_S1(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
697 {
698 T_REQUEST_PDP_CONTEXT_ACTIVATION *msg = (T_REQUEST_PDP_CONTEXT_ACTIVATION *)data;
699 (void)TRACE_FUNCTION("handle_network_request_activation_in_S1");
700
701 TRACE_ASSERT(msg != NULL);
702
703 /* Check whether PDP type, APN, and address match */
704 /*lint -e613 (Possible use of null pointer 'msg' in left argument to operator '->') */
705 if (sm_nw_is_address_and_apn_equal(context, &context->requested_address,
706 &msg->address, msg->v_apn, &msg->apn))
707 {
708 /* Ignore incoming request - proceed with current activation */
709 } else {
710 sm_set_nw_cause(context, CAUSE_is_from_nwsm, (U16)CAUSE_NWSM_INSUFFICIENT_RESOURCES);
711 sm_network_control(context, SM_I_NETWORK_REQUEST_ACTIVATION_REJECT, NULL);
712 }
713 }
714
715 /*
716 +------------------------------------------------------------------------------
717 | Function : handle_network_request_activation_override
718 +------------------------------------------------------------------------------
719 | Description : Handle event SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE in S5
720 |
721 | Parameters : context - Context data
722 | data - Not used
723 +------------------------------------------------------------------------------
724 */
725 static void handle_network_request_activation_override(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
726 {
727 (void)TRACE_FUNCTION("handle_network_request_activation_override");
728
729 /* Go to state SM CONTEXT ACTIVATION OVERRIDE */
730 context->context_control_state = SM_CONTEXT_ACTIVATION_OVERRIDE;
731
732 /* Inform Sequencer of activation override */
733 sm_sequencer(SM_I_CONTEXT_ACTIVATION_OVERRIDE, (void *)(T_NAS_ti)context->ti);
734 }
735
736 /*
737 +------------------------------------------------------------------------------
738 | Function : handle_network_request_deactivate
739 +------------------------------------------------------------------------------
740 | Description : Handle event SM_I_NETWORK_REQUEST_DEACTIVATE
741 |
742 | Parameters : context - Context data
743 | data - Tear-down indicator
744 +------------------------------------------------------------------------------
745 */
746 static void handle_network_request_deactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
747 {
748 U32 tear_down = (U32)data;
749 T_CAUSE_ps_cause *cause = sm_get_aci_cause(context);
750 U16 nsapi_as_set = sm_nsapi2nsapi_set(context->nsapi);
751 U16 nsapis_to_deactivate;
752
753 (void)TRACE_FUNCTION("handle_network_request_deactivate");
754
755 if (cause->ctrl_value == CAUSE_is_from_nwsm &&
756 cause->value.nwsm_cause == (U16)CAUSE_NWSM_REACTIVATION_REQUESTED)
757 {
758 /* Go to state SM CONTEXT REACTIVATING DEACTIVATING USER PLANE */
759 context->context_control_state = SM_CONTEXT_REACTIVATING_DEACTIVATING_USER_PLANE;
760
761 nsapis_to_deactivate = 0;
762 } else {
763 /* Go to state SM CONTEXT DEACTIVATED */
764 context->context_control_state = SM_CONTEXT_DEACTIVATED;
765
766 nsapis_to_deactivate = nsapi_as_set;
767 }
768
769 if (tear_down != 0)
770 {
771 nsapis_to_deactivate |= sm_linked_nsapis(context->ti);
772
773 /* Inform Sequencer of tear-down deactivation */
774 sm_sequencer(SM_I_CONTEXT_TEAR_DOWN_DEACTIVATE,
775 (void *)(T_NAS_ti)context->ti);
776
777 /* Send SMREG_PDP_DEACTIVATE_IND for all context being deactivated */
778 if (nsapis_to_deactivate != 0)
779 {
780 send_smreg_pdp_deactivate_ind(nsapis_to_deactivate,
781 sm_get_aci_cause(context));
782 }
783 } else {
784 /* Send SMREG_PDP_DEACTIVATE_IND for this single context. */
785 if (nsapis_to_deactivate != 0)
786 {
787 send_smreg_pdp_deactivate_ind(nsapi_as_set, sm_get_aci_cause(context));
788 }
789 }
790
791 /* Deactivate user plane */
792 sm_context_deactivate_control(context, SM_I_DEACTIVATE_USER_PLANE,
793 (void *)PS_REL_IND_NO);
794 }
795
796 /*
797 +------------------------------------------------------------------------------
798 | Function : handle_network_activate_completed_in_S2
799 +------------------------------------------------------------------------------
800 | Description : Handle event SM_I_NETWORK_ACTIVATE_COMPLETED in state S2
801 |
802 | Parameters : context - Context data
803 | data - Not used
804 +------------------------------------------------------------------------------
805 */
806 static void handle_network_activate_completed_in_S2(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/void *data)
807 {
808 (void)TRACE_FUNCTION("handle_network_activate_completed_in_S2");
809
810 /* Go to state SM CONTEXT ACTIVATING USER PLANE */
811 context->context_control_state = SM_CONTEXT_ACTIVATING_USER_PLANE;
812
813 /* Activate User Plane */
814 sm_user_plane_control(context, SM_I_USER_PLANE_ACTIVATE_COMPLETE, NULL);
815 }
816
817 /*
818 +------------------------------------------------------------------------------
819 | Function : handle_network_activate_completed_in_S6
820 +------------------------------------------------------------------------------
821 | Description : Handle event SM_I_NETWORK_ACTIVATE_COMPLETED in state S6
822 |
823 | Parameters : context - Context data
824 | data - (enum) T_SM_UPDATE_FLAGS
825 +------------------------------------------------------------------------------
826 */
827 static void handle_network_activate_completed_in_S6(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
828 {
829 T_SM_UPDATE_FLAGS update_flags = (T_SM_UPDATE_FLAGS)((UINT)data);
830 (void)TRACE_FUNCTION("handle_network_activate_completed_in_S6");
831
832 if (sm_is_aci_update_required(update_flags))
833 {
834 /* Inform ACI of new parameters */
835 send_smreg_pdp_modify_ind(context, update_flags);
836 }
837
838 if (sm_is_user_plane_update_required(update_flags))
839 {
840 /* Go to state SM CONTEXT MODIFYING USER PLANE MT */
841 context->context_control_state = SM_CONTEXT_MODIFYING_USER_PLANE_MT;
842
843 /* Modify User Plane */
844 sm_user_plane_control(context, SM_I_USER_PLANE_MODIFY, NULL);
845 } else {
846 /* Go to state SM CONTEXT ACTIVATED */
847 context->context_control_state = SM_CONTEXT_ACTIVATED;
848 }
849 }
850
851 /*
852 +------------------------------------------------------------------------------
853 | Function : handle_network_activate_completed_in_S12
854 +------------------------------------------------------------------------------
855 | Description : Handle event SM_I_NETWORK_ACTIVATE_COMPLETED in state S12
856 |
857 | Parameters : context - Context data
858 | data - Not used
859 +------------------------------------------------------------------------------
860 */
861 static void handle_network_activate_completed_in_S12(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/void *data)
862 {
863 (void)TRACE_FUNCTION("handle_network_activate_completed_in_S12");
864
865 /* Go to state SM CONTEXT REACTIVATING USER PLANE */
866 context->context_control_state = SM_CONTEXT_REACTIVATING_USER_PLANE;
867
868 /* Activate User Plane */
869 sm_user_plane_control(context, SM_I_USER_PLANE_ACTIVATE_COMPLETE, NULL);
870 }
871
872 /*
873 +------------------------------------------------------------------------------
874 | Function : handle_network_activate_rejected_in_S2
875 +------------------------------------------------------------------------------
876 | Description : Handle event SM_I_NETWORK_ACTIVATE_REJECTED in state S2
877 |
878 | Parameters : context - Context data
879 | data - Deactivate network trigger (BOOL)
880 +------------------------------------------------------------------------------
881 */
882 static void handle_network_activate_rejected_in_S2(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
883 {
884 BOOL deactivate_network = (data != NULL ? TRUE : FALSE);
885 (void)TRACE_FUNCTION("handle_network_activate_rejected_in_S2");
886
887 /* Go to state SM CONTEXT ACTIVATE FAILED DEACTIVATING */
888 context->context_control_state = SM_CONTEXT_ACTIVATE_FAILED_DEACTIVATING;
889
890 if (deactivate_network)
891 {
892 /* Deactivate user plane. Also, network is being deactivated;
893 * Deactivation Control should anticipate NETWORK_DEACTIVATE_COMPLETED. */
894 sm_context_deactivate_control(context,
895 SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE,
896 sm_get_nw_cause(context));
897 } else {
898 /* Dectivate User Plane */
899 sm_context_deactivate_control(context, SM_I_DEACTIVATE_USER_PLANE,
900 (void *)PS_REL_IND_NO);
901 }
902 }
903
904 /*
905 +------------------------------------------------------------------------------
906 | Function : handle_network_activate_rejected_in_S6
907 +------------------------------------------------------------------------------
908 | Description : Handle event SM_I_NETWORK_ACTIVATE_REJECTED in state S6
909 |
910 | Parameters : context - Context data
911 | data - Deactivate network trigger (BOOL)
912 +------------------------------------------------------------------------------
913 */
914 static void handle_network_activate_rejected_in_S6(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
915 {
916 (void)TRACE_FUNCTION("handle_network_activate_rejected_in_S6");
917
918 /* Inform ACI of failure and deactivation */
919 send_smreg_pdp_deactivate_ind(sm_nsapi2nsapi_set(context->nsapi),
920 sm_get_aci_cause(context));
921
922 /* Go to state SM CONTEXT DEACTIVATING */
923 context->context_control_state = SM_CONTEXT_DEACTIVATING;
924
925 /* Deactivate User Plane */
926 sm_context_deactivate_control(context, SM_I_DEACTIVATE_USER_PLANE,
927 (void *)PS_REL_IND_NO);
928 }
929
930 /*
931 +------------------------------------------------------------------------------
932 | Function : handle_network_activate_rejected_in_S12
933 +------------------------------------------------------------------------------
934 | Description : Handle event SM_I_NETWORK_ACTIVATE_REJECTED in state S12
935 |
936 | Parameters : context - Context data
937 | data - Deactivate network trigger (BOOL)
938 +------------------------------------------------------------------------------
939 */
940 static void handle_network_activate_rejected_in_S12(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
941 {
942 (void)TRACE_FUNCTION("handle_network_activate_rejected_in_S12");
943
944 /* Inform ACI of failure and deactivation */
945 send_smreg_pdp_deactivate_ind(sm_nsapi2nsapi_set(context->nsapi),
946 sm_get_aci_cause(context));
947
948 /* Go to state SM CONTEXT DEACTIVATING */
949 context->context_control_state = SM_CONTEXT_DEACTIVATING;
950
951 /* Deactivate User Plane */
952 sm_context_deactivate_control(context, SM_I_DEACTIVATE_USER_PLANE,
953 (void *)PS_REL_IND_NO);
954 }
955
956 /*
957 +------------------------------------------------------------------------------
958 | Function : handle_network_modify_rejected_in_S7
959 +------------------------------------------------------------------------------
960 | Description : Handle event SM_I_NETWORK_MODIFY_REJECTED in state S7
961 |
962 | Parameters : context - Context data
963 | data - BOOL (Deactivate context due to T3381)
964 +------------------------------------------------------------------------------
965 */
966 static void handle_network_modify_rejected_in_S7(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
967 {
968 BOOL deactivate_context = (BOOL)((UINT)data);
969 T_CAUSE_ps_cause *cause = sm_get_aci_cause(context);
970 (void)TRACE_FUNCTION("handle_network_modify_rejected_in_S7");
971
972 TRACE_ASSERT(cause != NULL);
973
974 /*lint -e613 (Possible use of null pointer 'cause' in left argument to operator '->') */
975 /* Inform ACI of failed modification attempt */
976 send_smreg_pdp_modify_rej(context->nsapi, cause);
977
978 /* In case of modify collisions or timeouts, the context remains active */
979 if (deactivate_context != TRUE &&
980 (cause->ctrl_value == CAUSE_is_from_sm &&
981 cause->value.sm_cause == (U16)CAUSE_SM_MODIFY_COLLISION
982 ||
983 cause->ctrl_value == CAUSE_is_from_nwsm &&
984 cause->value.nwsm_cause == (U16)CAUSE_NWSM_NETWORK_FAILURE))
985 {
986 /* Go to state SM CONTEXT ACTIVATED */
987 context->context_control_state = SM_CONTEXT_ACTIVATED;
988 } else {
989 /* Other errors: Context is deactivated */
990 send_smreg_pdp_deactivate_ind(sm_nsapi2nsapi_set(context->nsapi), cause);
991
992 /* Go to state SM CONTEXT DEACTIVATING */
993 context->context_control_state = SM_CONTEXT_DEACTIVATING;
994
995 /* Deactivate Network and User Plane (Network deactivation in progress) */
996 sm_context_deactivate_control(context, SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE, cause);
997 /*lint +e613 (Possible use of null pointer 'cause' in left argument to operator '->') */
998 }
999 }
1000
1001 /*
1002 +------------------------------------------------------------------------------
1003 | Function : handle_network_modify_rejected_in_S10
1004 +------------------------------------------------------------------------------
1005 | Description : Handle event SM_I_NETWORK_MODIFY_REJECTED in state S10
1006 |
1007 | Parameters : context - Context data
1008 | data - BOOL (Deactivate context due to T3381)
1009 +------------------------------------------------------------------------------
1010 */
1011 static void handle_network_modify_rejected_in_S10(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1012 {
1013 BOOL deactivate_context = (BOOL)((UINT)data);
1014 T_CAUSE_ps_cause *cause = sm_get_aci_cause(context);
1015 (void)TRACE_FUNCTION("handle_network_modify_rejected_in_S10");
1016
1017 TRACE_ASSERT(cause != NULL);
1018
1019 /* In case of modify collision, timeout, or temporary out-of-resources
1020 * the context remains active */
1021 /*lint -e613 (Possible use of null pointer 'cause' in left argument to operator '->') */
1022 if (deactivate_context != TRUE &&
1023 (cause->ctrl_value == CAUSE_is_from_sm &&
1024 cause->value.sm_cause == (U16)CAUSE_SM_MODIFY_COLLISION
1025 ||
1026 cause->ctrl_value == CAUSE_is_from_nwsm &&
1027 cause->value.nwsm_cause == (U16)CAUSE_NWSM_NETWORK_FAILURE
1028 ||
1029 cause->ctrl_value == CAUSE_is_from_nwsm &&
1030 cause->value.nwsm_cause == (U16)CAUSE_NWSM_INSUFFICIENT_RESOURCES))
1031 {
1032 /* Go to state SM CONTEXT ACTIVATED */
1033 context->context_control_state = SM_CONTEXT_ACTIVATED;
1034 } else {
1035 /* Other errors: Context is deactivated */
1036 send_smreg_pdp_deactivate_ind(sm_nsapi2nsapi_set(context->nsapi), cause);
1037 /*lint +e613 (Possible use of null pointer 'cause' in left argument to operator '->') */
1038
1039 /* Go to state SM CONTEXT DEACTIVATING */
1040 context->context_control_state = SM_CONTEXT_DEACTIVATING;
1041
1042 /* Deactivate Network and User Plane (Network deactivation in progress) */
1043 sm_context_deactivate_control(context, SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE, sm_get_nw_cause(context));
1044 }
1045 }
1046
1047 /*
1048 +------------------------------------------------------------------------------
1049 | Function : handle_network_modify_completed_in_S7
1050 +------------------------------------------------------------------------------
1051 | Description : Handle event SM_I_NETWORK_MODIFY_COMPLETED in state S7
1052 |
1053 | Parameters : context - Context data
1054 | data - T_SM_UPDATE_FLAGS
1055 +------------------------------------------------------------------------------
1056 */
1057 static void handle_network_modify_completed_in_S7(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1058 {
1059 T_SM_UPDATE_FLAGS update_flags = (T_SM_UPDATE_FLAGS)((UINT)data);
1060 (void)TRACE_FUNCTION("handle_network_modify_completed_in_S7");
1061
1062 if (sm_is_user_plane_update_required(update_flags))
1063 {
1064 /* Go to state SM CONTEXT MODIFYING USER PLANE */
1065 context->context_control_state = SM_CONTEXT_MODIFYING_USER_PLANE;
1066
1067 /* Start user plane modification */
1068 sm_user_plane_control(context, SM_I_USER_PLANE_MODIFY, (void *)update_flags);
1069 } else {
1070 /* Inform ACI of the successful modification and altered fields */
1071 send_smreg_pdp_modify_cnf(context, update_flags);
1072
1073 /* Go to state SM CONTEXT ACTIVATED */
1074 context->context_control_state = SM_CONTEXT_ACTIVATED;
1075 }
1076 }
1077
1078 /*
1079 +------------------------------------------------------------------------------
1080 | Function : handle_network_modify_completed_in_S10
1081 +------------------------------------------------------------------------------
1082 | Description : Handle event SM_I_NETWORK_MODIFY_COMPLETED in state S10
1083 |
1084 | Parameters : context - Context data
1085 | data - (enum) T_SM_UPDATE_FLAGS
1086 +------------------------------------------------------------------------------
1087 */
1088 static void handle_network_modify_completed_in_S10(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1089 {
1090 T_SM_UPDATE_FLAGS update_flags = (T_SM_UPDATE_FLAGS)((UINT)data);
1091 (void)TRACE_FUNCTION("handle_network_modify_completed_in_S10");
1092
1093 if (sm_is_aci_update_required(update_flags))
1094 {
1095 /* Inform ACI of new parameters */
1096 send_smreg_pdp_modify_ind(context, update_flags);
1097 }
1098
1099 if (sm_is_user_plane_update_required(update_flags))
1100 {
1101 /* Go to state SM CONTEXT MODIFYING USER PLANE MT */
1102 context->context_control_state = SM_CONTEXT_MODIFYING_USER_PLANE_MT;
1103
1104 /* Modify User Plane */
1105 sm_user_plane_control(context, SM_I_USER_PLANE_MODIFY, NULL);
1106 } else {
1107 /* Go to state SM CONTEXT ACTIVATED */
1108 context->context_control_state = SM_CONTEXT_ACTIVATED;
1109 }
1110 }
1111
1112 /*
1113 +------------------------------------------------------------------------------
1114 | Function : handle_user_plane_activated_in_S3
1115 +------------------------------------------------------------------------------
1116 | Description : Handle event SM_I_USER_PLANE_ACTIVATED in state S3
1117 |
1118 | Parameters : context - Context data
1119 | data - Not used
1120 +------------------------------------------------------------------------------
1121 */
1122 static void handle_user_plane_activated_in_S3(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1123 {
1124 (void)TRACE_FUNCTION("handle_user_plane_activated_in_S3");
1125
1126 /* Go to state SM CONTEXT ACTIVATED */
1127 context->context_control_state = SM_CONTEXT_ACTIVATED;
1128
1129 /* Confirm activation towards ACI; response depends on primary/secondary */
1130 if (!sm_is_secondary(context))
1131 {
1132 /* Primary context: send SMREG_PDP_ACTIVATE_CNF */
1133 send_smreg_pdp_activate_cnf(context);
1134 } else {
1135 /* Secondary context: send SMREG_PDP_ACTIVATE_SEC_CNF */
1136 send_smreg_pdp_activate_sec_cnf(context);
1137 }
1138 }
1139
1140 /*
1141 +------------------------------------------------------------------------------
1142 | Function : handle_user_plane_activated_in_S13
1143 +------------------------------------------------------------------------------
1144 | Description : Handle event SM_I_USER_PLANE_ACTIVATED in state S13
1145 |
1146 | Parameters : context - Context data
1147 | data - Not used
1148 +------------------------------------------------------------------------------
1149 */
1150 static void handle_user_plane_activated_in_S13(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1151 {
1152 (void)TRACE_FUNCTION("handle_user_plane_activated_in_S13");
1153
1154 /* Go to state SM CONTEXT ACTIVATED */
1155 context->context_control_state = SM_CONTEXT_ACTIVATED;
1156
1157 /* For primary contexts: Inform sequencer that reactivation was successful */
1158 if (!sm_is_secondary(context))
1159 {
1160 sm_sequencer(SM_I_CONTEXT_REACTIVATE_COMPLETED,
1161 (void *)(T_NAS_ti)context->ti);
1162 }
1163 }
1164
1165 /*
1166 +------------------------------------------------------------------------------
1167 | Function : handle_user_plane_error_in_S3
1168 +------------------------------------------------------------------------------
1169 | Description : Handle event SM_I_USER_PLANE_ERROR in state S3
1170 |
1171 | Parameters : context - Context data
1172 | data - BOOL
1173 +------------------------------------------------------------------------------
1174 */
1175 static void handle_user_plane_error_in_S3(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1176 {
1177 (void)TRACE_FUNCTION("handle_user_plane_error_in_S3");
1178
1179 /* Go to state SM CONTEXT ACTIVATE FAILED DEACTIVATING */
1180 context->context_control_state = SM_CONTEXT_ACTIVATE_FAILED_DEACTIVATING;
1181
1182 /* Dectivate User Plane locally */
1183 sm_user_plane_control(context, SM_I_USER_PLANE_DEACTIVATE_LOCAL, data);
1184
1185 /* Deactivate towards network */
1186 sm_set_nw_cause(context, CAUSE_is_from_nwsm, (U16)CAUSE_NWSM_REGULAR_DEACTIVATION);
1187 sm_context_deactivate_control(context, SM_I_DEACTIVATE_NETWORK,
1188 sm_get_nw_cause(context));
1189 }
1190
1191 /*
1192 +------------------------------------------------------------------------------
1193 | Function : handle_user_plane_error_while_active
1194 +------------------------------------------------------------------------------
1195 | Description : Handle event SM_I_USER_PLANE_ERROR in states S5 - S13
1196 |
1197 | Parameters : context - Context data
1198 | data - BOOL
1199 +------------------------------------------------------------------------------
1200 */
1201 static void handle_user_plane_error_while_active(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1202 {
1203 (void)TRACE_FUNCTION("handle_user_plane_error_while_active");
1204
1205 /* Inform ACI that the context will now be deactivated due to user plane error */
1206 send_smreg_pdp_deactivate_ind(sm_nsapi2nsapi_set(context->nsapi),
1207 sm_get_aci_cause(context));
1208
1209 /* Go to state SM CONTEXT DEACTIVATING */
1210 context->context_control_state = SM_CONTEXT_DEACTIVATING;
1211
1212 /* Dectivate User Plane locally */
1213 sm_user_plane_control(context, SM_I_USER_PLANE_DEACTIVATE_LOCAL, data);
1214
1215 /* Deactivate towards network */
1216 sm_set_nw_cause(context, CAUSE_is_from_nwsm, (U16)CAUSE_NWSM_REGULAR_DEACTIVATION);
1217 sm_context_deactivate_control(context, SM_I_DEACTIVATE_NETWORK,
1218 sm_get_nw_cause(context));
1219 }
1220
1221 /*
1222 +------------------------------------------------------------------------------
1223 | Function : handle_user_plane_modified_in_S8
1224 +------------------------------------------------------------------------------
1225 | Description : Handle event SM_I_USER_PLANE_MODIFIED in states S8
1226 |
1227 | Parameters : context - Context data
1228 | data - Not used
1229 +------------------------------------------------------------------------------
1230 */
1231 static void handle_user_plane_modified_in_S8(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1232 {
1233 (void)TRACE_FUNCTION("handle_user_plane_modified_in_S8");
1234
1235 /* Inform ACI of the successful modification and altered QoS */
1236 send_smreg_pdp_modify_cnf(context, SM_UPDATE_QOS);
1237
1238 /* Go to state SM CONTEXT ACTIVATED */
1239 context->context_control_state = SM_CONTEXT_ACTIVATED;
1240 }
1241
1242 /*
1243 +------------------------------------------------------------------------------
1244 | Function : handle_user_plane_deactivated_in_S11
1245 +------------------------------------------------------------------------------
1246 | Description : Handle event SM_I_USER_PLANE_DEACTIVATED in S11
1247 |
1248 | Parameters : context - Context data
1249 | data - Not used
1250 +------------------------------------------------------------------------------
1251 */
1252 static void handle_user_plane_deactivated_in_S11(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1253 {
1254 (void)TRACE_FUNCTION("handle_user_plane_deactivated_in_S11");
1255
1256 /* Go to state SM CONTEXT REACTIVATING IN NETWORK */
1257 context->context_control_state = SM_CONTEXT_REACTIVATING_IN_NETWORK;
1258
1259 /* Start primary context activation towards network */
1260 sm_network_control(context, SM_I_NETWORK_ACTIVATE_PRIMARY, NULL);
1261
1262 /* Inform User Plane Control of pending context activation */
1263 sm_user_plane_control(context, SM_I_USER_PLANE_ACTIVATE_START, NULL);
1264 }
1265
1266 /*
1267 +------------------------------------------------------------------------------
1268 | Function : handle_deactivate_completed_in_S0
1269 +------------------------------------------------------------------------------
1270 | Description : Handle event SM_I_DEACTIVATE_COMPLETED in state S0
1271 |
1272 | Parameters : context - Context data
1273 | data - Not used
1274 +------------------------------------------------------------------------------
1275 */
1276 static void handle_deactivate_completed_in_S0(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1277 {
1278 (void)TRACE_FUNCTION("handle_deactivate_completed_in_S0");
1279
1280 /* Mark context for deallocation after call returns */
1281 sm_mark_context_for_deallocation(context);
1282 }
1283
1284 /*
1285 +------------------------------------------------------------------------------
1286 | Function : handle_deactivate_completed_in_S4
1287 +------------------------------------------------------------------------------
1288 | Description : Handle event SM_I_DEACTIVATE_COMPLETED in state S4
1289 |
1290 | Parameters : context - Context data
1291 | data - Not used
1292 +------------------------------------------------------------------------------
1293 */
1294 static void handle_deactivate_completed_in_S4(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1295 {
1296 (void)TRACE_FUNCTION("handle_deactivate_completed_in_S4");
1297
1298 /* Go to state SM CONTEXT DEACTIVATED */
1299 context->context_control_state = SM_CONTEXT_DEACTIVATED;
1300
1301 /* Report failed activation to ACI: Response depends on primary/secondary */
1302 if (!sm_is_secondary(context))
1303 {
1304 /* Primary context: send SMREG_PDP_ACTIVATE_REJ */
1305 send_smreg_pdp_activate_rej(context->nsapi, sm_get_aci_cause(context));
1306 } else {
1307 /* Secondary context: send SMREG_PDP_ACTIVATE_SEC_REJ */
1308 send_smreg_pdp_activate_sec_rej(context->nsapi, sm_get_aci_cause(context));
1309 }
1310
1311 /* Mark context for deallocation after call returns */
1312 sm_mark_context_for_deallocation(context);
1313 }
1314
1315 /*
1316 +------------------------------------------------------------------------------
1317 | Function : handle_deactivate_completed_in_S14
1318 +------------------------------------------------------------------------------
1319 | Description : Handle event SM_I_DEACTIVATE_COMPLETED in state S14
1320 |
1321 | Parameters : context - Context data
1322 | data - Not used
1323 +------------------------------------------------------------------------------
1324 */
1325 static void handle_deactivate_completed_in_S14(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1326 {
1327 (void)TRACE_FUNCTION("handle_deactivate_completed_in_S14");
1328
1329 /* Go to state SM CONTEXT DEACTIVATED */
1330 context->context_control_state = SM_CONTEXT_DEACTIVATED;
1331
1332 /* Mark context for deallocation */
1333 sm_mark_context_for_deallocation(context);
1334 }
1335
1336 /*
1337 +------------------------------------------------------------------------------
1338 | Function : handle_deactivate_completed_in_S15
1339 +------------------------------------------------------------------------------
1340 | Description : Handle event SM_I_DEACTIVATE_COMPLETED in state S15
1341 |
1342 | Parameters : context - Context data
1343 | data - Not used
1344 +------------------------------------------------------------------------------
1345 */
1346 static void handle_deactivate_completed_in_S15(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1347 {
1348 (void)TRACE_FUNCTION("handle_deactivate_completed_in_S15");
1349
1350 /* Go to state SM CONTEXT DEACTIVATED */
1351 context->context_control_state = SM_CONTEXT_DEACTIVATED;
1352
1353 /* Mark context for deallocation */
1354 sm_mark_context_for_deallocation(context);
1355
1356 /* Confirm deactivation towards Sequencer */
1357 sm_sequencer(SM_I_CONTEXT_DEACTIVATE_COMPLETED, (void *)(T_NAS_nsapi)context->nsapi);
1358 }
1359
1360 /*
1361 +------------------------------------------------------------------------------
1362 | Function : handle_network_request_modify
1363 +------------------------------------------------------------------------------
1364 | Description : Handle event SM_I_NETWORK_REQUEST_MODIFY in state S4
1365 |
1366 | Parameters : context - Context data
1367 | data - Update flags
1368 +------------------------------------------------------------------------------
1369 */
1370 static void handle_network_request_modify(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1371 {
1372 T_SM_UPDATE_FLAGS update_flags = (T_SM_UPDATE_FLAGS)((UINT)data);
1373 (void)TRACE_FUNCTION("handle_network_request_modify");
1374
1375 if (sm_is_aci_update_required(update_flags))
1376 {
1377 /* Send SMREG_PDP_MODIFY_IND if required */
1378 send_smreg_pdp_modify_ind(context, update_flags);
1379 }
1380
1381 if (sm_is_user_plane_update_required(update_flags))
1382 {
1383 /* Go to state SM CONTEXT MODIFYING USER PLANE MT */
1384 context->context_control_state = SM_CONTEXT_MODIFYING_USER_PLANE_MT;
1385
1386 /* Update User Plane */
1387 sm_user_plane_control(context, SM_I_USER_PLANE_MODIFY, (void *)update_flags);
1388 }
1389 }
1390
1391 /*
1392 +------------------------------------------------------------------------------
1393 | Function : handle_network_request_modify_failed
1394 +------------------------------------------------------------------------------
1395 | Description : Handle event SM_I_NETWORK_REQUEST_MODIFY_FAILED
1396 |
1397 | Parameters : context - Context data
1398 | data - Not used (cause set in context data)
1399 +------------------------------------------------------------------------------
1400 */
1401 static void handle_network_request_modify_failed(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1402 {
1403 (void)TRACE_FUNCTION("handle_network_request_modify_failed");
1404
1405 /* Inform ACI of failed modification and deactivation */
1406 send_smreg_pdp_deactivate_ind(sm_nsapi2nsapi_set(context->nsapi),
1407 sm_get_aci_cause(context));
1408
1409 /* Go to state SM CONTEXT DEACTIVATING */
1410 context->context_control_state = SM_CONTEXT_DEACTIVATING;
1411
1412 /* Start user plane deactivation */
1413 sm_context_deactivate_control(context, SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE, sm_get_nw_cause(context));
1414 }
1415
1416 /*
1417 +------------------------------------------------------------------------------
1418 | Function : handle_context_upgrade
1419 +------------------------------------------------------------------------------
1420 | Description : Handle event SM_I_CONTEXT_UPGRADE in S5
1421 |
1422 | Parameters : context - Context data
1423 | data - Not used
1424 +------------------------------------------------------------------------------
1425 */
1426 static void handle_context_upgrade(struct T_SM_CONTEXT_DATA *context, /*@null@*/ /*@unused@*/ void *data)
1427 {
1428 (void)TRACE_FUNCTION("handle_context_upgrade");
1429
1430 /* Go to state SM CONTEXT UPGRADING IN NETWORK */
1431 context->context_control_state = SM_CONTEXT_UPGRADING_IN_NETWORK;
1432
1433 /* Start a network modify procedure in order to re-upgrade QoS */
1434 sm_network_control(context, SM_I_NETWORK_MODIFY, NULL);
1435 }
1436
1437 /*
1438 +------------------------------------------------------------------------------
1439 | Function : handle_context_reactivate
1440 +------------------------------------------------------------------------------
1441 | Description : Handle event SM_I_CONTEXT_REACTIVATE in deactivate(d) states
1442 |
1443 | Parameters : context - Context data
1444 | data - not used
1445 +------------------------------------------------------------------------------
1446 */
1447 void handle_context_reactivate(struct T_SM_CONTEXT_DATA *context, /*@unused@*/ /*@null@*/ void *data)
1448 {
1449 (void)TRACE_FUNCTION("handle_context_reactivate");
1450
1451 /* Go to state SM CONTEXT DEACTIVATING SEQUENCED */
1452 context->context_control_state = SM_CONTEXT_REACTIVATING_IN_NETWORK;
1453
1454 /* Start primary or secondary activation depending on context type */
1455 if (sm_is_secondary(context)) {
1456 sm_network_control(context, SM_I_NETWORK_ACTIVATE_SECONDARY, NULL);
1457 } else {
1458 sm_network_control(context, SM_I_NETWORK_ACTIVATE_PRIMARY, NULL);
1459 }
1460 /* (Re)start user plane */
1461 sm_user_plane_control(context, SM_I_USER_PLANE_ACTIVATE_START, NULL);
1462 }
1463
1464 /*
1465 +------------------------------------------------------------------------------
1466 | Function : handle_context_deactivate_in_S0
1467 +------------------------------------------------------------------------------
1468 | Description : Handle event SM_I_CONTEXT_DEACTIVATE in S0
1469 | Note: User Plane is deactivating in this state
1470 |
1471 | Parameters : context - Context data
1472 | data - deactivation type
1473 +------------------------------------------------------------------------------
1474 */
1475 static void handle_context_deactivate_in_S0(/*@unused@*/ struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1476 {
1477 int nsapi;
1478
1479 T_SM_CONTEXT_DEACTIVATE_CONTROL_EVENT event = (T_SM_CONTEXT_DEACTIVATE_CONTROL_EVENT)((UINT)data);
1480 (void)TRACE_FUNCTION("SM Context Control: handle_context_deactivate_in_S0");
1481
1482 if (event == SM_I_DEACTIVATE_USER_PLANE ||
1483 event == SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE)
1484 {
1485 /* Network deactivation ignored - already deactivated */
1486 sm_context_deactivate_control(context, SM_I_DEACTIVATE_USER_PLANE,
1487 (void *)PS_REL_IND_NO);
1488 /*ACI requested deactivation of an already inactive context. Acknowledge*/
1489 send_smreg_pdp_deactivate_cnf(sm_data.sm_nsapis_requested_deactivated);
1490
1491 /* If the context is not freed, clear it here so that future SMREG_PDP_ACTIVATE_REQ
1492 * served properly
1493 */
1494 for (nsapi = (int)NAS_NSAPI_5; nsapi < NAS_SIZE_NSAPI; nsapi++)
1495 {
1496 if (sm_is_nsapi_in_nsapi_set(nsapi, sm_data.sm_nsapis_requested_deactivated))
1497 {
1498 sm_free_context_data_by_nsapi(nsapi);
1499 }
1500 }
1501 }
1502 /* Network-only deactivation ignored - already deactivated */
1503 }
1504
1505 /*
1506 +------------------------------------------------------------------------------
1507 | Function : handle_context_deactivate
1508 +------------------------------------------------------------------------------
1509 | Description : Handle event SM_I_CONTEXT_DEACTIVATE in active states
1510 |
1511 | Parameters : context - Context data
1512 | data - deactivation type
1513 +------------------------------------------------------------------------------
1514 */
1515 void handle_context_deactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1516 {
1517 T_SM_CONTEXT_DEACTIVATE_CONTROL_EVENT event = (T_SM_CONTEXT_DEACTIVATE_CONTROL_EVENT)((UINT)data);
1518 void *param;
1519
1520 (void)TRACE_FUNCTION("handle_context_deactivate");
1521
1522 /* Go to state SM CONTEXT DEACTIVATING SEQUENCED */
1523 context->context_control_state = SM_CONTEXT_DEACTIVATING_SEQUENCED;
1524
1525 /* Set cause to be sent to the network (if indicated by deactivation type) */
1526 sm_set_nw_cause(context, CAUSE_is_from_nwsm,
1527 (U16)CAUSE_NWSM_REGULAR_DEACTIVATION);
1528
1529 switch (event)
1530 {
1531 case SM_I_DEACTIVATE_USER_PLANE:
1532 param = (void *)PS_REL_IND_NO;
1533 break;
1534 case SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE:
1535 default:
1536 event = SM_I_DEACTIVATE_NETWORK_AND_USER_PLANE;
1537 /*lint -fallthrough*/
1538 case SM_I_DEACTIVATE_NETWORK:
1539 param = sm_get_nw_cause(context);
1540 break;
1541 }
1542
1543 /* Forward deactivation event to Context Deactivate Control */
1544 sm_context_deactivate_control(context, event, param);
1545 }
1546
1547 /*
1548 +------------------------------------------------------------------------------
1549 | Function : handle_local_deactivate
1550 +------------------------------------------------------------------------------
1551 | Description : Handle event SM_I_CONTEXT_LOCAL_DEACTIVATE
1552 |
1553 | Parameters : context - Context data
1554 | data - UPM signalling switch
1555 +------------------------------------------------------------------------------
1556 */
1557 static void handle_local_deactivate(struct T_SM_CONTEXT_DATA *context, /*@null@*/ void *data)
1558 {
1559 (void)TRACE_FUNCTION("handle_local_deactivate");
1560
1561 /* Go to state SM CONTEXT DEACTIVATED */
1562 context->context_control_state = SM_CONTEXT_DEACTIVATED;
1563
1564 /* Locally deactivate Network Control */
1565 sm_network_control(context, SM_I_NETWORK_DEACTIVATE_LOCAL, NULL);
1566
1567 /* Locally deactivate user plane (with UPM signalling) */
1568 sm_user_plane_control(context, SM_I_USER_PLANE_DEACTIVATE_LOCAL, data);
1569
1570 /* Mark context for deallocation after call returns (unless context
1571 * is pending reactivation) */
1572 if (!sm_is_context_pending_reactivation(context)) {
1573 sm_mark_context_for_deallocation(context);
1574 }
1575 }
1576
1577 /*==== PUBLIC FUNCTIONS =====================================================*/
1578
1579 /*
1580 +------------------------------------------------------------------------------
1581 | Function : sm_context_control_init
1582 +------------------------------------------------------------------------------
1583 | Description : Context Control state machine initialization function
1584
1585 | Parameters : context - Context data
1586 +------------------------------------------------------------------------------
1587 */
1588 void sm_context_control_init(struct T_SM_CONTEXT_DATA *context)
1589 {
1590 (void)TRACE_FUNCTION("sm_context_control_init");
1591
1592 sm_set_context_pending_reactivation(context, FALSE);
1593 context->context_control_state = SM_CONTEXT_DEACTIVATED;
1594 }
1595
1596 /*
1597 +------------------------------------------------------------------------------
1598 | Function : sm_context_control_exit
1599 +------------------------------------------------------------------------------
1600 | Description : Context Control state machine exit function
1601
1602 | Parameters : context - Context data
1603 +------------------------------------------------------------------------------
1604 */
1605 void sm_context_control_exit(struct T_SM_CONTEXT_DATA *context)
1606 {
1607 (void)TRACE_FUNCTION("sm_context_control_exit");
1608
1609 sm_set_context_pending_reactivation(context, FALSE);
1610 context->context_control_state = SM_CONTEXT_DEACTIVATED;
1611 }
1612
1613 /*
1614 +------------------------------------------------------------------------------
1615 | Function : sm_context_control_state
1616 +------------------------------------------------------------------------------
1617 | Description : Returns a read-only string with the name of the active state.
1618
1619 | Parameters : context - Context data
1620 +------------------------------------------------------------------------------
1621 */
1622 #ifdef DEBUG
1623 /*@observer@*/const char *
1624 sm_context_control_state(struct T_SM_CONTEXT_DATA *context)
1625 {
1626 /*@observer@*/
1627 static const char *state_name[SM_CONTEXT_CONTROL_NUMBER_OF_STATES] = {
1628 "S0_SM_CONTEXT_DEACTIVATED",
1629 "S1_SM_CONTEXT_ACTIVATING_MT",
1630 "S2_SM_CONTEXT_ACTIVATING_NETWORK",
1631 "S3_SM_CONTEXT_ACTIVATING_USER_PLANE",
1632 "S4_SM_CONTEXT_ACTIVATE_FAILED_DEACTIVATING",
1633 "S5_SM_CONTEXT_ACTIVATED",
1634 "S6_SM_CONTEXT_ACTIVATION_OVERRIDE",
1635 "S7_SM_CONTEXT_MODIFYING_IN_NETWORK",
1636 "S8_SM_CONTEXT_MODIFYING_USER_PLANE",
1637 "S9_SM_CONTEXT_MODIFYING_USER_PLANE_MT",
1638 "S10_SM_CONTEXT_UPGRADING_IN_NETWORK",
1639 "S11_SM_CONTEXT_REACTIVATING_DEACTIVATING_USER_PLANE",
1640 "S12_SM_CONTEXT_REACTIVATING_IN_NETWORK",
1641 "S13_SM_CONTEXT_REACTIVATING_USER_PLANE",
1642 "S14_SM_CONTEXT_DEACTIVATING",
1643 "S15_SM_CONTEXT_DEACTIVATING_SEQUENCED"
1644 };
1645
1646 TRACE_ASSERT(context->context_control_state < SM_CONTEXT_CONTROL_NUMBER_OF_STATES);
1647
1648 return state_name[(U16)context->context_control_state];
1649 }
1650 #endif
1651 /*
1652 +------------------------------------------------------------------------------
1653 | Function : sm_context_control
1654 +------------------------------------------------------------------------------
1655 | Description : Context Control state machine
1656 |
1657 | Parameters : context - Context data
1658 | event - Internal event (see sm_context_control.h)
1659 | data - Event dependent parameter
1660 +------------------------------------------------------------------------------
1661 */
1662 void sm_context_control(struct T_SM_CONTEXT_DATA *context,
1663 T_SM_CONTEXT_CONTROL_EVENT event,
1664 /*@null@*/ void *data)
1665 {
1666 #ifdef DEBUG
1667 const char *old_state_name, *new_state_name;
1668 T_SM_CONTEXT_CONTROL_STATE old_state;
1669 /*@observer@*/
1670 static const char *event_name[SM_CONTEXT_CONTROL_NUMBER_OF_EVENTS] = {
1671 "SM_P_SMREG_PDP_ACTIVATE_REQ",
1672 "SM_P_SMREG_PDP_ACTIVATE_REJ_RES",
1673 "SM_P_SMREG_PDP_ACTIVATE_SEC_REQ",
1674 "SM_P_SMREG_PDP_MODIFY_REQ",
1675 "SM_I_CONTEXT_DEACTIVATE",
1676 "SM_I_CONTEXT_LOCAL_DEACTIVATE",
1677 "SM_I_CONTEXT_REACTIVATE",
1678 "SM_I_CONTEXT_UPGRADE",
1679 "SM_I_CONTEXT_USER_PLANE_ERROR",
1680 "SM_I_NETWORK_ACTIVATE_COMPLETED",
1681 "SM_I_NETWORK_ACTIVATE_REJECTED",
1682 "SM_I_NETWORK_DEACTIVATE_COMPLETED",
1683 "SM_I_NETWORK_MODIFY_REJECTED",
1684 "SM_I_NETWORK_MODIFY_COMPLETED",
1685 "SM_I_NETWORK_REQUEST_ACTIVATION",
1686 "SM_I_NETWORK_REQUEST_ACTIVATION_OVERRIDE",
1687 "SM_I_NETWORK_REQUEST_DEACTIVATE",
1688 "SM_I_NETWORK_REQUEST_MODIFY",
1689 "SM_I_NETWORK_REQUEST_MODIFY_FAILED",
1690 "SM_I_USER_PLANE_ACTIVATED",
1691 "SM_I_USER_PLANE_DEACTIVATED",
1692 "SM_I_USER_PLANE_MODIFIED",
1693 "SM_I_DEACTIVATE_COMPLETED"
1694 };
1695
1696 TRACE_ASSERT(event < SM_CONTEXT_CONTROL_NUMBER_OF_EVENTS);
1697
1698 old_state = context->context_control_state;
1699 old_state_name = sm_context_control_state(context);
1700
1701 if (transition[(U16)old_state][(U16)event].event != event)
1702 {
1703 (void)TRACE_ERROR("Event table error in sm_context_control!");
1704 }
1705 #endif /* DEBUG */
1706
1707 transition[(U16)context->context_control_state][(U16)event].func(context, data);
1708
1709 #ifdef DEBUG
1710 new_state_name = sm_context_control_state(context);
1711
1712 (void)TRACE_EVENT_P4("SM CONTEXT #%d: %s => %s to %s", context->nsapi,
1713 event_name[(U16)event], old_state_name, new_state_name);
1714 #endif /* DEBUG */
1715 }
1716
1717 /*==== END OF FILE ==========================================================*/