FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/psa_smp.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module defines the processing functions for the | |
18 | primitives send to the protocol stack adapter by the | |
19 | session management of GPRS ( SM ). | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifdef GPRS | |
24 | |
25 #ifndef PSA_SMP_C | |
26 #define PSA_SMP_C | |
27 #endif | |
28 | |
29 #include "aci_all.h" | |
30 /*==== INCLUDES ===================================================*/ | |
31 #include "dti.h" /* functionality of the dti library */ | |
32 #include "aci_cmh.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_cmd.h" | |
35 | |
36 #include "aci.h" | |
37 | |
38 #include "dti_conn_mng.h" | |
39 #include "dti_cntrl_mng.h" | |
40 | |
41 #include "gaci.h" | |
42 #include "gaci_cmh.h" | |
43 #include "psa.h" | |
44 #include "psa_sm.h" | |
45 | |
46 #include "cmh.h" | |
47 #include "cmh_sm.h" | |
48 | |
49 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E) | |
50 #include "psa_tcpip.h" | |
51 #include "wap_aci.h" | |
52 #endif /* defined (FF_WAP) || defined (FF_GPF_TCPIP) */ | |
53 | |
54 #ifdef FF_GPF_TCPIP | |
55 #include "dcm_utils.h" | |
56 #include "dcm_state.h" | |
57 #include "dcm_env.h" | |
58 #endif | |
59 #include "dcm_f.h" | |
60 | |
61 | |
62 | |
63 /*==== CONSTANTS ==================================================*/ | |
64 | |
65 | |
66 /*==== TYPES ======================================================*/ | |
67 | |
68 | |
69 /*==== EXPORT =====================================================*/ | |
70 | |
71 | |
72 /*==== VARIABLES ==================================================*/ | |
73 | |
74 | |
75 /*==== FUNCTIONS ==================================================*/ | |
76 | |
77 /* | |
78 +----------------------------------------------------------------------+ | |
79 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
80 | STATE : finished ROUTINE : psa_smreg_pdp_activate_cnf | | |
81 +----------------------------------------------------------------------+ | |
82 | |
83 PURPOSE : processes the SMREG_PDP_ACTIVATE_CNF primitive send by SM. | |
84 this confirms a successful context activation. | |
85 */ | |
86 GLOBAL void psa_smreg_pdp_activate_cnf ( T_SMREG_PDP_ACTIVATE_CNF *smreg_pdp_activate_cnf ) | |
87 { | |
88 | |
89 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL; | |
90 | |
91 TRACE_FUNCTION ("psa_smreg_pdp_activate_cnf()"); | |
92 | |
93 p_pdp_context_node = pdp_context_find_node_from_cid( work_cids[cid_pointer] ); | |
94 if( ! p_pdp_context_node ) | |
95 { | |
96 TRACE_ERROR( "ERROR: PDP context not found, in function psa_smreg_pdp_activate_cnf" ); | |
97 return; | |
98 } | |
99 | |
100 /* | |
101 *------------------------------------------------------------------- | |
102 * notify ACI | |
103 *------------------------------------------------------------------- | |
104 */ | |
105 | |
106 smShrdPrm.pdp_cnf = smreg_pdp_activate_cnf; | |
107 | |
108 /* | |
109 * Store negotiated QOS parameters, only used for read out | |
110 */ | |
111 p_pdp_context_node->ctrl_neg_qos = smreg_pdp_activate_cnf->ctrl_qos; | |
112 memcpy( &p_pdp_context_node->neg_qos, &smreg_pdp_activate_cnf->qos, sizeof(T_PS_qos) ); | |
113 | |
114 if ( cmhSM_Activated(smreg_pdp_activate_cnf) < 0) | |
115 { | |
116 TRACE_EVENT("cmhSM_Activated( ) returned error."); | |
117 } | |
118 | |
119 /* free the primitive buffer */ | |
120 PFREE (smreg_pdp_activate_cnf); | |
121 } | |
122 | |
123 | |
124 | |
125 /* | |
126 +----------------------------------------------------------------------+ | |
127 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
128 | STATE : finished ROUTINE : psa_smreg_pdp_activate_rej | | |
129 +----------------------------------------------------------------------+ | |
130 | |
131 PURPOSE : processes the SMREG_PDP_ACTIVATE_REJ primitive send by SM. | |
132 this indicates a context activation failed. | |
133 */ | |
134 GLOBAL void psa_smreg_pdp_activate_rej ( T_SMREG_PDP_ACTIVATE_REJ *smreg_pdp_activate_rej ) | |
135 { | |
136 | |
137 TRACE_FUNCTION ("psa_smreg_pdp_activate_rej()"); | |
138 | |
139 /* update shared parameter and notify ACI */ | |
140 smShrdPrm.pdp_rej = smreg_pdp_activate_rej; | |
141 | |
142 if ( cmhSM_NoActivate( ) < 0) | |
143 { | |
144 TRACE_EVENT("cmhSM_NoActivate( ) returned error."); | |
145 } | |
146 | |
147 #ifdef FF_GPF_TCPIP | |
148 if(is_gpf_tcpip_call()) | |
149 { | |
150 T_DCM_STATUS_IND_MSG msg; | |
151 msg.hdr.msg_id = DCM_NEXT_CMD_STOP_MSG; | |
152 dcm_send_message(msg, DCM_SUB_WAIT_CGACT_CNF); | |
153 } | |
154 #endif /* FF_GPF_TCPIP */ | |
155 | |
156 /* free the primitive buffer */ | |
157 PFREE (smreg_pdp_activate_rej); | |
158 } | |
159 | |
160 /* | |
161 +----------------------------------------------------------------------+ | |
162 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
163 | STATE : developing ROUTINE : convert_apn_to_netaddr | | |
164 +----------------------------------------------------------------------+ | |
165 | |
166 PURPOSE : converts an APN to a dotted network address | |
167 | |
168 */ | |
169 LOCAL SHORT convert_apn_to_netaddr ( T_SMREG_apn *apn_src, T_SMREG_apn *apn_dest) | |
170 { | |
171 | |
172 T_SMREG_apn dummy_apn = {0,0,0}; | |
173 U8 counter1 = 0; | |
174 U8 counter2 = 0; | |
175 U8 dest_pos = 0; | |
176 U8 bytecount = 0; | |
177 | |
178 TRACE_FUNCTION ("convert_apn_to_netaddr()"); | |
179 | |
180 if(apn_src EQ apn_dest) | |
181 { | |
182 apn_dest=&dummy_apn; | |
183 } | |
184 | |
185 while(counter1<apn_src->c_apn_buf-1) | |
186 { | |
187 bytecount=apn_src->apn_buf[counter1]; | |
188 for(counter2=0;counter2<bytecount;counter2++) | |
189 { | |
190 counter1++; | |
191 if (counter1>=apn_src->c_apn_buf) | |
192 { | |
193 return -1; | |
194 } | |
195 else | |
196 { | |
197 apn_dest->apn_buf[dest_pos]=apn_src->apn_buf[counter1]; | |
198 dest_pos++; | |
199 } | |
200 } | |
201 if (counter1<apn_src->c_apn_buf-1) | |
202 { | |
203 apn_dest->apn_buf[dest_pos]='.'; | |
204 dest_pos++; | |
205 counter1++; | |
206 } | |
207 else | |
208 { | |
209 apn_dest->apn_buf[dest_pos]=0; | |
210 } | |
211 } | |
212 if (apn_dest EQ &dummy_apn) | |
213 { | |
214 apn_dest=apn_src; | |
215 memcpy(apn_dest->apn_buf,&dummy_apn.apn_buf,dest_pos+1); | |
216 apn_dest->c_apn_buf=dest_pos; | |
217 } | |
218 return 0; | |
219 } | |
220 | |
221 /* | |
222 +----------------------------------------------------------------------+ | |
223 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
224 | STATE : finished ROUTINE : psa_smreg_pdp_activate_ind | | |
225 +----------------------------------------------------------------------+ | |
226 | |
227 PURPOSE : processes the SMREG_PDP_ACTIVATE_IND primitive send by SM. | |
228 this indicates a network asked for a PDP context activation. | |
229 */ | |
230 GLOBAL void psa_smreg_pdp_activate_ind ( T_SMREG_PDP_ACTIVATE_IND *smreg_pdp_activate_ind ) | |
231 { | |
232 | |
233 TRACE_FUNCTION ("psa_smreg_pdp_activate_ind()"); | |
234 | |
235 /* update shared parameter and notify ACI */ | |
236 memcpy(&smShrdPrm.act_ind, smreg_pdp_activate_ind, sizeof(T_SMREG_PDP_ACTIVATE_IND)); | |
237 | |
238 convert_apn_to_netaddr(&smShrdPrm.act_ind.apn,&smShrdPrm.act_ind.apn); | |
239 | |
240 cmhSM_NetActivate( ); | |
241 | |
242 /* free the primitive buffer */ | |
243 PFREE (smreg_pdp_activate_ind); | |
244 } | |
245 | |
246 /* | |
247 +------------------------------------------------------------------------+ | |
248 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
249 | STATE : finished ROUTINE : psa_smreg_pdp_deactivate_cnf | | |
250 +------------------------------------------------------------------------+ | |
251 | |
252 PURPOSE : processes the SMREG_PDP_DEACTIVATE_CNF primitive send by SM. | |
253 this confirms a successful PDP context deactivation. | |
254 */ | |
255 GLOBAL void psa_smreg_pdp_deactivate_cnf | |
256 ( T_SMREG_PDP_DEACTIVATE_CNF *smreg_pdp_deactivate_cnf ) | |
257 { | |
258 | |
259 TRACE_FUNCTION ("psa_smreg_pdp_deactivate_cnf()"); | |
260 | |
261 /* update shared parameter and notify ACI */ | |
262 smShrdPrm.nsapi_set = smreg_pdp_deactivate_cnf->nsapi_set; | |
263 | |
264 cmhSM_Deactivated(); | |
265 | |
266 /* free the primitive buffer */ | |
267 PFREE (smreg_pdp_deactivate_cnf); | |
268 } | |
269 | |
270 /* | |
271 +------------------------------------------------------------------------+ | |
272 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
273 | STATE : finished ROUTINE : psa_smreg_pdp_deactivate_ind | | |
274 +------------------------------------------------------------------------+ | |
275 | |
276 PURPOSE : processes the SMREG_PDP_DEACTIVATE_IND primitive send by SM. | |
277 this indicates a network initiated PDP context deactivation. | |
278 */ | |
279 GLOBAL void psa_smreg_pdp_deactivate_ind | |
280 ( T_SMREG_PDP_DEACTIVATE_IND *smreg_pdp_deactivate_ind ) | |
281 { | |
282 | |
283 TRACE_FUNCTION ("psa_smreg_pdp_deactivate_ind()"); | |
284 | |
285 /* update shared parameter and notify ACI */ | |
286 smShrdPrm.nsapi_set = smreg_pdp_deactivate_ind->nsapi_set; | |
287 | |
288 cmhSM_NetDeactivate( ); | |
289 | |
290 /* free the primitive buffer */ | |
291 PFREE (smreg_pdp_deactivate_ind); | |
292 } | |
293 | |
294 /* | |
295 +--------------------------------------------------------------------+ | |
296 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
297 | STATE : finished ROUTINE : psa_smreg_pdp_modify_ind | | |
298 +--------------------------------------------------------------------+ | |
299 | |
300 PURPOSE : processes the SMREG_PDP_MODIFY_IND primitive send by SM. | |
301 this indicates a network initiated PDP context modification. | |
302 */ | |
303 GLOBAL void psa_smreg_pdp_modify_ind | |
304 ( T_SMREG_PDP_MODIFY_IND *smreg_pdp_modify_ind ) | |
305 { | |
306 | |
307 TRACE_FUNCTION ("psa_smreg_pdp_modify_ind()"); | |
308 | |
309 /* | |
310 *------------------------------------------------------------------- | |
311 * informs context manager | |
312 *------------------------------------------------------------------- | |
313 */ | |
314 | |
315 cmhSM_NetModify(smreg_pdp_modify_ind); | |
316 | |
317 /* | |
318 *------------------------------------------------------------------- | |
319 * free the primitive buffer | |
320 *------------------------------------------------------------------- | |
321 */ | |
322 PFREE (smreg_pdp_modify_ind); | |
323 } | |
324 | |
325 | |
326 | |
327 /* | |
328 +----------------------------------------------------------------------+ | |
329 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
330 | STATE : finished ROUTINE : psa_smreg_pdp_modify_cnf | | |
331 +----------------------------------------------------------------------+ | |
332 | |
333 PURPOSE : processes the SMREG_PDP_MODIFY_CNF primitive send by SM. | |
334 this confirms a successful context modification. | |
335 */ | |
336 #ifdef REL99 | |
337 GLOBAL void psa_smreg_pdp_modify_cnf ( T_SMREG_PDP_MODIFY_CNF *smreg_pdp_modify_cnf ) | |
338 { | |
339 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL; | |
340 | |
341 TRACE_FUNCTION ("psa_smreg_pdp_modify_cnf()"); | |
342 | |
343 p_pdp_context_node = pdp_context_find_node_from_cid( work_cids[cid_pointer] ); | |
344 if( !p_pdp_context_node ) | |
345 { | |
346 TRACE_ERROR( "ERROR: PDP context not found, in function psa_smreg_pdp_modify_cnf" ); | |
347 return; | |
348 } | |
349 | |
350 /* | |
351 *------------------------------------------------------------------- | |
352 * update shared parameter with new QoS and notify ACI | |
353 *------------------------------------------------------------------- | |
354 */ | |
355 if( smreg_pdp_modify_cnf->ctrl_qos NEQ PS_is_qos_not_present ) | |
356 { | |
357 p_pdp_context_node->ctrl_neg_qos = smreg_pdp_modify_cnf->ctrl_qos; | |
358 memcpy( &p_pdp_context_node->neg_qos, &smreg_pdp_modify_cnf->qos, sizeof(T_PS_qos) ); | |
359 } | |
360 | |
361 | |
362 | |
363 if( cmhSM_Modified( smreg_pdp_modify_cnf) > 0 ) | |
364 { | |
365 TRACE_EVENT("cmhSM( SM_NTF_MOD_CNF ): not supported return value."); | |
366 } | |
367 /* | |
368 *------------------------------------------------------------------- | |
369 * free the primitive buffer | |
370 *------------------------------------------------------------------- | |
371 */ | |
372 PFREE (smreg_pdp_modify_cnf); | |
373 | |
374 } | |
375 | |
376 | |
377 /* | |
378 +----------------------------------------------------------------------+ | |
379 | PROJECT : GPRS (8441) MODULE : PSA_SM | | |
380 | STATE : finished ROUTINE : psa_smreg_pdp_modify_rej | | |
381 +----------------------------------------------------------------------+ | |
382 | |
383 PURPOSE : processes the SMREG_PDP_MODIFY_REJ primitive send by SM. | |
384 this indicates a context modification failed. | |
385 */ | |
386 | |
387 GLOBAL void psa_smreg_pdp_modify_rej ( T_SMREG_PDP_MODIFY_REJ *smreg_pdp_modify_rej ) | |
388 { | |
389 | |
390 TRACE_FUNCTION ("psa_smreg_pdp_modify_rej()"); | |
391 | |
392 /* | |
393 *------------------------------------------------------------------- | |
394 * notify ACI | |
395 *------------------------------------------------------------------- | |
396 */ | |
397 if( cmhSM_NoModify( smreg_pdp_modify_rej ) < 0 ) | |
398 { | |
399 TRACE_EVENT("cmhSM( SM_NTF_MOD_REJ ) give not supported return value."); | |
400 } | |
401 /* | |
402 *------------------------------------------------------------------- | |
403 * free the primitive buffer | |
404 *------------------------------------------------------------------- | |
405 */ | |
406 PFREE (smreg_pdp_modify_rej); | |
407 } | |
408 | |
409 /* | |
410 +----------------------------------------------------------------------------+ | |
411 | PROJECT : UMTS MODULE : PSA_SM | | |
412 | STATE : ROUTINE : psa_smreg_pdp_activate_sec_cnf | | |
413 +----------------------------------------------------------------------------+ | |
414 | |
415 PURPOSE : processes the SMREG_PDP_ACTIVATE_SEC_CNF primitive send by SM. | |
416 */ | |
417 GLOBAL void psa_smreg_pdp_activate_sec_cnf( T_SMREG_PDP_ACTIVATE_SEC_CNF *smreg_pdp_activate_sec_cnf ) | |
418 { | |
419 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL; | |
420 | |
421 TRACE_FUNCTION ("psa_smreg_pdp_activate_sec_cnf()"); | |
422 | |
423 p_pdp_context_node = pdp_context_find_node_from_cid( work_cids[cid_pointer] ); | |
424 if( !p_pdp_context_node ) | |
425 { | |
426 TRACE_ERROR( "ERROR: PDP context not found, in function psa_smreg_pdp_activate_sec_cnf" ); | |
427 return; | |
428 } | |
429 | |
430 /* | |
431 *------------------------------------------------------------------- | |
432 * update shared parameter with new QoS and notify ACI | |
433 *------------------------------------------------------------------- | |
434 */ | |
435 p_pdp_context_node->ctrl_neg_qos = smreg_pdp_activate_sec_cnf->ctrl_qos; | |
436 memcpy( &p_pdp_context_node->neg_qos, &smreg_pdp_activate_sec_cnf->qos, sizeof(T_PS_qos) ); | |
437 | |
438 | |
439 /* | |
440 *------------------------------------------------------------------- | |
441 * notify ACI | |
442 *------------------------------------------------------------------- | |
443 */ | |
444 if( cmhSM_ActivatedSecondary( smreg_pdp_activate_sec_cnf ) < 0 ) | |
445 { | |
446 TRACE_EVENT("cmhSM( SM_NTF_ACT_SEC_CNF ) un-supported return value."); | |
447 } | |
448 /* | |
449 *------------------------------------------------------------------- | |
450 * free the primitive buffer | |
451 *------------------------------------------------------------------- | |
452 */ | |
453 PFREE( smreg_pdp_activate_sec_cnf ); | |
454 } | |
455 | |
456 | |
457 /* | |
458 +----------------------------------------------------------------------------+ | |
459 | PROJECT : UMTS MODULE : PSA_SM | | |
460 | STATE : ROUTINE : psa_smreg_pdp_activate_sec_rej | | |
461 +----------------------------------------------------------------------------+ | |
462 | |
463 PURPOSE : processes the SMREG_PDP_ACTIVATE_SEC_REJ primitive send by SM. | |
464 */ | |
465 GLOBAL void psa_smreg_pdp_activate_sec_rej( T_SMREG_PDP_ACTIVATE_SEC_REJ *smreg_pdp_activate_sec_rej ) | |
466 { | |
467 | |
468 TRACE_FUNCTION ("psa_smreg_pdp_activate_sec_rej()"); | |
469 | |
470 /* | |
471 *------------------------------------------------------------------- | |
472 * notify ACI | |
473 *------------------------------------------------------------------- | |
474 */ | |
475 if( cmhSM_NoActivateSecondary( smreg_pdp_activate_sec_rej ) < 0 ) | |
476 { | |
477 TRACE_EVENT("cmhSM( SM_NTF_ACT_SEC_REJ ) un-supported return value."); | |
478 } | |
479 /* | |
480 *------------------------------------------------------------------- | |
481 * free the primitive buffer | |
482 *------------------------------------------------------------------- | |
483 */ | |
484 PFREE( smreg_pdp_activate_sec_rej ); | |
485 } | |
486 #endif /* REL99 */ | |
487 | |
488 #endif /* GPRS */ | |
489 /*==== EOF =========================================================*/ |