PPP: moved ppp_new() to low level protocol init for PPPoE and PPPoL2TP

First step of a rework of how low level protocols are using the
PPP core. Low level protocols are now going to use the core instead
of core using the low level protocols.

Final goal: separate PPP core code from low level protocols.
This commit is contained in:
Sylvain Rochet
2015-02-14 23:50:38 +01:00
parent 443b2551c7
commit 74fd2dc9ad
7 changed files with 53 additions and 57 deletions

View File

@@ -179,6 +179,9 @@ typedef unsigned char u_char;
#include "vj.h"
#endif /* VJ_SUPPORT */
/* Link status callback function prototype */
typedef void (*ppp_link_status_cb_fn)(ppp_pcb *pcb, int err_code, void *ctx);
#if PPPOE_SUPPORT
#include "netif/ppp/pppoe.h"
#endif /* PPPOE_SUPPORT */
@@ -504,9 +507,6 @@ struct ppp_pcb_s {
#define PPPAUTHTYPE_EAP 0x08
#define PPPAUTHTYPE_ANY 0xff
/* Link status callback function prototype */
typedef void (*ppp_link_status_cb_fn)(ppp_pcb *pcb, int err_code, void *ctx);
#if PPPOS_SUPPORT
/*
* Create a new PPP connection using the given serial I/O device.

View File

@@ -362,8 +362,11 @@ struct pppd_stats {
#endif /* PPP_STATS_SUPPORT */
/* PPP flow functions
/* PPP functions
*/
/* Create a new PPP control block */
ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
/* initialize the PPP subsystem */
int ppp_init(void);

View File

@@ -167,7 +167,10 @@ struct pppoe_softc {
#define pppoe_init() /* compatibility define, no initialization needed */
err_t pppoe_create(struct netif *ethif, ppp_pcb *pcb, void (*link_status_cb)(ppp_pcb *pcb, int up), struct pppoe_softc **scptr);
ppp_pcb *pppoe_create(struct netif *pppif,
void (*link_status_cb_ll)(ppp_pcb *pcb, int up),
struct netif *ethif,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
err_t pppoe_destroy(struct pppoe_softc *sc);
int pppoe_connect(struct pppoe_softc *sc);

View File

@@ -197,9 +197,10 @@ struct pppol2tp_pcb_s {
/* Create a new L2TP session. */
err_t pppol2tp_create(ppp_pcb *ppp, void (*link_status_cb)(ppp_pcb *pcb, int status), pppol2tp_pcb **l2tpptr,
struct netif *netif, ip_addr_t *ipaddr, u16_t port,
u8_t *secret, u8_t secret_len);
ppp_pcb *pppol2tp_create(struct netif *pppif,
void (*link_status_cb_ll)(ppp_pcb *pcb, int status),
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);
/* Destroy a L2TP control block */
err_t pppol2tp_destroy(pppol2tp_pcb *l2tp);