PPP, removed low level create functions from PPP core

ppp_over_ethernet_create() moved from ppp.c to pppoe.c
ppp_over_l2tp_create() moved from ppp.c to pppol2tp.c
This commit is contained in:
Sylvain Rochet 2015-02-15 11:15:07 +01:00
parent 0afc34f6fc
commit ee85aaccd2
7 changed files with 23 additions and 49 deletions

View File

@ -37,6 +37,8 @@
#include "lwip/pppapi.h"
#include "lwip/tcpip.h"
#include "netif/ppp/pppoe.h"
#include "netif/ppp/pppol2tp.h"
/**
* Call ppp_set_default() inside the tcpip_thread context.

View File

@ -491,25 +491,6 @@ struct ppp_pcb_s {
ppp_pcb *ppp_over_serial_create(struct netif *pppif, sio_fd_t fd, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOS_SUPPORT */
#if PPPOE_SUPPORT
/*
* Create a new PPP Over Ethernet (PPPoE) connection.
*
* Return 0 on success, an error code on failure.
*/
ppp_pcb *ppp_over_ethernet_create(struct netif *pppif, struct netif *ethif, const char *service_name, const char *concentrator_name,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOE_SUPPORT */
#if PPPOL2TP_SUPPORT
/*
* Create a new PPP Over L2TP (PPPoL2TP) connection.
*/
ppp_pcb *ppp_over_l2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOL2TP_SUPPORT */
/*
* Set auth helper, optional, you can either fill ppp_pcb->settings.
*

View File

@ -162,9 +162,10 @@ struct pppoe_softc {
#define pppoe_init() /* compatibility define, no initialization needed */
ppp_pcb *pppoe_create(struct netif *pppif,
struct netif *ethif,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
ppp_pcb *ppp_over_ethernet_create(struct netif *pppif,
struct netif *ethif,
const char *service_name, const char *concentrator_name,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
void pppoe_disc_input(struct netif *netif, struct pbuf *p);
void pppoe_data_input(struct netif *netif, struct pbuf *p);

View File

@ -192,9 +192,9 @@ struct pppol2tp_pcb_s {
/* Create a new L2TP session. */
ppp_pcb *pppol2tp_create(struct netif *pppif,
struct netif *netif, ip_addr_t *ipaddr, u16_t port, u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
ppp_pcb *ppp_over_l2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
#endif /* PPPOL2TP_H_ */
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */

View File

@ -246,23 +246,6 @@ void ppp_set_xaccm(ppp_pcb *pcb, ext_accm *accm) {
}
#endif /* PPPOS_SUPPORT */
#if PPPOE_SUPPORT
ppp_pcb *ppp_over_ethernet_create(struct netif *pppif, struct netif *ethif, const char *service_name, const char *concentrator_name,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
LWIP_UNUSED_ARG(service_name);
LWIP_UNUSED_ARG(concentrator_name);
return pppoe_create(pppif, ethif, link_status_cb, ctx_cb);
}
#endif /* PPPOE_SUPPORT */
#if PPPOL2TP_SUPPORT
ppp_pcb *ppp_over_l2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
return pppol2tp_create(pppif, netif, ipaddr, port, secret, secret_len, link_status_cb, ctx_cb);
}
#endif /* PPPOL2TP_SUPPORT */
void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd) {
#if PAP_SUPPORT

View File

@ -146,13 +146,20 @@ static struct pppoe_softc* pppoe_find_softc_by_hunique(u8_t *token, size_t len,
/** linked list of created pppoe interfaces */
static struct pppoe_softc *pppoe_softc_list;
ppp_pcb*
pppoe_create(struct netif *pppif,
struct netif *ethif,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb)
/*
* Create a new PPP Over Ethernet (PPPoE) connection.
*
* Return 0 on success, an error code on failure.
*/
ppp_pcb *ppp_over_ethernet_create(struct netif *pppif,
struct netif *ethif,
const char *service_name, const char *concentrator_name,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb)
{
ppp_pcb *ppp;
struct pppoe_softc *sc;
LWIP_UNUSED_ARG(service_name);
LWIP_UNUSED_ARG(concentrator_name);
ppp = ppp_new(pppif, link_status_cb, ctx_cb);
if (ppp == NULL) {

View File

@ -97,9 +97,9 @@ static err_t pppol2tp_xmit(pppol2tp_pcb *l2tp, struct pbuf *pb);
/* Create a new L2TP session. */
ppp_pcb *pppol2tp_create(struct netif *pppif,
struct netif *netif, ip_addr_t *ipaddr, u16_t port, u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
ppp_pcb *ppp_over_l2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port,
u8_t *secret, u8_t secret_len,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
ppp_pcb *ppp;
pppol2tp_pcb *l2tp;
struct udp_pcb *udp;