comparison src/g23m-aci/aci/psa_pppp.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : PSA_PPPP
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 processing functions for the
18 | primitives sent to the protocol stack adapter by the PPP
19 | module.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifdef DTI
24
25 #if defined (FF_WAP) || defined (FF_PPP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
26
27 #ifndef PSA_PPPP_C
28 #define PSA_PPPP_C
29 #endif /* of PSA_PPPP_C */
30
31 #include "aci_all.h"
32 /*==== INCLUDES ===================================================*/
33 #include "aci_cmh.h"
34 #include "ati_cmd.h"
35 #include "aci_cmd.h"
36
37 #include "dti.h"
38 #include "dti_conn_mng.h"
39 #include "dti_cntrl_mng.h"
40
41 #include "aci_fd.h"
42 #include "psa.h"
43 #include "psa_l2r.h"
44 #include "psa_cc.h" /* for getting the NO_ENTRY definition */
45 #include "wap_aci.h"
46 #include "psa_ppp_w.h"
47 #include "cmh.h"
48 #include "cmh_ppp.h"
49
50
51 /*==== CONSTANTS ==================================================*/
52
53
54 /*==== TYPES ======================================================*/
55
56
57 /*==== EXPORT =====================================================*/
58
59
60 /*==== VARIABLES ==================================================*/
61
62
63 /*==== FUNCTIONS ==================================================*/
64
65
66
67
68 /*
69 +-------------------------------------------------------------------+
70 | PROJECT : GSM-PS (6147) MODULE : PSA_PPP |
71 | ROUTINE : psa_wppp_establish_cnf |
72 +-------------------------------------------------------------------+
73
74 PURPOSE : processes the PPP_ESTABLISH_CNF primitive sent by PPP.
75
76 */
77
78 GLOBAL void psa_wppp_establish_cnf(T_PPP_ESTABLISH_CNF *ppp_establish_cnf)
79 {
80 ULONG ip_address;
81 USHORT max_receive_unit;
82 ULONG dns1, dns2 ; /* Name server addresses. */
83 TRACE_FUNCTION ("psa_wppp_establish_cnf()");
84
85 if(pppShrdPrm.state EQ PPP_ESTABLISH)
86 {
87 TRACE_EVENT("PPP_ESTABLISH_CNF received: PPP activated");
88 pppShrdPrm.state = PPP_ESTABLISHED;
89
90 ip_address = ppp_establish_cnf -> ip;
91 TRACE_EVENT_P4 ("IP Address: %03u.%03u.%03u.%03u", (ip_address & 0xff000000) >> 24,
92 (ip_address & 0x00ff0000) >> 16,
93 (ip_address & 0x0000ff00) >> 8,
94 (ip_address & 0x000000ff) );
95
96 max_receive_unit = ppp_establish_cnf -> mru;
97 TRACE_EVENT_P1 ("MRU : %u", max_receive_unit);
98 dns1 = ppp_establish_cnf->dns1 ;
99 dns2 = ppp_establish_cnf->dns2 ;
100
101 cmhPPP_Established(ip_address, max_receive_unit, dns1, dns2);
102 }
103 else
104 {
105 TRACE_EVENT("unexpected PPP_ESTABLISH_CNF primitive received");
106 }
107
108 PFREE(ppp_establish_cnf);
109 }
110
111
112 /*
113 +--------------------------------------------------------------------+
114 | PROJECT : GSM-PS (6147) MODULE : PSA_PPP |
115 | ROUTINE : psa_ppp_dti_connected_ind|
116 +--------------------------------------------------------------------+
117
118 PURPOSE : processes the PPP_DTI_CONNECTED_IND primitive sent by PPP.
119
120 */
121
122 GLOBAL void psa_wppp_dti_connected_ind(T_PPP_DTI_CONNECTED_IND
123 *ppp_dti_connected_ind)
124 {
125 TRACE_FUNCTION("psa_wppp_dti_connected_ind()");
126
127 if (ppp_dti_connected_ind->connected_direction EQ PPP_DTI_CONN_PEER)
128 {
129 dti_cntrl_entity_connected( peer_link_id, DTI_ENTITY_PPPC, DTI_OK );
130 }
131 else if (ppp_dti_connected_ind->connected_direction EQ PPP_DTI_CONN_PROT)
132 {
133 dti_cntrl_entity_connected( prot_link_id, DTI_ENTITY_PPPC, DTI_OK );
134 }
135
136 PFREE(ppp_dti_connected_ind);
137 }
138
139
140 /*
141 +-------------------------------------------------------------------+
142 | PROJECT : GSM-PS (6147) MODULE : PSA_PPP |
143 | ROUTINE : psa_wppp_terminate_ind |
144 +-------------------------------------------------------------------+
145
146 PURPOSE : processes the PPP_TERMINATE_IND primitive sent by PPP.
147
148 */
149
150 GLOBAL void psa_wppp_terminate_ind(T_PPP_TERMINATE_IND *ppp_terminate_ind)
151 {
152
153 TRACE_FUNCTION("psa_wppp_terminate_ind()");
154
155 if (Wap_Call OR pppShrdPrm.is_PPP_CALL )
156 {
157
158 /*
159 * PPP is terminated before - second termination indication received
160 */
161
162 if(pppShrdPrm.state EQ PPP_TERMINATED)
163 {
164 TRACE_EVENT("Unexpected: PPP_TERMINATE_IND received twice");
165 PFREE(ppp_terminate_ind);
166 return;
167 }
168
169 /*
170 * Termination after established and by terminate
171 */
172
173 if((pppShrdPrm.state EQ PPP_ESTABLISHED) OR (pppShrdPrm.state EQ PPP_TERMINATE))
174 {
175 TRACE_EVENT("PPP_TERMINATE_IND, PPP terminate as requested");
176 pppShrdPrm.state = PPP_TERMINATED;
177 cmhPPP_Terminated();
178 PFREE(ppp_terminate_ind);
179 return;
180 }
181
182 /*
183 * PPP send a terminate indication by establish request
184 */
185
186 if(pppShrdPrm.state EQ PPP_ESTABLISH)
187 {
188 TRACE_EVENT("PPP_TERMINATE_IND, PPP terminate by establish");
189 pppShrdPrm.state = PPP_TERMINATED;
190 // cmhIPA_Deconfigurated();
191 cmhPPP_Terminated();
192 PFREE(ppp_terminate_ind);
193 return;
194 }
195
196 else
197 {
198 pppShrdPrm.state = PPP_TERMINATED;
199 TRACE_EVENT("Unexpected: PPP_TERMINATE_IND, PPP in wrong ACI PPP state");
200 }
201 }
202 else
203 TRACE_EVENT("Unexpected: Not a WAP Call");
204
205 PFREE(ppp_terminate_ind);
206
207 }
208
209 #endif /* of FF_WAP or FF_PPP OR FF_GPF_TCPIP or FF_SAT_E */
210
211 #endif /* DTI */