comparison src/g23m-aci/aci/psa_tcpips.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : PSA_TCPS
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 #ifndef PSA_TCPS_C
21 #define PSA_TCPS_C
22 #endif
23
24 #include "aci_all.h"
25 /*==== INCLUDES ===================================================*/
26 #include "aci_cmh.h"
27 #include "ati_cmd.h"
28 #include "aci_cmd.h"
29 #include "dti.h" /* functionality of the dti library */
30 #include "dti_conn_mng.h"
31 #include "dti_cntrl_mng.h"
32
33 #include "aci.h"
34 #include "psa.h"
35 #include "psa_cc.h"
36 #include "psa_ss.h"
37 #include "aoc.h"
38
39 #if !defined (MFW)
40 #include "aci_io.h"
41 #endif
42
43 #include "wap_aci.h"
44
45 #include "psa_tcpip.h"
46 #include "psa_sim.h"
47
48 /*==== CONSTANTS ==================================================*/
49
50 /*==== TYPES ======================================================*/
51
52 /*==== EXPORT =====================================================*/
53
54 /*==== VARIABLES ==================================================*/
55
56 /*==== FUNCTIONS ==================================================*/
57
58
59 /*
60 +-------------------------------------------------------------------+
61 | PROJECT : GSM-PS (6147) MODULE : PSA_TCPS |
62 | ROUTINE : psaTCPIP_Config |
63 +-------------------------------------------------------------------+
64
65 PURPOSE : setup TCPIP
66
67 */
68
69 GLOBAL void psaTCPIP_Config (ULONG ipaddr, ULONG dns1, ULONG dns2, UBYTE dirc)
70 {
71 TRACE_FUNCTION("psaTCPIP_Config()");
72 switch( dirc )
73 {
74
75 case ( TCPIP_IFCONFIG_UP ):
76 wap_state = TCPIP_Configuration;
77 {
78 PALLOC(tcpip_config_req, TCPIP_IFCONFIG_REQ);
79 tcpip_config_req->if_up = TCPIP_IFCONFIG_UP;
80 tcpip_config_req->mtu_size = 1500;
81 tcpip_config_req->ipaddr = ipaddr;
82 tcpip_config_req->dnsaddr1 = dns1;
83 tcpip_config_req->dnsaddr2 = dns2;
84 PSENDX(TCPIP, tcpip_config_req);
85 }
86 break;
87
88 case ( TCPIP_IFCONFIG_DOWN ):
89 wap_state = TCPIP_Deconfiguration;
90 {
91 PALLOC(tcpip_config_req, TCPIP_IFCONFIG_REQ);
92 tcpip_config_req->if_up = TCPIP_IFCONFIG_DOWN;
93 tcpip_config_req->mtu_size = 0;
94 tcpip_config_req->ipaddr = 0;
95 tcpip_config_req->dnsaddr1 = 0;
96 tcpip_config_req->dnsaddr2 = 0;
97 PSENDX(TCPIP, tcpip_config_req);
98 }
99 break;
100 }
101 }
102
103
104 /*
105 +-------------------------------------------------------------------+
106 | PROJECT : GSM-PS (6147) MODULE : PSA_TCPS |
107 | ROUTINE : psaTCPIP_Dti_Req |
108 +-------------------------------------------------------------------+
109
110 PURPOSE : connect TCPIP
111
112 */
113
114 GLOBAL void psaTCPIP_Dti_Req(T_DTI_CONN_LINK_ID dti_id, UBYTE peer_to_connect_to, UBYTE dti_conn)
115 {
116 PALLOC( tcpip_dti_req, TCPIP_DTI_REQ);
117
118 TRACE_FUNCTION("psaTCPIP_Dti_Req");
119
120 tcpip_dti_req -> dti_conn = dti_conn;
121 tcpip_dti_req -> link_id = dti_id;
122
123 if (dti_conn EQ TCPIP_CONNECT_DTI)
124 {
125 if (dti_cntrl_set_conn_parms(dti_id, DTI_ENTITY_TCPIP, DTI_INSTANCE_NOTPRESENT, DTI_SUB_NO_NOTPRESENT) EQ FALSE)
126 {
127 return;
128 }
129 }
130 switch( peer_to_connect_to )
131 {
132 case( DTI_ENTITY_PPPC ):
133 tcpip_dti_req -> dti_direction = DTI_CHANNEL_TO_LOWER_LAYER;
134 tcpip_dti_req->entity_name = (U32) dti_entity_name[DTI_ENTITY_PPPC].name ;
135 TRACE_EVENT_P2("tcpip_dti_req->entity_name = %s <- %s",
136 (U8 *) tcpip_dti_req->entity_name,
137 dti_entity_name[DTI_ENTITY_PPPC].name) ;
138 break;
139 #ifdef GPRS
140 case( DTI_ENTITY_SNDCP ):
141 tcpip_dti_req -> dti_direction = DTI_CHANNEL_TO_LOWER_LAYER;
142 tcpip_dti_req->entity_name = (U32) dti_entity_name[DTI_ENTITY_SNDCP].name ;
143 TRACE_EVENT_P2("tcpip_dti_req->entity_name = %s <- %s",
144 (U8 *) tcpip_dti_req->entity_name,
145 dti_entity_name[DTI_ENTITY_SNDCP].name) ;
146 break;
147 #endif
148 case( DTI_ENTITY_WAP ):
149 tcpip_dti_req -> dti_direction = DTI_CHANNEL_TO_HIGHER_LAYER;
150 strcpy((char*)tcpip_dti_req->entity_name, dti_entity_name[DTI_ENTITY_WAP].name);
151 break;
152
153 case( DTI_ENTITY_SIM ):
154 tcpip_dti_req -> dti_direction = DTI_CHANNEL_TO_HIGHER_LAYER;
155 strcpy((char*)tcpip_dti_req->entity_name, dti_entity_name[DTI_ENTITY_SIM].name);
156 break;
157
158 default:
159 TRACE_EVENT("Error: Unknown conn_peer_Id: TCPIP_DTI_REQ not sent");
160 PFREE(tcpip_dti_req);
161 return;
162 }
163
164 PSENDX( TCPIP, tcpip_dti_req );
165 }
166
167
168 GLOBAL void psaTCPIP_Initialize_Req(void)
169 {
170 TRACE_FUNCTION("psaTCPIP_Initialize_Req()");
171 {
172 PALLOC(tcpip_initialize_req,TCPIP_INITIALIZE_REQ);
173 PSEND(hCommTCPIP,tcpip_initialize_req);
174 }
175
176 }
177
178
179 GLOBAL void psaTCPIP_Shutdown_Req(void)
180 {
181 TRACE_FUNCTION("psaTCPIP_Shutdown_Req()");
182 {
183 PALLOC(tcpip_shutdown_req ,TCPIP_SHUTDOWN_REQ);
184 PSEND(hCommTCPIP,tcpip_shutdown_req);
185 }
186 }