improved PPP API, added ppp_reopen()

This is now the user choice to re-establish the session in the link status callback
by either calling the ppp_reopen() to re-establish or ppp_delete() to free the PPP
control block. Without user intervention, the PPP control block now stay in the dead
phase, allowing the user to re-establish or delete the control block later.
This commit is contained in:
Sylvain Rochet
2012-07-22 20:53:54 +02:00
parent a467d21eba
commit 3c122117fc
8 changed files with 218 additions and 178 deletions

View File

@@ -205,6 +205,27 @@ int pppapi_over_l2tp_open(ppp_pcb *pcb, struct netif *netif, ip_addr_t *ipaddr,
#endif /* PPPOL2TP_SUPPORT */
/**
* Call ppp_reopen() inside the tcpip_thread context.
*/
static void pppapi_do_ppp_reopen(struct pppapi_msg_msg *msg) {
ppp_reopen(msg->ppp, msg->msg.reopen.holdoff);
TCPIP_PPPAPI_ACK(msg);
}
/**
* Call ppp_reopen() in a thread-safe way by running that function inside the
* tcpip_thread context.
*/
void pppapi_reopen(ppp_pcb *pcb, u16_t holdoff) {
struct pppapi_msg msg;
msg.function = pppapi_do_ppp_reopen;
msg.msg.ppp = pcb;
msg.msg.msg.reopen.holdoff = holdoff;
TCPIP_PPPAPI(&msg);
}
/**
* Call ppp_close() inside the tcpip_thread context.
*/