comparison src/aci2/aci/psa_smp.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
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 const void psa_smreg_pdp_activate_cnf ( T_SMREG_PDP_ACTIVATE_CNF *smreg_pdp_activate_cnf )
87 {
88 T_GPRS_CONT_CLASS *pcontext = &pdp_context[work_cids[cid_pointer] - 1];
89
90 TRACE_FUNCTION ("psa_smreg_pdp_activate_cnf()");
91
92 /* update shared parameter and notify ACI */
93 pdp_context->qos.preced = smreg_pdp_activate_cnf->smreg_qos.preced;
94 pdp_context->qos.delay = smreg_pdp_activate_cnf->smreg_qos.delay;
95 pdp_context->qos.relclass = smreg_pdp_activate_cnf->smreg_qos.relclass;
96 pdp_context->qos.peak = smreg_pdp_activate_cnf->smreg_qos.peak;
97 pdp_context->qos.mean = smreg_pdp_activate_cnf->smreg_qos.mean;
98
99 if ( cmhSM_Activated(smreg_pdp_activate_cnf) < 0)
100 {
101 TRACE_EVENT("cmhSM_Activated( ) returned error.");
102 }
103
104 /* free the primitive buffer */
105 PFREE (smreg_pdp_activate_cnf);
106 }
107
108
109 /*
110 +----------------------------------------------------------------------+
111 | PROJECT : GPRS (8441) MODULE : PSA_SM |
112 | STATE : finished ROUTINE : psa_smreg_pdp_activate_rej |
113 +----------------------------------------------------------------------+
114
115 PURPOSE : processes the SMREG_PDP_ACTIVATE_REJ primitive send by SM.
116 this indicates a context activation failed.
117 */
118 GLOBAL const void psa_smreg_pdp_activate_rej ( T_SMREG_PDP_ACTIVATE_REJ *smreg_pdp_activate_rej )
119 {
120
121 TRACE_FUNCTION ("psa_smreg_pdp_activate_rej()");
122
123 /* update shared parameter and notify ACI */
124 smShrdPrm.pdp_rej = smreg_pdp_activate_rej;
125
126 if ( cmhSM_NoActivate( ) < 0)
127 {
128 TRACE_EVENT("cmhSM_NoActivate( ) returned error.");
129 }
130
131 #ifdef FF_GPF_TCPIP
132 if(is_gpf_tcpip_call())
133 {
134 T_DCM_STATUS_IND_MSG msg;
135 msg.hdr.msg_id = DCM_NEXT_CMD_STOP_MSG;
136 dcm_send_message(msg, DCM_SUB_WAIT_CGACT_CNF);
137 }
138 #endif /* FF_GPF_TCPIP */
139
140 /* free the primitive buffer */
141 PFREE (smreg_pdp_activate_rej);
142 }
143
144 /*
145 +----------------------------------------------------------------------+
146 | PROJECT : GPRS (8441) MODULE : PSA_SM |
147 | STATE : developing ROUTINE : convert_apn_to_netaddr |
148 +----------------------------------------------------------------------+
149
150 PURPOSE : converts an APN to a dotted network address
151
152 */
153 LOCAL SHORT convert_apn_to_netaddr ( T_smreg_apn *apn_src, T_smreg_apn *apn_dest)
154 {
155
156 T_smreg_apn dummy_apn = {0};
157 BYTE counter1 = 0;
158 BYTE counter2 = 0;
159 BYTE dest_pos = 0;
160 BYTE bytecount = 0;
161
162 TRACE_FUNCTION ("convert_apn_to_netaddr()");
163
164 if(apn_src==apn_dest)
165 {
166 apn_dest=&dummy_apn;
167 }
168
169 while(counter1<apn_src->c_buffer-1)
170 {
171 bytecount=apn_src->buffer[counter1];
172 for(counter2=0;counter2<bytecount;counter2++)
173 {
174 counter1++;
175 if (counter1>=apn_src->c_buffer)
176 {
177 return -1;
178 }
179 else
180 {
181 apn_dest->buffer[dest_pos]=apn_src->buffer[counter1];
182 dest_pos++;
183 }
184 }
185 if (counter1<apn_src->c_buffer-1)
186 {
187 apn_dest->buffer[dest_pos]='.';
188 dest_pos++;
189 counter1++;
190 }
191 else
192 {
193 apn_dest->buffer[dest_pos]=0;
194 }
195 }
196
197 if (apn_dest == &dummy_apn)
198 {
199 apn_dest=apn_src;
200 memcpy(apn_dest->buffer,&dummy_apn.buffer,dest_pos+1);
201 apn_dest->c_buffer=dest_pos;
202 }
203 return 0;
204 }
205 /*
206 +----------------------------------------------------------------------+
207 | PROJECT : GPRS (8441) MODULE : PSA_SM |
208 | STATE : finished ROUTINE : psa_smreg_pdp_activate_ind |
209 +----------------------------------------------------------------------+
210
211 PURPOSE : processes the SMREG_PDP_ACTIVATE_IND primitive send by SM.
212 this indicates a network asked for a PDP context activation.
213 */
214 GLOBAL const void psa_smreg_pdp_activate_ind ( T_SMREG_PDP_ACTIVATE_IND *smreg_pdp_activate_ind )
215 {
216
217 TRACE_FUNCTION ("psa_smreg_pdp_activate_ind()");
218
219 /* update shared parameter and notify ACI */
220 memcpy(&smShrdPrm.act_ind, smreg_pdp_activate_ind, sizeof(T_SMREG_PDP_ACTIVATE_IND));
221
222 convert_apn_to_netaddr(&smShrdPrm.act_ind.smreg_apn,&smShrdPrm.act_ind.smreg_apn);
223
224 cmhSM_NetActivate( );
225
226 /* free the primitive buffer */
227 PFREE (smreg_pdp_activate_ind);
228 }
229
230 /*
231 +------------------------------------------------------------------------+
232 | PROJECT : GPRS (8441) MODULE : PSA_SM |
233 | STATE : finished ROUTINE : psa_smreg_pdp_deactivate_cnf |
234 +------------------------------------------------------------------------+
235
236 PURPOSE : processes the SMREG_PDP_DEACTIVATE_CNF primitive send by SM.
237 this confirms a successful PDP context deactivation.
238 */
239 GLOBAL const void psa_smreg_pdp_deactivate_cnf
240 ( T_SMREG_PDP_DEACTIVATE_CNF *smreg_pdp_deactivate_cnf )
241 {
242
243 TRACE_FUNCTION ("psa_smreg_pdp_deactivate_cnf()");
244
245 /* update shared parameter and notify ACI */
246 smShrdPrm.nsapi_set = smreg_pdp_deactivate_cnf->nsapi_set;
247
248 cmhSM_Deactivated();
249
250 /* free the primitive buffer */
251 PFREE (smreg_pdp_deactivate_cnf);
252 }
253
254 /*
255 +------------------------------------------------------------------------+
256 | PROJECT : GPRS (8441) MODULE : PSA_SM |
257 | STATE : finished ROUTINE : psa_smreg_pdp_deactivate_ind |
258 +------------------------------------------------------------------------+
259
260 PURPOSE : processes the SMREG_PDP_DEACTIVATE_IND primitive send by SM.
261 this indicates a network initiated PDP context deactivation.
262 */
263 GLOBAL const void psa_smreg_pdp_deactivate_ind
264 ( T_SMREG_PDP_DEACTIVATE_IND *smreg_pdp_deactivate_ind )
265 {
266
267 TRACE_FUNCTION ("psa_smreg_pdp_deactivate_ind()");
268
269 /* update shared parameter and notify ACI */
270 smShrdPrm.nsapi_set = smreg_pdp_deactivate_ind->nsapi_set;
271
272 cmhSM_NetDeactivate( );
273
274 /* free the primitive buffer */
275 PFREE (smreg_pdp_deactivate_ind);
276 }
277
278 /*
279 +--------------------------------------------------------------------+
280 | PROJECT : GPRS (8441) MODULE : PSA_SM |
281 | STATE : finished ROUTINE : psa_smreg_pdp_modify_ind |
282 +--------------------------------------------------------------------+
283
284 PURPOSE : processes the SMREG_PDP_MODIFY_IND primitive send by SM.
285 this indicates a network initiated PDP context modification.
286 */
287 GLOBAL const void psa_smreg_pdp_modify_ind
288 ( T_SMREG_PDP_MODIFY_IND *smreg_pdp_modify_ind )
289 {
290
291 TRACE_FUNCTION ("psa_smreg_pdp_modify_ind()");
292
293 /*
294 *-------------------------------------------------------------------
295 * informs context manager
296 *-------------------------------------------------------------------
297 */
298
299 cmhSM_NetModify( smreg_pdp_modify_ind->nsapi_set,
300 &smreg_pdp_modify_ind->smreg_qos );
301 /*
302 *-------------------------------------------------------------------
303 * free the primitive buffer
304 *-------------------------------------------------------------------
305 */
306 PFREE (smreg_pdp_modify_ind);
307 }
308
309 #endif /* GPRS */
310 /*==== EOF =========================================================*/