comparison gsm-fw/g23m-aci/aci/aci_bat_gprs.c @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-F&D (8411)
4 | Modul : ACI_BAT
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 BAT wrapper modul is ...
18 |
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifdef GPRS
23
24 #include "aci_all.h" /* includes prim.h, which includes p_bat.h */
25 #include "aci_cmh.h" /* prototypes of sAT_,qAT_,tAT_ */
26 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */
27 #include "ati_cmd.h"
28 #include "aci_cmd.h"
29 #include "gaci_cmh.h"
30 #include "aci_bat.h"
31 #include "aci_mem.h"
32 #include "gaci.h"
33
34 /*==== VARIABLES ==================================================*/
35 EXTERN T_PDP_CONTEXT_INTERNAL *p_pdp_context_list;
36
37 extern BOOL cmhSM_isContextActive( void );
38 extern T_ATI_RSLT setatPercentCGPCO_HEX (UBYTE srcId,USHORT cid,
39 UBYTE *pco_hex_string, USHORT len);
40 extern T_ATI_RSLT setatPercentCGPCO_ASCII (UBYTE srcId, USHORT cid,
41 UBYTE *pco_ascii_string, USHORT len);
42 extern void ipaddr_to_string(ULONG ipaddr, char *ipaddr_string);
43
44
45 #define MAGIC_EMPTY_APN "\x0ff"
46 /*
47 +--------------------------------------------------------------------+
48 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
49 | STATE : code ROUTINE : sBAT_PlusCGDCONT |
50 +--------------------------------------------------------------------+
51
52 PURPOSE :
53 */
54 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGDCONT (T_ACI_DTI_PRC_PSI *src_infos_psi,
55 T_BAT_cmd_send *cmd)
56 {
57 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
58 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT ;
59 T_PDP_CONTEXT inputCtxt; /*lint !e813*/
60
61 TRACE_FUNCTION ("sBAT_PlusCGDCONT()");
62
63 memset(&inputCtxt,0,sizeof(T_PDP_CONTEXT));
64
65 cid = cmd->params.ptr_set_plus_cgdcont->cid;
66 inputCtxt.pdp_addr.ctrl_ip_address = NAS_is_ip_not_present;
67 inputCtxt.pdp_addr.ip_address.ip_not_present = BAT_PARAMETER_NOT_PRESENT;
68
69 if (cid EQ BAT_PDP_CID_NOT_PRESENT )
70 {
71 cid = (T_BAT_pdp_cid)PDP_CONTEXT_CID_OMITTED ;
72 }
73
74 switch (cmd->params.ptr_set_plus_cgdcont->pdp_type)
75 {
76 case BAT_PDP_TYPE_IPV4:
77 strcpy(inputCtxt.pdp_type, "IP");
78 if(cmd->params.ptr_set_plus_cgdcont->v_pdp_addr)
79 {
80 inputCtxt.pdp_addr.ctrl_ip_address = NAS_is_ipv4;
81 memcpy(inputCtxt.pdp_addr.ip_address.ipv4_addr.a4,cmd->params.ptr_set_plus_cgdcont->pdp_addr,cmd->params.ptr_set_plus_cgdcont->c_pdp_addr);
82 }
83 break;
84 case BAT_PDP_TYPE_IPV6:
85 strcpy(inputCtxt.pdp_type, "IPV6");
86 if(cmd->params.ptr_set_plus_cgdcont->v_pdp_addr)
87 {
88 inputCtxt.pdp_addr.ctrl_ip_address = NAS_is_ipv6;
89 memcpy(inputCtxt.pdp_addr.ip_address.ipv6_addr.a6,cmd->params.ptr_set_plus_cgdcont->pdp_addr,cmd->params.ptr_set_plus_cgdcont->c_pdp_addr);
90 }
91 break;
92 default:
93 {
94 break;
95 }
96 //return ret;
97 }
98 if(cmd->params.ptr_set_plus_cgdcont->v_apn)
99 {
100 memcpy(inputCtxt.pdp_apn,cmd->params.ptr_set_plus_cgdcont->apn,cmd->params.ptr_set_plus_cgdcont->c_apn);
101 }
102 inputCtxt.d_comp = cmd->params.ptr_set_plus_cgdcont->d_comp;
103 inputCtxt.h_comp = cmd->params.ptr_set_plus_cgdcont->h_comp;
104
105 ret = (T_ACI_BAT_RSLT) sAT_PlusCGDCONT ((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8)cid ,&inputCtxt);
106 return(ret);
107 }
108
109
110 /*
111 +--------------------------------------------------------------------+
112 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
113 | STATE : code ROUTINE : qBAT_PlusCGDCONT |
114 +--------------------------------------------------------------------+
115
116 PURPOSE :
117 */
118 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGDCONT (T_ACI_DTI_PRC_PSI *src_infos_psi,
119 T_BAT_cmd_send *cmd)
120 {
121 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
122 T_BAT_cmd_response resp;
123 T_BAT_res_que_plus_cgdcont que_cgdcont_buffer; /*lint !e813*/
124 T_PDP_CONTEXT defCtxts[PDP_CONTEXT_CID_MAX]; /*lint !e813*/
125 SHORT cid_array[PDP_CONTEXT_CID_MAX];
126 U8 i ;
127
128 TRACE_FUNCTION ("qBAT_PlusCGDCONT()");
129 resp.ctrl_response = BAT_RES_QUE_PLUS_CGDCONT;
130 resp.response.ptr_que_plus_cgdcont = &que_cgdcont_buffer;
131
132 ret = (T_ACI_BAT_RSLT)qAT_PlusCGDCONT ((T_ACI_CMD_SRC)src_infos_psi->srcId, defCtxts, cid_array);
133
134 if (ret EQ ACI_BAT_CMPL)
135 {
136 for ( i = 0; i < PDP_CONTEXT_CID_MAX AND cid_array[i] NEQ PDP_CONTEXT_CID_OMITTED; i++ )
137 {
138 que_cgdcont_buffer.cid = (T_BAT_pdp_cid)cid_array[i];
139 if(!(utl_strcasecmp((const char *)defCtxts[i].pdp_type, (const char *)"ip")))
140 {
141 que_cgdcont_buffer.pdp_type = BAT_PDP_TYPE_IPV4;
142 memcpy(que_cgdcont_buffer.pdp_addr,defCtxts[i].pdp_addr.ip_address.ipv4_addr.a4,NAS_SIZE_IPv4_ADDR);
143 que_cgdcont_buffer.c_pdp_addr = NAS_SIZE_IPv4_ADDR;
144 }
145
146 else if(!(utl_strcasecmp((const char *)defCtxts[i].pdp_type, (const char *)"ipv6")))
147 {
148 que_cgdcont_buffer.pdp_type = BAT_PDP_TYPE_IPV6;
149 memcpy(que_cgdcont_buffer.pdp_addr,defCtxts[i].pdp_addr.ip_address.ipv6_addr.a6,NAS_SIZE_IPv6_ADDR);
150 que_cgdcont_buffer.c_pdp_addr = NAS_SIZE_IPv6_ADDR;
151 }
152 else
153 {
154 que_cgdcont_buffer.pdp_type = BAT_PDP_TYPE_NOT_PRESENT;
155 }
156
157 que_cgdcont_buffer.c_apn = strlen(defCtxts[i].pdp_apn);
158 memcpy(que_cgdcont_buffer.apn,defCtxts[i].pdp_apn,strlen(defCtxts[i].pdp_apn));
159 que_cgdcont_buffer.d_comp = (T_BAT_plus_cgdcont_d_comp)defCtxts[i].d_comp;
160 que_cgdcont_buffer.h_comp = (T_BAT_plus_cgdcont_h_comp)defCtxts[i].h_comp;
161 aci_bat_send(src_infos_psi,&resp);
162 }
163 return ACI_BAT_CMPL;
164 }
165 return(ret);
166 }
167
168
169 #ifdef REL99
170 /*
171 +--------------------------------------------------------------------+
172 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
173 | STATE : code ROUTINE : sBAT_PlusCGCMOD |
174 +--------------------------------------------------------------------+
175
176 PURPOSE :
177 */
178 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGCMOD (T_ACI_DTI_PRC_PSI *src_infos_psi,
179 T_BAT_cmd_send *cmd)
180 {
181 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
182 SHORT count = 0;
183 U8 cid_array[PDP_CONTEXT_CID_MAX];
184
185 TRACE_FUNCTION ("sBAT_PlusCGCMOD()");
186
187 if(cmd->params.ptr_set_plus_cgact->c_cid EQ 0)
188 cid_array[0] = PDP_CONTEXT_CID_INVALID;
189 for(count=0;count<cmd->params.ptr_set_plus_cgact->c_cid;count++)
190 {
191 cid_array[count] = (cmd->params.ptr_set_plus_cgact->cid[count] EQ BAT_PDP_CID_NOT_PRESENT)
192 ? PDP_CONTEXT_CID_INVALID : cmd->params.ptr_set_plus_cgact->cid[count];
193 }
194 if(count > 0)
195 cid_array[count]= PDP_CONTEXT_CID_INVALID;
196 ret = (T_ACI_BAT_RSLT) sAT_PlusCGCMOD ((T_ACI_CMD_SRC) src_infos_psi->srcId, cid_array );
197 return(ret);
198 }
199
200 /*
201 +--------------------------------------------------------------------+
202 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
203 | STATE : code ROUTINE : sBAT_PlusCGDSCONT |
204 +--------------------------------------------------------------------+
205
206 PURPOSE :
207 */
208 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGDSCONT (T_ACI_DTI_PRC_PSI *src_infos_psi,
209 T_BAT_cmd_send *cmd)
210 {
211 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
212 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT;
213 T_PDP_CONTEXT inputCtxt; /*lint !e813*/
214
215 TRACE_FUNCTION ("sBAT_PlusCGDSCONT()");
216
217 memset(&inputCtxt,0,sizeof(T_PDP_CONTEXT));
218
219 cid = cmd->params.ptr_set_plus_cgdscont->cid;
220 inputCtxt.p_cid = cmd->params.ptr_set_plus_cgdscont->p_cid;
221
222 if (cid EQ BAT_PDP_CID_NOT_PRESENT )
223 {
224 cid = (T_BAT_pdp_cid)PDP_CONTEXT_CID_OMITTED;
225 }
226
227 if (cmd->params.ptr_set_plus_cgdscont->p_cid EQ (U8)BAT_PDP_CID_NOT_PRESENT )
228 // if (inputCtxt.p_cid EQ (U8)BAT_PDP_CID_NOT_PRESENT )
229 {
230 inputCtxt.p_cid = PDP_CONTEXT_CID_OMITTED;
231 }
232
233 inputCtxt.d_comp = cmd->params.ptr_set_plus_cgdscont->d_comp;
234 inputCtxt.h_comp = cmd->params.ptr_set_plus_cgdscont->h_comp;
235
236 ret =(T_ACI_BAT_RSLT) sAT_PlusCGDSCONT ((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8)cid ,&inputCtxt);
237 if(ret EQ ACI_BAT_CMPL)
238 {
239 return ACI_BAT_CMPL;
240 }
241 return(ret);
242 }
243
244 /*
245 +--------------------------------------------------------------------+
246 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
247 | STATE : code ROUTINE : qBAT_PlusCGDSCONT |
248 +--------------------------------------------------------------------+
249
250 PURPOSE :
251 */
252 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGDSCONT (T_ACI_DTI_PRC_PSI *src_infos_psi,
253 T_BAT_cmd_send *cmd)
254 {
255 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
256 T_BAT_cmd_response resp;
257 T_PDP_CONTEXT pdp_context_array[PDP_CONTEXT_CID_MAX];
258 U8 pdp_context_cid_array[PDP_CONTEXT_CID_MAX];
259 int i;
260
261 TRACE_FUNCTION("qBAT_PlusCGDSCONT()");
262 resp.ctrl_response = BAT_RES_QUE_PLUS_CGDSCONT;
263
264 memset( pdp_context_cid_array, 0, sizeof(pdp_context_cid_array) );
265 memset( pdp_context_array, 0, sizeof(pdp_context_array) );
266
267 ret = (T_ACI_BAT_RSLT) qAT_PlusCGDSCONT((T_ACI_CMD_SRC)src_infos_psi->srcId, pdp_context_array, pdp_context_cid_array);
268
269 if (ret EQ ACI_BAT_CMPL)
270 {
271 for ( i = 0; i < PDP_CONTEXT_CID_MAX AND pdp_context_cid_array[i] NEQ PDP_CONTEXT_CID_OMITTED; i++ )
272 {
273 resp.response.ptr_que_plus_cgdscont->cid = (T_BAT_pdp_cid)pdp_context_cid_array[i];
274 resp.response.ptr_que_plus_cgdscont->p_cid = (U8)pdp_context_array[i].p_cid;
275 resp.response.ptr_que_plus_cgdscont->d_comp = (T_BAT_plus_cgdcont_d_comp)pdp_context_array[i].d_comp;
276 resp.response.ptr_que_plus_cgdscont->h_comp = (T_BAT_plus_cgdcont_h_comp)pdp_context_array[i].h_comp;
277
278 aci_bat_send(src_infos_psi,&resp);
279 }
280 return ACI_BAT_CMPL;
281 }
282 return ret;
283 }
284
285
286 /*
287 +--------------------------------------------------------------------+
288 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
289 | STATE : code ROUTINE : sBAT_PlusCGTFT |
290 +--------------------------------------------------------------------+
291
292 PURPOSE :
293 */
294 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGTFT (T_ACI_DTI_PRC_PSI *src_infos_psi,
295 T_BAT_cmd_send *cmd)
296 {
297 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
298 T_NAS_tft_pf tft_pf_input;
299 T_BAT_cmd_set_plus_cgtft *cgtft_prm;
300
301 TRACE_FUNCTION ("sBAT_PlusCGTFT()");
302
303 memset( &tft_pf_input, 0x00, sizeof(T_NAS_tft_pf) );
304 cgtft_prm = cmd->params.ptr_set_plus_cgtft;
305
306 /* cid */
307 if (cgtft_prm->cid EQ BAT_PDP_CID_NOT_PRESENT)
308 {
309 cmdCmeError(CME_ERR_OpNotAllow);
310 return (ACI_BAT_FAIL);
311 }
312
313 /* pf id, precedence */
314 if ((cgtft_prm->tft_pf_id >= BAT_MIN_TFT_PF_ID) AND
315 (cgtft_prm->tft_pf_id <= BAT_MAX_TFT_PF_ID))
316 {
317 tft_pf_input.tft_pf_id = (U8)cgtft_prm->tft_pf_id;
318 /* precedence has to be present in case of valid pf id */
319 if ( cgtft_prm->tft_pf_precedence >= BAT_MAX_TFT_PRECEDENCE )
320 {
321 cmdCmeError(CME_ERR_OpNotAllow);
322 return (ACI_BAT_FAIL);
323 }
324 tft_pf_input.tft_pf_precedence = (U8)cgtft_prm->tft_pf_precedence;
325 }
326 else
327 {
328 tft_pf_input.tft_pf_id = (U8)-1;
329 tft_pf_input.tft_pf_precedence = (U8)-1;// valid val (more suspicious than 0)
330 }
331
332 /* addr_n_mask */
333 if( cgtft_prm->v_addr_n_mask AND cgtft_prm->c_addr_n_mask )
334 {
335 /* IP4 addr_n_mask */
336 if( cgtft_prm->c_addr_n_mask EQ 8)
337 {
338 tft_pf_input.ctrl_tft_pf_entry = NAS_is_tft_pf_ipv4;
339 memcpy(tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_ipv4_src_addr_mask.tft_ipv4_addr,
340 cgtft_prm->addr_n_mask,
341 NAS_SIZE_IPv4_ADDR);
342 memcpy(tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_ipv4_src_addr_mask.tft_ipv4_mask,
343 cgtft_prm->addr_n_mask+NAS_SIZE_IPv4_ADDR,
344 NAS_SIZE_IPv4_ADDR);
345
346 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_IPv4_SRC_ADDR_MASK;
347 }
348
349 /* IP6 addr_n_mask */
350 else if( cgtft_prm->c_addr_n_mask EQ 32)
351 {
352 tft_pf_input.ctrl_tft_pf_entry = NAS_is_tft_pf_ipv6;
353 memcpy(tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_ipv6_src_addr_mask.tft_ipv6_addr,
354 cgtft_prm->addr_n_mask,
355 NAS_SIZE_IPv6_ADDR);
356 memcpy(tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_ipv6_src_addr_mask.tft_ipv6_mask,
357 cgtft_prm->addr_n_mask+NAS_SIZE_IPv6_ADDR,
358 NAS_SIZE_IPv6_ADDR);
359
360 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_IPv6_SRC_ADDR_MASK;
361 }
362 else
363 {
364 cmdCmeError(CME_ERR_OpNotAllow);
365 return (ACI_BAT_FAIL);
366 }
367 }
368 else
369 {
370 /* The following does not make sense according 27.007:
371 if addr_n_mask isn't present, flow label isn't present either,
372 but +CGTFT behaviour should not change */
373 if ( cgtft_prm->flow_label > BAT_MAX_TFT_FLOW_LABEL )
374 {
375 /* IP v4 type */
376 tft_pf_input.ctrl_tft_pf_entry = NAS_is_tft_pf_ipv4;
377 }
378 else
379 {
380 /* IP v6 type */
381 tft_pf_input.ctrl_tft_pf_entry = NAS_is_tft_pf_ipv6;
382 }
383 }
384
385 switch( tft_pf_input.ctrl_tft_pf_entry )
386 {
387 /*** IP v4 prmeters */
388 case NAS_is_tft_pf_ipv4:
389 {
390 /* Protocol number */
391 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_protocol =
392 (U8)cgtft_prm->prt_num_or_nxt_hd;
393 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_PROTOCOL_OR_NEXT_HDR;
394
395
396 /* Destination port */
397 if( cgtft_prm->v_dest_port_range AND cgtft_prm->c_dest_port_range)
398 {
399 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_dest_port_range.low_limit =
400 cgtft_prm->dest_port_range[0];
401 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_dest_port_range.high_limit =
402 cgtft_prm->dest_port_range[1];
403 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_DEST_PORT_RANGE;
404 }
405
406 /* Source port */
407 if( cgtft_prm->v_src_port_range AND cgtft_prm->c_src_port_range)
408 {
409 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_src_port_range.low_limit =
410 cgtft_prm->src_port_range[0];
411 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_src_port_range.high_limit =
412 cgtft_prm->src_port_range[1];
413 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_SRC_PORT_RANGE;
414 }
415
416 /* IPSEC security parameter spi */
417 /* valid val=[0..ffffffff] -> no way to find out if parameter was
418 omitted, but can't change BAT interface for PlusCGTFT -> open issue */
419 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_ipsec_spi = cgtft_prm->ipsec_spi;
420 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_IPSEC_SPI;
421
422 /* Type of service and mask */
423 if( cgtft_prm->v_tos_mask_or_tc_mask AND cgtft_prm->c_tos_mask_or_tc_mask )
424 {
425 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_tos_and_mask.tos_value =
426 cgtft_prm->tos_mask_or_tc_mask[0];
427 tft_pf_input.tft_pf_entry.tft_pf_ipv4.tft_tos_and_mask.tos_mask =
428 cgtft_prm->tos_mask_or_tc_mask[1];
429 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_TOS_AND_MASK;
430 }
431
432 break;
433
434 } /* END: case NAS_is_tft_pf_ipv4 */
435
436 /*** IP v6 parameters ***/
437 case NAS_is_tft_pf_ipv6:
438 {
439 /* Next header */
440 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_next_hdr =
441 (U8)cgtft_prm->prt_num_or_nxt_hd;
442 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_PROTOCOL_OR_NEXT_HDR;
443
444 /* Destination port */
445 if( cgtft_prm->v_dest_port_range AND cgtft_prm->c_dest_port_range)
446 {
447 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_dest_port_range.low_limit =
448 cgtft_prm->dest_port_range[0];
449 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_dest_port_range.high_limit =
450 cgtft_prm->dest_port_range[1];
451 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_DEST_PORT_RANGE;
452 }
453
454 /* Source port */
455 if( cgtft_prm->v_src_port_range AND cgtft_prm->c_src_port_range)
456 {
457 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_src_port_range.low_limit =
458 cgtft_prm->src_port_range[0];
459 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_src_port_range.high_limit =
460 cgtft_prm->src_port_range[1];
461 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_SRC_PORT_RANGE;
462 }
463
464 /* IPSEC security parameter spi */
465 /* valid val=[0..ffffffff] -> no way to find out if parameter was
466 omitted, but can't change BAT interface for PlusCGTFT -> open issue */
467 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_ipsec_spi = cgtft_prm->ipsec_spi;
468 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_IPSEC_SPI;
469
470 /* Type of service and mask */
471 if( cgtft_prm->v_tos_mask_or_tc_mask AND cgtft_prm->c_tos_mask_or_tc_mask )
472 {
473 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_tos_and_mask.tos_value =
474 cgtft_prm->tos_mask_or_tc_mask[0];
475 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_tos_and_mask.tos_mask =
476 cgtft_prm->tos_mask_or_tc_mask[1];
477 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_TOS_AND_MASK;
478 }
479
480 /* Flow label */
481 if (cgtft_prm->flow_label <= BAT_MAX_TFT_FLOW_LABEL)
482 {
483 tft_pf_input.tft_pf_entry.tft_pf_ipv6.tft_flow_label = cgtft_prm->flow_label;
484 tft_pf_input.tft_pf_valid_bits |= NAS_TFT_ID_FLOW_LABEL;
485 }
486
487 break;
488 } /* END: case NAS_is_tft_pf_ipv6 */
489
490 default:
491 {
492 cmdCmeError(CME_ERR_OpNotAllow);
493 return (ACI_BAT_FAIL);
494 }
495 } /* END: switch( tft_pf_input.ctrl_tft_pf_entry ) */
496
497 ret = (T_ACI_BAT_RSLT) sAT_PlusCGTFT ((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8)cgtft_prm->cid, &tft_pf_input);
498
499 switch( ret )
500 {
501 case (ACI_BAT_CMPL): /* Operation completed */
502 case (ACI_BAT_EXCT): /* Operation in progress */
503 return ret;
504 default:
505 cmdCmeError(CME_ERR_Unknown); /* Command failed */
506 return (ACI_BAT_FAIL);
507 }
508 }
509
510 /*
511 +--------------------------------------------------------------------+
512 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
513 | STATE : code ROUTINE : qBAT_PlusCGTFT |
514 +--------------------------------------------------------------------+
515
516 PURPOSE :
517 */
518 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGTFT (T_ACI_DTI_PRC_PSI *src_infos_psi,
519 T_BAT_cmd_send *cmd)
520 {
521 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
522 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL;
523 T_TFT_INTERNAL *p_tft_pf_node = NULL;
524 U8 pdp_context_cid_array[PDP_CONTEXT_CID_MAX];
525 T_BAT_cmd_response resp;
526 T_BAT_res_que_plus_cgtft que_cgtft_buffer;
527 int i;
528
529 TRACE_FUNCTION("qBAT_PlusCGTFT()");
530 resp.ctrl_response = BAT_RES_QUE_PLUS_CGTFT;
531 resp.response.ptr_que_plus_cgtft = &que_cgtft_buffer;
532
533 memset( &pdp_context_cid_array, PDP_CONTEXT_CID_OMITTED, sizeof(pdp_context_cid_array) );
534 ret = (T_ACI_BAT_RSLT) qAT_PlusCGTFT((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8*) &pdp_context_cid_array[0]);
535
536 if (ret EQ ACI_BAT_CMPL)
537 {
538 for ( i = 0; i < PDP_CONTEXT_CID_MAX AND pdp_context_cid_array[i] NEQ PDP_CONTEXT_CID_OMITTED; i++ )
539 {
540 p_pdp_context_node = pdp_context_find_node_from_cid( pdp_context_cid_array[i] );
541 p_tft_pf_node = p_pdp_context_node->p_tft_pf;
542
543 while( p_tft_pf_node )
544 {
545 memset(&que_cgtft_buffer, 0,sizeof(T_BAT_res_que_plus_cgtft));
546 que_cgtft_buffer.cid = (T_BAT_pdp_cid)pdp_context_cid_array[i];
547 que_cgtft_buffer.tft_pf_id = p_tft_pf_node->pf_attributes.tft_pf_id;
548 que_cgtft_buffer.tft_pf_precedence = p_tft_pf_node->pf_attributes.tft_pf_precedence;
549
550 switch( p_tft_pf_node->pf_attributes.ctrl_tft_pf_entry )
551 {
552 case NAS_is_tft_pf_ipv4:
553 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_IPv4_SRC_ADDR_MASK )
554 {
555 que_cgtft_buffer.v_addr_n_mask = TRUE;
556 que_cgtft_buffer.c_addr_n_mask = 8;
557 memcpy(que_cgtft_buffer.addr_n_mask, p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_ipv4_src_addr_mask.tft_ipv4_addr,que_cgtft_buffer.c_addr_n_mask);
558 }
559 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_PROTOCOL_OR_NEXT_HDR )
560 {
561 que_cgtft_buffer.prt_num_or_nxt_hd = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_protocol;
562 }
563 else
564 {
565 que_cgtft_buffer.prt_num_or_nxt_hd = (U8)TFT_PROT_OR_NXT_HDR_INVALID;
566 }
567 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_DEST_PORT_RANGE )
568 {
569 que_cgtft_buffer.c_dest_port_range = 2;
570 que_cgtft_buffer.dest_port_range[0] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_dest_port_range.low_limit;
571 que_cgtft_buffer.dest_port_range[1] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_dest_port_range.high_limit;
572 }
573 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_SRC_PORT_RANGE )
574 {
575 que_cgtft_buffer.c_src_port_range = 2;
576 que_cgtft_buffer.src_port_range[0] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_src_port_range.low_limit;
577 que_cgtft_buffer.src_port_range[1] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_src_port_range.high_limit;
578 }
579 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_IPSEC_SPI )
580 {
581 que_cgtft_buffer.ipsec_spi = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_ipsec_spi;
582 }
583 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_TOS_AND_MASK )
584 {
585 que_cgtft_buffer.c_tos_mask_or_tc_mask = 2;
586 que_cgtft_buffer.tos_mask_or_tc_mask[0] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_tos_and_mask.tos_value;
587 que_cgtft_buffer.tos_mask_or_tc_mask[1] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv4.tft_tos_and_mask.tos_mask;
588 }
589 que_cgtft_buffer.flow_label = (U8)TFT_FLOW_LABEL_INVALID;
590 break;
591
592 case NAS_is_tft_pf_ipv6:
593 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_IPv6_SRC_ADDR_MASK )
594 {
595 que_cgtft_buffer.v_addr_n_mask = TRUE;
596 que_cgtft_buffer.c_addr_n_mask = 32;
597 memcpy(que_cgtft_buffer.addr_n_mask, p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_ipv6_src_addr_mask.tft_ipv6_addr,que_cgtft_buffer.c_addr_n_mask);
598 }
599 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_PROTOCOL_OR_NEXT_HDR )
600 {
601 que_cgtft_buffer.prt_num_or_nxt_hd = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_next_hdr;
602 }
603 else
604 {
605 que_cgtft_buffer.prt_num_or_nxt_hd = (U8)TFT_PROT_OR_NXT_HDR_INVALID;
606 }
607 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_DEST_PORT_RANGE )
608 {
609 que_cgtft_buffer.c_dest_port_range = 2;
610 que_cgtft_buffer.dest_port_range[0] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_dest_port_range.low_limit;
611 que_cgtft_buffer.dest_port_range[1] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_dest_port_range.high_limit;
612 }
613 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_SRC_PORT_RANGE )
614 {
615 que_cgtft_buffer.c_src_port_range = 2;
616 que_cgtft_buffer.src_port_range[0] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_src_port_range.low_limit;
617 que_cgtft_buffer.src_port_range[1] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_src_port_range.high_limit;
618 }
619 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_IPSEC_SPI )
620 {
621 que_cgtft_buffer.ipsec_spi = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_ipsec_spi;
622 }
623 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_TOS_AND_MASK )
624 {
625 que_cgtft_buffer.c_tos_mask_or_tc_mask = 2;
626 que_cgtft_buffer.tos_mask_or_tc_mask[0] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_tos_and_mask.tos_value;
627 que_cgtft_buffer.tos_mask_or_tc_mask[1] = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_tos_and_mask.tos_mask;
628 }
629 if( p_tft_pf_node->pf_attributes.tft_pf_valid_bits & NAS_TFT_ID_FLOW_LABEL )
630 {
631 que_cgtft_buffer.flow_label = p_tft_pf_node->pf_attributes.tft_pf_entry.tft_pf_ipv6.tft_flow_label;
632 }
633 else
634 {
635 que_cgtft_buffer.flow_label = (U8)TFT_FLOW_LABEL_INVALID;
636 }
637 break;
638 }
639 aci_bat_send(src_infos_psi,&resp);
640
641 p_tft_pf_node = p_tft_pf_node->p_next;
642 }
643 }
644 }
645 else
646 {
647 return (ret);
648 }
649 return ACI_BAT_CMPL;
650 }
651
652 /*
653 +--------------------------------------------------------------------+
654 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
655 | STATE : code ROUTINE : sBAT_PlusCGEQREQ |
656 +--------------------------------------------------------------------+
657
658 PURPOSE :
659 */
660 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGEQREQ (T_ACI_DTI_PRC_PSI *src_infos_psi,
661 T_BAT_cmd_send *cmd)
662 {
663 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
664 T_PS_qos input_qos;
665 U8 cid = PDP_CONTEXT_CID_OMITTED;
666
667 TRACE_FUNCTION ("sBAT_PlusCGEQREQ()");
668
669 input_qos.qos_r99.tc = QOS_R99_TC_OMITTED;
670 input_qos.qos_r99.order = QOS_R99_ORDER_OMITTED;
671 input_qos.qos_r99.del_err_sdu = QOS_R99_DEL_ERR_SDU_OMITTED;
672 input_qos.qos_r99.max_sdu = QOS_R99_MAX_SDU_OMITTED;
673 input_qos.qos_r99.max_rate_ul = QOS_R99_MAX_BR_UL_OMITTED;
674 input_qos.qos_r99.max_rate_dl = QOS_R99_MAX_BR_DL_OMITTED;
675 input_qos.qos_r99.xfer_delay = QOS_R99_XFER_DELAY_OMITTED;
676 input_qos.qos_r99.handling_pri = QOS_R99_HANDLING_PRIO_OMITTED;
677 input_qos.qos_r99.guar_br_ul = QOS_R99_GUAR_BR_UL_OMITTED;
678 input_qos.qos_r99.guar_br_dl = QOS_R99_GUAR_BR_DL_OMITTED;
679 input_qos.qos_r99.ber.ratio_mant = QOS_R99_RATIO_MANT_OMITTED; /* Residual bit error ratio */
680 input_qos.qos_r99.ber.ratio_exp = QOS_R99_RATIO_EXP_OMITTED;
681 input_qos.qos_r99.sdu_err_ratio.ratio_mant = QOS_R99_RATIO_MANT_OMITTED;
682 input_qos.qos_r99.sdu_err_ratio.ratio_exp = QOS_R99_RATIO_EXP_OMITTED;
683
684 if (cmd->params.ptr_set_plus_cgeqreq->cid NEQ BAT_PDP_CID_NOT_PRESENT)
685 cid = cmd->params.ptr_set_plus_cgeqreq->cid;
686 if (cmd->params.ptr_set_plus_cgeqreq->tc NEQ NOT_PRESENT_8BIT)
687 input_qos.qos_r99.tc = cmd->params.ptr_set_plus_cgeqreq->tc;
688 if (cmd->params.ptr_set_plus_cgeqreq->order NEQ NOT_PRESENT_8BIT)
689 input_qos.qos_r99.order = cmd->params.ptr_set_plus_cgeqreq->order;
690 if (cmd->params.ptr_set_plus_cgeqreq->del_err_sdu NEQ NOT_PRESENT_8BIT)
691 input_qos.qos_r99.del_err_sdu = cmd->params.ptr_set_plus_cgeqreq->del_err_sdu;
692 if (cmd->params.ptr_set_plus_cgeqreq->max_sdu NEQ NOT_PRESENT_16BIT)
693 input_qos.qos_r99.max_sdu = (U16)cmd->params.ptr_set_plus_cgeqreq->max_sdu;
694 if (cmd->params.ptr_set_plus_cgeqreq->max_rate_ul NEQ NOT_PRESENT_16BIT)
695 input_qos.qos_r99.max_rate_ul = (U16)cmd->params.ptr_set_plus_cgeqreq->max_rate_ul;
696 if (cmd->params.ptr_set_plus_cgeqreq->max_rate_dl NEQ NOT_PRESENT_16BIT)
697 input_qos.qos_r99.max_rate_dl = (U16)cmd->params.ptr_set_plus_cgeqreq->max_rate_dl;
698 if (cmd->params.ptr_set_plus_cgeqreq->xfer_delay NEQ NOT_PRESENT_16BIT)
699 input_qos.qos_r99.xfer_delay = (U16)cmd->params.ptr_set_plus_cgeqreq->xfer_delay;
700 if (cmd->params.ptr_set_plus_cgeqreq->handling_pri NEQ NOT_PRESENT_8BIT)
701 input_qos.qos_r99.handling_pri = (U8)cmd->params.ptr_set_plus_cgeqreq->handling_pri;
702 if (cmd->params.ptr_set_plus_cgeqreq->guar_br_ul NEQ NOT_PRESENT_16BIT)
703 input_qos.qos_r99.guar_br_ul = (U16)cmd->params.ptr_set_plus_cgeqreq->guar_br_ul;
704 if (cmd->params.ptr_set_plus_cgeqreq->guar_br_dl NEQ NOT_PRESENT_16BIT)
705 input_qos.qos_r99.guar_br_dl = (U16)cmd->params.ptr_set_plus_cgeqreq->guar_br_dl;
706 if (cmd->params.ptr_set_plus_cgeqreq->c_ber NEQ 0)
707 {
708 input_qos.qos_r99.ber.ratio_mant = cmd->params.ptr_set_plus_cgeqreq->ber[0];
709 input_qos.qos_r99.ber.ratio_exp = cmd->params.ptr_set_plus_cgeqreq->ber[1];
710 }
711 if (cmd->params.ptr_set_plus_cgeqreq->c_sdu_err_ratio NEQ 0)
712 {
713 input_qos.qos_r99.sdu_err_ratio.ratio_mant = cmd->params.ptr_set_plus_cgeqreq->sdu_err_ratio[0];
714 input_qos.qos_r99.sdu_err_ratio.ratio_exp = cmd->params.ptr_set_plus_cgeqreq->sdu_err_ratio[1];
715 }
716
717
718 ret = (T_ACI_BAT_RSLT)sAT_PlusCGEQREQ ((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8)cid, &input_qos);
719 return(ret);
720 }
721
722 /*
723 +--------------------------------------------------------------------+
724 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
725 | STATE : code ROUTINE : qBAT_PlusCGEQREQ |
726 +--------------------------------------------------------------------+
727
728 PURPOSE :
729 */
730 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGEQREQ (T_ACI_DTI_PRC_PSI *src_infos_psi,
731 T_BAT_cmd_send *cmd)
732 {
733 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
734 T_BAT_cmd_response resp;
735 T_BAT_res_que_plus_cgeqreq que_cgeqreq_buffer;
736 T_PS_qos pdef_qos;
737 U8 cid;
738 BOOL qos_valid = FALSE;
739
740 TRACE_FUNCTION ("qBAT_PlusCGEQREQ()");
741
742 resp.ctrl_response = BAT_RES_QUE_PLUS_CGEQREQ;
743 resp.response.ptr_que_plus_cgeqreq = &que_cgeqreq_buffer;
744
745 for ( cid = PDP_CONTEXT_CID_MIN; cid <= PDP_CONTEXT_CID_MAX; cid++ )
746 {
747 ret = (T_ACI_BAT_RSLT) qAT_PlusCGEQREQ ((T_ACI_CMD_SRC)src_infos_psi->srcId, cid, &qos_valid, &pdef_qos);
748 if (ret EQ ACI_BAT_CMPL AND qos_valid)
749 {
750 que_cgeqreq_buffer.cid = (T_BAT_pdp_cid)cid;
751 que_cgeqreq_buffer.tc = pdef_qos.qos_r99.tc;
752 que_cgeqreq_buffer.order = pdef_qos.qos_r99.order;
753 que_cgeqreq_buffer.del_err_sdu = pdef_qos.qos_r99.del_err_sdu;
754 que_cgeqreq_buffer.max_sdu = pdef_qos.qos_r99.max_sdu;
755 que_cgeqreq_buffer.max_rate_ul = pdef_qos.qos_r99.max_rate_ul;
756 que_cgeqreq_buffer.max_rate_dl = pdef_qos.qos_r99.max_rate_dl;
757 que_cgeqreq_buffer.xfer_delay = pdef_qos.qos_r99.xfer_delay;
758 que_cgeqreq_buffer.handling_pri = pdef_qos.qos_r99.handling_pri;
759 que_cgeqreq_buffer.guar_br_ul = pdef_qos.qos_r99.guar_br_ul;
760 que_cgeqreq_buffer.guar_br_dl = pdef_qos.qos_r99.guar_br_dl;
761 que_cgeqreq_buffer.ber[0] = pdef_qos.qos_r99.ber.ratio_mant;
762 que_cgeqreq_buffer.ber[1] = pdef_qos.qos_r99.ber.ratio_exp;
763 que_cgeqreq_buffer.sdu_err_ratio[0] = pdef_qos.qos_r99.sdu_err_ratio.ratio_mant;
764 que_cgeqreq_buffer.sdu_err_ratio[1] = pdef_qos.qos_r99.sdu_err_ratio.ratio_exp;
765 aci_bat_send(src_infos_psi,&resp);
766 }
767 else
768 return ret;
769 }
770 return ACI_BAT_CMPL;
771 }
772
773 /*
774 +--------------------------------------------------------------------+
775 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
776 | STATE : code ROUTINE : sBAT_PlusCGEQNEG |
777 +--------------------------------------------------------------------+
778
779 PURPOSE :
780 */
781 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGEQNEG (T_ACI_DTI_PRC_PSI *src_infos_psi,
782 T_BAT_cmd_send *cmd)
783 {
784 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
785 T_BAT_res_que_plus_cgeqneg que_cgeqneg_buffer;
786 T_BAT_cmd_response resp;
787 T_PS_qos pdef_qos;
788 BOOL qos_valid;
789 U8 *cid_array;
790 U8 current_cid;
791 int no_of_cids, i;
792
793 TRACE_FUNCTION ("sBAT_PlusCGEQNEG()");
794
795 resp.ctrl_response = BAT_RES_QUE_PLUS_CGEQNEG;
796 resp.response.ptr_que_plus_cgeqneg = &que_cgeqneg_buffer;
797
798 no_of_cids = cmd->params.ptr_set_plus_cgeqneg->c_cid;
799 cid_array = (U8*)cmd->params.ptr_set_plus_cgeqneg->cid;
800
801 /* Calculate number of cids: If the first cid is omitted it is treated as all cids. */
802 if (cid_array[0] EQ PDP_CONTEXT_CID_OMITTED)
803 no_of_cids = PDP_CONTEXT_CID_MAX;
804
805 for(i = 0; i<no_of_cids; i++)
806 {
807 /* If the first cid is omitted it is treated as all cids */
808 if (cid_array[0] EQ PDP_CONTEXT_CID_OMITTED)
809 current_cid = i+1;
810 else
811 current_cid = cid_array[i];
812
813 ret = (T_ACI_BAT_RSLT) sAT_PlusCGEQNEG ((T_ACI_CMD_SRC) src_infos_psi->srcId, current_cid, &qos_valid, &pdef_qos);
814
815 if (ret EQ ACI_BAT_CMPL)
816 {
817 if (qos_valid)
818 {
819 que_cgeqneg_buffer.cid = (T_BAT_pdp_cid)cid_array[i];
820 que_cgeqneg_buffer.tc = (U8)pdef_qos.qos_r99.tc;
821 que_cgeqneg_buffer.order = pdef_qos.qos_r99.order;
822 que_cgeqneg_buffer.del_err_sdu = pdef_qos.qos_r99.del_err_sdu;
823 que_cgeqneg_buffer.max_sdu = pdef_qos.qos_r99.max_sdu;
824 que_cgeqneg_buffer.max_rate_ul = pdef_qos.qos_r99.max_rate_ul;
825 que_cgeqneg_buffer.max_rate_dl = pdef_qos.qos_r99.max_rate_dl;
826 que_cgeqneg_buffer.xfer_delay = pdef_qos.qos_r99.xfer_delay;
827 que_cgeqneg_buffer.handling_pri = pdef_qos.qos_r99.handling_pri;
828 que_cgeqneg_buffer.guar_br_ul = pdef_qos.qos_r99.guar_br_ul;
829 que_cgeqneg_buffer.guar_br_dl = pdef_qos.qos_r99.guar_br_dl;
830 que_cgeqneg_buffer.ber[0] = pdef_qos.qos_r99.ber.ratio_mant;
831 que_cgeqneg_buffer.ber[1] = pdef_qos.qos_r99.ber.ratio_exp;
832 que_cgeqneg_buffer.sdu_err_ratio[0] = pdef_qos.qos_r99.sdu_err_ratio.ratio_mant;
833 que_cgeqneg_buffer.sdu_err_ratio[1] = pdef_qos.qos_r99.sdu_err_ratio.ratio_exp;
834
835 aci_bat_send(src_infos_psi,&resp);
836 }
837 }
838 else
839 return ret;
840 }
841 return ACI_BAT_CMPL;
842 }
843
844 /*
845 +--------------------------------------------------------------------+
846 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
847 | STATE : code ROUTINE : sBAT_PlusCGEQMIN |
848 +--------------------------------------------------------------------+
849
850 PURPOSE :
851 */
852 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGEQMIN (T_ACI_DTI_PRC_PSI *src_infos_psi,
853 T_BAT_cmd_send *cmd)
854 {
855 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
856 T_PS_qos input_qos;
857 U8 cid;
858
859 TRACE_FUNCTION ("sBAT_PlusCGEQMIN()");
860
861 memset(&input_qos, 0, sizeof(T_PS_qos));
862 cid = PDP_CONTEXT_CID_OMITTED;
863 input_qos.qos_r99.tc = QOS_R99_TC_OMITTED;
864 input_qos.qos_r99.order = QOS_R99_ORDER_OMITTED;
865 input_qos.qos_r99.del_err_sdu = QOS_R99_DEL_ERR_SDU_OMITTED;
866 input_qos.qos_r99.max_sdu = QOS_R99_MAX_SDU_OMITTED;
867 input_qos.qos_r99.max_rate_ul = QOS_R99_MAX_BR_UL_OMITTED;
868 input_qos.qos_r99.max_rate_dl = QOS_R99_MAX_BR_DL_OMITTED;
869 input_qos.qos_r99.xfer_delay = QOS_R99_XFER_DELAY_OMITTED;
870 input_qos.qos_r99.handling_pri = QOS_R99_HANDLING_PRIO_OMITTED;
871 input_qos.qos_r99.guar_br_ul = QOS_R99_GUAR_BR_UL_OMITTED;
872 input_qos.qos_r99.guar_br_dl = QOS_R99_GUAR_BR_DL_OMITTED;
873 input_qos.qos_r99.ber.ratio_mant = QOS_R99_RATIO_MANT_OMITTED; /* Residual bit error ratio */
874 input_qos.qos_r99.ber.ratio_exp = QOS_R99_RATIO_EXP_OMITTED;
875 input_qos.qos_r99.sdu_err_ratio.ratio_mant = QOS_R99_RATIO_MANT_OMITTED;
876 input_qos.qos_r99.sdu_err_ratio.ratio_exp = QOS_R99_RATIO_EXP_OMITTED;
877
878 if (cmd->params.ptr_set_plus_cgeqreq->cid NEQ BAT_PDP_CID_NOT_PRESENT)
879 cid = cmd->params.ptr_set_plus_cgeqmin->cid;
880
881 if (cmd->params.ptr_set_plus_cgeqreq->tc NEQ NOT_PRESENT_8BIT)
882 input_qos.qos_r99.tc = cmd->params.ptr_set_plus_cgeqmin->tc;
883
884 if (cmd->params.ptr_set_plus_cgeqreq->order NEQ NOT_PRESENT_8BIT)
885 input_qos.qos_r99.order = cmd->params.ptr_set_plus_cgeqmin->order;
886
887 if (cmd->params.ptr_set_plus_cgeqreq->del_err_sdu NEQ NOT_PRESENT_8BIT)
888 input_qos.qos_r99.del_err_sdu = cmd->params.ptr_set_plus_cgeqmin->del_err_sdu;
889
890 if (cmd->params.ptr_set_plus_cgeqreq->max_sdu NEQ NOT_PRESENT_16BIT)
891 input_qos.qos_r99.max_sdu = (U16)cmd->params.ptr_set_plus_cgeqmin->max_sdu;
892
893 if (cmd->params.ptr_set_plus_cgeqreq->max_rate_ul NEQ NOT_PRESENT_16BIT)
894 input_qos.qos_r99.max_rate_ul = (U16)cmd->params.ptr_set_plus_cgeqmin->max_rate_ul;
895
896 if (cmd->params.ptr_set_plus_cgeqreq->max_rate_dl NEQ NOT_PRESENT_16BIT)
897 input_qos.qos_r99.max_rate_dl = (U16)cmd->params.ptr_set_plus_cgeqmin->max_rate_dl;
898
899 if (cmd->params.ptr_set_plus_cgeqreq->xfer_delay NEQ NOT_PRESENT_16BIT)
900 input_qos.qos_r99.xfer_delay = (U16)cmd->params.ptr_set_plus_cgeqmin->xfer_delay;
901
902 if (cmd->params.ptr_set_plus_cgeqreq->handling_pri NEQ NOT_PRESENT_8BIT)
903 input_qos.qos_r99.handling_pri = (U8)cmd->params.ptr_set_plus_cgeqmin->handling_pri;
904
905 if (cmd->params.ptr_set_plus_cgeqreq->guar_br_ul NEQ NOT_PRESENT_16BIT)
906 input_qos.qos_r99.guar_br_ul = (U16)cmd->params.ptr_set_plus_cgeqmin->guar_br_ul;
907
908 if (cmd->params.ptr_set_plus_cgeqreq->guar_br_dl NEQ NOT_PRESENT_16BIT)
909 input_qos.qos_r99.guar_br_dl = (U16)cmd->params.ptr_set_plus_cgeqmin->guar_br_dl;
910
911 if (cmd->params.ptr_set_plus_cgeqreq->c_ber NEQ 0)
912 {
913 input_qos.qos_r99.ber.ratio_mant = cmd->params.ptr_set_plus_cgeqmin->ber[0];
914 input_qos.qos_r99.ber.ratio_exp = cmd->params.ptr_set_plus_cgeqmin->ber[1];
915 }
916 if (cmd->params.ptr_set_plus_cgeqreq->c_sdu_err_ratio NEQ 0)
917 {
918 input_qos.qos_r99.sdu_err_ratio.ratio_mant = cmd->params.ptr_set_plus_cgeqmin->sdu_err_ratio[0];
919 input_qos.qos_r99.sdu_err_ratio.ratio_exp = cmd->params.ptr_set_plus_cgeqmin->sdu_err_ratio[1];
920 }
921
922 ret = (T_ACI_BAT_RSLT)sAT_PlusCGEQMIN ((T_ACI_CMD_SRC)src_infos_psi->srcId, cid ,&input_qos);
923
924 return ret;
925 }
926
927 /*
928 +--------------------------------------------------------------------+
929 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
930 | STATE : code ROUTINE : qBAT_PlusCGEQMIN |
931 +--------------------------------------------------------------------+
932
933 PURPOSE :
934 */
935 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGEQMIN (T_ACI_DTI_PRC_PSI *src_infos_psi,
936 T_BAT_cmd_send *cmd)
937 {
938 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
939 T_BAT_cmd_response resp;
940 T_BAT_res_que_plus_cgeqmin que_cgeqmin_buffer;
941 T_PS_min_qos pdef_qos;
942 U8 cid;
943 BOOL qos_valid;
944
945 TRACE_FUNCTION ("qBAT_PlusCGEQMIN()");
946
947 resp.ctrl_response = BAT_RES_QUE_PLUS_CGEQMIN;
948 resp.response.ptr_que_plus_cgeqmin = &que_cgeqmin_buffer;
949
950 for ( cid = PDP_CONTEXT_CID_MIN; cid <= PDP_CONTEXT_CID_MAX; cid++ )
951 {
952 ret = (T_ACI_BAT_RSLT) qAT_PlusCGEQMIN ((T_ACI_CMD_SRC) src_infos_psi->srcId, cid, &qos_valid, &pdef_qos);
953 if ( ret EQ ACI_BAT_CMPL)
954 {
955 if (qos_valid)
956 {
957 que_cgeqmin_buffer.cid = (T_BAT_pdp_cid)cid;
958 que_cgeqmin_buffer.tc = (U8)pdef_qos.qos_r99.tc;
959 que_cgeqmin_buffer.order = pdef_qos.qos_r99.order;
960 que_cgeqmin_buffer.del_err_sdu = pdef_qos.qos_r99.del_err_sdu;
961 que_cgeqmin_buffer.max_sdu = pdef_qos.qos_r99.max_sdu;
962 que_cgeqmin_buffer.max_rate_ul = pdef_qos.qos_r99.max_rate_ul;
963 que_cgeqmin_buffer.max_rate_dl = pdef_qos.qos_r99.max_rate_dl;
964 que_cgeqmin_buffer.xfer_delay = pdef_qos.qos_r99.xfer_delay;
965 que_cgeqmin_buffer.handling_pri = pdef_qos.qos_r99.handling_pri;
966 que_cgeqmin_buffer.guar_br_ul = pdef_qos.qos_r99.guar_br_ul;
967 que_cgeqmin_buffer.guar_br_dl = pdef_qos.qos_r99.guar_br_dl;
968 que_cgeqmin_buffer.ber[0] = pdef_qos.qos_r99.ber.ratio_mant;
969 que_cgeqmin_buffer.ber[1] = pdef_qos.qos_r99.ber.ratio_exp;
970 que_cgeqmin_buffer.sdu_err_ratio[0] = pdef_qos.qos_r99.sdu_err_ratio.ratio_mant;
971 que_cgeqmin_buffer.sdu_err_ratio[1] = pdef_qos.qos_r99.sdu_err_ratio.ratio_exp;
972
973 aci_bat_send(src_infos_psi,&resp);
974 }
975 }
976 else
977 return ret;
978 }
979 return ACI_BAT_CMPL;
980 }
981
982 #endif /* REL99 */
983
984 /*
985 +--------------------------------------------------------------------+
986 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
987 | STATE : code ROUTINE : sBAT_PlusCGQREQ |
988 +--------------------------------------------------------------------+
989
990 PURPOSE :
991 */
992 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGQREQ (T_ACI_DTI_PRC_PSI *src_infos_psi,
993 T_BAT_cmd_send *cmd)
994 {
995 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
996 T_PS_qos input_qos;
997 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT ;
998
999 TRACE_FUNCTION ("sBAT_PlusCGQREQ()");
1000
1001 cid = cmd->params.ptr_set_plus_cgqreq->cid;
1002 if (cid EQ BAT_PDP_CID_NOT_PRESENT )
1003 {
1004 cid = (T_BAT_pdp_cid)GPRS_CID_OMITTED ;
1005 }
1006 input_qos.qos_r97.preced = (U8)cmd->params.ptr_set_plus_cgqreq->precedence;
1007 input_qos.qos_r97.delay = (U8)cmd->params.ptr_set_plus_cgqreq->delay;
1008 input_qos.qos_r97.relclass = (U8)cmd->params.ptr_set_plus_cgqreq->reliability;
1009 input_qos.qos_r97.peak = (U8)cmd->params.ptr_set_plus_cgqreq->peak;
1010 input_qos.qos_r97.mean = (U8)cmd->params.ptr_set_plus_cgqreq->mean;
1011
1012 if (input_qos.qos_r97.preced EQ (U8)BAT_PRECEDENCE_NOT_PRESENT)
1013 {
1014 input_qos.qos_r97.preced = PDP_CONTEXT_QOS_OMITTED ;
1015 }
1016 if (input_qos.qos_r97.delay EQ (U8)BAT_DELAY_NOT_PRESENT)
1017 {
1018 input_qos.qos_r97.delay = PDP_CONTEXT_QOS_OMITTED ;
1019 }
1020 if (input_qos.qos_r97.relclass EQ (U8)BAT_RELIABILITY_NOT_PRESENT)
1021 {
1022 input_qos.qos_r97.relclass = PDP_CONTEXT_QOS_OMITTED ;
1023 }
1024 if (input_qos.qos_r97.peak EQ (U8)BAT_PEAK_NOT_PRESENT)
1025 {
1026 input_qos.qos_r97.peak= PDP_CONTEXT_QOS_OMITTED ;
1027 }
1028 if (input_qos.qos_r97.mean EQ (U8)BAT_MEAN_NOT_PRESENT)
1029 {
1030 input_qos.qos_r97.mean = PDP_CONTEXT_QOS_OMITTED ;
1031 }
1032 ret = (T_ACI_BAT_RSLT) sAT_PlusCGQREQ ((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8)cid ,&input_qos);
1033 return(ret);
1034 }
1035
1036 /*
1037 +--------------------------------------------------------------------+
1038 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1039 | STATE : code ROUTINE : qBAT_PlusCGQREQ |
1040 +--------------------------------------------------------------------+
1041
1042 PURPOSE :
1043 */
1044 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGQREQ (T_ACI_DTI_PRC_PSI *src_infos_psi,
1045 T_BAT_cmd_send *cmd)
1046 {
1047 T_PS_qos pdef_qos;
1048 BOOL qos_valid = FALSE;
1049 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL;
1050 T_BAT_cmd_response resp;
1051 T_BAT_res_que_plus_cgqreq que_cgqreq_buffer;
1052
1053 TRACE_FUNCTION ("qBAT_PlusCGQREQ()");
1054
1055 resp.ctrl_response = BAT_RES_QUE_PLUS_CGQREQ;
1056 resp.response.ptr_que_plus_cgqreq = &que_cgqreq_buffer;
1057
1058 p_pdp_context_node = p_pdp_context_list;
1059
1060 while( p_pdp_context_node )
1061 {
1062 if (qAT_PlusCGQREQ ( (T_ACI_CMD_SRC)src_infos_psi->srcId, p_pdp_context_node->cid, &qos_valid, &pdef_qos ) EQ AT_CMPL)
1063 {
1064 if( qos_valid )
1065 {
1066 resp.response.ptr_que_plus_cgqreq->cid = (T_BAT_pdp_cid)p_pdp_context_node->cid;
1067 resp.response.ptr_que_plus_cgqreq->precedence = (T_BAT_precedence)pdef_qos.qos_r97.preced;
1068 resp.response.ptr_que_plus_cgqreq->delay = (T_BAT_delay)pdef_qos.qos_r97.delay;
1069 resp.response.ptr_que_plus_cgqreq->reliability= (T_BAT_reliability)pdef_qos.qos_r97.relclass;
1070 resp.response.ptr_que_plus_cgqreq->peak = (T_BAT_peak)pdef_qos.qos_r97.peak;
1071 resp.response.ptr_que_plus_cgqreq->mean = (T_BAT_mean)pdef_qos.qos_r97.mean ;
1072
1073 aci_bat_send(src_infos_psi,&resp);
1074 }
1075 }
1076 else
1077 {
1078 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1079 return (ACI_BAT_FAIL);
1080 }
1081 p_pdp_context_node = p_pdp_context_node->p_next;
1082 }
1083 return ACI_BAT_CMPL;
1084 }
1085 /*
1086 +--------------------------------------------------------------------+
1087 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1088 | STATE : code ROUTINE : sBAT_PlusCGQMIN |
1089 +--------------------------------------------------------------------+
1090
1091 PURPOSE :
1092 */
1093 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGQMIN (T_ACI_DTI_PRC_PSI *src_infos_psi,
1094 T_BAT_cmd_send *cmd)
1095 {
1096 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1097 T_PS_min_qos input_qos;
1098 T_BAT_pdp_cid cid = BAT_PDP_CID_NOT_PRESENT ;
1099
1100 TRACE_FUNCTION ("sBAT_PlusCGQMIN()");
1101 cid = cmd->params.ptr_set_plus_cgqmin->cid;
1102 if (cid EQ BAT_PDP_CID_NOT_PRESENT )
1103 {
1104 cid = (T_BAT_pdp_cid)PDP_CONTEXT_CID_OMITTED ;
1105 }
1106
1107 input_qos.qos_r97.delay = (U8) PDP_CONTEXT_QOS_OMITTED;
1108 input_qos.qos_r97.relclass = (U8) PDP_CONTEXT_QOS_OMITTED;
1109 input_qos.qos_r97.peak = (U8) PDP_CONTEXT_QOS_OMITTED;
1110 input_qos.qos_r97.preced = (U8) PDP_CONTEXT_QOS_OMITTED;
1111 input_qos.qos_r97.mean = (U8) PDP_CONTEXT_QOS_OMITTED;
1112
1113 input_qos.qos_r97.preced = cmd->params.ptr_set_plus_cgqmin->precedence;
1114 input_qos.qos_r97.delay = cmd->params.ptr_set_plus_cgqmin->delay;
1115 input_qos.qos_r97.relclass = cmd->params.ptr_set_plus_cgqmin->reliability;
1116 input_qos.qos_r97.peak = cmd->params.ptr_set_plus_cgqmin->peak;
1117 input_qos.qos_r97.mean = cmd->params.ptr_set_plus_cgqmin->mean;
1118
1119 ret = (T_ACI_BAT_RSLT) sAT_PlusCGQMIN ((T_ACI_CMD_SRC)src_infos_psi->srcId, (U8)cid ,&input_qos);
1120 return(ret);
1121 }
1122
1123 /*
1124 +--------------------------------------------------------------------+
1125 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1126 | STATE : code ROUTINE : qBAT_PlusCGQMIN |
1127 +--------------------------------------------------------------------+
1128
1129 PURPOSE :
1130 */
1131 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGQMIN (T_ACI_DTI_PRC_PSI *src_infos_psi,
1132 T_BAT_cmd_send *cmd)
1133 {
1134 T_BAT_cmd_response resp;
1135 T_BAT_res_que_plus_cgqmin que_cgqmin_buffer;
1136 T_PS_qos pdef_qos;
1137 BOOL qos_valid = FALSE;
1138 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL;
1139
1140 TRACE_FUNCTION ("qBAT_PlusCGQMIN()");
1141
1142 resp.ctrl_response = BAT_RES_QUE_PLUS_CGQMIN;
1143 resp.response.ptr_que_plus_cgqmin = &que_cgqmin_buffer;
1144 p_pdp_context_node = p_pdp_context_list;
1145
1146 while( p_pdp_context_node )
1147 {
1148 if( qAT_PlusCGQMIN((T_ACI_CMD_SRC) src_infos_psi->srcId, p_pdp_context_node->cid, &qos_valid, &pdef_qos ) EQ AT_CMPL )
1149 {
1150 if (qos_valid)
1151 {
1152 resp.response.ptr_que_plus_cgqmin->cid = (T_BAT_pdp_cid)p_pdp_context_node->cid;
1153 resp.response.ptr_que_plus_cgqmin->precedence = (T_BAT_precedence)pdef_qos.qos_r97.preced;
1154 resp.response.ptr_que_plus_cgqmin->delay = (T_BAT_delay)pdef_qos.qos_r97.delay;
1155 resp.response.ptr_que_plus_cgqmin->reliability= (T_BAT_reliability)pdef_qos.qos_r97.relclass;
1156 resp.response.ptr_que_plus_cgqmin->peak = (T_BAT_peak)pdef_qos.qos_r97.peak;
1157 resp.response.ptr_que_plus_cgqmin->mean = (T_BAT_mean)pdef_qos.qos_r97.mean;
1158 aci_bat_send(src_infos_psi,&resp);
1159 }
1160 }
1161 else
1162 {
1163 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1164 return (ACI_BAT_FAIL);
1165 }
1166 p_pdp_context_node = p_pdp_context_node->p_next;
1167 }
1168 return ACI_BAT_CMPL;
1169 }
1170
1171
1172 /*
1173 +--------------------------------------------------------------------+
1174 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1175 | STATE : code ROUTINE : sBAT_PlusCGATT |
1176 +--------------------------------------------------------------------+
1177
1178 PURPOSE :
1179 */
1180 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGATT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1181 T_BAT_cmd_send *cmd)
1182 {
1183 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1184 T_CGATT_STATE state = CGATT_STATE_OMITTED;
1185
1186 TRACE_FUNCTION ("sBAT_PlusCGATT()");
1187
1188 state = (T_CGATT_STATE)cmd->params.ptr_set_plus_cgatt->state;
1189 ret = (T_ACI_BAT_RSLT)sAT_PlusCGATT ( (T_ACI_CMD_SRC)src_infos_psi->srcId, state );
1190 return(ret);
1191 }
1192
1193 /*
1194 +--------------------------------------------------------------------+
1195 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1196 | STATE : code ROUTINE : qBAT_PlusCGATT |
1197 +--------------------------------------------------------------------+
1198
1199 PURPOSE :
1200 */
1201 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGATT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1202 T_BAT_cmd_send *cmd)
1203 {
1204 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1205 T_BAT_cmd_response resp;
1206 T_BAT_res_que_plus_cgatt que_cgatt_buffer;
1207 T_CGATT_STATE state = CGATT_STATE_OMITTED;
1208
1209 TRACE_FUNCTION ("qBAT_PlusCGATT()");
1210 resp.ctrl_response = BAT_RES_QUE_PLUS_CGATT;
1211 resp.response.ptr_que_plus_cgatt = &que_cgatt_buffer;
1212
1213 ret = (T_ACI_BAT_RSLT)qAT_PlusCGATT((T_ACI_CMD_SRC)src_infos_psi->srcId, &state);
1214 if (ret EQ ACI_BAT_CMPL)
1215 {
1216 resp.response.ptr_que_plus_cgatt->state = (T_BAT_plus_cgatt_state)state;
1217 aci_bat_send(src_infos_psi,&resp);
1218 return ACI_BAT_CMPL;
1219 }
1220 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1221 return (ACI_BAT_FAIL);
1222 }
1223
1224 /*
1225 +--------------------------------------------------------------------+
1226 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1227 | STATE : code ROUTINE : sBAT_PlusCGCLASS |
1228 +--------------------------------------------------------------------+
1229
1230 PURPOSE :
1231 */
1232 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1233 T_BAT_cmd_send *cmd)
1234 {
1235 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1236 T_CGCLASS_CLASS m_class = CGCLASS_CLASS_OMITTED;
1237
1238 TRACE_FUNCTION ("sBAT_PlusCGCLASS()");
1239
1240 m_class = (T_CGCLASS_CLASS)cmd->params.ptr_set_plus_cgclass->mobile_class;
1241
1242 if (m_class EQ CGCLASS_CLASS_OMITTED)
1243 {
1244 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow);
1245 return (ACI_BAT_FAIL);
1246 }
1247 ret =(T_ACI_BAT_RSLT) sAT_PlusCGCLASS ((T_ACI_CMD_SRC)src_infos_psi->srcId, m_class );
1248 return(ret);
1249 }
1250
1251 /*
1252 +--------------------------------------------------------------------+
1253 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1254 | STATE : code ROUTINE : qBAT_PlusCGCLASS |
1255 +--------------------------------------------------------------------+
1256
1257 PURPOSE :
1258 */
1259 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1260 T_BAT_cmd_send *cmd)
1261 {
1262 T_ACI_BAT_RSLT ret;
1263 T_CGCLASS_CLASS m_class;
1264
1265 TRACE_FUNCTION ("qBAT_PlusCGCLASS()");
1266
1267 ret=(T_ACI_BAT_RSLT)qAT_PlusCGCLASS((T_ACI_CMD_SRC)src_infos_psi->srcId,&m_class);
1268
1269 /*
1270 * If the query completes, send the response now.
1271 */
1272 if (ret EQ ACI_BAT_CMPL)
1273 {
1274 T_BAT_cmd_response resp;
1275 T_BAT_res_que_plus_cgclass cgclass_data;
1276
1277 resp.ctrl_response=BAT_RES_QUE_PLUS_CGCLASS;
1278 resp.response.ptr_que_plus_cgclass=&cgclass_data;
1279
1280 /*
1281 * This relies on T_BAT_mobile_class and T_CGCLASS_CLASS
1282 * being identical.
1283 */
1284 resp.response.ptr_que_plus_cgclass->mobile_class=(T_BAT_mobile_class)m_class;
1285
1286 aci_bat_send(src_infos_psi,&resp);
1287 return ACI_BAT_CMPL;
1288 }
1289 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1290 return (ACI_BAT_FAIL);
1291 }
1292
1293 /*
1294 +--------------------------------------------------------------------+
1295 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1296 | STATE : code ROUTINE : sBAT_PlusCGACT |
1297 +--------------------------------------------------------------------+
1298
1299 PURPOSE :
1300 */
1301 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGACT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1302 T_BAT_cmd_send *cmd)
1303 {
1304 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1305 T_CGACT_STATE state = CGACT_STATE_OMITTED;
1306 SHORT count = 0;
1307 SHORT cid_array[PDP_CONTEXT_CID_MAX];
1308
1309 TRACE_FUNCTION ("sBAT_PlusCGACT()");
1310
1311 state =(T_CGACT_STATE) cmd->params.ptr_set_plus_cgact->state;
1312 if(cmd->params.ptr_set_plus_cgact->c_cid EQ 0)
1313 cid_array[0] = PDP_CONTEXT_CID_INVALID;
1314 for(count=0;count<cmd->params.ptr_set_plus_cgact->c_cid;count++)
1315 {
1316 cid_array[count] = (cmd->params.ptr_set_plus_cgact->cid[count] EQ BAT_PDP_CID_NOT_PRESENT)
1317 ? PDP_CONTEXT_CID_INVALID : cmd->params.ptr_set_plus_cgact->cid[count];
1318 }
1319 if(count > 0)
1320 cid_array[count]= PDP_CONTEXT_CID_INVALID;
1321 ret =(T_ACI_BAT_RSLT) sAT_PlusCGACT ((T_ACI_CMD_SRC)src_infos_psi->srcId, state, cid_array );
1322 return(ret);
1323 }
1324
1325
1326 /*
1327 +--------------------------------------------------------------------+
1328 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1329 | STATE : code ROUTINE : qBAT_PlusCGACT |
1330 +--------------------------------------------------------------------+
1331
1332 PURPOSE :
1333 */
1334 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGACT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1335 T_BAT_cmd_send *cmd)
1336 {
1337 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1338 SHORT cid_array[PDP_CONTEXT_CID_MAX];
1339 SHORT count = 0;
1340 BOOL states[PDP_CONTEXT_CID_MAX];
1341 T_BAT_cmd_response resp;
1342 T_BAT_res_que_plus_cgact que_cgact_buffer;
1343
1344 TRACE_FUNCTION ("qBAT_PlusCGACT()");
1345 resp.ctrl_response = BAT_RES_QUE_PLUS_CGACT;
1346 resp.response.ptr_que_plus_cgact = &que_cgact_buffer;
1347
1348 ret=(T_ACI_BAT_RSLT)qAT_PlusCGACT((T_ACI_CMD_SRC)src_infos_psi->srcId, states, cid_array);
1349 if(ret EQ ACI_BAT_CMPL)
1350 {
1351 for ( count = 0; count < PDP_CONTEXT_CID_MAX AND cid_array[count] NEQ PDP_CONTEXT_CID_INVALID; count++ )
1352 {
1353 resp.response.ptr_que_plus_cgact->state = (T_BAT_plus_cgact_state)states[count];
1354 resp.response.ptr_que_plus_cgact->cid = (T_BAT_pdp_cid)cid_array[count];
1355 aci_bat_send(src_infos_psi,&resp);
1356 }
1357 return(ret);
1358 }
1359 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1360 return (ACI_BAT_FAIL);
1361 }
1362
1363
1364 /*
1365 +--------------------------------------------------------------------+
1366 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1367 | STATE : code ROUTINE : sBAT_PlusCGDATA |
1368 +--------------------------------------------------------------------+
1369
1370 PURPOSE :
1371 */
1372 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGDATA (T_ACI_DTI_PRC_PSI *src_infos_psi,
1373 T_BAT_cmd_send *cmd)
1374 {
1375 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1376 char L2P[MAX_L2P_LENGTH] = "";
1377 U8 cid_array[PDP_CONTEXT_CID_MAX] = { GPRS_CID_OMITTED };
1378
1379 TRACE_FUNCTION ("sBAT_PlusCGDATA()");
1380
1381 if(cmd->params.ptr_set_plus_cgdata->v_l2p)
1382 {
1383 memcpy(L2P,cmd->params.ptr_set_plus_cgdata->l2p,cmd->params.ptr_set_plus_cgdata->c_l2p);
1384 }
1385 else
1386 {
1387 L2P[0] = 0;
1388 }
1389
1390 if(cmd->params.ptr_set_plus_cgdata->v_cid)
1391 {
1392 memcpy(cid_array,cmd->params.ptr_set_plus_cgdata->cid,2*cmd->params.ptr_set_plus_cgdata->c_cid);
1393 cid_array[cmd->params.ptr_set_plus_cgdata->c_cid] = PDP_CONTEXT_CID_INVALID;
1394 }
1395 ret =(T_ACI_BAT_RSLT) sAT_PlusCGDATA ((T_ACI_CMD_SRC)src_infos_psi->srcId, L2P, cid_array );
1396 return(ret);
1397 }
1398
1399 /*
1400 +--------------------------------------------------------------------+
1401 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1402 | STATE : code ROUTINE : sBAT_PlusCGPADDR |
1403 +--------------------------------------------------------------------+
1404
1405 PURPOSE :
1406 */
1407 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGPADDR (T_ACI_DTI_PRC_PSI *src_infos_psi,
1408 T_BAT_cmd_send *cmd)
1409 {
1410 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1411 T_NAS_ip *pdp_addresses;
1412 SHORT count = 0;
1413 SHORT cid_array[PDP_CONTEXT_CID_MAX + 1];
1414 T_BAT_cmd_set_plus_cgpaddr *cgpaddr;
1415
1416 TRACE_FUNCTION ("sBAT_PlusCGPADDR()");
1417
1418 ACI_MALLOC (pdp_addresses, sizeof (T_NAS_ip) * PDP_CONTEXT_CID_MAX);
1419
1420 /*
1421 * Get a pointer to the CGPADDR data for convenience.
1422 */
1423 cgpaddr=cmd->params.ptr_set_plus_cgpaddr;
1424
1425 if (cgpaddr->c_cid)
1426 {
1427 for (count=0; ((count<PDP_CONTEXT_CID_MAX) AND (count<cgpaddr->c_cid)); count++)
1428 cid_array[count]=(U8)cgpaddr->cid[count];
1429
1430 cid_array[count] = PDP_CONTEXT_CID_INVALID;
1431 }
1432 else
1433 {
1434 cid_array[0] = PDP_CONTEXT_CID_OMITTED;
1435 }
1436
1437 ret = (T_ACI_BAT_RSLT)sAT_PlusCGPADDR((T_ACI_CMD_SRC)src_infos_psi->srcId, cid_array, pdp_addresses );
1438
1439 if (ret EQ ACI_BAT_CMPL)
1440 {
1441 T_BAT_cmd_response resp;
1442 T_BAT_res_set_plus_cgpaddr cgpaddr_data;
1443 UBYTE len = 0;
1444
1445 resp.ctrl_response=BAT_RES_SET_PLUS_CGPADDR;
1446 resp.response.ptr_set_plus_cgpaddr=&cgpaddr_data;
1447
1448 for (count=0;count<PDP_CONTEXT_CID_MAX;count++)
1449 {
1450 if (cid_array[count] EQ PDP_CONTEXT_CID_INVALID)
1451 break;
1452
1453 cgpaddr_data.cid=(T_BAT_pdp_cid)cid_array[count];
1454
1455 switch( pdp_addresses[count].ctrl_ip_address )
1456 {
1457 case NAS_is_ip_not_present:
1458 len = 0;
1459 break;
1460
1461 case NAS_is_ipv4:
1462 len = 4;
1463 memcpy(cgpaddr_data.pdp_addr, pdp_addresses[count].ip_address.ipv4_addr.a4,len);
1464 break;
1465
1466 case NAS_is_ipv6:
1467 len = 16;
1468 memcpy(cgpaddr_data.pdp_addr, pdp_addresses[count].ip_address.ipv6_addr.a6,len);
1469 break;
1470 }
1471
1472 cgpaddr_data.c_pdp_addr=(U8)len;
1473 aci_bat_send(src_infos_psi,&resp);
1474 }
1475 }
1476
1477 ACI_MFREE(pdp_addresses);
1478 return(ret);
1479 }
1480
1481 /*
1482 +--------------------------------------------------------------------+
1483 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1484 | STATE : code ROUTINE : sBAT_PlusCGANS |
1485 +--------------------------------------------------------------------+
1486
1487 PURPOSE :
1488 */
1489 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGANS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1490 T_BAT_cmd_send *cmd)
1491 {
1492 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1493 char L2P[MAX_L2P_LENGTH] = "" ;
1494 SHORT cid = GPRS_CID_OMITTED, response = -1 ;
1495
1496 TRACE_FUNCTION ("sBAT_PlusCGANS()");
1497
1498 response = cmd->params.ptr_set_plus_cgans->response;
1499 if(cmd->params.ptr_set_plus_cgans->v_l2p)
1500 {
1501 memcpy(L2P,cmd->params.ptr_set_plus_cgans->l2p,cmd->params.ptr_set_plus_cgans->c_l2p);
1502 }
1503 else
1504 {
1505 L2P[0] = 0;
1506 }
1507
1508 cid = cmd->params.ptr_set_plus_cgans->cid;
1509 if (cid EQ BAT_PDP_CID_NOT_PRESENT )
1510 {
1511 cid = GPRS_CID_OMITTED ;
1512 }
1513 ret =(T_ACI_BAT_RSLT)sAT_PlusCGANS ((T_ACI_CMD_SRC) src_infos_psi->srcId, response, L2P, cid );
1514 return(ret);
1515 }
1516
1517 /*
1518 +--------------------------------------------------------------------+
1519 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1520 | STATE : code ROUTINE : qBAT_PlusCGREG |
1521 +--------------------------------------------------------------------+
1522
1523 PURPOSE :
1524 */
1525 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGREG (T_ACI_DTI_PRC_PSI *src_infos_psi,
1526 T_BAT_cmd_send *cmd)
1527 {
1528 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1529 T_CGREG_STAT stat;
1530 USHORT lac, cid;
1531
1532 TRACE_FUNCTION ("qBAT_PlusCGREG()");
1533
1534 ret=(T_ACI_BAT_RSLT)qAT_PlusCGREG((T_ACI_CMD_SRC)src_infos_psi->srcId, &stat, &lac, &cid);
1535
1536 if (ret==ACI_BAT_CMPL)
1537 {
1538 T_BAT_cmd_response resp;
1539 T_BAT_res_que_plus_cgreg que_cgreg_buffer;
1540
1541 resp.ctrl_response = BAT_RES_QUE_PLUS_CGREG;
1542 resp.response.ptr_que_plus_cgreg = &que_cgreg_buffer;
1543
1544 resp.response.ptr_que_plus_cgreg->stat = (T_BAT_plus_cgreg_stat)stat;
1545 resp.response.ptr_que_plus_cgreg->lac = lac;
1546 resp.response.ptr_que_plus_cgreg->ci = cid;
1547 aci_bat_send(src_infos_psi,&resp);
1548 }
1549
1550 return(ret);
1551 }
1552
1553 /*
1554 +--------------------------------------------------------------------+
1555 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1556 | STATE : code ROUTINE : qBAT_PercentCGREG |
1557 +--------------------------------------------------------------------+
1558
1559 PURPOSE :
1560 */
1561 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGREG (T_ACI_DTI_PRC_PSI *src_infos_psi,
1562 T_BAT_cmd_send *cmd)
1563 {
1564 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1565 T_P_CGREG_STAT stat;
1566 USHORT lac, cid;
1567
1568 TRACE_FUNCTION ("qBAT_PercentCGREG()");
1569 ret=(T_ACI_BAT_RSLT)qAT_PercentCGREG((T_ACI_CMD_SRC)src_infos_psi->srcId, &stat, &lac, &cid);
1570
1571 if (ret EQ ACI_BAT_CMPL)
1572 {
1573 T_BAT_cmd_response resp;
1574 T_BAT_res_que_percent_cgreg que_cgreg_buffer;
1575
1576 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGREG;
1577 resp.response.ptr_que_percent_cgreg = &que_cgreg_buffer;
1578
1579 resp.response.ptr_que_percent_cgreg->stat = (T_BAT_percent_cgreg_stat)stat;
1580 resp.response.ptr_que_percent_cgreg->lac = lac;
1581 resp.response.ptr_que_percent_cgreg->ci = cid;
1582 resp.response.ptr_que_percent_cgreg->state = (cmhSM_isContextActive() ? BAT_P_CGREG_STATE_STAT_1
1583 : BAT_P_CGREG_STATE_STAT_0 );
1584 aci_bat_send(src_infos_psi,&resp);
1585 }
1586
1587 return(ret);
1588 }
1589
1590 /*
1591 +--------------------------------------------------------------------+
1592 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1593 | STATE : code ROUTINE : tBAT_PlusCGPADDR |
1594 +--------------------------------------------------------------------+
1595
1596 PURPOSE :
1597 */
1598 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCGPADDR (T_ACI_DTI_PRC_PSI *src_infos_psi,
1599 T_BAT_cmd_send *cmd)
1600 {
1601 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1602 U8 count = 0;
1603 U8 cid_array[PDP_CONTEXT_CID_MAX];
1604 T_BAT_cmd_response resp;
1605 T_BAT_res_tst_plus_cgpaddr tst_cgpaddr_buffer;
1606
1607 TRACE_FUNCTION ("tBAT_PlusCGPADDR()");
1608
1609 ret = (T_ACI_BAT_RSLT)tAT_PlusCGPADDR ((T_ACI_CMD_SRC) src_infos_psi->srcId, cid_array );
1610 resp.ctrl_response = BAT_RES_TST_PLUS_CGPADDR;
1611 resp.response.ptr_tst_plus_cgpaddr = &tst_cgpaddr_buffer;
1612 if (ret EQ ACI_BAT_CMPL)
1613 {
1614 while ( cid_array[count] NEQ PDP_CONTEXT_CID_INVALID )
1615 {
1616 resp.response.ptr_tst_plus_cgpaddr->cid[count]=(T_BAT_pdp_cid)cid_array[count];
1617 count ++;
1618 }
1619 if(count EQ 0)
1620 resp.response.ptr_tst_plus_cgpaddr->cid[0] = BAT_PDP_CID_NOT_PRESENT;
1621
1622 resp.response.ptr_tst_plus_cgpaddr->c_cid = count;
1623 aci_bat_send(src_infos_psi,&resp);
1624 return(ACI_BAT_CMPL);
1625 }
1626 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1627 return(ACI_BAT_FAIL);
1628 }
1629
1630 /*
1631 +--------------------------------------------------------------------+
1632 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1633 | STATE : code ROUTINE : sBAT_PlusCGSMS |
1634 +--------------------------------------------------------------------+
1635
1636 PURPOSE :
1637 */
1638 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCGSMS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1639 T_BAT_cmd_send *cmd)
1640 {
1641 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1642 T_CGSMS_SERVICE service = CGSMS_SERVICE_OMITTED;
1643
1644 TRACE_FUNCTION ("sBAT_PlusCGSMS()");
1645
1646 service =(T_CGSMS_SERVICE) cmd->params.ptr_set_plus_cgsms->service;
1647 ret = (T_ACI_BAT_RSLT)sAT_PlusCGSMS ((T_ACI_CMD_SRC) src_infos_psi->srcId, service );
1648 return(ret);
1649 }
1650
1651 /*
1652 +--------------------------------------------------------------------+
1653 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1654 | STATE : code ROUTINE : qBAT_PlusCGSMS |
1655 +--------------------------------------------------------------------+
1656
1657 PURPOSE :
1658 */
1659 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCGSMS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1660 T_BAT_cmd_send *cmd)
1661 {
1662 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1663 T_BAT_cmd_response resp;
1664 T_BAT_res_que_plus_cgsms que_cgsms_buffer;
1665 T_CGSMS_SERVICE service = CGSMS_SERVICE_OMITTED;
1666
1667 TRACE_FUNCTION ("qBAT_PlusCGSMS()");
1668
1669 ret = (T_ACI_BAT_RSLT)qAT_PlusCGSMS((T_ACI_CMD_SRC)src_infos_psi->srcId, &service);
1670 resp.ctrl_response = BAT_RES_QUE_PLUS_CGSMS;
1671 resp.response.ptr_que_plus_cgsms = &que_cgsms_buffer;
1672 if(ret EQ ACI_BAT_CMPL)
1673 {
1674 resp.response.ptr_que_plus_cgsms->service = (T_BAT_plus_cgsms_service)service;
1675 aci_bat_send(src_infos_psi,&resp);
1676 return ret;
1677 }
1678 else
1679 {
1680 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1681 return (ACI_BAT_FAIL);
1682 }
1683 }
1684
1685 /*
1686 +--------------------------------------------------------------------+
1687 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1688 | STATE : code ROUTINE : sBAT_PercentCGAATT |
1689 +--------------------------------------------------------------------+
1690
1691 PURPOSE :
1692 */
1693 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGAATT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1694 T_BAT_cmd_send *cmd)
1695 {
1696 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1697 T_BAT_percent_cgaatt_att_m att_m;
1698 T_BAT_percent_cgaatt_det_m det_m;
1699
1700 TRACE_FUNCTION ("sBAT_PercentCGAATT()");
1701
1702 att_m = cmd->params.ptr_set_percent_cgaatt->att_m;
1703 det_m = cmd->params.ptr_set_percent_cgaatt->det_m;
1704 ret = (T_ACI_BAT_RSLT)sAT_PercentCGAATT ((T_ACI_CMD_SRC)src_infos_psi->srcId,(T_CGAATT_ATTACH_MODE)att_m, (T_CGAATT_DETACH_MODE)det_m );
1705 return(ret);
1706 }
1707
1708 /*
1709 +--------------------------------------------------------------------+
1710 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1711 | STATE : code ROUTINE : qBAT_PercentCGAATT |
1712 +--------------------------------------------------------------------+
1713
1714 PURPOSE :
1715 */
1716 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGAATT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1717 T_BAT_cmd_send *cmd)
1718 {
1719 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1720 T_BAT_percent_cgaatt_att_m att_m;
1721 T_BAT_percent_cgaatt_det_m det_m;
1722
1723 TRACE_FUNCTION ("qBAT_PercentCGAATT()");
1724
1725 ret = (T_ACI_BAT_RSLT)qAT_PercentCGAATT((T_ACI_CMD_SRC)
1726 src_infos_psi->srcId, (T_CGAATT_ATTACH_MODE *)&att_m, (T_CGAATT_DETACH_MODE *)&det_m);
1727
1728 if(ret EQ ACI_BAT_CMPL)
1729 {
1730 T_BAT_cmd_response resp;
1731 T_BAT_res_que_percent_cgaatt que_cgaatt_buffer;
1732
1733 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGAATT;
1734 resp.response.ptr_que_percent_cgaatt = &que_cgaatt_buffer;
1735
1736 resp.response.ptr_que_percent_cgaatt->att_m = att_m;
1737 resp.response.ptr_que_percent_cgaatt->det_m = det_m;
1738 aci_bat_send(src_infos_psi,&resp);
1739 }
1740
1741 return ret;
1742 }
1743
1744 /*
1745 +--------------------------------------------------------------------+
1746 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1747 | STATE : code ROUTINE : sBAT_PercentSNCNT |
1748 +--------------------------------------------------------------------+
1749
1750 PURPOSE :
1751 */
1752 GLOBAL T_ACI_BAT_RSLT sBAT_PercentSNCNT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1753 T_BAT_cmd_send *cmd)
1754 {
1755 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1756
1757 TRACE_FUNCTION ("sBAT_PercentSNCNT()");
1758 ret =(T_ACI_BAT_RSLT) sAT_PercentSNCNT( (T_ACI_CMD_SRC)src_infos_psi->srcId, TRUE );
1759 return(ret);
1760 }
1761
1762 /*
1763 +--------------------------------------------------------------------+
1764 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1765 | STATE : code ROUTINE : qBAT_PercentSNCNT |
1766 +--------------------------------------------------------------------+
1767
1768 PURPOSE :
1769 */
1770 GLOBAL T_ACI_BAT_RSLT qBAT_PercentSNCNT (T_ACI_DTI_PRC_PSI *src_infos_psi,
1771 T_BAT_cmd_send *cmd)
1772 {
1773 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1774
1775 TRACE_FUNCTION ("qBAT_PercentSNCNT()");
1776 ret = (T_ACI_BAT_RSLT)sAT_PercentSNCNT((T_ACI_CMD_SRC) src_infos_psi->srcId, FALSE );
1777 return(ret);
1778 }
1779
1780 /*
1781 +--------------------------------------------------------------------+
1782 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1783 | STATE : code ROUTINE : sBAT_PercentCGMM |
1784 +--------------------------------------------------------------------+
1785
1786 PURPOSE :
1787 */
1788 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGMM (T_ACI_DTI_PRC_PSI *src_infos_psi,
1789 T_BAT_cmd_send *cmd)
1790 {
1791 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1792 UBYTE cipher_on , tlli_handling ;
1793
1794 TRACE_FUNCTION ("sBAT_PercentCGMM()");
1795
1796 cipher_on = cmd->params.ptr_set_percent_cgmm->cipher_on;
1797 tlli_handling = cmd->params.ptr_set_percent_cgmm->tlli_handling;
1798
1799 ret =(T_ACI_BAT_RSLT) sAT_PercentCGMM((T_ACI_CMD_SRC) src_infos_psi->srcId, cipher_on, tlli_handling );
1800 return(ret);
1801 }
1802
1803 /*
1804 +--------------------------------------------------------------------+
1805 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1806 | STATE : code ROUTINE : sBAT_PercentCGPCO |
1807 +--------------------------------------------------------------------+
1808
1809 PURPOSE :
1810 */
1811 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGPCO (T_ACI_DTI_PRC_PSI *src_infos_psi,
1812 T_BAT_cmd_send *cmd)
1813 {
1814 T_ATI_RSLT ret = ATI_FAIL;
1815 USHORT cid = 0;
1816 T_ACI_CGPCO_FORMAT format;
1817 CHAR pco_string[BAT_MAX_CGPCO_PCO_LEN+1];
1818 T_ACI_CGPCO_MODE mode;
1819
1820 TRACE_FUNCTION ("sBAT_PercentCGPCO()");
1821
1822 memset(pco_string,0,sizeof(pco_string));
1823
1824 mode = (T_ACI_CGPCO_MODE)cmd->params.ptr_set_percent_cgpco->mode;
1825 format = (T_ACI_CGPCO_FORMAT)cmd->params.ptr_set_percent_cgpco->format;
1826
1827 if (cmd->params.ptr_set_percent_cgpco->v_pco)
1828 {
1829 memcpy(pco_string,cmd->params.ptr_set_percent_cgpco->pco,cmd->params.ptr_set_percent_cgpco->c_pco);
1830 }
1831 cid = cmd->params.ptr_set_percent_cgpco->cid;
1832 if(cid EQ (USHORT)BAT_PDP_CID_NOT_PRESENT)
1833 {
1834 cid = (USHORT) INVALID_CID ;
1835 }
1836 if (cid > MAX_CID)
1837 {
1838 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp);
1839 return ACI_BAT_FAIL ;
1840 }
1841
1842 switch (mode)
1843 {
1844 case CGPCO_MODE_QUERY_PCO:
1845 {
1846 ULONG gateway,dns1,dns2;
1847 char dns1_str[sizeof("255.255.255.255")];
1848 char dns2_str[sizeof("255.255.255.255")];
1849 char gatew_str[sizeof("255.255.255.255")];
1850 USHORT i;
1851
1852 for (i=1;i<MAX_CID;i++)
1853 {
1854 if ((i EQ cid) OR (cid EQ INVALID_CID))
1855 {
1856 gateway=dns1=dns2=0;
1857
1858 /*
1859 * Ignore the return value of the ACI function, which is
1860 * always AT_CMPL.
1861 */
1862 qAT_PercentCGPCO((T_ACI_CMD_SRC)src_infos_psi->srcId,&gateway,&dns1,&dns2,i);
1863
1864 if (dns1 OR dns2 OR gateway)
1865 {
1866 T_BAT_cmd_response resp;
1867 T_BAT_res_set_percent_cgpco cgpco;
1868
1869 resp.ctrl_response=BAT_RES_SET_PERCENT_CGPCO;
1870 resp.response.ptr_set_percent_cgpco=&cgpco;
1871
1872 ipaddr_to_string(dns1, dns1_str);
1873 ipaddr_to_string(dns2, dns2_str);
1874 ipaddr_to_string(gateway, gatew_str);
1875
1876 cgpco.cid=(T_BAT_pdp_cid)i;
1877
1878 sprintf((char *)cgpco.pco,"%s,%s,%s",dns1_str,dns2_str,gatew_str);
1879 cgpco.c_pco=strlen((char *)cgpco.pco);
1880
1881 aci_bat_send(src_infos_psi,&resp);
1882 }
1883 }
1884 }
1885 }
1886 return (ACI_BAT_CMPL);
1887
1888 case CGPCO_MODE_SET_PCO:
1889 {
1890 switch (format)
1891 {
1892 case CGPCO_FORMAT_HEX:
1893 ret = setatPercentCGPCO_HEX (src_infos_psi->srcId,cid, (UBYTE*)pco_string, (USHORT)strlen (pco_string));
1894 break;
1895 case CGPCO_FORMAT_ASCII:
1896 ret = setatPercentCGPCO_ASCII (src_infos_psi->srcId, cid, (UBYTE*)pco_string, (USHORT)strlen (pco_string));
1897 break;
1898 default:
1899 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp);
1900 break;
1901 }
1902 break;
1903 }
1904 default:
1905 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp);
1906 break;
1907 }
1908
1909 /*
1910 * Convert the ATI return value into ACI/BAT format.
1911 */
1912 switch (ret)
1913 {
1914 default:
1915 case ATI_FAIL:
1916 case ATI_FAIL_NO_OUTPUT:
1917 return(ACI_BAT_FAIL);
1918
1919 case ATI_BUSY:
1920 return(ACI_BAT_BUSY);
1921
1922 case ATI_EXCT:
1923 return(ACI_BAT_EXCT);
1924
1925 case ATI_CMPL:
1926 case ATI_CMPL_NO_OUTPUT:
1927 return(ACI_BAT_CMPL);
1928 }
1929 }
1930
1931 /*
1932 +--------------------------------------------------------------------+
1933 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1934 | STATE : code ROUTINE : sBAT_PercentCGPPP |
1935 +--------------------------------------------------------------------+
1936
1937 PURPOSE :
1938 */
1939 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGPPP (T_ACI_DTI_PRC_PSI *src_infos_psi,
1940 T_BAT_cmd_send *cmd)
1941 {
1942 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1943 T_ACI_PPP_PROT protocol;
1944
1945 TRACE_FUNCTION ("sBAT_PercentCGPPP()");
1946
1947 protocol =(T_ACI_PPP_PROT)cmd->params.ptr_set_percent_cgppp->protocol;
1948 ret = (T_ACI_BAT_RSLT)sAT_PercentCGPPP((T_ACI_CMD_SRC)src_infos_psi->srcId, protocol);
1949 return(ret);
1950 }
1951
1952 /*
1953 +--------------------------------------------------------------------+
1954 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1955 | STATE : code ROUTINE : qBAT_PercentCGPPP |
1956 +--------------------------------------------------------------------+
1957
1958 PURPOSE :
1959 */
1960 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGPPP (T_ACI_DTI_PRC_PSI *src_infos_psi,
1961 T_BAT_cmd_send *cmd)
1962 {
1963 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1964 T_ACI_PPP_PROT protocol;
1965 T_BAT_cmd_response resp;
1966 T_BAT_res_que_percent_cgppp que_cgppp_buffer;
1967
1968 TRACE_FUNCTION ("qBAT_PercentCGPPP()");
1969
1970 ret =(T_ACI_BAT_RSLT) qAT_PercentCGPPP((T_ACI_CMD_SRC)src_infos_psi->srcId, &protocol);
1971 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGPPP;
1972 resp.response.ptr_que_percent_cgppp = &que_cgppp_buffer;
1973 if( ret EQ ((T_ACI_BAT_RSLT)ATI_FAIL))
1974 {
1975 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown);
1976 return (ACI_BAT_FAIL);
1977 }
1978 resp.response.ptr_que_percent_cgppp->protocol = (T_BAT_percent_cgppp_protocol)protocol;
1979 aci_bat_send(src_infos_psi,&resp);
1980 return(ret);
1981 }
1982
1983 /*
1984 +--------------------------------------------------------------------+
1985 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1986 | STATE : code ROUTINE : sBAT_PercentCGCLASS |
1987 +--------------------------------------------------------------------+
1988
1989 PURPOSE :
1990 */
1991 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1992 T_BAT_cmd_send *cmd)
1993 {
1994 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1995 T_PERCENT_CGCLASS m_class = PERCENT_CGCLASS_OMITTED;
1996
1997 TRACE_FUNCTION ("sBAT_PercentCGCLASS()");
1998
1999 m_class=(T_PERCENT_CGCLASS)cmd->params.ptr_set_percent_cgclass->p_mobile_class;
2000
2001 if (m_class EQ PERCENT_CGCLASS_OMITTED)
2002 {
2003 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
2004 return (ACI_BAT_FAIL);
2005 }
2006 ret = (T_ACI_BAT_RSLT)sAT_PercentCGCLASS ((T_ACI_CMD_SRC) src_infos_psi->srcId, m_class );
2007 return(ret);
2008 }
2009
2010 /*
2011 +--------------------------------------------------------------------+
2012 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
2013 | STATE : code ROUTINE : qBAT_PercentCGCLASS |
2014 +--------------------------------------------------------------------+
2015
2016 PURPOSE :
2017 */
2018 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCGCLASS (T_ACI_DTI_PRC_PSI *src_infos_psi,
2019 T_BAT_cmd_send *cmd)
2020 {
2021 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
2022 T_PERCENT_CGCLASS m_class, currentClass;
2023 T_BAT_cmd_response resp;
2024 T_BAT_res_que_percent_cgclass que_cgclass_buffer;
2025
2026 TRACE_FUNCTION ("qBAT_PercentCGCLASS()");
2027
2028 resp.ctrl_response = BAT_RES_QUE_PERCENT_CGCLASS;
2029 resp.response.ptr_que_percent_cgclass = &que_cgclass_buffer;
2030 ret =(T_ACI_BAT_RSLT) qAT_PercentCGCLASS((T_ACI_CMD_SRC)src_infos_psi->srcId, &m_class, &currentClass);
2031 if (ret EQ ACI_BAT_CMPL)
2032 {
2033 resp.response.ptr_que_percent_cgclass->p_mobile_class = (T_BAT_p_mobile_class)m_class;
2034 resp.response.ptr_que_percent_cgclass->current_mobile_class = (T_BAT_p_mobile_class)currentClass;
2035 aci_bat_send(src_infos_psi,&resp);
2036 }
2037 return(ret);
2038 }
2039
2040 #endif /* GPRS */
2041