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