comparison src/g23m-fad/ppp/ppp_lcps.c @ 174:90eb61ecd093

src/g23m-fad: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2016 05:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
173:bf64d785238a 174:90eb61ecd093
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 (LCP-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef PPP_LCPS_C
24 #define PPP_LCPS_C
25 #endif /* PPP_LCPS_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_lcpf.h" /* to get function interface from lcp */
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_lcp_parameters_req
60 +------------------------------------------------------------------------------
61 | Description : Handles the internal signal SIG_ARB_LCP_PARAMETERS_REQ
62 |
63 | Parameters : mru - Maximum Receive Unit
64 | ap - Authentication Protocol
65 | accm - Async Control Character Map
66 |
67 +------------------------------------------------------------------------------
68 */
69 GLOBAL void sig_arb_lcp_parameters_req (USHORT mru, UBYTE ap, ULONG accm)
70 {
71 TRACE_ISIG( "sig_arb_lcp_parameters_req" );
72
73 ppp_data->lcp.req_mru=mru;
74 ppp_data->lcp.req_accm=accm;
75 ppp_data->lcp.req_ap=ap;
76
77 } /* sig_arb_lcp_parameters_req() */
78
79
80
81 /*
82 +------------------------------------------------------------------------------
83 | Function : sig_arb_lcp_modify_ap_req
84 +------------------------------------------------------------------------------
85 | Description : Handles the internal signal SIG_ARB_LCP_MODIFY_AP_REQ
86 |
87 | Parameters : ap - Authentication Protocol
88 |
89 +------------------------------------------------------------------------------
90 */
91 GLOBAL void sig_arb_lcp_modify_ap_req (UBYTE ap)
92 {
93 TRACE_ISIG( "sig_arb_lcp_modify_ap_req" );
94
95 ppp_data->lcp.req_ap=ap;
96
97 } /* sig_arb_lcp_modify_ap_req() */
98
99
100
101 /*
102 +------------------------------------------------------------------------------
103 | Function : sig_arb_lcp_packet_req
104 +------------------------------------------------------------------------------
105 | Description : Handles the internal signal SIG_ARB_LCP_PACKET_REQ
106 |
107 | Parameters : packet - pointer to a generic data descriptor
108 |
109 +------------------------------------------------------------------------------
110 */
111 GLOBAL void sig_arb_lcp_packet_req (T_desc2* packet)
112 {
113 UBYTE forward;
114 UBYTE isnew = 0;
115
116 TRACE_ISIG( "sig_arb_lcp_packet_req" );
117
118 /*
119 * depend on the code-field call appropriate function
120 */
121 switch(packet->buffer[0])
122 {
123 case CODE_CONF_REQ:
124 lcp_rcr(&packet, &isnew, &forward);
125 break;
126 case CODE_CONF_ACK:
127 lcp_rca(packet, &forward);
128 break;
129 case CODE_CONF_NAK:
130 lcp_rcn(&packet, &forward);
131 break;
132 case CODE_CONF_REJ:
133 lcp_rcj(&packet, &forward);
134 break;
135 case CODE_TERM_REQ:
136 lcp_rtr(&packet, &forward);
137 break;
138 case CODE_TERM_ACK:
139 lcp_rta(packet, &forward);
140 break;
141 case CODE_CODE_REJ:
142 lcp_rxj(&packet, &forward);
143 break;
144 case CODE_PROT_REJ:
145 lcp_rpj(packet, &forward);
146 break;
147 case CODE_ECHO_REQ:
148 lcp_rer(&packet, &forward);
149 break;
150 case CODE_ECHO_REP:
151 case CODE_DISC_REQ:
152 lcp_rep_rdr(packet, &forward);
153 break;
154 default:
155 lcp_ruc(&packet, &forward);
156 break;
157 }
158 switch(forward)
159 {
160 case FORWARD_RCRP:
161 sig_any_ona_rcrp_ind(DTI_PID_LCP, packet);
162 break;
163 case FORWARD_RCRN:
164 sig_any_ona_rcrn_ind(DTI_PID_LCP, packet, isnew);
165 break;
166 case FORWARD_RCA:
167 sig_any_ona_rca_ind(DTI_PID_LCP);
168 break;
169 case FORWARD_RCN:
170 sig_any_ona_rcn_ind(DTI_PID_LCP, packet);
171 break;
172 case FORWARD_RTR:
173 sig_any_ona_rtr_ind(DTI_PID_LCP, packet);
174 break;
175 case FORWARD_RTA:
176 sig_any_ona_rta_ind(DTI_PID_LCP);
177 break;
178 case FORWARD_RXJN:
179 sig_any_ona_rxjn_ind(DTI_PID_LCP, packet);
180 break;
181 case FORWARD_RUC:
182 sig_any_ona_ruc_ind(DTI_PID_LCP, packet);
183 break;
184 case FORWARD_RER:
185 sig_any_ona_rxr_ind(DTI_PID_LCP, packet);
186 break;
187 case FORWARD_RPJ_LCP:
188 sig_lcp_arb_rpj_ind(DTI_PID_LCP);
189 break;
190 case FORWARD_RPJ_PAP:
191 sig_lcp_arb_rpj_ind(DTI_PID_PAP);
192 break;
193 case FORWARD_RPJ_CHAP:
194 sig_lcp_arb_rpj_ind(DTI_PID_CHAP);
195 break;
196 case FORWARD_RPJ_IPCP:
197 sig_lcp_arb_rpj_ind(DTI_PID_IPCP);
198 break;
199 case FORWARD_RPJ_IP:
200 sig_lcp_arb_rpj_ind(DTI_PID_IP);
201 break;
202 case FORWARD_RPJ_CTCP:
203 sig_lcp_arb_rpj_ind(DTI_PID_CTCP);
204 break;
205 case FORWARD_RPJ_UTCP:
206 sig_lcp_arb_rpj_ind(DTI_PID_UTCP);
207 break;
208 default:
209 arb_discard_packet(packet);
210 break;
211 }
212 } /* sig_arb_lcp_packet_req() */
213
214
215
216 /*
217 +------------------------------------------------------------------------------
218 | Function : sig_arb_lcp_open_req
219 +------------------------------------------------------------------------------
220 | Description : Handles the internal signal SIG_ARB_LCP_OPEN_REQ
221 |
222 | Parameters : no parameters
223 |
224 +------------------------------------------------------------------------------
225 */
226 GLOBAL void sig_arb_lcp_open_req ()
227 {
228 T_desc2* packet;
229 TRACE_ISIG( "sig_arb_lcp_open_req" );
230
231 /*
232 * reset all rejected configuration options
233 */
234 ppp_data->lcp.s_rejected=0;
235 /*
236 * set configuration start values
237 */
238 ppp_data->lcp.s_mru=ppp_data->lcp.req_mru;
239 ppp_data->lcp.s_accm=ppp_data->lcp.req_accm;
240 switch(ppp_data->lcp.req_ap)
241 {
242 case PPP_AP_NO:
243 case PPP_AP_PAP:
244 case PPP_AP_CHAP:
245 ppp_data->lcp.n_ap=ppp_data->lcp.req_ap;
246 break;
247 default:
248 ppp_data->lcp.n_ap=PPP_AP_CHAP;
249 break;
250 }
251 ppp_data->lcp.s_pfc=TRUE;
252 ppp_data->lcp.s_acfc=TRUE;
253 ppp_data->lcp.scr=FALSE;
254 ppp_data->lcp.str=FALSE;
255 ppp_data->lcp.rcr=FALSE;
256 /*
257 * set new identifier
258 */
259 ppp_data->lcp.nscri++;
260 /*
261 * create configure request packet
262 */
263 lcp_get_scr(&packet);
264 /*
265 * inform ONA about the open signal
266 */
267 sig_any_ona_open_ind(DTI_PID_LCP, packet);
268
269 } /* sig_arb_lcp_open_req() */
270
271
272
273 /*
274 +------------------------------------------------------------------------------
275 | Function : sig_arb_lcp_close_req
276 +------------------------------------------------------------------------------
277 | Description : Handles the internal signal SIG_ARB_LCP_CLOSE_REQ
278 |
279 | Parameters : no parameters
280 |
281 +------------------------------------------------------------------------------
282 */
283 GLOBAL void sig_arb_lcp_close_req ()
284 {
285 T_desc2* packet;
286
287 TRACE_ISIG( "sig_arb_lcp_close_req" );
288
289 /*
290 * set new identifier
291 */
292 ppp_data->lcp.nstri++;
293 /*
294 * create terminate request packet
295 */
296 lcp_get_str(&packet);
297 /*
298 * inform ONA about the close signal
299 */
300 sig_any_ona_close_ind(DTI_PID_LCP, packet);
301
302 } /* sig_arb_lcp_close_req() */
303
304
305
306 /*
307 +------------------------------------------------------------------------------
308 | Function : sig_arb_lcp_down_req
309 +------------------------------------------------------------------------------
310 | Description : Handles the internal signal SIG_ARB_LCP_DOWN_REQ
311 |
312 | Parameters : no parameters
313 |
314 +------------------------------------------------------------------------------
315 */
316 GLOBAL void sig_arb_lcp_down_req ()
317 {
318 TRACE_ISIG( "sig_arb_lcp_down_req" );
319
320 /*
321 * inform ONA about the down signal
322 */
323 sig_any_ona_down_ind(DTI_PID_LCP);
324 } /* sig_arb_lcp_down_req() */
325
326
327
328 /*
329 +------------------------------------------------------------------------------
330 | Function : sig_arb_lcp_to_req
331 +------------------------------------------------------------------------------
332 | Description : Handles the internal signal SIG_ARB_LCP_TO_REQ
333 |
334 | Parameters : no parameters
335 |
336 +------------------------------------------------------------------------------
337 */
338 GLOBAL void sig_arb_lcp_to_req ()
339 {
340 TRACE_ISIG( "sig_arb_lcp_to_req" );
341
342 /*
343 * inform ONA about the time out signal
344 */
345 sig_any_ona_to_ind(DTI_PID_LCP);
346 } /* sig_arb_lcp_to_req() */
347
348
349
350 /*
351 +------------------------------------------------------------------------------
352 | Function : sig_ona_lcp_tld_req
353 +------------------------------------------------------------------------------
354 | Description : Handles the internal signal SIG_ONA_LCP_TLD_REQ
355 |
356 | Parameters : no parameters
357 |
358 +------------------------------------------------------------------------------
359 */
360 GLOBAL void sig_ona_lcp_tld_req()
361 {
362 TRACE_ISIG( "sig_ona_lcp_tld_req" );
363
364 /*
365 * inform ARB about This-Layer-Down signal
366 */
367 sig_lcp_arb_tld_ind();
368 } /* sig_ona_lcp_tld_req() */
369
370
371
372 /*
373 +------------------------------------------------------------------------------
374 | Function : sig_ona_lcp_tlf_req
375 +------------------------------------------------------------------------------
376 | Description : Handles the internal signal SIG_ONA_LCP_TLF_REQ
377 |
378 | Parameters : no parameters
379 |
380 +------------------------------------------------------------------------------
381 */
382 GLOBAL void sig_ona_lcp_tlf_req()
383 {
384 TRACE_ISIG( "sig_ona_lcp_tlf_req" );
385
386 /*
387 * inform ARB about This-Layer-Finish signal
388 */
389 sig_any_arb_tlf_ind();
390 } /* sig_ona_lcp_tlf_req() */
391
392
393
394 /*
395 +------------------------------------------------------------------------------
396 | Function : sig_ona_lcp_str_req
397 +------------------------------------------------------------------------------
398 | Description : Handles the internal signal SIG_ONA_LCP_STR_REQ
399 |
400 | Parameters : no parameters
401 |
402 +------------------------------------------------------------------------------
403 */
404 GLOBAL void sig_ona_lcp_str_req(T_desc2** ptr_packet)
405 {
406 TRACE_ISIG( "sig_ona_lcp_str_req" );
407
408 /*
409 * create terminate request packet
410 */
411 lcp_get_str(ptr_packet);
412 } /* sig_ona_lcp_str_req() */
413
414
415
416 /*
417 +------------------------------------------------------------------------------
418 | Function : sig_ona_lcp_scr_req
419 +------------------------------------------------------------------------------
420 | Description : Handles the internal signal SIG_ONA_LCP_SCR_REQ
421 |
422 | Parameters : no parameters
423 |
424 +------------------------------------------------------------------------------
425 */
426 GLOBAL void sig_ona_lcp_scr_req(T_desc2** ptr_packet)
427 {
428 TRACE_ISIG( "sig_ona_lcp_scr_req" );
429
430 /*
431 * create terminate request packet
432 */
433 lcp_get_scr(ptr_packet);
434 } /* sig_ona_lcp_scr_req() */
435
436
437
438 /*
439 +------------------------------------------------------------------------------
440 | Function : sig_ona_lcp_tlu_req
441 +------------------------------------------------------------------------------
442 | Description : Handles the internal signal SIG_ONA_LCP_TLU_REQ
443 |
444 | Parameters : no parameters
445 |
446 +------------------------------------------------------------------------------
447 */
448 GLOBAL void sig_ona_lcp_tlu_req()
449 {
450 TRACE_ISIG( "sig_ona_lcp_tlu_req" );
451
452 TRACE_EVENT( "LCP Established" );
453 if(ppp_data->lcp.n_ap EQ PPP_AP_CHAP)
454 {
455 TRACE_EVENT("Authentication Protocol: CHAP");
456 }
457 else if(ppp_data->lcp.n_ap EQ PPP_AP_PAP)
458 {
459 TRACE_EVENT("Authentication Protocol: PAP");
460 }
461 else if(ppp_data->lcp.n_ap EQ PPP_AP_NO)
462 {
463 TRACE_EVENT("Authentication Protocol: no authentication");
464 }
465 /*
466 * inform ARB about This-Layer-Up signal
467 */
468 sig_any_arb_tlu_ind();
469 } /* sig_ona_lcp_tlu_req() */
470
471