mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-02 21:02:10 +00:00
PPP, renamed ppp_open to ppp_connect
Makes it clear we are initiating the PPP session with ppp_connect (i.e. acting as a PPP client) so there is no confusion possible between ppp_connect and ppp_listen.
This commit is contained in:
parent
f7d5e81130
commit
2731976a95
@ -159,7 +159,7 @@ static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) {
|
|||||||
* Try to reconnect in 30 seconds, if you need a modem chatscript you have
|
* Try to reconnect in 30 seconds, if you need a modem chatscript you have
|
||||||
* to do a much better signaling here ;-)
|
* to do a much better signaling here ;-)
|
||||||
*/
|
*/
|
||||||
ppp_open(pcb, 30);
|
ppp_connect(pcb, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ ppp_set_default(ppp);
|
|||||||
* if PPP session is in the dead state (i.e. disconnected).
|
* if PPP session is in the dead state (i.e. disconnected).
|
||||||
*/
|
*/
|
||||||
u16_t holdoff = 0;
|
u16_t holdoff = 0;
|
||||||
ppp_open(ppp, holdoff);
|
ppp_connect(ppp, holdoff);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -334,7 +334,7 @@ from previous lwIP version is pretty easy:
|
|||||||
for PPP interface in pppoX_create() functions
|
for PPP interface in pppoX_create() functions
|
||||||
|
|
||||||
* PPP session are not started automatically after you created them anymore,
|
* PPP session are not started automatically after you created them anymore,
|
||||||
you have to call ppp_open(), this way you can configure the session before
|
you have to call ppp_connect(), this way you can configure the session before
|
||||||
starting it.
|
starting it.
|
||||||
|
|
||||||
* Previous PPP API used CamelCase, we are now using snake_case.
|
* Previous PPP API used CamelCase, we are now using snake_case.
|
||||||
|
@ -236,26 +236,26 @@ pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipad
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call ppp_open() inside the tcpip_thread context.
|
* Call ppp_connect() inside the tcpip_thread context.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pppapi_do_ppp_open(struct pppapi_msg_msg *msg)
|
pppapi_do_ppp_connect(struct pppapi_msg_msg *msg)
|
||||||
{
|
{
|
||||||
msg->err = ppp_open(msg->ppp, msg->msg.open.holdoff);
|
msg->err = ppp_connect(msg->ppp, msg->msg.connect.holdoff);
|
||||||
TCPIP_PPPAPI_ACK(msg);
|
TCPIP_PPPAPI_ACK(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call ppp_open() in a thread-safe way by running that function inside the
|
* Call ppp_connect() in a thread-safe way by running that function inside the
|
||||||
* tcpip_thread context.
|
* tcpip_thread context.
|
||||||
*/
|
*/
|
||||||
err_t
|
err_t
|
||||||
pppapi_open(ppp_pcb *pcb, u16_t holdoff)
|
pppapi_connect(ppp_pcb *pcb, u16_t holdoff)
|
||||||
{
|
{
|
||||||
struct pppapi_msg msg;
|
struct pppapi_msg msg;
|
||||||
msg.function = pppapi_do_ppp_open;
|
msg.function = pppapi_do_ppp_connect;
|
||||||
msg.msg.ppp = pcb;
|
msg.msg.ppp = pcb;
|
||||||
msg.msg.msg.open.holdoff = holdoff;
|
msg.msg.msg.connect.holdoff = holdoff;
|
||||||
TCPIP_PPPAPI(&msg);
|
TCPIP_PPPAPI(&msg);
|
||||||
return msg.msg.err;
|
return msg.msg.err;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ struct pppapi_msg_msg {
|
|||||||
#endif /* PPPOL2TP_SUPPORT */
|
#endif /* PPPOL2TP_SUPPORT */
|
||||||
struct {
|
struct {
|
||||||
u16_t holdoff;
|
u16_t holdoff;
|
||||||
} open;
|
} connect;
|
||||||
#if PPP_SERVER
|
#if PPP_SERVER
|
||||||
struct {
|
struct {
|
||||||
struct ppp_addrs *addrs;
|
struct ppp_addrs *addrs;
|
||||||
@ -131,7 +131,7 @@ ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_add
|
|||||||
u8_t *secret, u8_t secret_len,
|
u8_t *secret, u8_t secret_len,
|
||||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||||
#endif /* PPPOL2TP_SUPPORT */
|
#endif /* PPPOL2TP_SUPPORT */
|
||||||
err_t pppapi_open(ppp_pcb *pcb, u16_t holdoff);
|
err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
|
||||||
#if PPP_SERVER
|
#if PPP_SERVER
|
||||||
err_t pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
|
err_t pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
|
||||||
#endif /* PPP_SERVER */
|
#endif /* PPP_SERVER */
|
||||||
|
@ -451,7 +451,7 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p
|
|||||||
#endif /* PPP_NOTIFY_PHASE */
|
#endif /* PPP_NOTIFY_PHASE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a PPP connection.
|
* Initiate a PPP connection.
|
||||||
*
|
*
|
||||||
* This can only be called if PPP is in the dead phase.
|
* This can only be called if PPP is in the dead phase.
|
||||||
*
|
*
|
||||||
@ -461,7 +461,7 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p
|
|||||||
* If this port connects to a modem, the modem connection must be
|
* If this port connects to a modem, the modem connection must be
|
||||||
* established before calling this.
|
* established before calling this.
|
||||||
*/
|
*/
|
||||||
err_t ppp_open(ppp_pcb *pcb, u16_t holdoff);
|
err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff);
|
||||||
|
|
||||||
#if PPP_SERVER
|
#if PPP_SERVER
|
||||||
/*
|
/*
|
||||||
|
@ -178,7 +178,7 @@ const struct protent* const protocols[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes for procedures local to this file. */
|
/* Prototypes for procedures local to this file. */
|
||||||
static void ppp_do_open(void *arg);
|
static void ppp_do_connect(void *arg);
|
||||||
static err_t ppp_netif_init_cb(struct netif *netif);
|
static err_t ppp_netif_init_cb(struct netif *netif);
|
||||||
static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, const ip_addr_t *ipaddr);
|
static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, const ip_addr_t *ipaddr);
|
||||||
#if PPP_IPV6_SUPPORT
|
#if PPP_IPV6_SUPPORT
|
||||||
@ -221,7 +221,7 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p
|
|||||||
#endif /* PPP_NOTIFY_PHASE */
|
#endif /* PPP_NOTIFY_PHASE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a PPP connection.
|
* Initiate a PPP connection.
|
||||||
*
|
*
|
||||||
* This can only be called if PPP is in the dead phase.
|
* This can only be called if PPP is in the dead phase.
|
||||||
*
|
*
|
||||||
@ -231,19 +231,19 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p
|
|||||||
* If this port connects to a modem, the modem connection must be
|
* If this port connects to a modem, the modem connection must be
|
||||||
* established before calling this.
|
* established before calling this.
|
||||||
*/
|
*/
|
||||||
err_t ppp_open(ppp_pcb *pcb, u16_t holdoff) {
|
err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) {
|
||||||
if (pcb->phase != PPP_PHASE_DEAD) {
|
if (pcb->phase != PPP_PHASE_DEAD) {
|
||||||
return ERR_ALREADY;
|
return ERR_ALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
PPPDEBUG(LOG_DEBUG, ("ppp_open() called, holdoff=%d\n", holdoff));
|
PPPDEBUG(LOG_DEBUG, ("ppp_connect() called, holdoff=%d\n", holdoff));
|
||||||
|
|
||||||
if (holdoff == 0) {
|
if (holdoff == 0) {
|
||||||
return pcb->link_cb->connect(pcb, pcb->link_ctx_cb);
|
return pcb->link_cb->connect(pcb, pcb->link_ctx_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_phase(pcb, PPP_PHASE_HOLDOFF);
|
new_phase(pcb, PPP_PHASE_HOLDOFF);
|
||||||
sys_timeout((u32_t)(holdoff*1000), ppp_do_open, pcb);
|
sys_timeout((u32_t)(holdoff*1000), ppp_do_connect, pcb);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ ppp_close(ppp_pcb *pcb, u8_t nocarrier)
|
|||||||
|
|
||||||
/* holdoff phase, cancel the reconnection */
|
/* holdoff phase, cancel the reconnection */
|
||||||
if (pcb->phase == PPP_PHASE_HOLDOFF) {
|
if (pcb->phase == PPP_PHASE_HOLDOFF) {
|
||||||
sys_untimeout(ppp_do_open, pcb);
|
sys_untimeout(ppp_do_connect, pcb);
|
||||||
new_phase(pcb, PPP_PHASE_DEAD);
|
new_phase(pcb, PPP_PHASE_DEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ fail:
|
|||||||
/*** LOCAL FUNCTION DEFINITIONS ***/
|
/*** LOCAL FUNCTION DEFINITIONS ***/
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
|
||||||
static void ppp_do_open(void *arg) {
|
static void ppp_do_connect(void *arg) {
|
||||||
ppp_pcb *pcb = (ppp_pcb*)arg;
|
ppp_pcb *pcb = (ppp_pcb*)arg;
|
||||||
|
|
||||||
LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF", pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF);
|
LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF", pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF);
|
||||||
|
Loading…
Reference in New Issue
Block a user