comparison g23m/condat/ms/src/aci/psa_ppps.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 : PSA_PPPS
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 #ifdef DTI
22
23 #if defined (FF_WAP) || defined (FF_TCP_IP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
24
25 #ifndef PSA_PPPS_C
26 #define PSA_PPPS_C
27 #endif /* PSA_PPPS_C */
28
29 #include "aci_all.h"
30 /*==== INCLUDES ===================================================*/
31 #include "aci_cmh.h"
32 #include "ati_cmd.h"
33 #include "aci_cmd.h"
34 #include "dti.h" /* functionality of the dti library */
35 #include "dti_conn_mng.h"
36
37 #include "aci_fd.h"
38 #include "aci.h"
39 #include "psa.h"
40 #include "psa_l2r.h"
41 #include "cmh.h"
42 #include "cmh_ra.h"
43 #include "cmh_l2r.h"
44
45 #include "wap_aci.h"
46 #include "psa_ppp_w.h"
47
48 #include "dcm_f.h"
49
50 /*==== CONSTANTS ==================================================*/
51
52
53 /*==== TYPES ======================================================*/
54
55 /*==== EXPORT =====================================================*/
56
57 /*==== VARIABLES ==================================================*/
58
59
60 /*==== FUNCTIONS ==================================================*/
61
62 /*
63 +-------------------------------------------------------------------+
64 | PROJECT : GSM-PS (6147) MODULE : PSA_PPP |
65 | ROUTINE : psaPPP_Establish |
66 +-------------------------------------------------------------------+
67
68 PURPOSE : This function sends an PPP_ESTABLISH_REQ.
69
70 */
71
72 GLOBAL void psaPPP_Establish(T_DTI_CONN_LINK_ID link_id, UBYTE peer)
73 {
74 T_login pLogin;
75
76 TRACE_FUNCTION("psaPPP_Establish()");
77
78 if( (is_gpf_tcpip_call() GPF_TCPIP_STATEMENT(AND (peer EQ DTI_ENTITY_TCPIP))) OR
79 peer EQ DTI_ENTITY_IP OR peer EQ DTI_ENTITY_AAA)
80 {
81 prot_link_id = link_id;
82 prot_entity_id = peer;
83 }
84 else if (peer EQ DTI_ENTITY_L2R)
85 {
86 peer_link_id = link_id;
87 }
88 else
89 {
90 TRACE_EVENT("wrong peer entity");
91 }
92
93 #ifdef FF_WAP
94 rAT_WAP_start_login();
95 #endif /* FF_WAP */
96
97 if (pppShrdPrm.state NEQ PPP_ESTABLISH)
98 {
99 /* wait for the second call of psaPPP_Establish() */
100 pppShrdPrm.state = PPP_ESTABLISH;
101 return;
102 }
103 /* Set the unused bytes of login and password to zero */
104 memset(&pLogin, 0x00, sizeof( T_login ));
105 pLogin.name_len = strlen(pppShrdPrm.ppp_login);
106 memcpy((char*)(pLogin.name),pppShrdPrm.ppp_login, pLogin.name_len);
107 pLogin.password_len = strlen(pppShrdPrm.ppp_password);
108 memcpy((char*)(pLogin.password),
109 pppShrdPrm.ppp_password,
110 pLogin.password_len);
111
112 {
113 PALLOC(ppp_establish_req, PPP_ESTABLISH_REQ);
114
115 ppp_establish_req -> mode = PPP_CLIENT;
116 ppp_establish_req -> mru = PPP_MRU_DEFAULT;
117 ppp_establish_req -> ap = pppShrdPrm.auth_prot;
118
119 /* Copy user and password */
120 memcpy( &(ppp_establish_req->login),&pLogin, sizeof( T_login ));
121
122 ppp_establish_req -> accm = PPP_ACCM_DEFAULT;
123 ppp_establish_req -> rt = PPP_RT_DEFAULT;
124 ppp_establish_req -> mc = PPP_MC_DEFAULT;
125 ppp_establish_req -> mt = PPP_MT_DEFAULT;
126 ppp_establish_req -> mf = PPP_MF_DEFAULT;
127 ppp_establish_req -> ppp_hc = PPP_HC_OFF;
128 ppp_establish_req -> ip = PPP_IP_DYNAMIC;
129 ppp_establish_req -> dns1 = PPP_DNS1_DYNAMIC;
130 ppp_establish_req -> dns2 = PPP_DNS2_DYNAMIC;
131
132 strcpy((char*)ppp_establish_req->peer_channel.peer_entity,
133 dti_entity_name[DTI_ENTITY_L2R].name);
134
135 strcpy((char*)ppp_establish_req->protocol_channel.protocol_entity,
136 dti_entity_name[prot_entity_id].name);
137
138 ppp_establish_req -> peer_link_id = peer_link_id;
139 ppp_establish_req -> prot_link_id = prot_link_id;
140
141 /* Direction for the Protocol Layer */
142 ppp_establish_req -> peer_direction = DTI_CHANNEL_TO_LOWER_LAYER;
143
144 /* Direction for the Peer Layer */
145 ppp_establish_req -> prot_direction = DTI_CHANNEL_TO_HIGHER_LAYER;
146
147 PSENDX(PPP,ppp_establish_req);
148 }
149 }
150
151 /*
152 +-------------------------------------------------------------------+
153 | PROJECT : GSM-PS (6147) MODULE : PSA_PPP |
154 | ROUTINE : psaPPP_Terminate |
155 +-------------------------------------------------------------------+
156
157 PURPOSE :
158
159 */
160
161 GLOBAL void psaPPP_Terminate(T_ACI_PPP_LOWER_LAYER ppp_lower_layer)
162 {
163
164 TRACE_FUNCTION("psaPPP_Terminate()");
165
166 if ((pppShrdPrm.state EQ PPP_TERMINATE) OR (pppShrdPrm.state EQ PPP_TERMINATED))
167 {
168 return;
169 }
170
171 pppShrdPrm.state = PPP_TERMINATE;
172 {
173 PALLOC(ppp_terminate_req, PPP_TERMINATE_REQ);
174 switch (ppp_lower_layer)
175 {
176 case (UP):
177 ppp_terminate_req -> lower_layer = PPP_LOWER_LAYER_UP;
178 break;
179
180 case (DWN):
181 ppp_terminate_req -> lower_layer = PPP_LOWER_LAYER_DOWN;
182 break;
183
184 default:
185 TRACE_EVENT("error: status of lower_layer undefined");
186 }
187
188 PSENDX(PPP,ppp_terminate_req);
189 }
190 }
191 #endif /* of FF_WAP or FF_TCP_IP OR FF_GPF_TCPIP or FF_SAT_E */
192 #endif /* DTI */