STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
pppapi.h
Go to the documentation of this file.
1 /*
2  * Redistribution and use in source and binary forms, with or without modification,
3  * are permitted provided that the following conditions are met:
4  *
5  * 1. Redistributions of source code must retain the above copyright notice,
6  * this list of conditions and the following disclaimer.
7  * 2. Redistributions in binary form must reproduce the above copyright notice,
8  * this list of conditions and the following disclaimer in the documentation
9  * and/or other materials provided with the distribution.
10  * 3. The name of the author may not be used to endorse or promote products
11  * derived from this software without specific prior written permission.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
14  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
16  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
17  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
18  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
21  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
22  * OF SUCH DAMAGE.
23  *
24  * This file is part of the lwIP TCP/IP stack.
25  *
26  */
27 
28 #ifndef __LWIP_PPPAPI_H__
29 #define __LWIP_PPPAPI_H__
30 
31 #include "lwip/opt.h"
32 
33 #if LWIP_PPP_API /* don't build if not configured for use in lwipopts.h */
34 
35 #include "lwip/sys.h"
36 #include "lwip/netif.h"
37 #include "netif/ppp/ppp.h"
38 #if PPPOS_SUPPORT
39 #include "netif/ppp/pppos.h"
40 #endif /* PPPOS_SUPPORT */
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 struct pppapi_msg_msg {
47 #if !LWIP_TCPIP_CORE_LOCKING
48  sys_sem_t sem;
49 #endif /* !LWIP_TCPIP_CORE_LOCKING */
50  err_t err;
51  ppp_pcb *ppp;
52  union {
53  struct {
54  u8_t authtype;
55  const char *user;
56  const char *passwd;
57  } setauth;
58 #if PPP_NOTIFY_PHASE
59  struct {
60  ppp_notify_phase_cb_fn notify_phase_cb;
61  } setnotifyphasecb;
62 #endif /* PPP_NOTIFY_PHASE */
63 #if PPPOS_SUPPORT
64  struct {
65  struct netif *pppif;
66  pppos_output_cb_fn output_cb;
67  ppp_link_status_cb_fn link_status_cb;
68  void *ctx_cb;
69  } serialcreate;
70 #endif /* PPPOS_SUPPORT */
71 #if PPPOE_SUPPORT
72  struct {
73  struct netif *pppif;
74  struct netif *ethif;
75  const char *service_name;
76  const char *concentrator_name;
77  ppp_link_status_cb_fn link_status_cb;
78  void *ctx_cb;
79  } ethernetcreate;
80 #endif /* PPPOE_SUPPORT */
81 #if PPPOL2TP_SUPPORT
82  struct {
83  struct netif *pppif;
84  struct netif *netif;
85  ip_addr_t *ipaddr;
86  u16_t port;
87 #if PPPOL2TP_AUTH_SUPPORT
88  const u8_t *secret;
89  u8_t secret_len;
90 #endif /* PPPOL2TP_AUTH_SUPPORT */
91  ppp_link_status_cb_fn link_status_cb;
92  void *ctx_cb;
93  } l2tpcreate;
94 #endif /* PPPOL2TP_SUPPORT */
95  struct {
96  u16_t holdoff;
97  } connect;
98 #if PPP_SERVER
99  struct {
100  struct ppp_addrs *addrs;
101  } listen;
102 #endif /* PPP_SERVER */
103  struct {
104  u8_t nocarrier;
105  } close;
106  struct {
107  u8_t cmd;
108  void *arg;
109  } ioctl;
110  } msg;
111 };
112 
113 struct pppapi_msg {
114  void (* function)(struct pppapi_msg_msg *msg);
115  struct pppapi_msg_msg msg;
116 };
117 
118 /* API for application */
119 void pppapi_set_default(ppp_pcb *pcb);
120 void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
121 #if PPP_NOTIFY_PHASE
122 void pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
123 #endif /* PPP_NOTIFY_PHASE */
124 #if PPPOS_SUPPORT
125 ppp_pcb *pppapi_pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
126 #endif /* PPPOS_SUPPORT */
127 #if PPPOE_SUPPORT
128 ppp_pcb *pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *service_name,
129  const char *concentrator_name, ppp_link_status_cb_fn link_status_cb,
130  void *ctx_cb);
131 #endif /* PPPOE_SUPPORT */
132 #if PPPOL2TP_SUPPORT
133 ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
134  const u8_t *secret, u8_t secret_len,
135  ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
136 #endif /* PPPOL2TP_SUPPORT */
137 err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
138 #if PPP_SERVER
139 err_t pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
140 #endif /* PPP_SERVER */
141 err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
142 err_t pppapi_free(ppp_pcb *pcb);
143 err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* LWIP_PPP_API */
150 
151 #endif /* __LWIP_PPPAPI_H__ */
152 
s8_t err_t
Definition: err.h:47
osSemaphoreId sys_sem_t
Definition: sys_arch.h:44
Definition: netif.h:182
unsigned char u8_t
Definition: cc.h:38
ip6_addr_t ip_addr_t
Definition: ip_addr.h:194
unsigned short u16_t
Definition: cc.h:40