FreeCalypso > hg > tcs211-fcmodem
comparison g23m/condat/ms/src/aci/dti_cntrl_mng.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : ... | |
4 | Modul : dti_cntrl_mng.c | |
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 modul ... | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifdef DTI | |
22 | |
23 #ifndef DTI_CNTRL_MNG_C | |
24 #define DTI_CNTRL_MNG_C | |
25 #endif | |
26 | |
27 #ifdef MFW | |
28 #define ENTITY_MFW | |
29 #else | |
30 #ifdef SMI | |
31 #define ENTITY_SMI | |
32 #else | |
33 #define ENTITY_ACI | |
34 #endif | |
35 #endif | |
36 | |
37 #define ACI_MEMBER | |
38 | |
39 #include "aci_all.h" | |
40 | |
41 #include "dti.h" /* functionality of the dti library */ | |
42 #include "aci.h" | |
43 #include "aci_cmh.h" | |
44 #include "ati_cmd.h" | |
45 #include "aci_io.h" | |
46 | |
47 #include "aci_cmh.h" | |
48 #include "aci_mem.h" | |
49 #include "aci_lst.h" | |
50 | |
51 #include "dti_conn_mng.h" | |
52 #include "cmh_dti.h" | |
53 | |
54 #ifdef FAX_AND_DATA | |
55 #include "aci_fd.h" | |
56 #include "psa.h" | |
57 #include "psa_l2r.h" | |
58 #include "cmh.h" | |
59 #include "cmh_ra.h" | |
60 #include "cmh_l2r.h" | |
61 | |
62 #ifdef FF_FAX | |
63 #include "psa_t30.h" | |
64 #include "psa_tra.h" | |
65 #endif | |
66 | |
67 #else | |
68 | |
69 #include "psa.h" | |
70 #include "cmh.h" | |
71 | |
72 #endif /* #ifdef FAX_AND_DATA */ | |
73 | |
74 #include "psa_aaa.h" | |
75 | |
76 #if defined (GPRS) AND defined (UART) | |
77 #include "gaci.h" | |
78 #include "gaci_cmh.h" | |
79 #include "pcm.h" | |
80 #include "psa_gmm.h" | |
81 #include "cmh_gmm.h" | |
82 #include "psa_sm.h" | |
83 #include "cmh_sm.h" | |
84 #include "psa_gppp.h" | |
85 #include "cmh_gppp.h" | |
86 #ifdef FF_PKTIO | |
87 #include "psa_pktio.h" | |
88 #endif | |
89 #endif /* GPRS */ | |
90 | |
91 #if defined (FF_WAP) || defined (GPRS) || defined (FF_SAT_E) | |
92 #include "gaci.h" | |
93 #include "gaci_cmh.h" | |
94 #include "psa_sm.h" | |
95 #include "cmh_sm.h" | |
96 #endif | |
97 | |
98 #if defined (FF_WAP) || defined (FF_TCP_IP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E) | |
99 #include "psa_ppp_w.h" | |
100 #include "wap_aci.h" | |
101 #endif /* WAP or FF_TCP_IP */ | |
102 | |
103 #ifdef UART | |
104 #include "dti_cntrl_mng.h" | |
105 #include "psa_uart.h" | |
106 #include "ati_src_uart.h" | |
107 #endif | |
108 #ifdef FF_PSI | |
109 #include "psa_psi.h" | |
110 #endif | |
111 #include "sap_dti.h" | |
112 | |
113 #ifdef SIM_TOOLKIT | |
114 #include "psa.h" | |
115 #include "psa_sim.h" | |
116 #endif | |
117 | |
118 extern void psaTCPIP_Dti_Req(T_DTI_CONN_LINK_ID dti_id, | |
119 UBYTE peer_to_connect_to, UBYTE dti_conn); | |
120 /* | |
121 * list for devices maintained by DTI Control Manager | |
122 */ | |
123 LOCAL T_ACI_LIST *dti_cntrl_list = NULL; | |
124 /* static pointer to manage output of dti_cntrl_list elements */ | |
125 static const T_ACI_LIST *dti_cntrl_dev_ptr = NULL; | |
126 /* | |
127 * a customer can install up to 3 own entities involved in data transmission | |
128 * every customer entity has its own call back function, noted in this array | |
129 */ | |
130 LOCAL T_DTI_CNTRL_REGISTERED_EXT_CB reg_ext_cb[DTI_MAX_EXT_CB] = | |
131 { | |
132 {DTI_DTI_ID_NOTPRESENT, NULL}, | |
133 {DTI_DTI_ID_NOTPRESENT, NULL}, | |
134 {DTI_DTI_ID_NOTPRESENT, NULL} | |
135 }; | |
136 | |
137 | |
138 /* | |
139 * reuse of the global variable g_cur_cap due to the fact that the | |
140 * function dti_cntrl_est_dpath_indirect() is (always) called with the | |
141 * SPLIT mode, which means that there is the calling of | |
142 * dti_cntrl_entity_disconnected() which causes to reset the current | |
143 * capability and then there is the calling of dti_cntrl_entity_connected() | |
144 * and here we need the capability given in dti_cntrl_est_dpath_indirect() | |
145 */ | |
146 UBYTE g_cur_cap; | |
147 | |
148 /* bit set for DTI ID which should be reconnected to ACI */ | |
149 ULONG dti_cntrl_reconnect_to_aci; | |
150 | |
151 /*********************** LOCAL FUNCTIONS *****************************/ | |
152 | |
153 /* | |
154 +--------------------------------------------------------------------+ | |
155 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
156 | STATE : code ROUTINE : dti_cntrl_search_dev_id | | |
157 +--------------------------------------------------------------------+ | |
158 | |
159 PURPOSE : help function for | |
160 find_element_by_tupel (dti_cntrl_list, dev_id, dev_no, sub_no, dti_cntrl_search_dev_id); | |
161 */ | |
162 LOCAL BOOL dti_cntrl_search_dev_id (T_DTI_ENTITY_ID dev_id, UBYTE dev_no, UBYTE sub_no, void *elem) | |
163 { | |
164 T_DTI_CNTRL *compared = (T_DTI_CNTRL *)elem; | |
165 | |
166 if (compared NEQ NULL) | |
167 if (compared->dev_id EQ dev_id) | |
168 if (compared->dev_no EQ dev_no) | |
169 if (compared->sub_no EQ sub_no | |
170 #ifdef _SIMULATION_ | |
171 | |
172 OR 0 EQ sub_no AND 255 EQ compared->sub_no | |
173 | |
174 #endif | |
175 ) | |
176 return (TRUE); | |
177 return (FALSE); | |
178 } | |
179 | |
180 /* | |
181 +--------------------------------------------------------------------+ | |
182 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
183 | STATE : code ROUTINE : find_element_by_tupel | | |
184 +--------------------------------------------------------------------+ | |
185 | |
186 PURPOSE : find element in dti_cntrl_list | |
187 */ | |
188 typedef BOOL T_LIST_HELP_FCT (T_DTI_ENTITY_ID criterium1, UBYTE criterium2, UBYTE criterium3, void *elem); | |
189 | |
190 LOCAL void *find_element_by_tupel (T_ACI_LIST *search_list, | |
191 T_DTI_ENTITY_ID criterium1, | |
192 UBYTE criterium2, | |
193 UBYTE criterium3, | |
194 T_LIST_HELP_FCT test_criterium) | |
195 { | |
196 T_ACI_LIST *current = NULL; | |
197 | |
198 if ((search_list EQ NULL) OR (search_list->msg EQ NULL)) | |
199 { | |
200 return (NULL); | |
201 } | |
202 | |
203 current = search_list; | |
204 | |
205 do | |
206 { | |
207 if (current->msg NEQ NULL) | |
208 { | |
209 if (test_criterium (criterium1, criterium2, criterium3, current->msg)) | |
210 { | |
211 return (current->msg); | |
212 } | |
213 else | |
214 { | |
215 current = current->next; | |
216 } | |
217 } | |
218 }while (current NEQ NULL); | |
219 | |
220 return (NULL); | |
221 } | |
222 | |
223 /* | |
224 +--------------------------------------------------------------------+ | |
225 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
226 | STATE : code ROUTINE : dti_cntrl_call_reg_fct | | |
227 +--------------------------------------------------------------------+ | |
228 | |
229 PURPOSE : this function is called by dti_cntrl_maintain_entity(), | |
230 which is a call back function used by the DTI Connection | |
231 Manager, in such a case, where a customer installed its | |
232 own entity involved during data transmission | |
233 */ | |
234 LOCAL BOOL dti_cntrl_call_reg_fct( T_DTI_ENTITY_ID entity_id, | |
235 T_DTI_CONN_LINK_ID link_id, | |
236 T_DTI_ENTITY_ID peer_entity_id, | |
237 UBYTE dti_conn ) | |
238 { | |
239 UBYTE i = 0; | |
240 | |
241 TRACE_FUNCTION("dti_cntrl_call_reg_fct()"); | |
242 | |
243 for (i=0; i<DTI_MAX_EXT_CB; ++i) | |
244 { | |
245 if (reg_ext_cb[i].ent_id EQ entity_id) | |
246 { | |
247 if (reg_ext_cb[i].fct) | |
248 { | |
249 return (reg_ext_cb[i].fct(link_id, peer_entity_id, dti_conn)); | |
250 } | |
251 } | |
252 } | |
253 return (FALSE); | |
254 } | |
255 | |
256 /* | |
257 +------------------------------------------------------------------------------+ | |
258 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
259 | STATE : code ROUTINE : dti_cntrl_set_redirection | | |
260 +------------------------------------------------------------------------------+ | |
261 | |
262 PURPOSE : sub function of dti_cntrl_set_redirect_from_src and | |
263 dti_cntrl_set_redirect_from_device | |
264 */ | |
265 LOCAL BOOL dti_cntrl_set_redirection (T_DTI_CNTRL *dti_cntrl_dev, | |
266 T_DTI_CNTRL *indirect_dev, | |
267 UBYTE mode, | |
268 UBYTE capability, | |
269 UBYTE cid) | |
270 { | |
271 TRACE_FUNCTION("dti_cntrl_set_redirection()"); | |
272 | |
273 switch (capability) | |
274 { | |
275 case (DTI_CPBLTY_PKT): | |
276 { | |
277 if (mode EQ DTI_MODE_DELETE) | |
278 { | |
279 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].mode = DTI_MODE_NIL; | |
280 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].redirection = NULL; | |
281 } | |
282 else | |
283 { | |
284 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].mode = mode; | |
285 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].redirection = indirect_dev; | |
286 } | |
287 break; | |
288 } | |
289 case (DTI_CPBLTY_SER): | |
290 { | |
291 if (mode EQ DTI_MODE_DELETE) | |
292 { | |
293 dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].mode = DTI_MODE_NIL; | |
294 dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].redirection = NULL; | |
295 } | |
296 else | |
297 { | |
298 dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].mode = mode; | |
299 dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].redirection = indirect_dev; | |
300 } | |
301 break; | |
302 } | |
303 default: | |
304 { | |
305 TRACE_EVENT("given capability is not SER or PKT"); | |
306 return (FALSE); | |
307 } | |
308 } | |
309 return (TRUE); | |
310 } | |
311 | |
312 /* | |
313 +------------------------------------------------------------------------------+ | |
314 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
315 | STATE : code ROUTINE : dti_cntrl_get_redirection | | |
316 +------------------------------------------------------------------------------+ | |
317 | |
318 PURPOSE : sub function of dti_cntrl_get_first_redirection and | |
319 dti_cntrl_get_next_redirection | |
320 */ | |
321 LOCAL BOOL dti_cntrl_get_redirection (T_DTI_CNTRL *dti_cntrl_dev, | |
322 T_DTI_CNTRL *indirection, /* out parameter */ | |
323 UBYTE cid, | |
324 UBYTE capability) | |
325 { | |
326 UBYTE mode = DTI_MODE_NIL; /* remember temporary */ | |
327 | |
328 TRACE_FUNCTION("dti_cntrl_get_redirection()"); | |
329 | |
330 switch (capability) | |
331 { | |
332 case (DTI_CPBLTY_PKT): | |
333 { | |
334 for (cid += 1; cid<DTI_MAX_REDIRECTIONS; cid++) /* watch the start value */ | |
335 { | |
336 if (dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].redirection) | |
337 { | |
338 mode = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].mode; | |
339 /* | |
340 * set the pointer to the redirected device for packet data transmission | |
341 */ | |
342 dti_cntrl_dev = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].redirection; | |
343 break; | |
344 } | |
345 } | |
346 break; | |
347 } | |
348 case (DTI_CPBLTY_SER): | |
349 { | |
350 for (cid += 1; cid<DTI_MAX_REDIRECTIONS; cid++) /* watch the start value */ | |
351 { | |
352 if (dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].redirection) | |
353 { | |
354 mode = dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].mode; | |
355 /* | |
356 * set the pointer to the redirected device for serial data transmission | |
357 */ | |
358 dti_cntrl_dev = dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].redirection; | |
359 break; | |
360 } | |
361 } | |
362 break; | |
363 } | |
364 default: | |
365 { | |
366 TRACE_EVENT("given capability is not SER or PKT"); | |
367 indirection = NULL; /* make it invalid */ | |
368 return (FALSE); | |
369 } | |
370 } | |
371 | |
372 if (cid >= DTI_MAX_REDIRECTIONS) | |
373 { | |
374 indirection = NULL; /* there is no further redirection */ | |
375 } | |
376 else | |
377 { | |
378 /* | |
379 * fill the out parameter | |
380 */ | |
381 indirection->dev_id = dti_cntrl_dev->dev_id; | |
382 indirection->dev_no = dti_cntrl_dev->dev_no; | |
383 indirection->sub_no = dti_cntrl_dev->sub_no; | |
384 indirection->capability = dti_cntrl_dev->capability; | |
385 indirection->src_id = dti_cntrl_dev->src_id; | |
386 indirection->dti_id = dti_cntrl_dev->dti_id; | |
387 indirection->port_number = dti_cntrl_dev->port_number; | |
388 indirection->cur_cap = dti_cntrl_dev->cur_cap; | |
389 /* | |
390 * ! important ! with >>DTI_DEV_I_AM_THE_ONE<< we indicate that the | |
391 * redirect_info is now _actually_ the info about this device | |
392 */ | |
393 indirection->redirect_info.info.cid = cid; | |
394 indirection->redirect_info.info.mode = mode; | |
395 indirection->redirect_info.info.capability = capability; | |
396 indirection->redirect_info.info.direction = DTI_DEV_I_AM_THE_ONE; | |
397 } | |
398 return (TRUE); | |
399 } | |
400 | |
401 /* | |
402 +------------------------------------------------------------------------------+ | |
403 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
404 | STATE : code ROUTINE : dti_cntrl_get_info | | |
405 +------------------------------------------------------------------------------+ | |
406 | |
407 PURPOSE : sub function of the three functions | |
408 dti_cntrl_get_info_from_src_id | |
409 dti_cntrl_get_info_from_dti_id | |
410 dti_cntrl_get_info_from_dev_id | |
411 */ | |
412 LOCAL BOOL dti_cntrl_get_info (T_DTI_CNTRL *info, /* out parameter */ | |
413 T_DTI_CNTRL *dti_cntrl_dev) | |
414 { | |
415 UBYTE i = 0; | |
416 | |
417 TRACE_FUNCTION("dti_cntrl_get_info()"); | |
418 | |
419 info->dev_id = dti_cntrl_dev->dev_id; | |
420 info->dev_no = dti_cntrl_dev->dev_no; | |
421 info->sub_no = dti_cntrl_dev->sub_no; | |
422 info->capability = dti_cntrl_dev->capability; | |
423 info->src_id = dti_cntrl_dev->src_id; | |
424 info->dti_id = dti_cntrl_dev->dti_id; | |
425 info->port_number = dti_cntrl_dev->port_number; | |
426 info->cur_cap = dti_cntrl_dev->cur_cap; | |
427 info->driver_id = dti_cntrl_dev->driver_id; | |
428 info->dio_ctrl_id = dti_cntrl_dev->dio_ctrl_id; | |
429 /* | |
430 * init a possible indirection info with default values ( all 0xFF ) | |
431 */ | |
432 info->redirect_info.info.cid = DTI_CID_NOTPRESENT; | |
433 info->redirect_info.info.mode = DTI_MODE_NIL; | |
434 info->redirect_info.info.capability = DTI_CPBLTY_NO; | |
435 info->redirect_info.info.direction = DTI_DIRECTION_NOTPRESENT; | |
436 /* | |
437 * search, whether there is a redirection, start with packet device | |
438 */ | |
439 for (i=0; i<DTI_MAX_REDIRECTIONS; i++) | |
440 { | |
441 if (dti_cntrl_dev->redirect_info.tbl->pkt_redirect[i].redirection) | |
442 { | |
443 break; | |
444 } | |
445 } | |
446 if (i < DTI_MAX_REDIRECTIONS) | |
447 { | |
448 info->redirect_info.info.cid = i; | |
449 info->redirect_info.info.mode = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[i].mode; | |
450 info->redirect_info.info.capability = DTI_CPBLTY_PKT; | |
451 info->redirect_info.info.direction = DTI_DEV_IS_REDIRECTED; | |
452 } | |
453 /* | |
454 * there is no redirection to a packet device, so search for redirection to a serial device | |
455 */ | |
456 for (i=0; i<DTI_MAX_REDIRECTIONS; i++) | |
457 { | |
458 if (dti_cntrl_dev->redirect_info.tbl->ser_redirect[i].redirection) | |
459 { | |
460 break; | |
461 } | |
462 } | |
463 if (i < DTI_MAX_REDIRECTIONS) | |
464 { | |
465 info->redirect_info.info.cid = i; | |
466 info->redirect_info.info.mode = dti_cntrl_dev->redirect_info.tbl->ser_redirect[i].mode; | |
467 info->redirect_info.info.capability = DTI_CPBLTY_SER; | |
468 info->redirect_info.info.direction = DTI_DEV_IS_REDIRECTED; | |
469 } | |
470 return (TRUE); | |
471 } | |
472 | |
473 | |
474 /* | |
475 +------------------------------------------------------------------------------+ | |
476 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
477 | STATE : code ROUTINE : dti_cntrl_maintain_entity_connect | | |
478 +------------------------------------------------------------------------------+ | |
479 | |
480 PURPOSE : sub function of dti_cntrl_maintain_entity, called when the DTI | |
481 Connection Manager wants to connect entites for data transmission | |
482 | |
483 */ | |
484 LOCAL BOOL dti_cntrl_maintain_entity_connect ( T_DTI_CONN_LINK_ID link_id, | |
485 T_DTI_ENTITY_ID cur_ent_id, | |
486 T_DTI_ENTITY_ID peer_ent_id, | |
487 UBYTE dti_conn) | |
488 { | |
489 TRACE_FUNCTION("dti_cntrl_maintain_entity_connect()"); | |
490 | |
491 #ifdef FF_TCP_IP | |
492 /* If the peer entity is AAA, delay the connect request until AAA has | |
493 * responded to the AAA_DTI_IND. ati_src_riv_dti_rsp() calls | |
494 * dti_cntrl_connect_after_aaa_dti_rsp(), which in turn calls this function, | |
495 * on receiving the response. */ | |
496 { | |
497 if (peer_ent_id EQ DTI_ENTITY_AAA) | |
498 { | |
499 T_DTI_CNTRL *dti_cntrl_dev; /* Information about DTI link. */ | |
500 UBYTE dti_id ; /* DTI id of this connection. */ | |
501 | |
502 dti_id = EXTRACT_DTI_ID(link_id) ; | |
503 dti_cntrl_dev = (T_DTI_CNTRL *) find_element (dti_cntrl_list, dti_id, | |
504 dti_cntrl_search_dti_id) ; | |
505 if (!dti_cntrl_dev->had_aaa_dti_rsp) | |
506 { | |
507 dti_cntrl_dev->save_link_id = link_id ; | |
508 dti_cntrl_dev->save_cur_ent_id = cur_ent_id ; | |
509 dti_cntrl_dev->save_dti_conn = dti_conn ; | |
510 return TRUE ; | |
511 } | |
512 dti_cntrl_dev->had_aaa_dti_rsp = FALSE; | |
513 | |
514 } | |
515 } | |
516 #endif /* FF_TCP_IP */ | |
517 | |
518 switch ( cur_ent_id ) | |
519 { | |
520 case DTI_ENTITY_ACI: /* entity ACI */ | |
521 /* handle ACI as independent entity */ | |
522 psaACI_Dti_Req(link_id, peer_ent_id, ACI_CONNECT_DTI); | |
523 break; | |
524 | |
525 case DTI_ENTITY_UART: /* entity UART */ | |
526 psaUART_SetDTIReq (link_id, peer_ent_id); | |
527 break; | |
528 | |
529 #ifdef FF_TRACE_OVER_MTST | |
530 case DTI_ENTITY_MTST: /* for traces */ | |
531 psaMTST_Switch_Trace (link_id, peer_ent_id, TRUE); | |
532 break; | |
533 #endif | |
534 | |
535 #ifdef FAX_AND_DATA | |
536 case DTI_ENTITY_TRA: | |
537 psaTRA_Dti_Req( link_id, TRA_CONNECT_DTI, (UBYTE)peer_ent_id ); | |
538 break; | |
539 | |
540 case DTI_ENTITY_L2R: | |
541 psaL2R_Enable (link_id, (UBYTE)peer_ent_id); | |
542 break; | |
543 | |
544 #ifdef FF_FAX | |
545 case DTI_ENTITY_T30: | |
546 psaT30_Dti_Req( link_id, T30_CONNECT_DTI ); | |
547 break; | |
548 #endif | |
549 | |
550 #ifdef BT_ADAPTER | |
551 case DTI_ENTITY_BLUETOOTH: | |
552 psaBTI_Dti_Req( link_id, peer_ent_id, BTI_CONNECT_DTI ); | |
553 break; | |
554 #endif /* BT_ADAPTER */ | |
555 | |
556 #endif /* FAX_AND_DATA */ | |
557 | |
558 #ifdef GPRS | |
559 case DTI_ENTITY_PPPS: | |
560 psaGPPPS_Dti_Req(link_id, (UBYTE) peer_ent_id); /* rather use dti_id instead of link_id ???? */ | |
561 break; | |
562 #ifdef FF_PKTIO | |
563 case DTI_ENTITY_PKTIO: | |
564 psaPKT_Dti_Req((ULONG)link_id, (UBYTE)peer_ent_id, PKT_CONNECT_DTI); | |
565 break; | |
566 #endif /* FF_PKTIO */ | |
567 case DTI_ENTITY_SNDCP: | |
568 psaSNDCP_Dti_Req( link_id, (UBYTE) peer_ent_id ); /* rather use dti_id instead of link_id ???? */ | |
569 break; | |
570 #endif /* GPRS */ | |
571 #ifdef FF_PSI | |
572 case DTI_ENTITY_PSI: | |
573 psaPSI_Dti_Req((ULONG)link_id, (UBYTE)peer_ent_id, PSI_CONNECT_DTI); | |
574 break; | |
575 #endif /*FF_PSI*/ | |
576 case DTI_ENTITY_NULL: | |
577 dti_cntrl_entity_connected (link_id, DTI_ENTITY_NULL, DTI_OK); | |
578 break; | |
579 | |
580 #if defined (FF_WAP) || defined (FF_TCP_IP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E) | |
581 case DTI_ENTITY_PPPC: | |
582 psaPPP_Establish(link_id, (UBYTE) peer_ent_id); | |
583 break; | |
584 #endif /* WAP or FF_TCP_IP or SAT E */ | |
585 #ifdef CO_UDP_IP | |
586 case DTI_ENTITY_IP: | |
587 psaIPA_Dti_Req(link_id, (UBYTE) peer_ent_id, IPA_CONNECT_DTI); | |
588 break; | |
589 | |
590 case DTI_ENTITY_UDP: | |
591 psaUDPA_Dti_Req(link_id, (UBYTE) peer_ent_id, UDPA_CONNECT_DTI); | |
592 break; | |
593 | |
594 #ifdef FF_WAP | |
595 case DTI_ENTITY_WAP: | |
596 psaWAP_Dti_Req(link_id, (UBYTE) peer_ent_id, WAP_CONNECT_DTI); | |
597 break; | |
598 #endif /* WAP */ | |
599 | |
600 #endif /* WAP || SAT E */ | |
601 | |
602 #ifdef FF_GPF_TCPIP | |
603 case DTI_ENTITY_TCPIP: | |
604 psaTCPIP_Dti_Req(link_id, (UBYTE) peer_ent_id, TCPIP_CONNECT_DTI); | |
605 break; | |
606 #endif | |
607 | |
608 #ifdef FF_TCP_IP | |
609 case DTI_ENTITY_AAA: /* entity AAA */ | |
610 psaAAA_dti_ind (link_id, peer_ent_id); | |
611 break; | |
612 #endif | |
613 | |
614 #ifdef FF_SAT_E | |
615 /* SAT class e */ | |
616 case DTI_ENTITY_SIM: | |
617 /* init connection SIM--PEER */ | |
618 /* open DTI connection */ | |
619 psaSIM_Dti_Req(link_id); | |
620 break; | |
621 #endif | |
622 | |
623 default: | |
624 /* search for registered connect function */ | |
625 return dti_cntrl_call_reg_fct(cur_ent_id, link_id, peer_ent_id, dti_conn); | |
626 } | |
627 return (TRUE); | |
628 } | |
629 | |
630 #ifdef FF_TCP_IP | |
631 EXTERN void dti_cntrl_connect_after_aaa_dti_rsp(UBYTE dti_id) | |
632 { | |
633 /* If the peer entity is AAA, the connect request has been delayed, until | |
634 * AAA has responded to the AAA_DTI_IND. ati_src_riv_dti_rsp() calls this | |
635 * function on receiving this response. */ | |
636 | |
637 T_DTI_CNTRL *dti_cntrl_dev ; /* Information about DTI link. */ | |
638 | |
639 TRACE_FUNCTION("dti_cntrl_connect_after_aaa_dti_rsp()"); | |
640 dti_cntrl_dev = (T_DTI_CNTRL *) find_element (dti_cntrl_list, dti_id, | |
641 dti_cntrl_search_dti_id) ; | |
642 dti_cntrl_dev->had_aaa_dti_rsp = TRUE ; | |
643 dti_cntrl_maintain_entity_connect(dti_cntrl_dev->save_link_id, | |
644 dti_cntrl_dev->save_cur_ent_id, | |
645 DTI_ENTITY_AAA, | |
646 dti_cntrl_dev->save_dti_conn) ; | |
647 } | |
648 #endif /* FF_TCP_IP */ | |
649 | |
650 /* | |
651 +---------------------------------------------------------------------------------+ | |
652 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
653 | STATE : code ROUTINE : dti_cntrl_maintain_entity_disconnect | | |
654 +---------------------------------------------------------------------------------+ | |
655 | |
656 PURPOSE : sub function of dti_cntrl_maintain_entity, called when the DTI | |
657 Connection Manager wants to disconnect entites after data transmission | |
658 */ | |
659 LOCAL BOOL dti_cntrl_maintain_entity_disconnect ( T_DTI_CONN_LINK_ID link_id, | |
660 T_DTI_ENTITY_ID cur_ent_id, | |
661 T_DTI_ENTITY_ID peer_ent_id, | |
662 UBYTE dti_conn) | |
663 { | |
664 TRACE_FUNCTION("dti_cntrl_maintain_entity_disconnect()"); | |
665 switch( cur_ent_id ) | |
666 { | |
667 case DTI_ENTITY_ACI: | |
668 psaACI_Dti_Req (link_id, peer_ent_id, ACI_DISCONNECT_DTI); | |
669 break; | |
670 | |
671 case DTI_ENTITY_UART: | |
672 /* for UART, we have to wait for UART_DTI_IND | |
673 * sent when UART recognizes it's dti connection has been | |
674 * closed down. | |
675 * It would be nice to just send UART_DTI_REQ | |
676 * here in order to make handling of the UART entity | |
677 * more similar to the other entities.. | |
678 */ | |
679 break; | |
680 | |
681 #ifdef FF_TRACE_OVER_MTST | |
682 case DTI_ENTITY_MTST: /* for traces */ | |
683 if (psaMTST_Switch_Trace (link_id, peer_ent_id, FALSE) EQ PEI_ERROR) | |
684 { | |
685 return (FALSE); | |
686 } | |
687 break; | |
688 #endif | |
689 | |
690 #ifdef FAX_AND_DATA | |
691 case DTI_ENTITY_TRA: | |
692 psaTRA_Dti_Req (link_id, TRA_DISCONNECT_DTI, (UBYTE)peer_ent_id); | |
693 break; | |
694 | |
695 #ifdef FF_FAX | |
696 case DTI_ENTITY_T30: | |
697 psaT30_Dti_Req (link_id, T30_DISCONNECT_DTI); | |
698 break; | |
699 #endif | |
700 | |
701 case DTI_ENTITY_L2R: | |
702 /* in the case of disconnecting L2R, | |
703 it has to be DEACTIVATED */ | |
704 psaL2R_Deactivate(); | |
705 break; | |
706 | |
707 #ifdef BT_ADAPTER | |
708 case DTI_ENTITY_BLUETOOTH: | |
709 psaBTI_Dti_Req(link_id, peer_ent_id, BTI_DISCONNECT_DTI); | |
710 break; | |
711 #endif /* BT_ADAPTER */ | |
712 | |
713 #endif /* FAX_AND_DATA */ | |
714 | |
715 #ifdef GPRS | |
716 case DTI_ENTITY_PPPS: | |
717 cmhGPPPS_Disable( link_id ); | |
718 break; | |
719 | |
720 case DTI_ENTITY_SNDCP: | |
721 cmhSNDCP_Disable( link_id ); | |
722 break; | |
723 #ifdef FF_PKTIO | |
724 case DTI_ENTITY_PKTIO: | |
725 psaPKT_Dti_Req((ULONG)link_id, (UBYTE)peer_ent_id, PKT_DISCONNECT_DTI); | |
726 break; | |
727 #endif /* FF_PKTIO */ | |
728 #endif /* GPRS */ | |
729 | |
730 #ifdef FF_PSI | |
731 case DTI_ENTITY_PSI: | |
732 psaPSI_Dti_Req((ULONG)link_id, (UBYTE)peer_ent_id, PSI_DISCONNECT_DTI); | |
733 break; | |
734 #endif /*FF_PSI*/ | |
735 | |
736 #ifdef CO_UDP_IP | |
737 case DTI_ENTITY_IP: | |
738 psaIPA_Dti_Req(link_id, (UBYTE)peer_ent_id, IPA_DISCONNECT_DTI); | |
739 break; | |
740 | |
741 case DTI_ENTITY_UDP: | |
742 /* for UDP, we have to wait for UDPA_DTI_IND(DISCONNECT) which is | |
743 * sent when UDP recognizes it's dti connection has been | |
744 * closed down | |
745 */ | |
746 break; | |
747 #endif /* CO_UDP_IP */ | |
748 | |
749 #ifdef FF_WAP | |
750 case DTI_ENTITY_WAP: | |
751 psaWAP_Dti_Req(link_id, (UBYTE) peer_ent_id, WAP_DISCONNECT_DTI); | |
752 break; | |
753 #endif /* WAP */ | |
754 | |
755 #ifdef FF_GPF_TCPIP | |
756 case DTI_ENTITY_TCPIP: | |
757 /* for TCP/IP, we have to wait for TCPIP_DTI_IND(DISCONNECT) which is | |
758 * sent when TCP/IP recognizes its DTI connection has been closed down */ | |
759 psaTCPIP_Dti_Req(link_id, (UBYTE) peer_ent_id, TCPIP_DISCONNECT_DTI); | |
760 break; | |
761 #endif /* FF_GPF_TCPIP */ | |
762 | |
763 #ifdef FF_TCP_IP | |
764 case DTI_ENTITY_AAA: /* entity AAA */ | |
765 psaAAA_disconnect_ind (link_id); | |
766 break; | |
767 case DTI_ENTITY_PPPC: | |
768 psaPPP_Terminate(UP); | |
769 break; | |
770 #endif | |
771 | |
772 #ifdef FF_SAT_E | |
773 /* SAT class e */ | |
774 case DTI_ENTITY_SIM: | |
775 psaSIM_Dti_Req(link_id); | |
776 break; | |
777 #endif | |
778 | |
779 default: | |
780 /* search for registered connect function */ | |
781 return dti_cntrl_call_reg_fct(cur_ent_id, link_id, peer_ent_id, dti_conn); | |
782 } | |
783 | |
784 return (TRUE); | |
785 } | |
786 | |
787 /* | |
788 +----------------------------------------------------------------------+ | |
789 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
790 | STATE : code ROUTINE : dti_cntrl_maintain_entity | | |
791 +----------------------------------------------------------------------+ | |
792 | |
793 PURPOSE : this function is used by the DTI Connection Manager as a | |
794 call back function for connecting/disconnecting. | |
795 The registeration of dti_cntrl_maintain_entity in the | |
796 DTI Connection Manager takes place with: | |
797 dti_conn_init (dti_cntrl_maintain_entity); | |
798 */ | |
799 LOCAL BOOL dti_cntrl_maintain_entity ( T_DTI_CONN_LINK_ID link_id, | |
800 T_DTI_ENTITY_ID cur_ent_id, | |
801 T_DTI_ENTITY_ID peer_ent_id, | |
802 UBYTE dti_conn) | |
803 { | |
804 TRACE_FUNCTION("dti_cntrl_maintain_entity()"); | |
805 | |
806 if (dti_conn EQ DTI_CONNECT) | |
807 { | |
808 return (dti_cntrl_maintain_entity_connect (link_id, cur_ent_id, peer_ent_id, dti_conn)); | |
809 } | |
810 else /* DTI_DISCONNECT */ | |
811 { | |
812 return (dti_cntrl_maintain_entity_disconnect (link_id, cur_ent_id, peer_ent_id, dti_conn)); | |
813 } | |
814 } | |
815 /********************** GLOBAL FUNCTIONS *****************************/ | |
816 | |
817 /* | |
818 +--------------------------------------------------------------------+ | |
819 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
820 | STATE : code ROUTINE : dti_cntrl_search_src_id | | |
821 +--------------------------------------------------------------------+ | |
822 | |
823 PURPOSE : help function for | |
824 find_element (dti_cntrl_list, dti_id, dti_cntrl_search_src_id); | |
825 */ | |
826 GLOBAL BOOL dti_cntrl_search_src_id (UBYTE src_id, void *elem) | |
827 { | |
828 T_DTI_CNTRL *compared = (T_DTI_CNTRL *)elem; | |
829 | |
830 if (compared NEQ NULL) | |
831 if (compared->src_id EQ src_id) | |
832 return (TRUE); | |
833 return (FALSE); | |
834 } | |
835 | |
836 /* | |
837 +--------------------------------------------------------------------+ | |
838 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
839 | STATE : code ROUTINE : dti_cntrl_search_dti_id | | |
840 +--------------------------------------------------------------------+ | |
841 | |
842 PURPOSE : help function for | |
843 find_element (dti_cntrl_list, dti_id, dti_cntrl_search_dti_id); | |
844 */ | |
845 GLOBAL BOOL dti_cntrl_search_dti_id (UBYTE dti_id, void *elem) | |
846 { | |
847 T_DTI_CNTRL *compared = (T_DTI_CNTRL *)elem; | |
848 | |
849 if (compared NEQ NULL) | |
850 if (compared->dti_id EQ dti_id) | |
851 return (TRUE); | |
852 return (FALSE); | |
853 } | |
854 | |
855 /* | |
856 +--------------------------------------------------------------------+ | |
857 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
858 | STATE : code ROUTINE : dti_cntrl_init | | |
859 +--------------------------------------------------------------------+ | |
860 | |
861 PURPOSE : create the global defined dti_cntrl_list and | |
862 register dti_cntrl_maintain_entity as call back | |
863 */ | |
864 GLOBAL void dti_cntrl_init (void) | |
865 { | |
866 UBYTE i; | |
867 | |
868 TRACE_FUNCTION("dti_cntrl_init()"); | |
869 | |
870 for (i=0; i<MAX_DTI_CONN_LINK_IDS; i++) | |
871 { | |
872 dti_aci_data_base[i].link_id = DTI_LINK_ID_NOTPRESENT; | |
873 dti_aci_data_base[i].dev_no1 = DTI_DEV_NO_NOTPRESENT; | |
874 dti_aci_data_base[i].dev_no2 = DTI_DEV_NO_NOTPRESENT; | |
875 dti_aci_data_base[i].ent_id1 = DTI_ENTITY_INVALID; | |
876 dti_aci_data_base[i].ent_id2 = DTI_ENTITY_INVALID; | |
877 dti_aci_data_base[i].sub_no1 = DTI_SUB_NO_NOTPRESENT; | |
878 dti_aci_data_base[i].sub_no2 = DTI_SUB_NO_NOTPRESENT; | |
879 } | |
880 | |
881 dti_cntrl_reconnect_to_aci = 0; | |
882 | |
883 dti_cntrl_list = new_list (); | |
884 | |
885 dti_conn_init (dti_cntrl_maintain_entity); | |
886 } | |
887 | |
888 /* | |
889 +--------------------------------------------------------------------+ | |
890 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
891 | STATE : code ROUTINE : dti_cntrl_new_dti | | |
892 +--------------------------------------------------------------------+ | |
893 | |
894 PURPOSE : | |
895 | |
896 */ | |
897 GLOBAL UBYTE dti_cntrl_new_dti (UBYTE dti_id) | |
898 { | |
899 | |
900 TRACE_FUNCTION("dti_cntrl_new_dti()"); | |
901 | |
902 /* call DTI connection manager function to get a DTI ID */ | |
903 if ((dti_id = dti_conn_new(dti_id)) EQ DTI_DTI_ID_NOTPRESENT) | |
904 { | |
905 TRACE_EVENT("couldn't create new dti_id"); | |
906 return (FALSE); | |
907 } | |
908 | |
909 return (dti_id); | |
910 } | |
911 | |
912 /* | |
913 +--------------------------------------------------------------------+ | |
914 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
915 | STATE : code ROUTINE : dti_cntrl_new_device | | |
916 +--------------------------------------------------------------------+ | |
917 | |
918 PURPOSE : a PSA wants to set up a device. | |
919 in case of ATI_RIV called this function, then port_num | |
920 is meaningful number, else port_num = NO_PORT_NUMBER. | |
921 we keep the port number here to frees ATI-RIV from | |
922 maintaining its own redundant list. | |
923 */ | |
924 GLOBAL BOOL dti_cntrl_new_device (UBYTE src_id, | |
925 UBYTE dev_id, | |
926 UBYTE dev_no, | |
927 UBYTE sub_no, | |
928 UBYTE port_num, | |
929 UBYTE capability, | |
930 UBYTE driver_id, | |
931 UBYTE dio_ctrl_id) | |
932 { | |
933 UBYTE dti_id = DTI_DTI_ID_NOTPRESENT; | |
934 T_DTI_CNTRL *dti_cntrl_dev = NULL; | |
935 USHORT i = 0; | |
936 | |
937 TRACE_FUNCTION("dti_cntrl_new_device()"); | |
938 | |
939 /* call DTI connection manager function to get a DTI ID */ | |
940 if ((dti_id = dti_conn_new(DTI_DTI_ID_NOTPRESENT)) EQ DTI_DTI_ID_NOTPRESENT) | |
941 { | |
942 TRACE_EVENT("couldn't create new dti_id"); | |
943 return (FALSE); | |
944 } | |
945 | |
946 ACI_MALLOC (dti_cntrl_dev, sizeof (T_DTI_CNTRL)); | |
947 ACI_MALLOC (dti_cntrl_dev->redirect_info.tbl, sizeof (T_DTI_CNTRL_REDIRECT_INTERN)); | |
948 | |
949 dti_cntrl_dev->dev_id = dev_id; | |
950 dti_cntrl_dev->dev_no = dev_no; | |
951 dti_cntrl_dev->sub_no = sub_no; /* multiplexed sub channels */ | |
952 dti_cntrl_dev->capability = capability; /* what the device is capable to */ | |
953 dti_cntrl_dev->src_id = src_id; | |
954 dti_cntrl_dev->dti_id = dti_id; | |
955 dti_cntrl_dev->port_number = port_num; | |
956 dti_cntrl_dev->driver_id = driver_id; | |
957 dti_cntrl_dev->dio_ctrl_id = dio_ctrl_id; | |
958 | |
959 #ifdef FF_TCP_IP | |
960 dti_cntrl_dev->had_aaa_dti_rsp = FALSE ; | |
961 dti_cntrl_dev->save_link_id = 0 ; | |
962 dti_cntrl_dev->save_cur_ent_id = 0 ; | |
963 dti_cntrl_dev->save_dti_conn = 0 ; | |
964 #endif /* FF_TCP_IP */ | |
965 | |
966 if ((src_id NEQ DTI_SRC_ID_NOTPRESENT) AND (src_id <= CMD_SRC_MAX)) | |
967 { | |
968 dti_cntrl_dev->cur_cap = DTI_CPBLTY_CMD; /* has been called by an AT src, so at least CMD capability */ | |
969 } | |
970 else | |
971 { | |
972 dti_cntrl_dev->cur_cap = DTI_CPBLTY_NO; /* has not been called by an AT src and there is no connection yet */ | |
973 } | |
974 | |
975 for (i=0; i<DTI_MAX_REDIRECTIONS; ++i) | |
976 { | |
977 dti_cntrl_dev->redirect_info.tbl->ser_redirect[i].mode = DTI_MODE_PERM; | |
978 dti_cntrl_dev->redirect_info.tbl->ser_redirect[i].redirection = NULL; | |
979 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[i].mode = DTI_MODE_PERM; | |
980 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[i].redirection = NULL; | |
981 } | |
982 | |
983 return (insert_list (dti_cntrl_list, dti_cntrl_dev)); | |
984 } | |
985 | |
986 /* | |
987 +--------------------------------------------------------------------+ | |
988 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
989 | STATE : code ROUTINE : dti_cntrl_new_device | | |
990 +--------------------------------------------------------------------+ | |
991 | |
992 PURPOSE : change the sub channel number (for multiplexer) | |
993 */ | |
994 GLOBAL void dti_cntrl_change_sub_no (UBYTE src_id, | |
995 UBYTE sub_no) | |
996 { | |
997 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
998 | |
999 TRACE_FUNCTION("dti_cntrl_change_sub_no()"); | |
1000 | |
1001 if (dti_cntrl_dev NEQ NULL) | |
1002 { | |
1003 dti_cntrl_dev->sub_no = sub_no; /* multiplexed sub channels */ | |
1004 } | |
1005 else | |
1006 { | |
1007 TRACE_EVENT_P1("no registered device found for src_id=%u", src_id); | |
1008 } | |
1009 } | |
1010 | |
1011 /* | |
1012 +--------------------------------------------------------------------+ | |
1013 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1014 | STATE : code ROUTINE : dti_cntrl_est_dpath | | |
1015 +--------------------------------------------------------------------+ | |
1016 | |
1017 PURPOSE : establish a data connection path directly | |
1018 | |
1019 */ | |
1020 GLOBAL BOOL dti_cntrl_est_dpath ( UBYTE dti_id, | |
1021 T_DTI_ENTITY_ID *entity_list, | |
1022 UBYTE num_entities, | |
1023 T_DTI_CONN_MODE mode, /* split/append */ | |
1024 T_DTI_CONN_CB *cb) | |
1025 { | |
1026 TRACE_FUNCTION("dti_cntrl_est_dpath()"); | |
1027 | |
1028 return (dti_conn_est_dpath (dti_id, entity_list, num_entities, mode, cb)); | |
1029 } | |
1030 | |
1031 /* | |
1032 +-------------------------------------------------------------------------+ | |
1033 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1034 | STATE : code ROUTINE : dti_cntrl_est_dpath_indirect | | |
1035 +-------------------------------------------------------------------------+ | |
1036 | |
1037 PURPOSE : establish a data connection path, for which a redirection has been set up. | |
1038 a redirection relates to a serial or packet device indicated by capability. | |
1039 with the cid we find in ser_redirect[cid] respectively pkt_redirect[cid] | |
1040 the pointer to the redirected device maintenance in dti_cntrl_list, from | |
1041 which we get the dti_id to pass it to the DTI Connection Manager. | |
1042 */ | |
1043 GLOBAL BOOL dti_cntrl_est_dpath_indirect (UBYTE src_id, | |
1044 T_DTI_ENTITY_ID *entity_list, | |
1045 UBYTE num_entities, | |
1046 T_DTI_CONN_MODE mode, /* split/append */ | |
1047 T_DTI_CONN_CB *cb, | |
1048 UBYTE capability, | |
1049 UBYTE cid) | |
1050 { | |
1051 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
1052 T_DTI_CNTRL *indirect_dev = NULL; /* the pointer to the redirected device maintenance */ | |
1053 UBYTE dti_id = DTI_DTI_ID_NOTPRESENT; | |
1054 UBYTE mode_once_perm = DTI_MODE_NIL; | |
1055 T_DTI_ENTITY_ID *new_entity_list; | |
1056 BOOL ret_value; | |
1057 | |
1058 /* for tracing of establishing of CMD channels for dual port version */ | |
1059 #ifdef RMV_15_04_03 | |
1060 extern CHAR gob_tst_buf[]; | |
1061 #endif | |
1062 | |
1063 TRACE_FUNCTION("dti_cntrl_est_dpath_indirect()"); | |
1064 | |
1065 if (dti_cntrl_dev EQ NULL) | |
1066 { | |
1067 TRACE_EVENT_P1("[ERR]Device with src_id=%d was not registered", src_id); | |
1068 return FALSE; | |
1069 } | |
1070 | |
1071 ACI_MALLOC(new_entity_list, sizeof(T_DTI_ENTITY_ID)*(num_entities+1) ); | |
1072 memcpy(&new_entity_list[1], entity_list, sizeof(T_DTI_ENTITY_ID)*num_entities); | |
1073 | |
1074 if (cid EQ DTI_CID_NOTPRESENT) | |
1075 { | |
1076 cid = 0; | |
1077 } | |
1078 | |
1079 /* | |
1080 * requested capability for data transmission can be SER ,PKT or CMD | |
1081 */ | |
1082 switch (capability) | |
1083 { | |
1084 case (DTI_CPBLTY_PKT): | |
1085 { | |
1086 mode_once_perm = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].mode; | |
1087 indirect_dev = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[cid].redirection; | |
1088 | |
1089 /* | |
1090 * if there is no redirection for the given cid (so it is a GPRS call) | |
1091 * then look in the "redirection for all cids" entry | |
1092 */ | |
1093 if ((indirect_dev EQ NULL) AND (cid NEQ 0)) | |
1094 { | |
1095 mode_once_perm = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[0].mode; | |
1096 indirect_dev = dti_cntrl_dev->redirect_info.tbl->pkt_redirect[0].redirection; | |
1097 } | |
1098 | |
1099 if(indirect_dev NEQ NULL) | |
1100 { | |
1101 indirect_dev->cur_cap = DTI_CPBLTY_PKT; | |
1102 } | |
1103 break; | |
1104 } | |
1105 case (DTI_CPBLTY_SER): | |
1106 { | |
1107 mode_once_perm = dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].mode; | |
1108 indirect_dev = dti_cntrl_dev->redirect_info.tbl->ser_redirect[cid].redirection; | |
1109 | |
1110 /* | |
1111 * if there is no redirection for the given cid (so it is a GPRS call) | |
1112 * then look in the "redirection for all cids" entry | |
1113 */ | |
1114 if ((indirect_dev EQ NULL) AND (cid NEQ 0)) | |
1115 { | |
1116 mode_once_perm = dti_cntrl_dev->redirect_info.tbl->ser_redirect[0].mode; | |
1117 indirect_dev = dti_cntrl_dev->redirect_info.tbl->ser_redirect[0].redirection; | |
1118 #ifdef RMV_15_04_03 | |
1119 TRACE_EVENT("redirection used"); | |
1120 TRACE_EVENT_P1("cid: %d", cid); | |
1121 #endif | |
1122 } | |
1123 | |
1124 if(indirect_dev NEQ NULL) | |
1125 { | |
1126 indirect_dev->cur_cap = DTI_CPBLTY_SER; | |
1127 } | |
1128 break; | |
1129 } | |
1130 case (DTI_CPBLTY_CMD): | |
1131 dti_cntrl_dev->cur_cap = DTI_CPBLTY_CMD; | |
1132 break; | |
1133 default: | |
1134 { | |
1135 return (FALSE); | |
1136 } | |
1137 } | |
1138 | |
1139 if (indirect_dev EQ NULL) | |
1140 { | |
1141 /* verify that the device is able to work in the requested capability */ | |
1142 if ((BITFIELD_CHECK (capability, dti_cntrl_dev->capability)) EQ FALSE) | |
1143 { | |
1144 return (FALSE); | |
1145 } | |
1146 | |
1147 dti_id = dti_cntrl_dev->dti_id; | |
1148 new_entity_list[0] = dti_cntrl_dev->dev_id; | |
1149 } | |
1150 else | |
1151 { | |
1152 /* verify that the device is able to work in the requested capability */ | |
1153 if ((BITFIELD_CHECK (capability, indirect_dev->capability)) EQ FALSE) | |
1154 { | |
1155 return (FALSE); | |
1156 } | |
1157 | |
1158 dti_id = indirect_dev->dti_id; | |
1159 new_entity_list[0] = indirect_dev->dev_id; | |
1160 if (mode_once_perm EQ DTI_MODE_ONCE) | |
1161 { | |
1162 /* the redirected data transmission connection is not permanent, | |
1163 * so remove the pointer to the redirected device maintenance */ | |
1164 indirect_dev = NULL; | |
1165 } | |
1166 } | |
1167 | |
1168 num_entities++; | |
1169 /* | |
1170 * remember capability, we need it again in dti_cntrl_entity_connected() | |
1171 */ | |
1172 g_cur_cap = capability; | |
1173 | |
1174 /* for tracing of establishing of CMD channels for dual port version */ | |
1175 #ifdef RMV_15_04_03 | |
1176 TRACE_EVENT_P1("num_entities: %d", num_entities); | |
1177 TRACE_EVENT_P1("g_cur_cap: %d", g_cur_cap); | |
1178 TRACE_EVENT_P1("new_entity_list[0]: %d", new_entity_list[0]); | |
1179 TRACE_EVENT_P1("new_entity_list[1]: %d", new_entity_list[1]); | |
1180 TRACE_EVENT_P1("new_entity_list[2]: %d", new_entity_list[2]); | |
1181 TRACE_EVENT_P1("dti_cntrl_dev->dti_id: %d", dti_cntrl_dev->dti_id); | |
1182 if (indirect_dev) | |
1183 { | |
1184 TRACE_EVENT_P1("indirect_dev->dti_id: %d", indirect_dev->dti_id); | |
1185 } | |
1186 | |
1187 TRACE_EVENT(gob_tst_buf); | |
1188 #endif | |
1189 | |
1190 /* clear reconnect flag for the new connction */ | |
1191 dti_cntrl_clear_dti_id_to_reconnect(dti_id); | |
1192 | |
1193 ret_value = dti_conn_est_dpath (dti_id, new_entity_list, num_entities, mode, cb); | |
1194 | |
1195 ACI_MFREE(new_entity_list); | |
1196 return ret_value; | |
1197 } | |
1198 | |
1199 /* | |
1200 +------------------------------------------------------------------------+ | |
1201 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1202 | STATE : code ROUTINE : dti_cntrl_is_dti_channel_connected | | |
1203 +------------------------------------------------------------------------+ | |
1204 | |
1205 PURPOSE : | |
1206 | |
1207 */ | |
1208 GLOBAL BOOL dti_cntrl_is_dti_channel_connected (T_DTI_ENTITY_ID ent_id, UBYTE dti_id) | |
1209 { | |
1210 TRACE_FUNCTION("dti_cntrl_is_dti_channel_connected()"); | |
1211 | |
1212 return (dti_conn_is_dti_channel_connected (ent_id, dti_id)); | |
1213 } | |
1214 | |
1215 /* | |
1216 +--------------------------------------------------------------------------+ | |
1217 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1218 | STATE : code ROUTINE : dti_cntrl_is_dti_channel_disconnected | | |
1219 +--------------------------------------------------------------------------+ | |
1220 | |
1221 PURPOSE : | |
1222 | |
1223 */ | |
1224 GLOBAL BOOL dti_cntrl_is_dti_channel_disconnected (UBYTE dti_id) | |
1225 { | |
1226 TRACE_FUNCTION("dti_cntrl_is_dti_channel_disconnected()"); | |
1227 | |
1228 return (dti_conn_is_dti_channel_disconnected (dti_id)); | |
1229 } | |
1230 /* | |
1231 +------------------------------------------------------------------------+ | |
1232 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1233 | STATE : code ROUTINE : dti_cntrl_close_dpath_from_src_id | | |
1234 +------------------------------------------------------------------------+ | |
1235 | |
1236 PURPOSE : | |
1237 | |
1238 */ | |
1239 GLOBAL BOOL dti_cntrl_close_dpath_from_src_id (UBYTE src_id) | |
1240 { | |
1241 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
1242 | |
1243 TRACE_FUNCTION("dti_cntrl_close_dpath_from_src_id()"); | |
1244 | |
1245 return (dti_conn_close_dpath (dti_cntrl_dev->dti_id)); | |
1246 } | |
1247 | |
1248 /* | |
1249 +------------------------------------------------------------------------+ | |
1250 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1251 | STATE : code ROUTINE : dti_cntrl_close_dpath_from_dti_id | | |
1252 +------------------------------------------------------------------------+ | |
1253 | |
1254 PURPOSE : | |
1255 | |
1256 */ | |
1257 GLOBAL BOOL dti_cntrl_close_dpath_from_dti_id (UBYTE dti_id) | |
1258 { | |
1259 TRACE_FUNCTION("dti_cntrl_close_dpath_from_dti_id()"); | |
1260 | |
1261 return (dti_conn_close_dpath (dti_id)); | |
1262 } | |
1263 | |
1264 /* | |
1265 +----------------------------------------------------------------------------+ | |
1266 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1267 | STATE : code ROUTINE : dti_cntrl_get_info_from_src_id | | |
1268 +----------------------------------------------------------------------------+ | |
1269 | |
1270 PURPOSE : | |
1271 | |
1272 */ | |
1273 GLOBAL BOOL dti_cntrl_get_info_from_src_id (UBYTE src_id, | |
1274 T_DTI_CNTRL *info) /* out parameter */ | |
1275 { | |
1276 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
1277 | |
1278 TRACE_FUNCTION("dti_cntrl_get_info_from_src_id()"); | |
1279 | |
1280 if (dti_cntrl_dev) | |
1281 { | |
1282 return (dti_cntrl_get_info (info, dti_cntrl_dev)); | |
1283 } | |
1284 return (FALSE); | |
1285 } | |
1286 /* | |
1287 +----------------------------------------------------------------------------+ | |
1288 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1289 | STATE : code ROUTINE : dti_cntrl_get_info_from_dti_id | | |
1290 +----------------------------------------------------------------------------+ | |
1291 | |
1292 PURPOSE : | |
1293 | |
1294 */ | |
1295 GLOBAL BOOL dti_cntrl_get_info_from_dti_id (UBYTE dti_id, | |
1296 T_DTI_CNTRL *info) /* out parameter */ | |
1297 { | |
1298 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, dti_id, dti_cntrl_search_dti_id); | |
1299 | |
1300 TRACE_FUNCTION("dti_cntrl_get_info_from_dti_id()"); | |
1301 | |
1302 if (dti_cntrl_dev) | |
1303 { | |
1304 return (dti_cntrl_get_info (info, dti_cntrl_dev)); | |
1305 } | |
1306 return (FALSE); | |
1307 } | |
1308 | |
1309 /* | |
1310 +----------------------------------------------------------------------------+ | |
1311 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1312 | STATE : code ROUTINE : dti_cntrl_get_info_from_dev_id | | |
1313 +----------------------------------------------------------------------------+ | |
1314 | |
1315 PURPOSE : | |
1316 | |
1317 */ | |
1318 GLOBAL BOOL dti_cntrl_get_info_from_dev_id (T_DTI_ENTITY_ID dev_id, | |
1319 UBYTE dev_no, | |
1320 UBYTE sub_no, | |
1321 T_DTI_CNTRL *info) /* out parameter */ | |
1322 { | |
1323 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element_by_tupel (dti_cntrl_list, | |
1324 dev_id, | |
1325 dev_no, | |
1326 sub_no, | |
1327 dti_cntrl_search_dev_id); | |
1328 TRACE_FUNCTION("dti_cntrl_info_from_dev_id()"); | |
1329 | |
1330 if (dti_cntrl_dev) | |
1331 { | |
1332 return (dti_cntrl_get_info (info, dti_cntrl_dev)); | |
1333 } | |
1334 return (FALSE); | |
1335 } | |
1336 | |
1337 /* | |
1338 +-----------------------------------------------------------------------------+ | |
1339 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1340 | STATE : code ROUTINE : dti_cntrl_set_redirect_from_src | | |
1341 +-----------------------------------------------------------------------------+ | |
1342 | |
1343 PURPOSE : | |
1344 | |
1345 */ | |
1346 GLOBAL BOOL dti_cntrl_set_redirect_from_src (UBYTE src_id, | |
1347 UBYTE mode, | |
1348 T_DTI_ENTITY_ID dst_dev_id, | |
1349 UBYTE dst_dev_no, | |
1350 UBYTE dst_sub_no, | |
1351 UBYTE capability, | |
1352 UBYTE cid) | |
1353 { | |
1354 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
1355 T_DTI_CNTRL *indirect_dev = (T_DTI_CNTRL *)find_element_by_tupel (dti_cntrl_list, | |
1356 dst_dev_id, | |
1357 dst_dev_no, | |
1358 dst_sub_no, | |
1359 dti_cntrl_search_dev_id); | |
1360 | |
1361 TRACE_FUNCTION("dti_cntrl_set_redirect_from_src()"); | |
1362 | |
1363 if (dti_cntrl_dev AND indirect_dev) | |
1364 { | |
1365 return (dti_cntrl_set_redirection (dti_cntrl_dev, indirect_dev, mode, capability, cid)); | |
1366 } | |
1367 | |
1368 if (dti_cntrl_dev EQ 0) | |
1369 { | |
1370 TRACE_EVENT_P1("dti_cntrl_set_redirect_from_src():[ERR] no list element for src_id=%d", src_id); | |
1371 } | |
1372 if (indirect_dev EQ 0) | |
1373 { | |
1374 TRACE_EVENT_P3("dti_cntrl_set_redirect_from_src():[ERR] no list element for dev_id=%d, dev_no=%d, sub_no=%d", dst_dev_id, | |
1375 dst_dev_no, | |
1376 dst_sub_no); | |
1377 } | |
1378 return (FALSE); | |
1379 } | |
1380 | |
1381 /* | |
1382 +--------------------------------------------------------------------------------+ | |
1383 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1384 | STATE : code ROUTINE : dti_cntrl_set_redirect_from_device | | |
1385 +--------------------------------------------------------------------------------+ | |
1386 | |
1387 PURPOSE : | |
1388 | |
1389 */ | |
1390 GLOBAL BOOL dti_cntrl_set_redirect_from_device (UBYTE mode, | |
1391 T_DTI_ENTITY_ID dst_dev_id, | |
1392 UBYTE dst_dev_no, | |
1393 UBYTE dst_sub_no, | |
1394 T_DTI_ENTITY_ID src_dev_id, | |
1395 UBYTE src_dev_no, | |
1396 UBYTE src_sub_no, | |
1397 UBYTE capability, | |
1398 UBYTE cid) | |
1399 { | |
1400 T_DTI_CNTRL *source_dev = (T_DTI_CNTRL *)find_element_by_tupel (dti_cntrl_list, | |
1401 src_dev_id, | |
1402 src_dev_no, | |
1403 src_sub_no, | |
1404 dti_cntrl_search_dev_id); | |
1405 T_DTI_CNTRL *destination_dev = (T_DTI_CNTRL *)find_element_by_tupel (dti_cntrl_list, | |
1406 dst_dev_id, | |
1407 dst_dev_no, | |
1408 dst_sub_no, | |
1409 dti_cntrl_search_dev_id); | |
1410 | |
1411 TRACE_FUNCTION("dti_cntrl_set_redirect_from_device()"); | |
1412 | |
1413 if (source_dev AND destination_dev) | |
1414 { | |
1415 if ((BITFIELD_CHECK (source_dev->capability, DTI_CPBLTY_CMD)) EQ FALSE) | |
1416 { | |
1417 TRACE_EVENT("source device has no command capability !"); | |
1418 return (FALSE); | |
1419 } | |
1420 | |
1421 return (dti_cntrl_set_redirection (source_dev, destination_dev, mode, capability, cid)); | |
1422 } | |
1423 return (FALSE); | |
1424 } | |
1425 | |
1426 /* | |
1427 +-----------------------------------------------------------------------------+ | |
1428 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1429 | STATE : code ROUTINE : dti_cntrl_get_first_device | | |
1430 +-----------------------------------------------------------------------------+ | |
1431 | |
1432 PURPOSE : this function is used in conjunction with | |
1433 1:AT%DATA where all devices | |
1434 and their possible redirections for data transmission have to | |
1435 be listed. so start with the first element of dti_cntrl_list | |
1436 2.AT%DINF where all devices have to be listed, start with first element | |
1437 */ | |
1438 GLOBAL BOOL dti_cntrl_get_first_device (T_DTI_CNTRL *info) /* out parameter */ | |
1439 { | |
1440 T_DTI_CNTRL *dti_cntrl_dev; | |
1441 | |
1442 TRACE_FUNCTION("dti_cntrl_get_first_device()"); | |
1443 | |
1444 dti_cntrl_dev_ptr = dti_cntrl_list; | |
1445 dti_cntrl_dev = (T_DTI_CNTRL *)(dti_cntrl_dev_ptr->msg); | |
1446 | |
1447 if (dti_cntrl_dev) | |
1448 { | |
1449 return (dti_cntrl_get_info (info, dti_cntrl_dev)); | |
1450 } | |
1451 return (FALSE); | |
1452 } | |
1453 | |
1454 /* | |
1455 +-----------------------------------------------------------------------------+ | |
1456 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1457 | STATE : code ROUTINE : dti_cntrl_get_next_device | | |
1458 +-----------------------------------------------------------------------------+ | |
1459 | |
1460 PURPOSE : this function is used in conjunction with AT%DINF where all devices have | |
1461 to be listed, give next element | |
1462 */ | |
1463 GLOBAL BOOL dti_cntrl_get_next_device (T_DTI_CNTRL *info) /* out parameter */ | |
1464 { | |
1465 T_DTI_CNTRL *dti_cntrl_dev; | |
1466 | |
1467 TRACE_FUNCTION("dti_cntrl_get_next_device()"); | |
1468 | |
1469 if(dti_cntrl_dev_ptr->next NEQ NULL) | |
1470 { | |
1471 dti_cntrl_dev_ptr = dti_cntrl_dev_ptr->next; | |
1472 dti_cntrl_dev = (T_DTI_CNTRL *)(dti_cntrl_dev_ptr->msg); | |
1473 | |
1474 if (dti_cntrl_dev) | |
1475 { | |
1476 return (dti_cntrl_get_info (info, dti_cntrl_dev)); | |
1477 } | |
1478 } | |
1479 else | |
1480 dti_cntrl_dev_ptr = NULL; | |
1481 return (FALSE); | |
1482 } | |
1483 | |
1484 /* | |
1485 +-----------------------------------------------------------------------------+ | |
1486 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1487 | STATE : code ROUTINE : dti_cntrl_get_first_redirection | | |
1488 +-----------------------------------------------------------------------------+ | |
1489 | |
1490 PURPOSE : to the given src_id and capability (SER/PKT) find the first | |
1491 redirection. | |
1492 */ | |
1493 GLOBAL BOOL dti_cntrl_get_first_redirection (UBYTE src_id, | |
1494 UBYTE capability, | |
1495 T_DTI_CNTRL *redirection) /* out parameter */ | |
1496 { | |
1497 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
1498 | |
1499 TRACE_FUNCTION("dti_cntrl_get_first_redirection()"); | |
1500 | |
1501 /* | |
1502 * for the cid we set here -1, because the sub function will first increase it by one | |
1503 * so we access ser_redirect[0] respectively pkt_redirect[0] | |
1504 */ | |
1505 return (dti_cntrl_get_redirection (dti_cntrl_dev, redirection, -1, capability)); | |
1506 } | |
1507 | |
1508 /* | |
1509 +----------------------------------------------------------------------------+ | |
1510 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1511 | STATE : code ROUTINE : dti_cntrl_get_next_redirection | | |
1512 +----------------------------------------------------------------------------+ | |
1513 | |
1514 PURPOSE : to the given src_id and capability (SER/PKT) find the next | |
1515 redirection >>after<< the given cid. | |
1516 */ | |
1517 GLOBAL BOOL dti_cntrl_get_next_redirection (UBYTE src_id, | |
1518 UBYTE cid, | |
1519 UBYTE capability, | |
1520 T_DTI_CNTRL *redirection) /* out parameter */ | |
1521 { | |
1522 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, src_id, dti_cntrl_search_src_id); | |
1523 | |
1524 TRACE_FUNCTION("dti_cntrl_get_next_redirection()"); | |
1525 | |
1526 return (dti_cntrl_get_redirection (dti_cntrl_dev, redirection, cid, capability)); | |
1527 } | |
1528 | |
1529 /* | |
1530 +-------------------------------------------------------------------------+ | |
1531 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1532 | STATE : code ROUTINE : dti_cntrl_entity_connected | | |
1533 +-------------------------------------------------------------------------+ | |
1534 | |
1535 PURPOSE : | |
1536 | |
1537 */ | |
1538 GLOBAL void dti_cntrl_entity_connected (ULONG link_id, | |
1539 T_DTI_ENTITY_ID entity_id, | |
1540 T_DTI_CONN_RESULT result) | |
1541 { | |
1542 UBYTE dti_id = EXTRACT_DTI_ID(link_id); | |
1543 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, dti_id, dti_cntrl_search_dti_id); | |
1544 | |
1545 TRACE_FUNCTION("dti_cntrl_entity_connected()"); | |
1546 | |
1547 if (dti_cntrl_dev AND (result EQ DTI_ERROR)) | |
1548 { | |
1549 dti_cntrl_dev->cur_cap = DTI_CPBLTY_NO; /* reset current capability */ | |
1550 } | |
1551 | |
1552 /* call DTI Connection Mng function */ | |
1553 dti_conn_entity_connected (link_id, entity_id, result); | |
1554 | |
1555 /* set current capability if DTI channel is connected */ | |
1556 if (dti_cntrl_dev AND (dti_conn_is_dti_channel_connected(entity_id, dti_id) EQ TRUE)) | |
1557 { | |
1558 dti_cntrl_dev->cur_cap = g_cur_cap; | |
1559 } | |
1560 } | |
1561 /* | |
1562 +----------------------------------------------------------------------------+ | |
1563 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1564 | STATE : code ROUTINE : dti_cntrl_entity_disconnected | | |
1565 +----------------------------------------------------------------------------+ | |
1566 | |
1567 PURPOSE : | |
1568 | |
1569 */ | |
1570 GLOBAL void dti_cntrl_entity_disconnected (ULONG link_id, | |
1571 T_DTI_ENTITY_ID entity_id) | |
1572 { | |
1573 UBYTE dti_id = EXTRACT_DTI_ID(link_id); | |
1574 T_DTI_CNTRL *dti_cntrl_dev = (T_DTI_CNTRL *)find_element (dti_cntrl_list, dti_id, dti_cntrl_search_dti_id); | |
1575 | |
1576 TRACE_FUNCTION("dti_cntrl_entity_disconnected()"); | |
1577 | |
1578 if (dti_cntrl_dev) | |
1579 { | |
1580 dti_cntrl_dev->cur_cap = DTI_CPBLTY_NO; /* reset current capability */ | |
1581 } | |
1582 | |
1583 /* call DTI Connection Mng function */ | |
1584 dti_conn_entity_disconnected( link_id, entity_id ); | |
1585 } | |
1586 | |
1587 /* | |
1588 +--------------------------------------------------------------------+ | |
1589 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1590 | STATE : code ROUTINE : dti_cntrl_erase_entry | | |
1591 +--------------------------------------------------------------------+ | |
1592 | |
1593 PURPOSE : This function removes a registered device from | |
1594 DTI Cntrl Mng list and removes its DTI ID from the list of | |
1595 DTI Conn Mng. | |
1596 | |
1597 */ | |
1598 GLOBAL void dti_cntrl_erase_entry (UBYTE dti_id) | |
1599 { | |
1600 T_DTI_CNTRL *dti_cntrl_dev = NULL; | |
1601 | |
1602 TRACE_FUNCTION("dti_cntrl_erase_entry()"); | |
1603 | |
1604 dti_cntrl_dev = remove_element (dti_cntrl_list, dti_id, dti_cntrl_search_dti_id); | |
1605 | |
1606 if (dti_cntrl_dev EQ NULL) | |
1607 { | |
1608 TRACE_EVENT_P1("Device with DTI ID %d was not registered", dti_id); | |
1609 } | |
1610 else | |
1611 { | |
1612 /* | |
1613 * redirect_info is a union, where we use the union element tbl, | |
1614 * which is a pointer to an allocated structure | |
1615 * of type T_DTI_CNTRL_REDIRECT_INTERN | |
1616 */ | |
1617 if (dti_cntrl_dev->redirect_info.tbl NEQ NULL) | |
1618 { | |
1619 ACI_MFREE (dti_cntrl_dev->redirect_info.tbl); | |
1620 dti_cntrl_dev->redirect_info.tbl = NULL; | |
1621 } | |
1622 ACI_MFREE (dti_cntrl_dev); | |
1623 } | |
1624 | |
1625 /* call DTI connection manager function */ | |
1626 dti_conn_erase_entry(dti_id); | |
1627 | |
1628 } | |
1629 | |
1630 /* | |
1631 +--------------------------------------------------------------------+ | |
1632 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1633 | STATE : code ROUTINE : dti_cntrl_reg_new_fct | | |
1634 +--------------------------------------------------------------------+ | |
1635 | |
1636 PURPOSE : register an call back function, which is used when a | |
1637 customer/external has its own entity involved during | |
1638 a data transmission. | |
1639 The registered function is called by dti_cntrl_maintain_entity() | |
1640 only, where dti_cntrl_maintain_entity() itself is a | |
1641 call back function used by the DTI Connection Manager | |
1642 */ | |
1643 GLOBAL BOOL dti_cntrl_reg_new_fct (T_DTI_ENTITY_ID entity_id, | |
1644 T_DTI_EXT_CB *fct) | |
1645 { | |
1646 UBYTE i = 0; | |
1647 | |
1648 TRACE_FUNCTION("dti_cntrl_reg_new_fct()"); | |
1649 | |
1650 if (entity_id <= DTI_ENTITY_MAX) | |
1651 { | |
1652 TRACE_EVENT("ENTITY ID already in use"); | |
1653 return (FALSE); | |
1654 } | |
1655 | |
1656 for (i=0; i<DTI_MAX_EXT_CB; i++) | |
1657 { | |
1658 if (reg_ext_cb[i].ent_id EQ DTI_ENTITY_INVALID) | |
1659 { | |
1660 reg_ext_cb[i].ent_id = entity_id; | |
1661 reg_ext_cb[i].fct = fct; | |
1662 return (TRUE); | |
1663 } | |
1664 } | |
1665 return (FALSE); | |
1666 } | |
1667 | |
1668 /* | |
1669 * special temporary stuff | |
1670 */ | |
1671 | |
1672 /* | |
1673 +--------------------------------------------------------------------+ | |
1674 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1675 | STATE : code ROUTINE : dti_cntrl_get_link_id() | | |
1676 +--------------------------------------------------------------------+ | |
1677 | |
1678 PURPOSE : | |
1679 | |
1680 */ | |
1681 GLOBAL T_DTI_CONN_LINK_ID dti_cntrl_get_link_id( T_DTI_ENTITY_ID ent_id, | |
1682 UBYTE dev_no, | |
1683 UBYTE sub_no) | |
1684 { | |
1685 UBYTE i; | |
1686 | |
1687 TRACE_FUNCTION("dti_cntrl_get_link_id()"); | |
1688 | |
1689 for (i=0; i<MAX_DTI_CONN_LINK_IDS; i++) | |
1690 { | |
1691 if ( ((dti_aci_data_base[i].ent_id1 EQ ent_id) | |
1692 AND (dti_aci_data_base[i].dev_no1 EQ dev_no) | |
1693 AND (dti_aci_data_base[i].sub_no1 EQ sub_no)) | |
1694 OR | |
1695 ((dti_aci_data_base[i].ent_id2 EQ ent_id) | |
1696 AND (dti_aci_data_base[i].dev_no2 EQ dev_no) | |
1697 AND (dti_aci_data_base[i].sub_no2 EQ sub_no)) ) | |
1698 return (dti_aci_data_base[i].link_id); | |
1699 } | |
1700 | |
1701 TRACE_EVENT("link_id not found"); | |
1702 return DTI_LINK_ID_NOTPRESENT; | |
1703 } | |
1704 | |
1705 | |
1706 /* | |
1707 +--------------------------------------------------------------------+ | |
1708 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1709 | STATE : code ROUTINE : dti_cntrl_get_peer_() | | |
1710 +--------------------------------------------------------------------+ | |
1711 | |
1712 PURPOSE : | |
1713 | |
1714 */ | |
1715 GLOBAL T_DTI_ENTITY_ID dti_cntrl_get_peer( T_DTI_ENTITY_ID ent_id, | |
1716 UBYTE dev_no, | |
1717 UBYTE sub_no) | |
1718 { | |
1719 UBYTE i; | |
1720 | |
1721 TRACE_FUNCTION("dti_cntrl_get_peer()"); | |
1722 | |
1723 for (i=0; i<MAX_DTI_CONN_LINK_IDS; i++) | |
1724 { | |
1725 if ((dti_aci_data_base[i].ent_id1 EQ ent_id) | |
1726 AND (dti_aci_data_base[i].dev_no1 EQ dev_no) | |
1727 AND (dti_aci_data_base[i].sub_no1 EQ sub_no)) | |
1728 { | |
1729 return dti_aci_data_base[i].ent_id2; | |
1730 } | |
1731 if ((dti_aci_data_base[i].ent_id2 EQ ent_id) | |
1732 AND (dti_aci_data_base[i].dev_no2 EQ dev_no) | |
1733 AND (dti_aci_data_base[i].sub_no2 EQ sub_no)) | |
1734 { | |
1735 return dti_aci_data_base[i].ent_id1; | |
1736 } | |
1737 } | |
1738 | |
1739 TRACE_EVENT("peer entity not found"); | |
1740 return DTI_ENTITY_INVALID; | |
1741 } | |
1742 | |
1743 /* | |
1744 +--------------------------------------------------------------------+ | |
1745 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1746 | STATE : code ROUTINE : dti_cntrl_set_conn_parms() | | |
1747 +--------------------------------------------------------------------+ | |
1748 | |
1749 PURPOSE : | |
1750 | |
1751 */ | |
1752 GLOBAL BOOL dti_cntrl_set_conn_parms( T_DTI_CONN_LINK_ID link_id, | |
1753 T_DTI_ENTITY_ID ent_id, | |
1754 UBYTE dev_no, | |
1755 UBYTE sub_no ) | |
1756 { | |
1757 UBYTE i; | |
1758 | |
1759 TRACE_FUNCTION("dti_cntrl_set_conn_parms()"); | |
1760 | |
1761 for (i=0; i<MAX_DTI_CONN_LINK_IDS; i++) | |
1762 { | |
1763 if (dti_aci_data_base[i].link_id EQ DTI_LINK_ID_NOTPRESENT) | |
1764 { | |
1765 dti_aci_data_base[i].link_id = link_id; | |
1766 | |
1767 dti_aci_data_base[i].ent_id1 = ent_id; | |
1768 dti_aci_data_base[i].dev_no1 = dev_no; | |
1769 dti_aci_data_base[i].sub_no1 = sub_no; | |
1770 | |
1771 return TRUE; | |
1772 } | |
1773 else if (dti_aci_data_base[i].link_id EQ link_id) | |
1774 { | |
1775 dti_aci_data_base[i].ent_id2 = ent_id; | |
1776 dti_aci_data_base[i].dev_no2 = dev_no; | |
1777 dti_aci_data_base[i].sub_no2 = sub_no; | |
1778 | |
1779 return TRUE; | |
1780 } | |
1781 } | |
1782 | |
1783 return FALSE; | |
1784 } | |
1785 | |
1786 /* | |
1787 +--------------------------------------------------------------------+ | |
1788 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1789 | STATE : code ROUTINE : dti_cntrl_clear_conn_parms | | |
1790 +--------------------------------------------------------------------+ | |
1791 | |
1792 PURPOSE : | |
1793 | |
1794 */ | |
1795 GLOBAL void dti_cntrl_clear_conn_parms( UBYTE dti_id ) | |
1796 { | |
1797 UBYTE i; | |
1798 | |
1799 TRACE_FUNCTION("dti_cntrl_clear_conn_parms()"); | |
1800 | |
1801 for (i=0; i<MAX_DTI_CONN_LINK_IDS; i++) | |
1802 { | |
1803 if (EXTRACT_DTI_ID(dti_aci_data_base[i].link_id) EQ dti_id) | |
1804 { | |
1805 dti_aci_data_base[i].link_id = DTI_LINK_ID_NOTPRESENT; | |
1806 dti_aci_data_base[i].dev_no1 = DTI_DEV_NO_NOTPRESENT; | |
1807 dti_aci_data_base[i].dev_no2 = DTI_DEV_NO_NOTPRESENT; | |
1808 dti_aci_data_base[i].ent_id1 = DTI_ENTITY_INVALID; | |
1809 dti_aci_data_base[i].ent_id2 = DTI_ENTITY_INVALID; | |
1810 dti_aci_data_base[i].sub_no1 = DTI_SUB_NO_NOTPRESENT; | |
1811 dti_aci_data_base[i].sub_no2 = DTI_SUB_NO_NOTPRESENT; | |
1812 } | |
1813 } | |
1814 } | |
1815 | |
1816 /* | |
1817 +---------------------------------------------------------------------+ | |
1818 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1819 | STATE : code ROUTINE : dti_cntrl_close_all_connections | | |
1820 +---------------------------------------------------------------------+ | |
1821 | |
1822 PURPOSE : | |
1823 | |
1824 */ | |
1825 GLOBAL void dti_cntrl_close_all_connections() | |
1826 { | |
1827 T_DTI_CNTRL *dti_cntrl_dev; | |
1828 USHORT dti_cntrl_list_num = 0; | |
1829 USHORT i = 0; | |
1830 USHORT k = 0; | |
1831 | |
1832 TRACE_FUNCTION("dti_cntrl_close_all_connections()"); | |
1833 | |
1834 dti_cntrl_list_num = get_list_count (dti_cntrl_list); | |
1835 /* | |
1836 * we clear the list from head to tail | |
1837 */ | |
1838 while (i <= dti_cntrl_list_num) | |
1839 { | |
1840 dti_cntrl_dev = (T_DTI_CNTRL *)remove_first_element (dti_cntrl_list); | |
1841 | |
1842 if (dti_cntrl_dev) | |
1843 { | |
1844 for (k=0; k<DTI_MAX_REDIRECTIONS; ++k) | |
1845 { | |
1846 dti_cntrl_dev->redirect_info.tbl->ser_redirect[k].redirection = NULL; | |
1847 dti_cntrl_dev->redirect_info.tbl->pkt_redirect[k].redirection = NULL; | |
1848 } | |
1849 | |
1850 ACI_MFREE (dti_cntrl_dev->redirect_info.tbl); | |
1851 ACI_MFREE (dti_cntrl_dev); | |
1852 } | |
1853 ++i; | |
1854 } | |
1855 | |
1856 dti_conn_close_all_connections(); | |
1857 } | |
1858 | |
1859 /* | |
1860 +----------------------------------------------------------------------+ | |
1861 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1862 | STATE : code ROUTINE : dti_cntrl_set_dti_id_to_reconnect| | |
1863 +----------------------------------------------------------------------+ | |
1864 | |
1865 PURPOSE : This function sets a flag that means that if this DTI | |
1866 connection is completely disconnected then reconnect the | |
1867 registered device to ACI. | |
1868 */ | |
1869 GLOBAL void dti_cntrl_set_dti_id_to_reconnect(UBYTE dti_id) | |
1870 { | |
1871 ULONG tmp_bit_field = 0x01 << (dti_id); | |
1872 | |
1873 TRACE_FUNCTION("dti_cntrl_set_dti_id_to_reconnect()"); | |
1874 | |
1875 BITFIELD_SET(dti_cntrl_reconnect_to_aci, tmp_bit_field); | |
1876 } | |
1877 | |
1878 /* | |
1879 +------------------------------------------------------------------------+ | |
1880 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1881 | STATE : code ROUTINE : dti_cntrl_clear_dti_id_to_reconnect| | |
1882 +------------------------------------------------------------------------+ | |
1883 | |
1884 PURPOSE : Clears the 'Reconnect-to-ACI' flag. | |
1885 | |
1886 */ | |
1887 GLOBAL void dti_cntrl_clear_dti_id_to_reconnect(UBYTE dti_id) | |
1888 { | |
1889 ULONG tmp_bit_field = 0x01 << (dti_id); | |
1890 | |
1891 TRACE_FUNCTION("dti_cntrl_clear_dti_id_to_reconnect()"); | |
1892 | |
1893 BITFIELD_CLEAR(dti_cntrl_reconnect_to_aci, tmp_bit_field); | |
1894 } | |
1895 | |
1896 /* | |
1897 +------------------------------------------------------------------------+ | |
1898 | PROJECT : GSM-F&D (8411) MODULE : DTI_CNTRL | | |
1899 | STATE : code ROUTINE : dti_cntrl_is_dti_id_to_reconnect | | |
1900 +------------------------------------------------------------------------+ | |
1901 | |
1902 PURPOSE : Queries the 'Reconnect-to-ACI' flag. | |
1903 | |
1904 */ | |
1905 GLOBAL BOOL dti_cntrl_is_dti_id_to_reconnect(UBYTE dti_id) | |
1906 { | |
1907 ULONG tmp_bit_field = 0x01 << (dti_id); | |
1908 | |
1909 TRACE_FUNCTION("dti_cntrl_is_dti_id_to_reconnect()"); | |
1910 | |
1911 if (BITFIELD_CHECK(dti_cntrl_reconnect_to_aci, tmp_bit_field)) | |
1912 { | |
1913 TRACE_EVENT_P1("dti_id=%d must be reconnected", dti_id); | |
1914 return TRUE; | |
1915 } | |
1916 else | |
1917 { | |
1918 return FALSE; | |
1919 } | |
1920 } | |
1921 | |
1922 #endif /* DTI */ |