mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 09:19:53 +00:00
PPP, merged ppp_link_set_callbacks() into ppp_new()
This commit is contained in:
parent
46204a9f86
commit
c15b357889
@ -387,10 +387,8 @@ 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 functions */
|
||||
void ppp_link_set_callbacks(ppp_pcb *pcb, const struct link_callbacks *callbacks, void *ctx);
|
||||
ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, void *link_ctx_cb,
|
||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||
|
||||
/* Set a PPP PCB to its initial state */
|
||||
void ppp_clear(ppp_pcb *pcb);
|
||||
|
@ -567,7 +567,7 @@ int ppp_init(void) {
|
||||
* Return a new PPP connection control block pointer
|
||||
* on success or a null pointer on failure.
|
||||
*/
|
||||
ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
|
||||
ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, void *link_ctx_cb, ppp_link_status_cb_fn link_status_cb, void *ctx_cb) {
|
||||
ppp_pcb *pcb;
|
||||
|
||||
/* PPP is single-threaded: without a callback,
|
||||
@ -637,17 +637,14 @@ ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pcb->link_cb = callbacks;
|
||||
pcb->link_ctx_cb = link_ctx_cb;
|
||||
pcb->link_status_cb = link_status_cb;
|
||||
pcb->ctx_cb = ctx_cb;
|
||||
new_phase(pcb, PPP_PHASE_DEAD);
|
||||
return pcb;
|
||||
}
|
||||
|
||||
void ppp_link_set_callbacks(ppp_pcb *pcb, const struct link_callbacks *callbacks, void *ctx) {
|
||||
pcb->link_cb = callbacks;
|
||||
pcb->link_ctx_cb = ctx;
|
||||
}
|
||||
|
||||
/* Set a PPP PCB to its initial state */
|
||||
void ppp_clear(ppp_pcb *pcb) {
|
||||
const struct protent *protp;
|
||||
|
@ -179,12 +179,11 @@ ppp_pcb *pppoe_create(struct netif *pppif,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ppp = ppp_new(pppif, link_status_cb, ctx_cb);
|
||||
ppp = ppp_new(pppif, &pppoe_callbacks, sc, link_status_cb, ctx_cb);
|
||||
if (ppp == NULL) {
|
||||
memp_free(MEMP_PPPOE_IF, sc);
|
||||
return NULL;
|
||||
}
|
||||
ppp_link_set_callbacks(ppp, &pppoe_callbacks, sc);
|
||||
|
||||
memset(sc, 0, sizeof(struct pppoe_softc));
|
||||
/* changed to real address later */
|
||||
|
@ -129,11 +129,10 @@ ppp_pcb *pppol2tp_create(struct netif *pppif,
|
||||
goto memp_malloc_l2tp_failed;
|
||||
}
|
||||
|
||||
ppp = ppp_new(pppif, link_status_cb, ctx_cb);
|
||||
ppp = ppp_new(pppif, &pppol2tp_callbacks, l2tp, link_status_cb, ctx_cb);
|
||||
if (ppp == NULL) {
|
||||
goto ppp_new_failed;
|
||||
}
|
||||
ppp_link_set_callbacks(ppp, &pppol2tp_callbacks, l2tp);
|
||||
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6_VAL(*ipaddr)) {
|
||||
|
@ -178,12 +178,11 @@ ppp_pcb *pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ppp = ppp_new(pppif, link_status_cb, ctx_cb);
|
||||
ppp = ppp_new(pppif, &pppos_callbacks, pppos, link_status_cb, ctx_cb);
|
||||
if (ppp == NULL) {
|
||||
memp_free(MEMP_PPPOS_PCB, pppos);
|
||||
return NULL;
|
||||
}
|
||||
ppp_link_set_callbacks(ppp, &pppos_callbacks, pppos);
|
||||
|
||||
pppos->ppp = ppp;
|
||||
pppos->output_cb = output_cb;
|
||||
|
Loading…
Reference in New Issue
Block a user