PPP: prepared callbacks from PPP core to low level protocols

New PPP callback from PPP core to low level protocols, first
step about removing named calls to low level protocols from PPP core.
This commit is contained in:
Sylvain Rochet
2015-02-15 10:18:02 +01:00
parent a5582e0960
commit f8501478f6
7 changed files with 80 additions and 25 deletions

View File

@@ -358,6 +358,7 @@ struct ppp_pcb_s {
#if PPPOS_SUPPORT
sio_fd_t fd; /* File device ID of port. */
#endif /* PPPOS_SUPPORT */
void (*link_command_cb)(void *pcb, u8_t command);
#if PPPOE_SUPPORT
struct pppoe_softc *pppoe_sc;
#endif /* PPPOE_SUPPORT */

View File

@@ -87,6 +87,16 @@
#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
/*
* Low-level links commands
*/
/* Start a connection (i.e. initiate discovery phase) */
#define PPP_LINK_COMMAND_CONNECT 0
/* End a connection (i.e. initiate disconnect phase) */
#define PPP_LINK_COMMAND_DISCONNECT 1
/* Free link connection */
#define PPP_LINK_COMMAND_FREE 2
/*
* Protocol field values.
*/
@@ -370,6 +380,9 @@ int ppp_init(void);
/* Create a new PPP control block */
ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
/* Set link callback function */
#define ppp_link_set_callback(ppp, cb) (ppp->link_command_cb = cb)
/* Initiate LCP open request */
void ppp_start(ppp_pcb *pcb);

View File

@@ -165,10 +165,6 @@ struct pppoe_softc {
ppp_pcb *pppoe_create(struct netif *pppif,
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);
void pppoe_disconnect(struct pppoe_softc *sc);
void pppoe_disc_input(struct netif *netif, struct pbuf *p);
void pppoe_data_input(struct netif *netif, struct pbuf *p);

View File

@@ -196,15 +196,6 @@ 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);
/* Destroy a L2TP control block */
err_t pppol2tp_destroy(pppol2tp_pcb *l2tp);
/* Be a LAC, connect to a LNS. */
err_t pppol2tp_connect(pppol2tp_pcb *l2tp);
/* Disconnect */
void pppol2tp_disconnect(pppol2tp_pcb *l2tp);
/* Data packet from PPP to L2TP */
err_t pppol2tp_xmit(pppol2tp_pcb *l2tp, struct pbuf *pb);