Mistake on this page?
Report an issue in GitHub or email us
pppos.h
Go to the documentation of this file.
1 /**
2  * @file
3  * Network Point to Point Protocol over Serial header file.
4  *
5  */
6 
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 "ppp_opts.h"
35 #if PPP_SUPPORT && PPPOS_SUPPORT /* don't build if not configured for use in ppp_opts.h */
36 
37 #ifndef PPPOS_H
38 #define PPPOS_H
39 
40 #include "ppp.h"
41 #include "vj.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /* PPP packet parser states. Current state indicates operation yet to be
48  * completed. */
49 enum {
50  PDIDLE = 0, /* Idle state - waiting. */
51  PDSTART, /* Process start flag. */
52  PDADDRESS, /* Process address field. */
53  PDCONTROL, /* Process control field. */
54  PDPROTOCOL1, /* Process protocol field 1. */
55  PDPROTOCOL2, /* Process protocol field 2. */
56  PDDATA /* Process data byte. */
57 };
58 
59 /* PPPoS serial output callback function prototype */
60 typedef u32_t (*pppos_output_cb_fn)(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx);
61 
62 /*
63  * Extended asyncmap - allows any character to be escaped.
64  */
65 typedef u8_t ext_accm[32];
66 
67 /*
68  * PPPoS interface control block.
69  */
70 typedef struct pppos_pcb_s pppos_pcb;
71 struct pppos_pcb_s {
72  /* -- below are data that will NOT be cleared between two sessions */
73  ppp_pcb *ppp; /* PPP PCB */
74  pppos_output_cb_fn output_cb; /* PPP serial output callback */
75 
76  /* -- below are data that will be cleared between two sessions
77  *
78  * last_xmit must be the first member of cleared members, because it is
79  * used to know which part must not be cleared.
80  */
81  u32_t last_xmit; /* Time of last transmission. */
82  ext_accm out_accm; /* Async-Ctl-Char-Map for output. */
83 
84  /* flags */
85  unsigned int open :1; /* Set if PPPoS is open */
86  unsigned int pcomp :1; /* Does peer accept protocol compression? */
87  unsigned int accomp :1; /* Does peer accept addr/ctl compression? */
88 
89  /* PPPoS rx */
90  ext_accm in_accm; /* Async-Ctl-Char-Map for input. */
91  struct pbuf *in_head, *in_tail; /* The input packet. */
92  u16_t in_protocol; /* The input protocol code. */
93  u16_t in_fcs; /* Input Frame Check Sequence value. */
94  u8_t in_state; /* The input process state. */
95  u8_t in_escaped; /* Escape next character. */
96 };
97 
98 /* Create a new PPPoS session. */
99 ppp_pcb *pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb,
100  ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
101 
102 #if !NO_SYS && !PPP_INPROC_IRQ_SAFE
103 /* Pass received raw characters to PPPoS to be decoded through stacks TCPIP thread. */
104 err_t pppos_input_tcpip(ppp_pcb *ppp, u8_t *s, int l);
105 #endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */
106 
107 /* PPP over Serial: this is the input function to be called for received data. */
108 void pppos_input(ppp_pcb *ppp, u8_t* data, int len);
109 
110 
111 /*
112  * Functions called from stack
113  * DO NOT CALL FROM stacks USER APPLICATION.
114  */
115 #if !NO_SYS && !PPP_INPROC_IRQ_SAFE
116 err_t pppos_input_sys(struct pbuf *p, struct netif *inp);
117 #endif /* !NO_SYS && !PPP_INPROC_IRQ_SAFE */
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* PPPOS_H */
124 #endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */
Main packet buffer struct.
Generic data structure used for all lwIP network interfaces.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.