Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pppapi.h Source File

pppapi.h

00001 /*
00002  * Redistribution and use in source and binary forms, with or without modification,
00003  * are permitted provided that the following conditions are met:
00004  *
00005  * 1. Redistributions of source code must retain the above copyright notice,
00006  *    this list of conditions and the following disclaimer.
00007  * 2. Redistributions in binary form must reproduce the above copyright notice,
00008  *    this list of conditions and the following disclaimer in the documentation
00009  *    and/or other materials provided with the distribution.
00010  * 3. The name of the author may not be used to endorse or promote products
00011  *    derived from this software without specific prior written permission.
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00014  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00015  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00016  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00017  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00018  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00019  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00020  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00021  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00022  * OF SUCH DAMAGE.
00023  *
00024  * This file is part of the lwIP TCP/IP stack.
00025  *
00026  */
00027 
00028 #ifndef PPPAPI_H
00029 #define PPPAPI_H
00030 
00031 #include "ppp_opts.h"
00032 
00033 #if PPP_API
00034 
00035 #if PPP_SUPPORT /* don't build if not configured for use in ppp_opts.h */
00036 
00037 #include "ppp.h"
00038 #if PPPOS_SUPPORT
00039 #include "pppos.h"
00040 #endif /* PPPOS_SUPPORT */
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 struct pppapi_msg_msg {
00047   ppp_pcb *ppp;
00048   union {
00049 #if PPP_NOTIFY_PHASE
00050     struct {
00051       ppp_notify_phase_cb_fn notify_phase_cb;
00052     } setnotifyphasecb;
00053 #endif /* PPP_NOTIFY_PHASE */
00054 #if PPPOS_SUPPORT
00055     struct {
00056       struct netif *pppif;
00057       pppos_output_cb_fn output_cb;
00058       ppp_link_status_cb_fn link_status_cb;
00059       void *ctx_cb;
00060     } serialcreate;
00061 #endif /* PPPOS_SUPPORT */
00062 #if PPPOE_SUPPORT
00063     struct {
00064       struct netif *pppif;
00065       struct netif *ethif;
00066       const char *service_name;
00067       const char *concentrator_name;
00068       ppp_link_status_cb_fn link_status_cb;
00069       void *ctx_cb;
00070     } ethernetcreate;
00071 #endif /* PPPOE_SUPPORT */
00072 #if PPPOL2TP_SUPPORT
00073     struct {
00074       struct netif *pppif;
00075       struct netif *netif;
00076       API_MSG_M_DEF_C(ip_addr_t, ipaddr);
00077       u16_t port;
00078 #if PPPOL2TP_AUTH_SUPPORT
00079       const u8_t *secret;
00080       u8_t secret_len;
00081 #endif /* PPPOL2TP_AUTH_SUPPORT */
00082       ppp_link_status_cb_fn link_status_cb;
00083       void *ctx_cb;
00084     } l2tpcreate;
00085 #endif /* PPPOL2TP_SUPPORT */
00086     struct {
00087       u16_t holdoff;
00088     } connect;
00089     struct {
00090       u8_t nocarrier;
00091     } close;
00092     struct {
00093       u8_t cmd;
00094       void *arg;
00095     } ioctl;
00096   } msg;
00097 };
00098 
00099 struct pppapi_msg {
00100   struct tcpip_api_call_data call;
00101   struct pppapi_msg_msg msg;
00102 };
00103 
00104 /* API for application */
00105 err_t pppapi_set_default(ppp_pcb *pcb);
00106 #if PPP_NOTIFY_PHASE
00107 err_t pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
00108 #endif /* PPP_NOTIFY_PHASE */
00109 #if PPPOS_SUPPORT
00110 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);
00111 #endif /* PPPOS_SUPPORT */
00112 #if PPPOE_SUPPORT
00113 ppp_pcb *pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *service_name,
00114                                 const char *concentrator_name, ppp_link_status_cb_fn link_status_cb,
00115                                 void *ctx_cb);
00116 #endif /* PPPOE_SUPPORT */
00117 #if PPPOL2TP_SUPPORT
00118 ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
00119                             const u8_t *secret, u8_t secret_len,
00120                             ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
00121 #endif /* PPPOL2TP_SUPPORT */
00122 err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
00123 #if PPP_SERVER
00124 err_t pppapi_listen(ppp_pcb *pcb);
00125 #endif /* PPP_SERVER */
00126 err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
00127 err_t pppapi_free(ppp_pcb *pcb);
00128 err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
00129 
00130 #ifdef __cplusplus
00131 }
00132 #endif
00133 
00134 #endif /* PPP_SUPPORT */
00135 
00136 #endif /* PPP_API */
00137 
00138 #endif /* PPPAPI_H */