comparison g23m/condat/ms/src/aci/cmh_sndr.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 :
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module defines the functions which are responsible
18 | for the responses of the protocol stack adapter for SNDCP.
19 +-----------------------------------------------------------------------------
20 */
21
22 #if defined (GPRS) && defined (DTI)
23
24 #ifndef CMH_SNDR_C
25 #define CMH_SNDR_C
26 #endif
27
28 #include "aci_all.h"
29 /*==== INCLUDES ===================================================*/
30
31 #include "aci_cmh.h"
32
33 #include "psa.h"
34
35 #include "dti.h"
36 #include "dti_conn_mng.h"
37 #include "dti_cntrl_mng.h"
38
39 #include "gaci_cmh.h"
40 #include "gaci.h"
41
42 #include "cmh.h"
43 #include "cmh_snd.h"
44 #include "cmh_sm.h"
45
46 #ifdef FF_GPF_TCPIP
47 #include "dcm_utils.h"
48 #include "dcm_state.h"
49 #include "dcm_env.h"
50 #endif
51
52 /*==== CONSTANTS ==================================================*/
53
54
55 /*==== TYPES ======================================================*/
56
57
58 /*==== EXPORT =====================================================*/
59
60
61 /*==== VARIABLES ==================================================*/
62 EXTERN SHORT nsapi_to_cid[SMH_NSAPI_MAX];
63
64
65 /*==== FUNCTIONS ==================================================*/
66
67 /*
68 +-------------------------------------------------------------------+
69 | PROJECT : GPRS (8441) MODULE : CMH_SNDR |
70 | STATE : finished ROUTINE : cmhSNDCP_Counted |
71 +-------------------------------------------------------------------+
72
73 PURPOSE :
74
75 */
76 GLOBAL void cmhSNDCP_Counted( UBYTE nsapi,
77 ULONG octets_uplink,
78 ULONG octets_downlink,
79 ULONG packets_uplink,
80 ULONG packets_downlink )
81 {
82 UBYTE i;
83 SHORT cid = nsapi_to_cid[nsapi];
84
85 TRACE_FUNCTION ("cmhSNDCP_Counted()");
86
87 for (i = 0; i < MAX_CID ; i++)
88 {
89 if (pdp_context[i].nsapi EQ nsapi AND
90 (pdp_context[i].state NEQ CS_ACTIVATED AND pdp_context[i].state NEQ CS_DATA_LINK))
91 {
92 cid = i+1; /* Gets the deactivated CID */
93 pdp_context[i].nsapi = UNUSED_NSAPI;
94 break;
95 }
96 }
97
98 R_AT( RAT_SNCNT, sndcpShrdPrm.srcId ) ( cid, /* issue 10417 */
99 octets_uplink,
100 octets_downlink,
101 packets_uplink,
102 packets_downlink );
103 }
104
105
106 /*
107 +---------------------------------------------------------------------------+
108 | PROJECT : GSM-F&D (8411) MODULE : CMH_SNDR |
109 | STATE : code ROUTINE : NULL_SNDCP_connect_dti_cb |
110 +---------------------------------------------------------------------------+
111
112 PURPOSE : Callback for connection between PPP Server and SNDCP.
113
114 */
115 GLOBAL BOOL NULL_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type)
116 {
117 TRACE_FUNCTION("NULL_SNDCP_connect_dti_cb");
118
119 switch( result_type)
120 {
121 case DTI_CONN_STATE_DISCONNECTED:
122 cmhSM_connection_down(dti_id);
123 break;
124 case DTI_CONN_STATE_DISCONNECTING:
125 case DTI_CONN_STATE_CONNECTING:
126 case DTI_CONN_STATE_CONNECTED:
127 break;
128 case DTI_CONN_STATE_ERROR:
129 /* connection not possible: disconnect SNDCP */
130 dti_cntrl_close_dpath_from_dti_id( dti_id );
131 break;
132 case DTI_CONN_STATE_UNKNOWN:
133 default:
134 TRACE_EVENT("PPP_SNDCP_connect_dti_cb call with not awaited value");
135 break;
136 }
137 return TRUE;
138 }
139
140
141 #if defined(FF_PKTIO) OR defined(FF_TCP_IP) OR defined (FF_PSI)
142 /*
143 +---------------------------------------------------------------------------+
144 | PROJECT : GSM-F&D (8411) MODULE : CMH_SNDR |
145 | STATE : code ROUTINE : PKTIO_SNDCP_connect_dti_cb |
146 +---------------------------------------------------------------------------+
147
148 PURPOSE : Callback for connection between PKTIO and SNDCP.
149
150 */
151 GLOBAL BOOL PKTIO_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type)
152 {
153 SHORT cid;
154
155 TRACE_FUNCTION("PKTIO_SNDCP_connect_dti_cb");
156
157 switch( result_type)
158 {
159 case DTI_CONN_STATE_DISCONNECTING:
160 cid = gaci_get_cid_over_dti_id(dti_id);
161 if( INVALID_CID NEQ cid AND
162 CS_ACTIVATING EQ get_state_over_cid(cid) AND
163 ( DTI_ENTITY_PKTIO EQ pdp_context[cid - 1].entity_id OR
164 DTI_ENTITY_AAA EQ pdp_context[cid - 1].entity_id OR
165 DTI_ENTITY_PSI EQ pdp_context[cid - 1].entity_id ) )
166 {
167 cmhSM_deactivateAContext(CMD_SRC_NONE, cid);
168 set_state_over_cid( cid, CS_DEACTIVATE_NORMAL);
169 }
170 break;
171 case DTI_CONN_STATE_DISCONNECTED:
172 cmhSM_connection_down(dti_id);
173 break;
174 case DTI_CONN_STATE_CONNECTING:
175 case DTI_CONN_STATE_CONNECTED:
176 break ;
177 case DTI_CONN_STATE_ERROR:
178 /* connection not possible: disconnect SNDCP */
179 dti_cntrl_close_dpath_from_dti_id( dti_id );
180 break;
181 case DTI_CONN_STATE_UNKNOWN:
182 default:
183 TRACE_EVENT("PKTIO_SNDCP_connect_dti_cb call with not awaited value");
184 break;
185 }
186 return TRUE;
187 }
188 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */
189
190
191 #ifdef CO_UDP_IP
192 /*
193 +--------------------------------------------------------------------------+
194 | PROJECT : GSM-F&D (8411) MODULE : CMH_SNDR |
195 | STATE : code ROUTINE : IP_SNDCP_connect_dti_cb |
196 +--------------------------------------------------------------------------+
197
198 PURPOSE : Callback for connection between IP Server and SNDCP.
199
200 */
201
202 GLOBAL BOOL IP_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type)
203 {
204 TRACE_FUNCTION("IP_SNDCP_connect_dti_cb");
205
206 switch( result_type)
207 {
208 case DTI_CONN_STATE_DISCONNECTING:
209 case DTI_CONN_STATE_DISCONNECTED:
210 case DTI_CONN_STATE_CONNECTING:
211 case DTI_CONN_STATE_CONNECTED:
212 break;
213 case DTI_CONN_STATE_ERROR:
214 /* connection not possible: disconnect SNDCP */
215 TRACE_EVENT("IP_SNDCP_connect_dti_cb connection not possible: disconnect SNDCP");
216 dti_cntrl_close_dpath_from_dti_id( dti_id);
217 break;
218 case DTI_CONN_STATE_UNKNOWN:
219 default:
220 TRACE_EVENT("IP_SNDCP_connect_dti_cb call with not awaited value");
221 break;
222 }
223 return TRUE;
224 }
225 #endif /* CO_UDP_IP */
226
227
228 #ifdef FF_GPF_TCPIP
229 GLOBAL BOOL TCPIP_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type)
230 {
231 TRACE_FUNCTION("TCPIP_SNDCP_connect_dti_cb");
232 TRACE_EVENT_P1("TCPIP_SNDCP_connect_dti_cb() result = %d",result_type);
233
234 switch( result_type)
235 {
236 case DTI_CONN_STATE_DISCONNECTING:
237 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_DISCONNECTING") ;
238 break ;
239
240 case DTI_CONN_STATE_CONNECTING:
241 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_CONNECTING") ;
242 break;
243
244 case DTI_CONN_STATE_DISCONNECTED:
245 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_DISCONNECTED") ;
246 dti_cntrl_erase_entry(dti_id);
247 {
248 T_DCM_STATUS_IND_MSG msg;
249 msg.hdr.msg_id = DCM_NEXT_CMD_READY_MSG;
250 dcm_send_message(msg, DCM_SUB_WAIT_CGACT_CNF);
251 }
252 break;
253
254 case DTI_CONN_STATE_CONNECTED:
255 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_CONNECTED");
256 {
257 T_DCM_STATUS_IND_MSG msg;
258 msg.hdr.msg_id = DCM_NEXT_CMD_READY_MSG;
259 dcm_send_message(msg, DCM_SUB_WAIT_CGACT_CNF);
260 }
261 break;
262
263 case DTI_CONN_STATE_ERROR:
264 /* connection not possible: disconnect SNDCP */
265 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb connection not possible: disconnect SNDCP");
266 dti_cntrl_close_dpath_from_dti_id( dti_id);
267 break;
268
269 case DTI_CONN_STATE_UNKNOWN:
270 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb in DTI_CONN_STATE_UNKNOWN") ;
271 break;
272
273 default:
274 TRACE_EVENT("TCPIP_SNDCP_connect_dti_cb call with not awaited value");
275 break;
276 }
277 return TRUE;
278 }
279 #endif /* FF_GPF_TCPIP */
280
281 #endif /* GPRS && DTI*/