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

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
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 signalling functions of the
18 | protocol stack adapter for the registration part of
19 | the SNDCP entity.
20 +-----------------------------------------------------------------------------
21 */
22
23 #if defined (GPRS) && defined (DTI)
24
25 #ifndef PSA_SNDS_C
26 #define PSA_SNDS_C
27 #endif
28
29 #include "aci_all.h"
30 /*==== INCLUDES ===================================================*/
31 #include "aci.h"
32
33 #include "dti.h" /* functionality of the dti library */
34 #include "aci_cmh.h"
35 #include "ati_cmd.h"
36 #include "aci_cmd.h"
37 #include "aci_mem.h"
38
39 #include "aci.h"
40
41 #include "dti_conn_mng.h"
42 #include "dti_cntrl_mng.h"
43
44 #include "gaci.h"
45 #include "gaci_cmh.h"
46 #include "psa.h"
47 #include "psa_sm.h"
48
49 #include "cmh.h"
50 #include "cmh_sm.h"
51
52 #if defined(FF_WAP) || defined(FF_GPF_TCPIP)
53 #include "wap_aci.h"
54 #include "psa_tcpip.h"
55 #endif
56
57
58
59 /*==== CONSTANTS ==================================================*/
60
61 /*==== TYPES ======================================================*/
62
63 /*==== EXPORT =====================================================*/
64
65 /*==== VARIABLES ==================================================*/
66
67 /*==== FUNCTIONS ==================================================*/
68
69
70 /*
71 +-------------------------------------------------------------------+
72 | PROJECT : GPRS (8441) MODULE : PSA_SMS |
73 | STATE : finished ROUTINE : psaSNDCP_Dti_Req |
74 +-------------------------------------------------------------------+
75
76 PURPOSE : Request of setting or removing the DTI user plane..
77
78 */
79 GLOBAL void psa_sn_dti_req( T_DTI_CONN_LINK_ID link_id, T_DTI_ENTITY_ID peer, U8 dti_conn )
80 {
81 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = pdp_context_find_node_from_cid(work_cids[cid_pointer]); /* Issue 27457 */
82 #ifdef _SIMULATION_
83 U8 *dti_neighbor = NULL;
84 #endif
85
86 #if defined (FF_WAP) || defined (FF_GPF_TCPIP)
87 U8 cid = PDP_CONTEXT_CID_OMITTED;
88 U8 nsapi;
89 #endif
90
91 U8 dti_direction = NAS_HOME;
92
93 PALLOC (sn_dti_req, SN_DTI_REQ);
94
95 TRACE_FUNCTION("psa_sn_dti_req()");
96
97 #ifdef _SIMULATION_
98 ACI_MALLOC(dti_neighbor, NAS_SIZE_ENTITY_NAME);
99 #endif
100
101 if (dti_conn EQ NAS_CONNECT_DTI)
102 {
103
104 switch ( peer )
105 {
106 case DTI_ENTITY_PPPS:
107
108 #ifdef _SIMULATION_
109 strcpy((char*)(dti_neighbor), PPP_NAME);
110 #else
111 sn_dti_req->dti_neighbor = (ULONG)PPP_NAME;
112 #endif
113 dti_direction = NAS_HOME;
114 p_pdp_context_node->internal_data.entity_id = peer;
115 p_pdp_context_node->internal_data.link_id = link_id;
116 break;
117
118 #ifdef TI_DUAL_MODE
119 case DTI_ENTITY_SNDCP:
120
121 #ifdef _SIMULATION_
122 strcpy((char*)(dti_neighbor), SNDCP_NAME);
123 #else
124 sn_dti_req->dti_neighbor = (ULONG)SNDCP_NAME;
125 #endif
126 dti_direction = NAS_HOME;
127 break;
128 #endif /* TI_DUAL_MODE */
129
130 #ifdef FF_TCP_IP
131 case DTI_ENTITY_AAA:
132
133 #ifdef _SIMULATION_
134 strcpy((char*)(dti_neighbor), RIV_NAME);
135 #else
136 sn_dti_req->dti_neighbor = (ULONG)RIV_NAME;
137 #endif
138 dti_direction = NAS_NEIGHBOR;
139 p_pdp_context_node->internal_data.entity_id = peer;
140 p_pdp_context_node->internal_data.link_id = link_id;
141 break;
142 #endif /* FF_TCP_IP */
143
144 case DTI_ENTITY_IP:
145
146 #ifdef _SIMULATION_
147 strcpy((char*)(dti_neighbor), IP_NAME);
148 #else
149 sn_dti_req->dti_neighbor = (ULONG)IP_NAME;
150 #endif
151 dti_direction = NAS_NEIGHBOR;
152 p_pdp_context_node->internal_data.link_id = link_id;
153 break;
154 case DTI_ENTITY_SIM:
155
156 #ifdef _SIMULATION_
157 strcpy((char*)(dti_neighbor), SIM_NAME);
158 #else
159 sn_dti_req->dti_neighbor = (ULONG)SIM_NAME;
160 #endif
161 dti_direction = NAS_NEIGHBOR;
162 p_pdp_context_node->internal_data.link_id = link_id;
163 break;
164 case DTI_ENTITY_PKTIO:
165
166 #ifdef _SIMULATION_
167 strcpy((char*)(dti_neighbor), PKTIO_NAME);
168 #else
169 sn_dti_req->dti_neighbor = (ULONG)PKTIO_NAME;
170 #endif
171 dti_direction = NAS_HOME;
172 p_pdp_context_node->internal_data.entity_id = peer;
173 p_pdp_context_node->internal_data.link_id = link_id;
174 break;
175 #ifdef FF_GPF_TCPIP
176 case DTI_ENTITY_TCPIP:
177 sn_dti_req->dti_neighbor = (ULONG)TCPIP_NAME;
178 dti_direction = NAS_NEIGHBOR;
179 break;
180 #endif /* FF_GPF_TCPIP */
181
182 }
183
184 /* Copy the neighbor name (incl. the zero termination). */
185 #ifdef _SIMULATION_
186 memcpy( &sn_dti_req->dti_neighbor, dti_neighbor, strlen((const char *)dti_neighbor) + 1 );
187 ACI_MFREE( dti_neighbor );
188 #endif
189 sn_dti_req->dti_direction = dti_direction;
190 sn_dti_req->dti_conn = NAS_CONNECT_DTI;
191 }
192 else /* if (dti_conn == SNDCP_CONNECT_DTI) */
193 {
194 sn_dti_req->dti_conn = NAS_DISCONNECT_DTI;
195 }
196
197 sn_dti_req->dti_linkid = link_id;
198 sn_dti_req->nsapi = (U8)CID_TO_NSAPI( gaci_get_cid_over_link_id( link_id ) );
199 #if defined (FF_WAP) || defined (FF_GPF_TCPIP)
200 nsapi = sn_dti_req->nsapi;
201 #endif
202 PSEND(hCommSNDCP, sn_dti_req);
203 #if defined (FF_WAP) || defined (FF_GPF_TCPIP)
204 if ( (Wap_Call) AND
205 (dti_conn EQ NAS_CONNECT_DTI) ) /* TC ACISAT 530 */
206 {
207 cid = (U8)NSAPI_TO_CID( nsapi );
208 if ( (get_state_over_cid( cid ) EQ PDP_CONTEXT_STATE_DEFINED ) OR
209 (get_state_over_cid( cid ) EQ PDP_CONTEXT_STATE_ATTACHING) OR
210 (get_state_over_cid( cid ) EQ PDP_CONTEXT_STATE_DEACTIVATE_NORMAL) ) //// pinghua DCM_OPEN_CLOSE patch 20080429 start
211 {
212 cmhSM_activate_context();
213 }
214 else if ( (get_state_over_cid( cid ) EQ PDP_CONTEXT_STATE_ACTIVATED))
215 {
216 char c_ip_address[16];
217 UBYTE* ip_address;
218
219 TRACE_EVENT("No PDP Context Found to Activate");
220
221 ip_address = p_pdp_context_node->internal_data.pdp_address_allocated.ip_address.ipv4_addr.a4;
222 sprintf (c_ip_address, "%03u.%03u.%03u.%03u", ip_address[0],
223 ip_address[1],
224 ip_address[2],
225 ip_address[3] );
226
227
228 psaTCPIP_Configure( NULL,
229 (UBYTE*) c_ip_address,
230 NULL,
231 NULL,
232 NULL,
233 1500,
234 cmhSM_IP_activate_cb );
235 }
236 }
237 #endif /* FF_WAP */
238 }
239 #endif /* GPRS */