FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/sm/sm_aci_output_handler.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Oct 2016 04:24:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
182:f02d0a0e1849 | 183:219afcfc6250 |
---|---|
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: Output functions for primitives from SM to the ACI 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_aci_output_handler.h" | |
28 #include "sm_qos.h" | |
29 | |
30 /*==== CONSTS ===============================================================*/ | |
31 | |
32 /*==== TYPES ================================================================*/ | |
33 | |
34 /*==== LOCALS ===============================================================*/ | |
35 | |
36 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
37 | |
38 /* | |
39 +------------------------------------------------------------------------------ | |
40 | Function : send_smreg_pdp_activate_cnf | |
41 +------------------------------------------------------------------------------ | |
42 | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_CNF primitive. | |
43 | | |
44 | Parameters : context - Pointer to context structure | |
45 +------------------------------------------------------------------------------ | |
46 */ | |
47 void send_smreg_pdp_activate_cnf(struct T_SM_CONTEXT_DATA *context) | |
48 { | |
49 U16 pco_len; | |
50 (void)TRACE_FUNCTION("send_smreg_pdp_activate_cnf"); | |
51 | |
52 pco_len = (context->negotiated_pco != NULL | |
53 ? (U16)context->negotiated_pco->c_pco_value | |
54 : (U16)0); | |
55 | |
56 { | |
57 U16 pco_bit_len = pco_len << 3; | |
58 PALLOC_SDU(prim, SMREG_PDP_ACTIVATE_CNF, pco_bit_len); | |
59 | |
60 if (prim != NULL) { | |
61 prim->nsapi = context->nsapi; | |
62 prim->pdp_type = context->pdp_type; | |
63 sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); | |
64 memcpy(&prim->comp_params, &context->comp_params, sizeof(T_NAS_comp_params)); | |
65 prim->ctrl_ip_address = context->negotiated_address.ctrl_ip_address; | |
66 memcpy(&prim->ip_address, &context->negotiated_address.ip_address, sizeof(T_NAS_ip_address)); | |
67 if (pco_len > 0 && context->negotiated_pco != NULL) { | |
68 U16 offset = prim->sdu.o_buf >> 3; | |
69 /* sdu.o_buf and sdu.l_buf already by PALLOC_SDU macro above! */ | |
70 memcpy(&prim->sdu.buf[offset], context->negotiated_pco->pco_value, | |
71 (size_t)pco_len); | |
72 } else { | |
73 prim->sdu.l_buf = 0; | |
74 } | |
75 | |
76 (void)PSEND(hCommACI, prim); | |
77 } else { | |
78 (void)TRACE_ERROR("Unable to allocate SMREG_PDP_ACTIVATE_CNF primitive!"); | |
79 } | |
80 } | |
81 } | |
82 | |
83 /* | |
84 +------------------------------------------------------------------------------ | |
85 | Function : send_smreg_pdp_activate_ind | |
86 +------------------------------------------------------------------------------ | |
87 | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_IND primitive. | |
88 | | |
89 | Parameters : context - Pointer to context structure | |
90 +------------------------------------------------------------------------------ | |
91 */ | |
92 void send_smreg_pdp_activate_ind(struct T_SM_CONTEXT_DATA *context) | |
93 { | |
94 (void)TRACE_FUNCTION("send_smreg_pdp_activate_ind"); | |
95 | |
96 { | |
97 PALLOC(prim, SMREG_PDP_ACTIVATE_IND); | |
98 | |
99 prim->ti = context->ti; | |
100 prim->pdp_type = context->pdp_type; | |
101 prim->ctrl_ip_address = context->negotiated_address.ctrl_ip_address; | |
102 memcpy(&prim->ip_address, &context->negotiated_address.ip_address, sizeof(T_NAS_ip_address)); | |
103 if (context->apn != NULL) { /* NOTE: *MUST* be present acc to 3G 24.008, but just in case... */ | |
104 memcpy(&prim->apn, context->apn, sizeof(T_SMREG_apn)); | |
105 } else { | |
106 prim->apn.c_apn_buf = (U8)0; | |
107 } | |
108 | |
109 (void)PSEND(hCommACI, prim); | |
110 } | |
111 } | |
112 | |
113 /* | |
114 +------------------------------------------------------------------------------ | |
115 | Function : send_smreg_pdp_activate_rej | |
116 +------------------------------------------------------------------------------ | |
117 | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_REJ primitive. | |
118 | | |
119 | Parameters : context - Pointer to context structure | |
120 +------------------------------------------------------------------------------ | |
121 */ | |
122 void send_smreg_pdp_activate_rej(U8 nsapi, T_CAUSE_ps_cause *cause) | |
123 { | |
124 (void)TRACE_FUNCTION("send_smreg_pdp_activate_rej"); | |
125 | |
126 { | |
127 PALLOC(prim, SMREG_PDP_ACTIVATE_REJ); | |
128 | |
129 prim->nsapi = nsapi; | |
130 prim->ps_cause.ctrl_value = cause->ctrl_value; | |
131 prim->ps_cause.value = cause->value; | |
132 | |
133 (void)PSEND(hCommACI, prim); | |
134 } | |
135 } | |
136 | |
137 /* | |
138 +------------------------------------------------------------------------------ | |
139 | Function : send_smreg_pdp_activate_sec_cnf | |
140 +------------------------------------------------------------------------------ | |
141 | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_SEC_CNF primitive. | |
142 | | |
143 | Parameters : context - Pointer to context structure | |
144 +------------------------------------------------------------------------------ | |
145 */ | |
146 void send_smreg_pdp_activate_sec_cnf(struct T_SM_CONTEXT_DATA *context) | |
147 { | |
148 (void)TRACE_FUNCTION("send_smreg_pdp_activate_sec_cnf"); | |
149 | |
150 { | |
151 PALLOC(prim, SMREG_PDP_ACTIVATE_SEC_CNF); | |
152 | |
153 prim->nsapi = context->nsapi; | |
154 | |
155 sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); | |
156 | |
157 (void)PSEND(hCommACI, prim); | |
158 } | |
159 } | |
160 | |
161 /* | |
162 +------------------------------------------------------------------------------ | |
163 | Function : send_smreg_pdp_activate_sec_rej | |
164 +------------------------------------------------------------------------------ | |
165 | Description : Allocate, pack and send SMREG_PDP_ACTIVATE_SEC_REJ primitive. | |
166 | | |
167 | Parameters : nsapi - Context identifier | |
168 | cause - Rejection cause | |
169 +------------------------------------------------------------------------------ | |
170 */ | |
171 void send_smreg_pdp_activate_sec_rej(U8 nsapi, T_CAUSE_ps_cause *cause) | |
172 { | |
173 (void)TRACE_FUNCTION("send_smreg_pdp_activate_sec_rej"); | |
174 | |
175 { | |
176 PALLOC(prim, SMREG_PDP_ACTIVATE_SEC_REJ); | |
177 | |
178 prim->nsapi = nsapi; | |
179 prim->ps_cause.ctrl_value = cause->ctrl_value; | |
180 prim->ps_cause.value = cause->value; | |
181 | |
182 (void)PSEND(hCommACI, prim); | |
183 } | |
184 } | |
185 | |
186 /* | |
187 +------------------------------------------------------------------------------ | |
188 | Function : send_smreg_pdp_deactivate_cnf | |
189 +------------------------------------------------------------------------------ | |
190 | Description : Allocate, pack and send SMREG_PDP_DEACTIVATE_CNF primitive. | |
191 | | |
192 | Parameters : nsapi_set - Set of NSAPIs successfully deactivated | |
193 +------------------------------------------------------------------------------ | |
194 */ | |
195 void send_smreg_pdp_deactivate_cnf(U16 nsapi_set) | |
196 { | |
197 (void)TRACE_FUNCTION("send_smreg_pdp_deactivate_cnf"); | |
198 | |
199 { | |
200 PALLOC(prim, SMREG_PDP_DEACTIVATE_CNF); | |
201 | |
202 prim->nsapi_set = nsapi_set; | |
203 | |
204 (void)PSEND(hCommACI, prim); | |
205 } | |
206 } | |
207 | |
208 /* | |
209 +------------------------------------------------------------------------------ | |
210 | Function : send_smreg_pdp_deactivate_ind | |
211 +------------------------------------------------------------------------------ | |
212 | Description : Allocate, pack and send SMREG_PDP_DEACTIVATE_IND primitive. | |
213 | | |
214 | Parameters : nsapi_set - Set of NSAPIs being deactivated | |
215 | cause - Reason for deactivation | |
216 +------------------------------------------------------------------------------ | |
217 */ | |
218 void send_smreg_pdp_deactivate_ind(U16 nsapi_set, T_CAUSE_ps_cause *cause) | |
219 { | |
220 (void)TRACE_FUNCTION("send_smreg_pdp_deactivate_ind"); | |
221 | |
222 { | |
223 PALLOC(prim, SMREG_PDP_DEACTIVATE_IND); | |
224 | |
225 prim->nsapi_set = nsapi_set; | |
226 prim->ps_cause.ctrl_value = cause->ctrl_value; | |
227 prim->ps_cause.value = cause->value; | |
228 | |
229 (void)PSEND(hCommACI, prim); | |
230 } | |
231 } | |
232 | |
233 /* | |
234 +------------------------------------------------------------------------------ | |
235 | Function : send_smreg_pdp_modify_cnf | |
236 +------------------------------------------------------------------------------ | |
237 | Description : Allocate, pack and send SMREG_PDP_MODIFY_CNF primitive. | |
238 | | |
239 | Parameters : None | |
240 +------------------------------------------------------------------------------ | |
241 */ | |
242 void send_smreg_pdp_modify_cnf(struct T_SM_CONTEXT_DATA *context, | |
243 T_SM_UPDATE_FLAGS update_flags) | |
244 { | |
245 (void)TRACE_FUNCTION("send_smreg_pdp_modify_cnf"); | |
246 | |
247 { | |
248 PALLOC(prim, SMREG_PDP_MODIFY_CNF); | |
249 | |
250 prim->nsapi = context->nsapi; | |
251 | |
252 if ((update_flags & SM_UPDATE_QOS) != (T_SM_UPDATE_FLAGS)0) { | |
253 sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); | |
254 } else { | |
255 prim->ctrl_qos = PS_is_qos_not_present; | |
256 } | |
257 | |
258 (void)PSEND(hCommACI, prim); | |
259 } | |
260 } | |
261 | |
262 /* | |
263 +------------------------------------------------------------------------------ | |
264 | Function : send_smreg_pdp_modify_ind | |
265 +------------------------------------------------------------------------------ | |
266 | Description : Allocate, pack and send SMREG_PDP_MODIFY_IND primitive. | |
267 | | |
268 | Parameters : None | |
269 +------------------------------------------------------------------------------ | |
270 */ | |
271 void send_smreg_pdp_modify_ind(struct T_SM_CONTEXT_DATA *context, | |
272 T_SM_UPDATE_FLAGS update_flags) | |
273 { | |
274 (void)TRACE_FUNCTION("send_smreg_pdp_modify_ind"); | |
275 | |
276 { | |
277 PALLOC(prim, SMREG_PDP_MODIFY_IND); | |
278 | |
279 prim->nsapi = context->nsapi; | |
280 | |
281 if ((int)(update_flags & SM_UPDATE_QOS) != 0) { | |
282 sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); | |
283 } else { | |
284 prim->ctrl_qos = PS_is_qos_not_present; | |
285 } | |
286 | |
287 if ((int)(update_flags & SM_UPDATE_ADDRESS) != 0) { | |
288 prim->ctrl_ip_address = context->negotiated_address.ctrl_ip_address; | |
289 memcpy(&prim->ip_address, &context->negotiated_address.ip_address, sizeof(T_NAS_ip_address)); | |
290 } else { | |
291 prim->ctrl_ip_address = NAS_is_ip_not_present; | |
292 } | |
293 | |
294 (void)PSEND(hCommACI, prim); | |
295 } | |
296 } | |
297 | |
298 /* | |
299 +------------------------------------------------------------------------------ | |
300 | Function : send_smreg_pdp_modify_ind_multiple | |
301 +------------------------------------------------------------------------------ | |
302 | Description : Allocate, pack and send SMREG_PDP_MODIFY_IND primitives for | |
303 | several NSAPIs. | |
304 | | |
305 | Parameters : None | |
306 +------------------------------------------------------------------------------ | |
307 */ | |
308 void send_smreg_pdp_modify_ind_multiple(U16 nsapi_set, | |
309 T_SM_UPDATE_FLAGS update_flags) | |
310 { | |
311 int nsapi; | |
312 | |
313 (void)TRACE_FUNCTION("send_smreg_pdp_modify_ind_multiple"); | |
314 | |
315 for (nsapi = (int)NAS_NSAPI_5; | |
316 nsapi < NAS_SIZE_NSAPI && sm_is_nsapi_in_nsapi_set(nsapi, nsapi_set); | |
317 nsapi++) | |
318 { | |
319 struct T_SM_CONTEXT_DATA *context; | |
320 | |
321 context = sm_get_context_data_from_nsapi(nsapi); | |
322 if (context != NULL) | |
323 { | |
324 PALLOC(prim, SMREG_PDP_MODIFY_IND); | |
325 | |
326 prim->nsapi = context->nsapi; | |
327 | |
328 if ((update_flags & SM_UPDATE_QOS_DOWNGRADE) != (T_SM_UPDATE_FLAGS)0) { | |
329 sm_qos_copy_from_sm(&prim->qos, &context->accepted_qos, &prim->ctrl_qos); | |
330 /* QoS downgraded to 0kbps */ | |
331 prim->qos.qos_r99.max_rate_ul = 0; | |
332 prim->qos.qos_r99.max_rate_dl = 0; | |
333 } else { | |
334 prim->ctrl_qos = PS_is_qos_not_present; | |
335 } | |
336 | |
337 /* IP address is not changed/set using this function */ | |
338 prim->ctrl_ip_address = NAS_is_ip_not_present; | |
339 | |
340 (void)PSEND(hCommACI, prim); | |
341 } /* if */ | |
342 } /* for */ | |
343 } | |
344 | |
345 /* | |
346 +------------------------------------------------------------------------------ | |
347 | Function : send_smreg_pdp_modify_rej | |
348 +------------------------------------------------------------------------------ | |
349 | Description : Allocate, pack and send SMREG_PDP_MODIFY_REJ primitive. | |
350 | | |
351 | Parameters : None | |
352 +------------------------------------------------------------------------------ | |
353 */ | |
354 void send_smreg_pdp_modify_rej(U8 nsapi, T_CAUSE_ps_cause *cause) | |
355 { | |
356 (void)TRACE_FUNCTION("send_smreg_pdp_modify_rej"); | |
357 | |
358 { | |
359 PALLOC(prim, SMREG_PDP_MODIFY_REJ); | |
360 | |
361 prim->nsapi = nsapi; | |
362 prim->ps_cause.ctrl_value = cause->ctrl_value; | |
363 prim->ps_cause.value = cause->value; | |
364 | |
365 (void)PSEND(hCommACI, prim); | |
366 } | |
367 } | |
368 | |
369 /*==== END OF FILE ==========================================================*/ |