comparison src/g23m-aci/aci/dti_cntrl_mng.c @ 162:53929b40109c

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