sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
pppos.h
Go to the documentation of this file.
1
7
8/*
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * 3. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
23 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
25 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
29 * OF SUCH DAMAGE.
30 *
31 * This file is part of the lwIP TCP/IP stack.
32 *
33 */
34
35#include "netif/ppp/ppp_opts.h"
36#if PPP_SUPPORT && PPPOS_SUPPORT /* don't build if not configured for use in lwipopts.h */
37
38#ifndef PPPOS_H
39#define PPPOS_H
40
41#include "lwip/sys.h"
42
43#include "ppp.h"
44#include "vj.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50/* PPP packet parser states. Current state indicates operation yet to be
51 * completed. */
52enum {
53 PDIDLE = 0, /* Idle state - waiting. */
54 PDADDRESS, /* Process address field. */
55 PDCONTROL, /* Process control field. */
56 PDPROTOCOL1, /* Process protocol field 1. */
57 PDPROTOCOL2, /* Process protocol field 2. */
58 PDDATA /* Process data byte. */
59};
60
61/* PPPoS serial output callback function prototype */
62typedef u32_t (*pppos_output_cb_fn)(ppp_pcb *pcb, const void *data, u32_t len, void *ctx);
63
64/*
65 * Extended asyncmap - allows any character to be escaped.
66 */
67typedef u8_t ext_accm[32];
68
69/*
70 * PPPoS interface control block.
71 */
72typedef struct pppos_pcb_s pppos_pcb;
73struct pppos_pcb_s {
74 /* -- below are data that will NOT be cleared between two sessions */
75 ppp_pcb *ppp; /* PPP PCB */
76 pppos_output_cb_fn output_cb; /* PPP serial output callback */
77
78 /* -- below are data that will be cleared between two sessions
79 *
80 * last_xmit must be the first member of cleared members, because it is
81 * used to know which part must not be cleared.
82 */
83 u32_t last_xmit; /* Time of last transmission. */
84 ext_accm out_accm; /* Async-Ctl-Char-Map for output. */
85
86 /* flags */
87 unsigned int open :1; /* Set if PPPoS is open */
88 unsigned int pcomp :1; /* Does peer accept protocol compression? */
89 unsigned int accomp :1; /* Does peer accept addr/ctl compression? */
90
91 /* PPPoS rx */
92 ext_accm in_accm; /* Async-Ctl-Char-Map for input. */
93 struct pbuf *in_head, *in_tail; /* The input packet. */
94 u16_t in_protocol; /* The input protocol code. */
95 u16_t in_fcs; /* Input Frame Check Sequence value. */
96 u8_t in_state; /* The input process state. */
97 u8_t in_escaped; /* Escape next character. */
98};
99
100/* Create a new PPPoS session. */
101ppp_pcb *pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb,
102 ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
103
104#if !NO_SYS && !PPP_INPROC_IRQ_SAFE
105/* Pass received raw characters to PPPoS to be decoded through lwIP TCPIP thread. */
106err_t pppos_input_tcpip(ppp_pcb *ppp, const void *s, int l);
107#endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */
108
109/* PPP over Serial: this is the input function to be called for received data. */
110void pppos_input(ppp_pcb *ppp, const void* data, int len);
111
112
113/*
114 * Functions called from lwIP
115 * DO NOT CALL FROM lwIP USER APPLICATION.
116 */
117#if !NO_SYS && !PPP_INPROC_IRQ_SAFE
118err_t pppos_input_sys(struct pbuf *p, struct netif *inp);
119#endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif /* PPPOS_H */
126#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */
Definition tcpip.h:234
u16 len
Definition tcpip.h:251