comparison src/g23m-fad/ppp/ppp_ncps.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
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 modul is part of the entity PPP and implements all
18 | functions to handles the incoming process internal signals as
19 | described in the SDL-documentation (NCP-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef PPP_NCPS_C
24 #define PPP_NCPS_C
25 #endif /* PPP_NCPS_C */
26
27 #define ENTITY_PPP
28
29 /*==== INCLUDES =============================================================*/
30
31 #include "typedefs.h" /* to get Condat data types */
32 #include "vsi.h" /* to get a lot of macros */
33 #include "macdef.h" /* to get a lot of macros */
34 #include "custom.h" /* to get a lot of macros */
35 #include "gsm.h" /* to get a lot of macros */
36 #include "cnf_ppp.h" /* to get cnf-definitions */
37 #include "mon_ppp.h" /* to get mon-definitions */
38 #include "prim.h" /* to get the definitions of used SAP and directions */
39 #include "dti.h" /* to get the DTILIB definitions */
40 #include "ppp.h" /* to get the global entity definitions */
41
42 #include "ppp_ncpf.h" /* to get function interface from ncp */
43 #include "ppp_arbf.h" /* to get function interface from arb */
44 #include "ppp_onas.h" /* to get signal interface from ona */
45 #include "ppp_arbs.h" /* to get signal interface from arb */
46
47 /*==== CONST ================================================================*/
48
49 /*==== LOCAL VARS ===========================================================*/
50
51 /*==== PRIVATE FUNCTIONS ====================================================*/
52
53 /*==== PUBLIC FUNCTIONS =====================================================*/
54
55
56
57 /*
58 +------------------------------------------------------------------------------
59 | Function : sig_arb_ncp_parameters_req
60 +------------------------------------------------------------------------------
61 | Description : Handles the internal signal SIG_ARB_NCP_PARAMETERS_REQ
62 |
63 | Parameters : hc - IP header compression
64 | msid - max slot identifier
65 | ip - IP address
66 | pdns - primary DNS server address
67 | sdns - secondary DNS server address
68 | gateway - Gateway address
69 |
70 +------------------------------------------------------------------------------
71 */
72 GLOBAL void sig_arb_ncp_parameters_req (UBYTE hc,
73 UBYTE msid,
74 ULONG ip,
75 ULONG pdns,
76 ULONG sdns,
77 ULONG gateway)
78 {
79 TRACE_ISIG( "sig_arb_ncp_parameters_req" );
80
81 ppp_data->ncp.req_hc = hc;
82 ppp_data->ncp.req_msid = msid;
83 ppp_data->ncp.req_ip = ip;
84 ppp_data->ncp.req_pdns = pdns;
85 ppp_data->ncp.req_sdns = sdns;
86 ppp_data->ncp.req_gateway = gateway;
87
88 } /* sig_arb_ncp_parameters_req() */
89
90
91
92 /*
93 +------------------------------------------------------------------------------
94 | Function : sig_arb_ncp_modify_hc_req
95 +------------------------------------------------------------------------------
96 | Description : Handles the internal signal SIG_ARB_NCP_MODIFY_HC_REQ
97 |
98 | Parameters : hc - IP header compression
99 | msid - max slot identifier
100 |
101 +------------------------------------------------------------------------------
102 */
103 GLOBAL void sig_arb_ncp_modify_hc_req (UBYTE hc, UBYTE msid)
104 {
105 TRACE_ISIG( "sig_arb_ncp_modify_hc_req" );
106
107 ppp_data->ncp.req_hc = hc;
108 ppp_data->ncp.req_msid = msid;
109
110 } /* sig_arb_ncp_modify_hc_req() */
111
112
113
114 /*
115 +------------------------------------------------------------------------------
116 | Function : sig_arb_ncp_packet_req
117 +------------------------------------------------------------------------------
118 | Description : Handles the internal signal SIG_ARB_NCP_PACKET_REQ
119 |
120 | Parameters : packet - pointer to a generic data descriptor
121 |
122 +------------------------------------------------------------------------------
123 */
124 GLOBAL void sig_arb_ncp_packet_req (T_desc2* packet)
125 {
126 UBYTE forward;
127 UBYTE isnew = 0;
128
129 TRACE_ISIG( "sig_arb_ncp_packet_req" );
130
131 /*
132 * depend on the code-field call appropriate function
133 */
134 switch(packet->buffer[0])
135 {
136 case CODE_CONF_REQ:
137 ncp_rcr(&packet, &isnew, &forward);
138 break;
139 case CODE_CONF_ACK:
140 ncp_rca(packet, &forward);
141 break;
142 case CODE_CONF_NAK:
143 ncp_rcn(&packet, &forward);
144 break;
145 case CODE_CONF_REJ:
146 ncp_rcj(&packet, &forward);
147 break;
148 case CODE_TERM_REQ:
149 ncp_rtr(&packet, &forward);
150 break;
151 case CODE_TERM_ACK:
152 ncp_rta(packet, &forward);
153 break;
154 case CODE_CODE_REJ:
155 ncp_rxj(&packet, &forward);
156 break;
157 default:
158 ncp_ruc(&packet, &forward);
159 break;
160 }
161 switch(forward)
162 {
163 case FORWARD_RCRP:
164 sig_any_ona_rcrp_ind(DTI_PID_IPCP, packet);
165 break;
166 case FORWARD_RCRN:
167 sig_any_ona_rcrn_ind(DTI_PID_IPCP, packet, isnew);
168 break;
169 case FORWARD_RCA:
170 sig_any_ona_rca_ind(DTI_PID_IPCP);
171 break;
172 case FORWARD_RCN:
173 sig_any_ona_rcn_ind(DTI_PID_IPCP, packet);
174 break;
175 case FORWARD_RTR:
176 sig_any_ona_rtr_ind(DTI_PID_IPCP, packet);
177 break;
178 case FORWARD_RTA:
179 sig_any_ona_rta_ind(DTI_PID_IPCP);
180 break;
181 case FORWARD_RXJN:
182 sig_any_ona_rxjn_ind(DTI_PID_IPCP, packet);
183 break;
184 case FORWARD_RUC:
185 sig_any_ona_ruc_ind(DTI_PID_IPCP, packet);
186 break;
187 default:
188 arb_discard_packet(packet);
189 break;
190 }
191 } /* sig_arb_ncp_packet_req() */
192
193
194
195 /*
196 +------------------------------------------------------------------------------
197 | Function : sig_arb_ncp_open_req
198 +------------------------------------------------------------------------------
199 | Description : Handles the internal signal SIG_ARB_NCP_OPEN_REQ
200 |
201 | Parameters : no parameters
202 |
203 +------------------------------------------------------------------------------
204 */
205 GLOBAL void sig_arb_ncp_open_req ()
206 {
207 T_desc2* packet;
208 TRACE_ISIG( "sig_arb_ncp_open_req" );
209
210 /*
211 * reset all rejected configuration options
212 */
213 ppp_data->ncp.s_rejected = 0;
214 /*
215 * set configuration start values
216 */
217 ppp_data->ncp.s_hc = ppp_data->ncp.req_hc;
218 ppp_data->ncp.s_msid = ppp_data->ncp.req_msid;
219 ppp_data->ncp.n_ip = ppp_data->ncp.req_ip;
220 ppp_data->ncp.n_pdns = ppp_data->ncp.req_pdns;
221 ppp_data->ncp.n_sdns = ppp_data->ncp.req_sdns;
222 ppp_data->ncp.n_gateway = ppp_data->ncp.req_gateway;
223
224 ppp_data->ncp.scr = FALSE;
225 ppp_data->ncp.str = FALSE;
226 ppp_data->ncp.rcr = FALSE;
227 /*
228 * set new identifier
229 */
230 ppp_data->ncp.nscri++;
231 /*
232 * create configure request packet
233 */
234 ncp_get_scr(&packet);
235 /*
236 * inform ONA about the open signal
237 */
238 sig_any_ona_open_ind(DTI_PID_IPCP, packet);
239
240 } /* sig_arb_ncp_open_req() */
241
242
243
244 /*
245 +------------------------------------------------------------------------------
246 | Function : sig_arb_ncp_close_req
247 +------------------------------------------------------------------------------
248 | Description : Handles the internal signal SIG_ARB_NCP_CLOSE_REQ
249 |
250 | Parameters : no parameters
251 |
252 +------------------------------------------------------------------------------
253 */
254 GLOBAL void sig_arb_ncp_close_req ()
255 {
256 T_desc2* packet;
257
258 TRACE_ISIG( "sig_arb_ncp_close_req" );
259
260 /*
261 * set new identifier
262 */
263 ppp_data->ncp.nstri++;
264 /*
265 * create terminate request packet
266 */
267 ncp_get_str(&packet);
268 /*
269 * inform ONA about the close signal
270 */
271 sig_any_ona_close_ind(DTI_PID_IPCP, packet);
272
273 } /* sig_arb_ncp_close_req() */
274
275
276
277 /*
278 +------------------------------------------------------------------------------
279 | Function : sig_arb_ncp_down_req
280 +------------------------------------------------------------------------------
281 | Description : Handles the internal signal SIG_ARB_NCP_DOWN_REQ
282 |
283 | Parameters : no parameters
284 |
285 +------------------------------------------------------------------------------
286 */
287 GLOBAL void sig_arb_ncp_down_req ()
288 {
289 TRACE_ISIG( "sig_arb_ncp_down_req" );
290
291 /*
292 * inform ONA about the down signal
293 */
294 sig_any_ona_down_ind(DTI_PID_IPCP);
295 } /* sig_arb_ncp_down_req() */
296
297
298
299 /*
300 +------------------------------------------------------------------------------
301 | Function : sig_arb_ncp_to_req
302 +------------------------------------------------------------------------------
303 | Description : Handles the internal signal SIG_ARB_NCP_TO_REQ
304 |
305 | Parameters : no parameters
306 |
307 +------------------------------------------------------------------------------
308 */
309 GLOBAL void sig_arb_ncp_to_req ()
310 {
311 TRACE_ISIG( "sig_arb_ncp_to_req" );
312
313 /*
314 * inform ONA about the time out signal
315 */
316 sig_any_ona_to_ind(DTI_PID_IPCP);
317 } /* sig_arb_ncp_to_req() */
318
319
320
321 /*
322 +------------------------------------------------------------------------------
323 | Function : sig_ona_ncp_tld_req
324 +------------------------------------------------------------------------------
325 | Description : Handles the internal signal SIG_ONA_NCP_TLD_REQ
326 |
327 | Parameters : no parameters
328 |
329 +------------------------------------------------------------------------------
330 */
331 GLOBAL void sig_ona_ncp_tld_req ()
332 {
333 TRACE_ISIG( "sig_ona_ncp_tld_req" );
334
335 /*
336 * inform ARB about This-Layer-Down signal
337 */
338 sig_ncp_arb_tld_ind();
339 } /* sig_ona_ncp_tld_req() */
340
341
342
343 /*
344 +------------------------------------------------------------------------------
345 | Function : sig_ona_ncp_tlf_req
346 +------------------------------------------------------------------------------
347 | Description : Handles the internal signal SIG_ONA_NCP_TLF_REQ
348 |
349 | Parameters : no parameters
350 |
351 +------------------------------------------------------------------------------
352 */
353 GLOBAL void sig_ona_ncp_tlf_req ()
354 {
355 TRACE_ISIG( "sig_ona_ncp_tlf_req" );
356
357 /*
358 * inform ARB about This-Layer-Finish signal
359 */
360 sig_any_arb_tlf_ind();
361 } /* sig_ona_ncp_tlf_req() */
362
363
364
365 /*
366 +------------------------------------------------------------------------------
367 | Function : sig_ona_ncp_str_req
368 +------------------------------------------------------------------------------
369 | Description : Handles the internal signal SIG_ONA_NCP_STR_REQ
370 |
371 | Parameters : pointer on packet
372 |
373 +------------------------------------------------------------------------------
374 */
375 GLOBAL void sig_ona_ncp_str_req (T_desc2** ptr_packet)
376 {
377 TRACE_ISIG( "sig_ona_ncp_str_req" );
378
379 /*
380 * create terminate request packet
381 */
382 ncp_get_str(ptr_packet);
383 } /* sig_ona_ncp_str_req() */
384
385
386
387 /*
388 +------------------------------------------------------------------------------
389 | Function : sig_ona_ncp_scr_req
390 +------------------------------------------------------------------------------
391 | Description : Handles the internal signal SIG_ONA_NCP_SCR_REQ
392 |
393 | Parameters : pointer on packet
394 |
395 +------------------------------------------------------------------------------
396 */
397 GLOBAL void sig_ona_ncp_scr_req (T_desc2** ptr_packet)
398 {
399 TRACE_ISIG( "sig_ona_ncp_scr_req" );
400
401 /*
402 * create terminate request packet
403 */
404 ncp_get_scr(ptr_packet);
405 } /* sig_ona_ncp_scr_req() */
406
407
408
409 /*
410 +------------------------------------------------------------------------------
411 | Function : sig_ona_ncp_tlu_req
412 +------------------------------------------------------------------------------
413 | Description : Handles the internal signal SIG_ONA_NCP_TLU_REQ
414 |
415 | Parameters : no parameters
416 |
417 +------------------------------------------------------------------------------
418 */
419 GLOBAL void sig_ona_ncp_tlu_req ()
420 {
421 TRACE_ISIG( "sig_ona_ncp_tlu_req" );
422
423 /*
424 * inform ARB about This-Layer-Up signal
425 */
426 sig_any_arb_tlu_ind();
427 } /* sig_ona_ncp_tlu_req() */
428
429