comparison src/g23m-fad/ppp/ppp_pei.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 :
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 module implements the process body interface
18 | for the entity Point-to-Point Protocol (PPP)
19 |
20 | Exported functions:
21 |
22 | pei_create - Create the Protocol Stack Entity
23 | pei_init - Initialize Protocol Stack Entity
24 | pei_primitive - Process Primitive
25 | pei_timeout - Process Timeout
26 | pei_exit - Close resources and terminate
27 | pei_run - Process Primitive
28 | pei_config - Dynamic Configuration
29 | pei_monitor - Monitoring of physical Parameters
30 +-----------------------------------------------------------------------------
31 */
32
33 #define PPP_PEI_C
34
35 #define ENTITY_PPP
36
37 /*==== INCLUDES =============================================================*/
38
39 #include <stddef.h>
40 #include "typedefs.h" /* to get Condat data types */
41 #include "vsi.h" /* to get a lot of macros */
42 /*lint -efile(766,macdef.h) */
43 #include "macdef.h" /* to get a lot of macros */
44 #include "custom.h" /* to get a lot of macros */
45 #include "gsm.h" /* to get a lot of macros */
46 /*lint -efile(766,cnf_ppp.h) */
47 #include "cnf_ppp.h" /* to get cnf-definitions */
48 #include "mon_ppp.h" /* to get mon-definitions */
49 #include "prim.h" /* to get the definitions of used SAP and directions */
50 #include "dti.h" /* to get the DTILIB definitions */
51 #include "ppp.h" /* to get the global entity definitions */
52
53 #ifdef FF_STATUS_TE
54 #include "gdi.h" /* To include driver type-defines */
55 #include "ste.h" /* To include function interface for TE status driver */
56 #endif /* FF_STATUS_TE */
57
58 #include "ppp_rtf.h" /* to get rt functions */
59 #include "ppp_rtp.h" /* to get rt primitives */
60 #include "ppp_rts.h" /* to get rt signals */
61
62 /*lint -efile(766,ppp_prxp.h) */
63 #include "ppp_prxf.h" /* to get prx functions */
64 #include "ppp_prxp.h" /* to get prx primitives */
65 #include "ppp_prxs.h" /* to get prx signals */
66
67 /*lint -efile(766,ppp_ptxp.h) */
68 #include "ppp_ptxf.h" /* to get ptx functions */
69 #include "ppp_ptxp.h" /* to get ptx primitives */
70 #include "ppp_ptxs.h" /* to get ptx signals */
71
72 /*lint -efile(766,ppp_frxp.h) */
73 #include "ppp_frxf.h" /* to get frx functions */
74 #include "ppp_frxp.h" /* to get frx primitives */
75 #include "ppp_frxs.h" /* to get frx signals */
76
77 /*lint -efile(766,ppp_ftxp.h) */
78 #include "ppp_ftxf.h" /* to get ftx functions */
79 #include "ppp_ftxp.h" /* to get ftx primitives */
80 #include "ppp_ftxs.h" /* to get ftx signals */
81
82 #include "ppp_arbf.h" /* to get arb functions */
83 #include "ppp_arbp.h" /* to get arb primitives */
84 #include "ppp_arbs.h" /* to get arb signals */
85
86 /*lint -efile(766,ppp_lcpp.h) */
87 /*lint -efile(766,ppp_lcps.h) */
88 #include "ppp_lcpf.h" /* to get lcp functions */
89 #include "ppp_lcpp.h" /* to get lcp primitives */
90 #include "ppp_lcps.h" /* to get lcp signals */
91
92 /*lint -efile(766,ppp_onap.h) */
93 /*lint -efile(766,ppp_onas.h) */
94 #include "ppp_onaf.h" /* to get ona functions */
95 #include "ppp_onap.h" /* to get ona primitives */
96 #include "ppp_onas.h" /* to get ona signals */
97
98 /*lint -efile(766,ppp_ncpp.h) */
99 /*lint -efile(766,ppp_ncps.h) */
100 #include "ppp_ncpf.h" /* to get ncp functions */
101 #include "ppp_ncpp.h" /* to get ncp primitives */
102 #include "ppp_ncps.h" /* to get ncp signals */
103
104 /*lint -efile(766,ppp_papp.h) */
105 /*lint -efile(766,ppp_paps.h) */
106 #include "ppp_papf.h" /* to get pap functions */
107 #include "ppp_papp.h" /* to get pap primitives */
108 #include "ppp_paps.h" /* to get pap signals */
109
110 /*lint -efile(766,ppp_capp.h) */
111 /*lint -efile(766,ppp_caps.h) */
112 #include "ppp_capf.h" /* to get chap functions */
113 #include "ppp_capp.h" /* to get chap primitives */
114 #include "ppp_caps.h" /* to get chap signals */
115
116 #include "ppp_dti.h" /* to get the DTI signals */
117
118 /*==== DEFINITIONS ==========================================================*/
119
120 /*==== TYPES ================================================================*/
121
122 /*==== GLOBAL VARS ==========================================================*/
123
124 /*==== LOCAL VARS ===========================================================*/
125
126 static BOOL first_access = TRUE;
127 static T_MONITOR ppp_mon;
128
129 /*
130 * Jumptables to primitive handler functions. One table per SAP.
131 *
132 * Use MAK_FUNC_0 for primitives which contains no SDU.
133 * Use MAK_FUNC_S for primitives which contains a SDU.
134 */
135
136 /*
137 * Function is needed for developing. This declaration can be removed
138 * as soon as this function is no more called (i.e. all primitives are
139 * handled).
140 */
141
142 LOCAL void primitive_not_supported (void *data);
143 LOCAL void pei_dti_dti_ready_ind (T_DTI2_READY_IND *dti_ready_ind);
144 LOCAL void pei_dti_dti_data_req (T_DTI2_DATA_REQ *dti_data_req);
145 LOCAL void pei_dti_dti_data_ind (T_DTI2_DATA_IND *dti_data_ind);
146 LOCAL void pei_dti_dti_getdata_req (T_DTI2_GETDATA_REQ *dti_getdata_req);
147 LOCAL void pei_dti_dti_data_test_ind (T_DTI2_DATA_TEST_IND *dti_data_test_ind);
148 LOCAL void pei_dti_dti_data_test_req (T_DTI2_DATA_TEST_REQ *dti_data_test_req);
149 LOCAL void pei_dti_dti_connect_req (T_DTI2_CONNECT_REQ *dti_connect_req );
150 LOCAL void pei_dti_dti_disconnect_ind (T_DTI2_DISCONNECT_IND *dti_disconnect_ind);
151 LOCAL void pei_dti_dti_connect_cnf (T_DTI2_CONNECT_CNF *dti_connect_cnf);
152 LOCAL void pei_dti_dti_connect_ind (T_DTI2_CONNECT_IND *dti_connect_ind);
153 LOCAL void pei_dti_dti_connect_res (T_DTI2_CONNECT_RES *dti_connect_res);
154 LOCAL void pei_dti_dti_disconnect_req (T_DTI2_DISCONNECT_REQ *dti_disconnect_req);
155
156
157 static const T_FUNC ppp_table[] =
158 {
159 MAK_FUNC_0(arb_ppp_establish_req, PPP_ESTABLISH_REQ), /* 7500 */
160 MAK_FUNC_0(arb_ppp_terminate_req, PPP_TERMINATE_REQ), /* 7501 */
161 MAK_FUNC_S(arb_ppp_pdp_activate_res, PPP_PDP_ACTIVATE_RES),/* 7502 */
162 MAK_FUNC_0(arb_ppp_pdp_activate_rej, PPP_PDP_ACTIVATE_REJ),/* 7503 */
163 MAK_FUNC_0(arb_ppp_modification_req, PPP_MODIFICATION_REQ) /* 7504 */
164 };
165
166 LOCAL const T_FUNC dti_dl_table[] = {
167 MAK_FUNC_0( pei_dti_dti_connect_ind , DTI2_CONNECT_IND ),
168 MAK_FUNC_0( pei_dti_dti_connect_cnf , DTI2_CONNECT_CNF ),
169 MAK_FUNC_0( pei_dti_dti_disconnect_ind , DTI2_DISCONNECT_IND)
170 ,
171 MAK_FUNC_0( pei_dti_dti_ready_ind , DTI2_READY_IND ),
172 MAK_FUNC_0( pei_dti_dti_data_ind , DTI2_DATA_IND )
173 #if defined (_SIMULATION_)
174 ,
175 MAK_FUNC_S( pei_dti_dti_data_test_ind , DTI2_DATA_TEST_IND )
176 #endif
177 };
178
179 LOCAL const T_FUNC dti_ul_table[] = {
180 MAK_FUNC_0( pei_dti_dti_connect_req , DTI2_CONNECT_REQ ),
181 MAK_FUNC_0( pei_dti_dti_connect_res , DTI2_CONNECT_RES ),
182 MAK_FUNC_0( pei_dti_dti_disconnect_req, DTI2_DISCONNECT_REQ)
183 ,
184 MAK_FUNC_0( pei_dti_dti_getdata_req , DTI2_GETDATA_REQ ),
185 MAK_FUNC_0( pei_dti_dti_data_req , DTI2_DATA_REQ )
186
187 #if defined (_SIMULATION_)
188 ,
189 MAK_FUNC_S( pei_dti_dti_data_test_req , DTI2_DATA_TEST_REQ )
190 #endif
191 };
192
193 /*==== DIAGNOSTICS ==========================================================*/
194 #ifdef _DEBUG
195 #endif /* _DEBUG */
196
197 /*==== END DIAGNOSTICS ======================================================*/
198
199 /*==== PRIVATE FUNCTIONS ====================================================*/
200
201 /*
202 +------------------------------------------------------------------------------
203 | Function : primitive_not_supported
204 +------------------------------------------------------------------------------
205 | Description : This function handles unsupported primitives.
206 |
207 | Parameters : -
208 |
209 | Return : -
210 |
211 +------------------------------------------------------------------------------
212 */
213 LOCAL void primitive_not_supported (void *data)
214 {
215 TRACE_FUNCTION ("primitive_not_supported");
216
217 PFREE (data);
218 }
219
220
221 /*==== PUBLIC FUNCTIONS =====================================================*/
222
223 /* qqq hier malen
224 +------------------------------------------------------------------------------
225 | Function : pei_primitive
226 +------------------------------------------------------------------------------
227 | Description : This function is called by the frame when a primitive is
228 | received and needs to be processed.
229 |
230 | | |
231 | MMI DTI UPLINK
232 | | |
233 | +--------v--------v--------+
234 | | |
235 | | PPP |
236 | | |
237 | +-------------^------------+
238 | |
239 | DTI DOWNLINK
240 | |
241 |
242 |
243 | Parameters : prim - Pointer to the received primitive
244 |
245 | Return : PEI_OK - function succeeded
246 | PEI_ERROR - function failed
247 |
248 +------------------------------------------------------------------------------
249 */
250
251 /*qqq hier kucken*/
252 LOCAL SHORT pei_primitive (void * primptr)
253 {
254 TRACE_FUNCTION ("pei_primitive");
255
256 if (primptr NEQ NULL)
257 {
258 T_PRIM *prim = (T_PRIM *)primptr;
259 USHORT opc = (USHORT)prim->custom.opc;
260 USHORT n;
261 const T_FUNC *table;
262
263 /*
264 * This must be called for Partition Pool supervision. Will be replaced
265 * by another macro some time.
266 */
267 VSI_PPM_REC (&prim->custom, __FILE__, __LINE__);
268 PTRACE_IN (opc);
269
270 switch (opc & OPC_MASK)
271 {
272 case PPP_DL:
273 table = ppp_table;
274 n = TAB_SIZE (ppp_table);
275 break;
276 case DTI_UL:
277
278 table = dti_ul_table;
279 n = TAB_SIZE (dti_ul_table);
280 break;
281 case DTI_DL:
282 table = dti_dl_table;
283 n = TAB_SIZE (dti_dl_table);
284 break;
285 default:
286 table = NULL;
287 n = 0;
288 break;
289 }
290
291 if (table NEQ NULL)
292 {
293 #define PRIM_OFFSET_DTI2 0x50
294 #define PRM_MASK2 0x000F
295 if (((opc & PRM_MASK) - PRIM_OFFSET_DTI2) < n)
296 {
297 table += opc & PRM_MASK2;
298 #ifdef PALLOC_TRANSITION
299 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; /*lint !e740 !e545 */
300 #ifndef NO_COPY_ROUTING
301 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER);
302 #endif /* NO_COPY_ROUTING */
303 #endif /* PALLOC_TRANSITION */
304 JUMP (table->func) (P2D(prim));
305 }
306 else
307 {
308 primitive_not_supported (P2D(prim));
309 }
310 return PEI_OK;
311 }
312
313 /*
314 * primitive is not a GSM primitive - forward it to the environment
315 */
316 if (opc & SYS_MASK)
317 vsi_c_primitive (VSI_CALLER prim); /*lint !e534 */
318 else
319 {
320 PFREE (P2D(prim));
321 return PEI_ERROR;
322 }
323 }
324 return PEI_OK;
325 }
326
327
328 /*
329 +------------------------------------------------------------------------------
330 | Function : pei_init
331 +------------------------------------------------------------------------------
332 | Description : This function is called by the frame. It is used to initialise
333 | the entitiy.
334 |
335 | Parameters : handle - task handle
336 |
337 | Return : PEI_OK - entity initialised
338 | PEI_ERROR - entity not (yet) initialised
339 |
340 +------------------------------------------------------------------------------
341 */
342
343 /*qqq hier Kommunikationskanaele eintragen*/
344 LOCAL SHORT pei_init (T_HANDLE handle)
345 {
346
347 TRACE_FUNCTION ("pei_init");
348
349 /*
350 * Initialize task handle
351 */
352 PPP_handle = handle;
353 /*
354 * Open communication channel
355 */
356 if (hCommMMI < VSI_OK)
357 {
358 if ((hCommMMI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK) /*lint !e605 */
359 return PEI_ERROR;
360 }
361
362 if (hCommPPP < VSI_OK)
363 {
364 if ((hCommPPP = vsi_c_open (VSI_CALLER PPP_NAME)) < VSI_OK) /*lint !e605 */
365 return PEI_ERROR;
366 }
367
368 /*
369 * Initialize global pointer ppp_data. This is required to access all
370 * entity data.
371 */
372 ppp_data = &ppp_data_base;
373 ppp_data->fcstab = fcstab_base;
374 ppp_data->ftx.accmtab = accmtab_base;
375
376
377 /*
378 * Initialize entity data (call init function of every service)
379 */
380 rt_init();
381 prx_init();
382 ptx_init();
383 frx_init();
384 ftx_init();
385 arb_init();
386 lcp_init();
387 ona_init();
388 ncp_init();
389 pap_init();
390 chap_init();
391
392 /*
393 * initialize global entity variables
394 */
395 ppp_data->mc = PPP_MC_DEFAULT;
396 ppp_data->mt = PPP_MT_DEFAULT;
397 ppp_data->mf = PPP_MF_DEFAULT;
398
399 /*
400 * a value different from 0 indicates an error or
401 * administrative termination
402 */
403 ppp_data->ppp_cause = 0;
404
405 ppp_data->mru = PPP_MRU_DEFAULT;
406 ppp_data->n_hc = PPP_HC_OFF;
407
408 ppp_data->pco_mask = PPP_PCO_MASK_DEFAULT;
409
410 /*
411 * Init DTILIB channels and allocate the DTI Database
412 */
413 if ( (
414 ppp_data->ppphDTI = dti_init (
415 MAX_PPP_LINKS,
416 PPP_handle,
417 DTI_DEFAULT_OPTIONS,
418 sig_callback
419 )
420 ) EQ D_NO_DATA_BASE)
421 {
422 TRACE_ERROR("Open the DTILIB Databank not correct");
423 return PEI_ERROR;
424 }
425 return PEI_OK;
426 }
427
428 /*
429 +------------------------------------------------------------------------------
430 | Function : pei_timeout
431 +------------------------------------------------------------------------------
432 | Description : This function is called by the frame when a timer has expired.
433 |
434 | Parameters : index - timer index
435 |
436 | Return : PEI_OK - timeout processed
437 | PEI_ERROR - timeout not processed
438 |
439 +------------------------------------------------------------------------------
440 */
441 /*qqq hier noch ppp timer eintragen!!!*/
442 LOCAL SHORT pei_timeout (USHORT index)
443 {
444 TRACE_FUNCTION ("pei_timeout");
445
446 /*
447 * Process timeout
448 */
449 switch (index)
450 {
451 case RT_INDEX:
452 /*
453 * RT expired.
454 */
455 rt_rt_expired();
456 break;
457 default:
458 TRACE_ERROR("Unknown Timeout");
459 break;
460 }
461
462 return PEI_OK;
463 }
464
465
466
467 /*
468 +------------------------------------------------------------------------------
469 | Function : pei_signal
470 +------------------------------------------------------------------------------
471 | Description : This function is called by the frame when a signal has been
472 | received.
473 |
474 | Parameters : opc - signal operation code
475 | *data - pointer to primitive
476 |
477 | Return : PEI_OK - signal processed
478 | PEI_ERROR - signal not processed
479 |
480 +------------------------------------------------------------------------------
481 */
482 LOCAL SHORT pei_signal (ULONG opc, void *data)
483 {
484 TRACE_FUNCTION ("pei_signal");
485
486 /*
487 * Process signal
488 */
489 switch (opc)
490 {
491 #ifdef FF_STATUS_TE
492 /*
493 * Call-back from TE status driver - power status has changed
494 */
495 case NEW_POWER_STATUS:
496 new_power_status_TE ( );
497 break;
498 #endif /* FF_STATUS_TE */
499
500 default:
501 TRACE_ERROR("Unknown Signal OPC");
502 break;
503 } /*lint !e764 switch statement does not have a case */
504
505 return PEI_OK;
506 } /*lint !e715 data not referenced */
507
508
509
510 /*
511 +------------------------------------------------------------------------------
512 | Function : pei_exit
513 +------------------------------------------------------------------------------
514 | Description : This function is called by the frame when the entity is
515 | terminated. All open resources are freed.
516 |
517 | Parameters : -
518 |
519 | Return : PEI_OK - exit sucessful
520 | PEI_ERROR - exit not sueccessful
521 |
522 +------------------------------------------------------------------------------
523 */
524 LOCAL SHORT pei_exit (void)
525 {
526 TRACE_FUNCTION ("pei_exit");
527
528 /*
529 * Stop timer
530 */
531 sig_any_rt_srt_req ();
532
533 /*
534 * Close communication channel
535 */
536 vsi_c_close (VSI_CALLER hCommMMI); /*lint !e534 Ignoring return value */
537 hCommMMI = VSI_ERROR;
538
539 /*
540 * Deinit the DTI Database
541 */
542 dti_deinit(ppp_data->ppphDTI);
543
544 return PEI_OK;
545 }
546
547
548
549 /*
550 +------------------------------------------------------------------------------
551 | Function : pei_run
552 +------------------------------------------------------------------------------
553 | Description : This function is called by the frame when entering the main
554 | loop. This fucntion is only required in the active variant.
555 |
556 | This function is not used.
557 |
558 | Parameters : handle - Communication handle
559 |
560 | Return : PEI_OK - sucessful
561 | PEI_ERROR - not successful
562 |
563 +------------------------------------------------------------------------------
564 */
565 LOCAL SHORT pei_run (T_HANDLE TaskHandle, T_HANDLE ComHandle )
566 {
567 return PEI_OK;
568 } /*lint !e715 TaskHandle and ComHandle not referenced */
569
570
571
572 /*
573 +------------------------------------------------------------------------------
574 | Function : pei_config
575 +------------------------------------------------------------------------------
576 | Description : This function is called by the frame when a primitive is
577 | received indicating dynamic configuration.
578 |
579 | This function is not used in this entity.
580 |
581 | Parameters : handle - Communication handle
582 |
583 | Return : PEI_OK - sucessful
584 | PEI_ERROR - not successful
585 |
586 +------------------------------------------------------------------------------
587 */
588 LOCAL SHORT pei_config (char *inString)
589 {
590 #ifndef NCONFIG
591 ULONG new_mask;
592 #endif /* !NCONFIG */
593
594 TRACE_FUNCTION ("pei_config");
595 TRACE_FUNCTION (inString);
596
597 #ifndef NCONFIG
598 /*
599 * Parse next keyword and number of variables
600 */
601
602 /*if(!strcmp(inString,"PCO="))*/
603 if (inString[0] EQ 'P' &&
604 inString[1] EQ 'C' &&
605 inString[2] EQ 'O' &&
606 inString[3] EQ '=')
607 {
608 TRACE_EVENT ("New PCO content:");
609 new_mask = 0;
610 /*
611 * LCP MRU
612 */
613 if((inString[4] EQ 0x31) ||
614 ((inString[4] NEQ 0x30) &&
615 (ppp_data->pco_mask & PPP_PCO_MASK_LCP_MRU)))
616 {
617 TRACE_EVENT(" - LCP MRU");
618 new_mask|= PPP_PCO_MASK_LCP_MRU;
619 }
620 /*
621 * LCP AP
622 */
623 if((inString[5] EQ 0x31) ||
624 ((inString[5] NEQ 0x30) &&
625 (ppp_data->pco_mask & PPP_PCO_MASK_LCP_AP)))
626 {
627 TRACE_EVENT(" - LCP Authentication protocol");
628 new_mask|= PPP_PCO_MASK_LCP_AP;
629 }
630 /*
631 * LCP TWO
632 */
633 if((inString[6] EQ 0x31) ||
634 ((inString[6] NEQ 0x30) &&
635 (ppp_data->pco_mask & PPP_PCO_MASK_LCP_TWO)))
636 {
637 TRACE_EVENT(" - two LCP packets");
638 new_mask|= PPP_PCO_MASK_LCP_TWO;
639 }
640 /*
641 * Authentication Protocol
642 */
643 if((inString[7] EQ 0x31) ||
644 ((inString[7] NEQ 0x30) &&
645 (ppp_data->pco_mask & PPP_PCO_MASK_AUTH_PROT)))
646 {
647 TRACE_EVENT(" - PAP/CHAP Authentication packet(s)");
648 new_mask|= PPP_PCO_MASK_AUTH_PROT;
649 }
650 /*
651 * IPCP HC
652 */
653 if((inString[8] EQ 0x31) ||
654 ((inString[8] NEQ 0x30) &&
655 (ppp_data->pco_mask & PPP_PCO_MASK_IPCP_HC)))
656 {
657 TRACE_EVENT(" - VJ Header Compression");
658 new_mask|= PPP_PCO_MASK_IPCP_HC;
659 }
660 /*
661 * IPCP IP
662 */
663 if((inString[9] EQ 0x31) ||
664 ((inString[9] NEQ 0x30) &&
665 (ppp_data->pco_mask & PPP_PCO_MASK_IPCP_IP)))
666 {
667 TRACE_EVENT(" - IP address");
668 new_mask|= PPP_PCO_MASK_IPCP_IP;
669 }
670 /*
671 * IPCP PDNS
672 */
673 if((inString[10] EQ 0x31) ||
674 ((inString[10] NEQ 0x30) &&
675 (ppp_data->pco_mask & PPP_PCO_MASK_IPCP_PDNS)))
676 {
677 TRACE_EVENT(" - primary DNS address");
678 new_mask|= PPP_PCO_MASK_IPCP_PDNS;
679 }
680 /*
681 * IPCP SDNS
682 */
683 if((inString[11] EQ 0x31) ||
684 ((inString[11] NEQ 0x30) &&
685 (ppp_data->pco_mask & PPP_PCO_MASK_IPCP_SDNS)))
686 {
687 TRACE_EVENT(" - secondary DNS address");
688 new_mask|= PPP_PCO_MASK_IPCP_SDNS;
689 }
690 /*
691 * IPCP GATEWAY
692 */
693 if((inString[12] EQ 0x31) ||
694 ((inString[12] NEQ 0x30) &&
695 (ppp_data->pco_mask & PPP_PCO_MASK_IPCP_GATEWAY)))
696 {
697 TRACE_EVENT(" - Gateway address");
698 new_mask|= PPP_PCO_MASK_IPCP_GATEWAY;
699 }
700
701 if(new_mask EQ 0)
702 {
703 TRACE_EVENT(" - no content");
704 }
705 /*
706 * set new PCO mask
707 */
708 ppp_data->pco_mask = new_mask;
709 }
710 else
711 {
712 TRACE_ERROR("config command does not exist");
713 }
714 #endif /* !NCONFIG */
715
716 return PEI_OK;
717 }
718
719
720
721 /*
722 +------------------------------------------------------------------------------
723 | Function : pei_config
724 +------------------------------------------------------------------------------
725 | Description : This function is called by the frame in case sudden entity
726 | specific data is requested (e.g. entity Version).
727 |
728 | Parameters : out_monitor - return the address of the data to be
729 | monitoredCommunication handle
730 |
731 | Return : PEI_OK - sucessful (address in out_monitor is valid)
732 | PEI_ERROR - not successful
733 |
734 +------------------------------------------------------------------------------
735 */
736 LOCAL SHORT pei_monitor (void ** out_monitor)
737 {
738 TRACE_FUNCTION ("pei_monitor");
739
740 /*
741 * Version = "0.S" (S = Step).
742 */
743 ppp_mon.version = VERSION_PPP; /*lint !e605 Increase in pointer capability */
744 *out_monitor = &ppp_mon;
745
746 return PEI_OK;
747 }
748
749
750
751 /*
752 +------------------------------------------------------------------------------
753 | Function : pei_create
754 +------------------------------------------------------------------------------
755 | Description : This function is called by the frame when the process is
756 | created.
757 |
758 | Parameters : out_name - Pointer to the buffer in which to locate
759 | the name of this entity
760 |
761 | Return : PEI_OK - entity created successfuly
762 | PEI_ERROR - entity could not be created
763 |
764 +------------------------------------------------------------------------------
765 */
766 GLOBAL SHORT pei_create (T_PEI_INFO **info)
767 {
768 static T_PEI_INFO pei_info =
769 {
770 "PPP", /*lint !e605 Increase in pointer capability */
771 { /* pei-table */
772 pei_init,
773 pei_exit,
774 pei_primitive,
775 pei_timeout,
776 pei_signal,
777 pei_run,
778 pei_config,
779 pei_monitor
780 },
781 2048, /* stack size */
782 10, /* queue entries */
783 185, /* priority (1->low, 255->high) */
784 TIMER_MAX, /* number of timers */
785 0x03|PRIM_NO_SUSPEND /* flags: bit 0 active(0) body/passive(1) */
786 }; /* bit 1 com by copy(0)/reference(1) */
787
788
789 TRACE_FUNCTION ("pei_create");
790
791 /*
792 * Close Resources if open
793 */
794 if (first_access)
795 first_access = FALSE;
796 else
797 pei_exit(); /*lint !e534 Ignoring return value */
798
799 /*
800 * Export startup configuration data
801 */
802 *info = &pei_info;
803
804 return PEI_OK;
805 }
806
807 /*
808 +------------------------------------------------------------------------------
809 | Function : sig_callback
810 +------------------------------------------------------------------------------
811 | Description : This is the DTI Callback Function which handles the DTI signals.
812 |
813 |
814 | Parameters : instance - DTI instance
815 | inter_face - DTI interface
816 | channel - DTI channel
817 | reason - DTI reason
818 | *dti_data_ind - Ptr. to the data primitive
819 |
820 +------------------------------------------------------------------------------
821 */
822
823 GLOBAL void sig_callback(U8 instance, U8 inter_face, U8 channel,
824 U8 reason, T_DTI2_DATA_IND *dti_data_ind)
825 {
826 DTI_HANDLE hDTI;
827
828 TRACE_FUNCTION("sig_callback");
829
830 hDTI = ppp_data->ppphDTI;
831
832 if (hDTI NEQ D_NO_DATA_BASE)
833 {
834 switch (reason)
835 {
836 case DTI_REASON_CONNECTION_OPENED:
837 /*
838 * DTI connect
839 */
840 sig_dti_arb_connection_opened_ind (hDTI, instance, inter_face, channel);
841 break;
842
843 case DTI_REASON_CONNECTION_CLOSED:
844 /*
845 * DTI disconnect
846 */
847 sig_dti_arb_connection_closed_ind (hDTI, instance, inter_face, channel);
848 break;
849
850 case DTI_REASON_DATA_RECEIVED:
851 if(inter_face EQ PROT_LAYER)
852 /*
853 * Data packet recived from Protocol Layer. Process it and send.
854 */
855 sig_dti_prx_data_received_ind(dti_data_ind);
856 else
857 /*
858 * Data packet recived from Peer Layer. Process it and send.
859 */
860 sig_dti_frx_data_received_ind (dti_data_ind);
861 break;
862
863 case DTI_REASON_TX_BUFFER_FULL:
864 if(inter_face EQ PROT_LAYER)
865 /*
866 * Buffer full for sending data to Protocol Layer.
867 */
868 sig_dti_ptx_tx_buffer_full_ind();
869 else
870 /*
871 * Buffer full for sending data to Peer Layer.
872 */
873 sig_dti_ftx_tx_buffer_full_ind ();
874 break;
875
876 case DTI_REASON_TX_BUFFER_READY:
877 if(inter_face EQ PROT_LAYER)
878 /*
879 * Buffer ready Protocol Layer.
880 */
881 sig_dti_ptx_tx_buffer_ready_ind();
882 else
883 /*
884 * Buffer ready Peer Layer.
885 */
886 sig_dti_ftx_tx_buffer_ready_ind();
887 break;
888
889 default:
890 TRACE_ERROR("Pointer to no DTI database");
891 break;
892 } /* end switch */
893 } /* end if */
894 else
895 {
896 TRACE_ERROR("Pointer to DTILIB database non existing");
897 }
898 } /* sig_callback() */
899
900 /*
901 +------------------------------------------------------------------------------
902 | Function : sig_any_dti_data_ind
903 +------------------------------------------------------------------------------
904 | Description : This function sends a Data Primitive
905 |
906 | Parameters : *hDTI - Ptr. to DTI Databank
907 | *dti_data_ind - Ptr. to Primitive which shall be sended
908 | instance - DTI instance
909 | interface - DTI interface
910 | channel - DTI channel
911 |
912 +------------------------------------------------------------------------------
913 */
914
915 GLOBAL void sig_any_dti_data_ind (
916 DTI_HANDLE hDTI,
917 T_DTI2_DATA_IND *dti_data_ind,
918 UBYTE instance,
919 UBYTE inter_face,
920 UBYTE channel,
921 UBYTE p_id
922 )
923 {
924 T_desc2* temp_desc;
925
926 TRACE_FUNCTION ("sig_any_dti_data_ind()");
927
928 dti_data_ind->parameters.p_id = p_id;
929 dti_data_ind->parameters.st_lines.st_flow = DTI_FLOW_ON;
930 dti_data_ind->parameters.st_lines.st_line_sa = DTI_SA_ON;
931 dti_data_ind->parameters.st_lines.st_line_sb = DTI_SB_ON;
932 dti_data_ind->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
933
934 /*
935 * This PPP does not support handle of offset in the descriptor.
936 * Offset is set to 0 and size to len.
937 */
938 temp_desc = (T_desc2*)dti_data_ind->desc_list2.first;
939 while(temp_desc)
940 {
941 temp_desc->offset = 0;
942 temp_desc->size = temp_desc->len;
943 temp_desc = (T_desc2*)temp_desc->next;
944 }
945
946 dti_send_data(hDTI, instance, inter_face, channel, dti_data_ind);
947 } /* sig_any_dti_data_ind () */
948
949
950 /*
951 +------------------------------------------------------------------------------
952 | Function : pei_dti_dti_connect_req
953 +------------------------------------------------------------------------------
954 | Description : Helpfunction to activate dti_dti_connect_req
955 |
956 | Parameters : Ptr. to primitive
957 |
958 +------------------------------------------------------------------------------
959 */
960
961 GLOBAL void pei_dti_dti_connect_req (
962 T_DTI2_CONNECT_REQ *dti_connect_req
963 )
964 {
965 dti_dti_connect_req (ppp_data->ppphDTI, dti_connect_req);
966 }
967
968
969 /*
970 +------------------------------------------------------------------------------
971 | Function : pei_dti_dti_disconnect_ind
972 +------------------------------------------------------------------------------
973 | Description : Helpfunction to activate dti_dti_disconnect_ind
974 |
975 | Parameters : Ptr. to primitive
976 |
977 +------------------------------------------------------------------------------
978 */
979
980 GLOBAL void pei_dti_dti_disconnect_ind (
981 T_DTI2_DISCONNECT_IND *dti_disconnect_ind
982 )
983 {
984 dti_dti_disconnect_ind (ppp_data->ppphDTI, dti_disconnect_ind);
985 }
986
987 /*
988 +------------------------------------------------------------------------------
989 | Function : pei_dti_dti_connect_cnf
990 +------------------------------------------------------------------------------
991 | Description : Helpfunction to activate dti_dti_connect_cnf
992 |
993 | Parameters : Ptr. to primitive
994 |
995 +------------------------------------------------------------------------------
996 */
997
998 GLOBAL void pei_dti_dti_connect_cnf (
999 T_DTI2_CONNECT_CNF *dti_connect_cnf
1000 )
1001 {
1002 dti_dti_connect_cnf(ppp_data->ppphDTI, dti_connect_cnf);
1003 }
1004
1005
1006 /*
1007 +------------------------------------------------------------------------------
1008 | Function : pei_dti_dti_connect_ind
1009 +------------------------------------------------------------------------------
1010 | Description : Helpfunction to activate dti_dti_connect_ind
1011 |
1012 | Parameters : Ptr. to primitive
1013 |
1014 +------------------------------------------------------------------------------
1015 */
1016
1017 GLOBAL void pei_dti_dti_connect_ind (
1018 T_DTI2_CONNECT_IND *dti_connect_ind
1019 )
1020 {
1021 dti_dti_connect_ind(ppp_data->ppphDTI, dti_connect_ind);
1022 }
1023
1024
1025 /*
1026 +------------------------------------------------------------------------------
1027 | Function : pei_dti_dti_connect_res
1028 +------------------------------------------------------------------------------
1029 | Description : Helpfunction to activate dti_dti_connect_res
1030 |
1031 | Parameters : Ptr. to primitive
1032 |
1033 +------------------------------------------------------------------------------
1034 */
1035
1036 GLOBAL void pei_dti_dti_connect_res (
1037 T_DTI2_CONNECT_RES *dti_connect_res
1038 )
1039 {
1040 dti_dti_connect_res(ppp_data->ppphDTI, dti_connect_res);
1041 }
1042
1043 /*
1044 +------------------------------------------------------------------------------
1045 | Function : pei_dti_dti_disconnect_req
1046 +------------------------------------------------------------------------------
1047 | Description : Helpfunction to activate dti_dti_disconnect_req
1048 |
1049 | Parameters : Ptr. to primitive
1050 |
1051 +------------------------------------------------------------------------------
1052 */
1053
1054 GLOBAL void pei_dti_dti_disconnect_req (
1055 T_DTI2_DISCONNECT_REQ *dti_disconnect_req
1056 )
1057 {
1058 dti_dti_disconnect_req (ppp_data->ppphDTI, dti_disconnect_req);
1059 }
1060
1061
1062 /*
1063 +------------------------------------------------------------------------------
1064 | Function : pei_dti_dti_ready_ind
1065 +------------------------------------------------------------------------------
1066 | Description : Helpfunction to activate dti_dti_ready_ind
1067 |
1068 | Parameters : Ptr. to primitive
1069 |
1070 +------------------------------------------------------------------------------
1071 */
1072
1073 GLOBAL void pei_dti_dti_ready_ind (
1074 T_DTI2_READY_IND *dti_ready_ind
1075 )
1076 {
1077 dti_dti_ready_ind (ppp_data->ppphDTI, dti_ready_ind);
1078 }
1079
1080 /*
1081 +------------------------------------------------------------------------------
1082 | Function : pei_dti_dti_data_req
1083 +------------------------------------------------------------------------------
1084 | Description : Helpfunction to activate dti_dti_data_req
1085 |
1086 | Parameters : Ptr. to primitive
1087 |
1088 +------------------------------------------------------------------------------
1089 */
1090
1091 GLOBAL void pei_dti_dti_data_req (
1092 T_DTI2_DATA_REQ *dti_data_req
1093 )
1094 {
1095 dti_dti_data_req (ppp_data->ppphDTI, dti_data_req);
1096 }
1097
1098 /*
1099 +------------------------------------------------------------------------------
1100 | Function : pei_dti_dti_data_ind
1101 +------------------------------------------------------------------------------
1102 | Description : Helpfunction to activate dti_dti_data_ind
1103 |
1104 | Parameters : Ptr. to primitive
1105 |
1106 +------------------------------------------------------------------------------
1107 */
1108
1109 GLOBAL void pei_dti_dti_data_ind (
1110 T_DTI2_DATA_IND *dti_data_ind
1111 )
1112 {
1113 dti_dti_data_ind (ppp_data->ppphDTI, dti_data_ind);
1114 }
1115
1116 /*
1117 +------------------------------------------------------------------------------
1118 | Function : pei_dti_dti_getdata_req
1119 +------------------------------------------------------------------------------
1120 | Description : Helpfunction to activate dti_dti_getdata_req
1121 |
1122 | Parameters : Ptr. to primitive
1123 |
1124 +------------------------------------------------------------------------------
1125 */
1126
1127 GLOBAL void pei_dti_dti_getdata_req (
1128 T_DTI2_GETDATA_REQ *dti_getdata_req
1129 )
1130 {
1131 dti_dti_getdata_req (ppp_data->ppphDTI, dti_getdata_req);
1132 }
1133
1134 /*==== Start functions only use with Windows ===============================*/
1135
1136 #if defined (_SIMULATION_)
1137
1138 /*
1139 +------------------------------------------------------------------------------
1140 | Function : pei_dti_dti_data_test_req
1141 +------------------------------------------------------------------------------
1142 | Description : Helpfunction to activate dti_dti_data_test_req
1143 |
1144 | Parameters : Ptr. to primitive
1145 |
1146 +------------------------------------------------------------------------------
1147 */
1148
1149 GLOBAL void pei_dti_dti_data_test_req (
1150 T_DTI2_DATA_TEST_REQ *dti_data_test_req
1151 )
1152 {
1153 dti_dti_data_test_req (ppp_data->ppphDTI, dti_data_test_req);
1154 }
1155
1156 /*
1157 +------------------------------------------------------------------------------
1158 | Function : pei_dti_dti_data_test_ind
1159 +------------------------------------------------------------------------------
1160 | Description : Helpfunction to activate dti_dti_data_test_req
1161 |
1162 | Parameters : Ptr. to primitive
1163 |
1164 +------------------------------------------------------------------------------
1165 */
1166
1167 GLOBAL void pei_dti_dti_data_test_ind (
1168 T_DTI2_DATA_TEST_IND *dti_data_test_ind
1169 )
1170 {
1171 dti_dti_data_test_ind (ppp_data->ppphDTI, dti_data_test_ind);
1172 }
1173
1174 #endif /* _SIMULATION_) */
1175
1176 /*==== END OF FILE =========================================================*/