comparison g23m/condat/ms/src/aci/cmh_tcpipr.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 : GSM-PS (6147)
4 | Modul : CMH_TCPR
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 :
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef CMH_TCPR_C
22 #define CMH_TCPR_C
23 #endif
24
25 #include "aci_all.h"
26
27 /*==== INCLUDES ===================================================*/
28
29 #include "aci_cmh.h"
30
31 #ifdef FAX_AND_DATA
32 #include "aci_fd.h"
33 #endif
34
35 #include "ati_cmd.h"
36 #include "aci_cmd.h"
37 #include "aci_io.h"
38
39 #include "psa.h"
40 #include "psa_ra.h"
41 #include "psa_cc.h"
42 #include "cmh.h"
43 #include "cmh_ra.h"
44 #include "dti_conn_mng.h"
45 #include "Dti_cntrl_mng.h"
46
47 #include "wap_aci.h"
48
49 #include "psa_tcpip.h"
50
51 /*==== CONSTANTS ==================================================*/
52
53 /*==== EXPORT =====================================================*/
54
55 /*==== VARIABLES ==================================================*/
56 EXTERN ULONG ipAddress;
57 /*==== FUNCTIONS ==================================================*/
58
59 /*
60 +-------------------------------------------------------------------+
61 | PROJECT : GSM-PS (6147) MODULE : CMH_TCPR |
62 | ROUTINE : cmhTCPIP_Configurated |
63 +-------------------------------------------------------------------+
64
65 PURPOSE : TCPIP configurated
66 */
67
68 GLOBAL T_ACI_RETURN cmhTCPIP_Configurated ( void )
69 {
70 TRACE_FUNCTION ("cmhTCPIP_Configurated()");
71
72 #ifdef FF_WAP
73 if (Wap_Call)
74 {
75 if ( tcpipShrdPrm.connection_type EQ TCPIP_CONNECTION_TYPE_CSD_WAP )
76 {
77 /* This is only BMI specific code */
78 rAT_WAP_PPP_connected(wapId,ipAddress);
79 }
80 else
81 {
82 TRACE_EVENT_P1 ("IP: %s", tcpipShrdPrm.ipaddr);
83 /* This is only BMI specific code and only evaluates the ipaddr but has nothing to do
84 with PPP connection since this is the GPRS path of the above if(TCPIP_CONNECTION_TYPE_CSD_WAP)*/
85 rAT_WAP_PPP_connected(wapId, psaTCPIP_bytes2ipv4addr(tcpipShrdPrm.ipaddr));
86 }
87 }
88 #endif
89 psaTCPIP_config_dispatch ();
90 return 0;
91 }
92
93 /*
94 +-------------------------------------------------------------------+
95 | PROJECT : GSM-PS (6147) MODULE : CMH_TCPR |
96 | ROUTINE : cmhTCPIP_Configurated |
97 +-------------------------------------------------------------------+
98 PURPOSE : TCPIP deconfigurated
99 */
100 GLOBAL T_ACI_RETURN cmhTCPIP_Deconfigurated ( void )
101 {
102 TRACE_FUNCTION ("cmhTCPIP_Deconfigurated()");
103
104 cmhTCPIP_Deactivate(tcpipShrdPrm.src_id);
105 return 0;
106 }
107
108
109 /******************************************************************************/
110 // This function returns the DTI connection state as a string; it is only
111 // relevant for tracing
112 LOCAL char* dti_conn_state_string(T_DTI_CONN_STATE state)
113 {
114 switch (state)
115 {
116 case DTI_CONN_STATE_UNKNOWN: return "DTI_CONN_STATE_UNKNOWN";
117 case DTI_CONN_STATE_CONNECTING: return "DTI_CONN_STATE_CONNECTING";
118 case DTI_CONN_STATE_CONNECTED: return "DTI_CONN_STATE_CONNECTED";
119 case DTI_CONN_STATE_DISCONNECTING: return "DTI_CONN_STATE_DISCONNECTING";
120 case DTI_CONN_STATE_DISCONNECTED: return "DTI_CONN_STATE_DISCONNECTED";
121 case DTI_CONN_STATE_ERROR: return "DTI_CONN_STATE_ERROR";
122 default: return "NOT_DEFINED_DTI_CONN_STATE";
123
124 }
125 }
126
127
128 /******************************************************************************/
129 GLOBAL BOOL TCPIP_connect_dti_cb (UBYTE dti_id, T_DTI_CONN_STATE result_type)
130 {
131 TRACE_FUNCTION("TCPIP_connect_dti_cb()");
132 TRACE_EVENT_P1("Result: %s", dti_conn_state_string(result_type));
133
134 switch( result_type)
135 {
136 case(DTI_CONN_STATE_CONNECTING):
137 case(DTI_CONN_STATE_CONNECTED):
138 case(DTI_CONN_STATE_DISCONNECTING):
139 break;
140
141 case(DTI_CONN_STATE_DISCONNECTED):
142 dti_cntrl_clear_conn_parms(dti_id);
143 break;
144
145 case(DTI_CONN_STATE_ERROR):
146 /* connection not possible: disconnect */
147 dti_cntrl_close_dpath_from_dti_id( dti_id );
148 break;
149
150 default:
151 TRACE_EVENT("TCPIP_connect_dti_cb(): call with not awaited value");
152 break;
153 }
154 return TRUE;
155 }
156