Mbed OS Reference
Loading...
Searching...
No Matches
pppapi.h
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 PPPAPI_H
29#define PPPAPI_H
30
31#include "ppp_opts.h"
32
33#if PPP_API
34
35#if PPP_SUPPORT /* don't build if not configured for use in ppp_opts.h */
36
37#include "ppp.h"
38#if PPPOS_SUPPORT
39#include "pppos.h"
40#endif /* PPPOS_SUPPORT */
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46struct pppapi_msg_msg {
47 ppp_pcb *ppp;
48 union {
49#if PPP_NOTIFY_PHASE
50 struct {
51 ppp_notify_phase_cb_fn notify_phase_cb;
52 } setnotifyphasecb;
53#endif /* PPP_NOTIFY_PHASE */
54#if PPPOS_SUPPORT
55 struct {
56 struct netif *pppif;
57 pppos_output_cb_fn output_cb;
58 ppp_link_status_cb_fn link_status_cb;
59 void *ctx_cb;
60 } serialcreate;
61#endif /* PPPOS_SUPPORT */
62#if PPPOE_SUPPORT
63 struct {
64 struct netif *pppif;
65 struct netif *ethif;
66 const char *service_name;
67 const char *concentrator_name;
68 ppp_link_status_cb_fn link_status_cb;
69 void *ctx_cb;
70 } ethernetcreate;
71#endif /* PPPOE_SUPPORT */
72#if PPPOL2TP_SUPPORT
73 struct {
74 struct netif *pppif;
75 struct netif *netif;
76 API_MSG_M_DEF_C(ip_addr_t, ipaddr);
77 u16_t port;
78#if PPPOL2TP_AUTH_SUPPORT
79 const u8_t *secret;
80 u8_t secret_len;
81#endif /* PPPOL2TP_AUTH_SUPPORT */
82 ppp_link_status_cb_fn link_status_cb;
83 void *ctx_cb;
84 } l2tpcreate;
85#endif /* PPPOL2TP_SUPPORT */
86 struct {
87 u16_t holdoff;
88 } connect;
89 struct {
90 u8_t nocarrier;
91 } close;
92 struct {
93 u8_t cmd;
94 void *arg;
95 } ioctl;
96 } msg;
97};
98
99struct pppapi_msg {
100 struct tcpip_api_call_data call;
101 struct pppapi_msg_msg msg;
102};
103
104/* API for application */
105err_t pppapi_set_default(ppp_pcb *pcb);
106#if PPP_NOTIFY_PHASE
107err_t pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
108#endif /* PPP_NOTIFY_PHASE */
109#if PPPOS_SUPPORT
110ppp_pcb *pppapi_pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
111#endif /* PPPOS_SUPPORT */
112#if PPPOE_SUPPORT
113ppp_pcb *pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *service_name,
114 const char *concentrator_name, ppp_link_status_cb_fn link_status_cb,
115 void *ctx_cb);
116#endif /* PPPOE_SUPPORT */
117#if PPPOL2TP_SUPPORT
118ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
119 const u8_t *secret, u8_t secret_len,
120 ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
121#endif /* PPPOL2TP_SUPPORT */
122err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
123#if PPP_SERVER
124err_t pppapi_listen(ppp_pcb *pcb);
125#endif /* PPP_SERVER */
126err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
127err_t pppapi_free(ppp_pcb *pcb);
128err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* PPP_SUPPORT */
135
136#endif /* PPP_API */
137
138#endif /* PPPAPI_H */
Network Point to Point Protocol over Serial header file.
IP address structure for passing IP addresses by value.
Definition: nsapi_types.h:247