STM32F7 Ethernet interface for nucleo STM32F767

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 LWIP_PPPAPI_H
00029 #define LWIP_PPPAPI_H
00030 
00031 #include "netif/ppp/ppp_opts.h"
00032 
00033 #if LWIP_PPP_API /* don't build if not configured for use in lwipopts.h */
00034 
00035 #include "lwip/sys.h"
00036 #include "lwip/netif.h"
00037 #include "lwip/priv/tcpip_priv.h"
00038 #include "netif/ppp/ppp.h"
00039 #if PPPOS_SUPPORT
00040 #include "netif/ppp/pppos.h"
00041 #endif /* PPPOS_SUPPORT */
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 struct pppapi_msg_msg {
00048   ppp_pcb *ppp;
00049   union {
00050 #if PPP_NOTIFY_PHASE
00051     struct {
00052       ppp_notify_phase_cb_fn notify_phase_cb;
00053     } setnotifyphasecb;
00054 #endif /* PPP_NOTIFY_PHASE */
00055 #if PPPOS_SUPPORT
00056     struct {
00057       struct netif *pppif;
00058       pppos_output_cb_fn output_cb;
00059       ppp_link_status_cb_fn link_status_cb;
00060       void *ctx_cb;
00061     } serialcreate;
00062 #endif /* PPPOS_SUPPORT */
00063 #if PPPOE_SUPPORT
00064     struct {
00065       struct netif *pppif;
00066       struct netif *ethif;
00067       const char *service_name;
00068       const char *concentrator_name;
00069       ppp_link_status_cb_fn link_status_cb;
00070       void *ctx_cb;
00071     } ethernetcreate;
00072 #endif /* PPPOE_SUPPORT */
00073 #if PPPOL2TP_SUPPORT
00074     struct {
00075       struct netif *pppif;
00076       struct netif *netif;
00077       API_MSG_M_DEF_C(ip_addr_t, ipaddr);
00078       u16_t port;
00079 #if PPPOL2TP_AUTH_SUPPORT
00080       const u8_t *secret;
00081       u8_t secret_len;
00082 #endif /* PPPOL2TP_AUTH_SUPPORT */
00083       ppp_link_status_cb_fn link_status_cb;
00084       void *ctx_cb;
00085     } l2tpcreate;
00086 #endif /* PPPOL2TP_SUPPORT */
00087     struct {
00088       u16_t holdoff;
00089     } connect;
00090     struct {
00091       u8_t nocarrier;
00092     } close;
00093     struct {
00094       u8_t cmd;
00095       void *arg;
00096     } ioctl;
00097   } msg;
00098 };
00099 
00100 struct pppapi_msg {
00101   struct tcpip_api_call_data call;
00102   struct pppapi_msg_msg msg;
00103 };
00104 
00105 /* API for application */
00106 err_t pppapi_set_default(ppp_pcb *pcb);
00107 #if PPP_NOTIFY_PHASE
00108 err_t pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
00109 #endif /* PPP_NOTIFY_PHASE */
00110 #if PPPOS_SUPPORT
00111 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);
00112 #endif /* PPPOS_SUPPORT */
00113 #if PPPOE_SUPPORT
00114 ppp_pcb *pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *service_name,
00115                                 const char *concentrator_name, ppp_link_status_cb_fn link_status_cb,
00116                                 void *ctx_cb);
00117 #endif /* PPPOE_SUPPORT */
00118 #if PPPOL2TP_SUPPORT
00119 ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
00120                             const u8_t *secret, u8_t secret_len,
00121                             ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
00122 #endif /* PPPOL2TP_SUPPORT */
00123 err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
00124 #if PPP_SERVER
00125 err_t pppapi_listen(ppp_pcb *pcb);
00126 #endif /* PPP_SERVER */
00127 err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
00128 err_t pppapi_free(ppp_pcb *pcb);
00129 err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
00130 
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134 
00135 #endif /* LWIP_PPP_API */
00136 
00137 #endif /* LWIP_PPPAPI_H */