From 2731976a95afe2c9c207135fe7f2fecf61e893b1 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 1 Mar 2015 10:53:08 +0100 Subject: [PATCH] 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. --- doc/ppp.txt | 6 +++--- src/api/pppapi.c | 14 +++++++------- src/include/lwip/pppapi.h | 4 ++-- src/include/netif/ppp/ppp.h | 4 ++-- src/netif/ppp/ppp.c | 14 +++++++------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/ppp.txt b/doc/ppp.txt index 5a0cc9af..08aedd46 100644 --- a/doc/ppp.txt +++ b/doc/ppp.txt @@ -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 * 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). */ 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 * 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. * Previous PPP API used CamelCase, we are now using snake_case. diff --git a/src/api/pppapi.c b/src/api/pppapi.c index a11145b1..5b7940d1 100644 --- a/src/api/pppapi.c +++ b/src/api/pppapi.c @@ -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 -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); } /** - * 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. */ err_t -pppapi_open(ppp_pcb *pcb, u16_t holdoff) +pppapi_connect(ppp_pcb *pcb, u16_t holdoff) { struct pppapi_msg msg; - msg.function = pppapi_do_ppp_open; + msg.function = pppapi_do_ppp_connect; msg.msg.ppp = pcb; - msg.msg.msg.open.holdoff = holdoff; + msg.msg.msg.connect.holdoff = holdoff; TCPIP_PPPAPI(&msg); return msg.msg.err; } diff --git a/src/include/lwip/pppapi.h b/src/include/lwip/pppapi.h index 65ff6c63..270c5fc7 100644 --- a/src/include/lwip/pppapi.h +++ b/src/include/lwip/pppapi.h @@ -91,7 +91,7 @@ struct pppapi_msg_msg { #endif /* PPPOL2TP_SUPPORT */ struct { u16_t holdoff; - } open; + } connect; #if PPP_SERVER struct { 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, ppp_link_status_cb_fn link_status_cb, void *ctx_cb); #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 err_t pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs); #endif /* PPP_SERVER */ diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index 212c4c59..7232bedd 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -451,7 +451,7 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p #endif /* PPP_NOTIFY_PHASE */ /* - * Open a PPP connection. + * Initiate a PPP connection. * * 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 * 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 /* diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index b863ec7a..837b9eb1 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -178,7 +178,7 @@ const struct protent* const protocols[] = { }; /* 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_output_ip4(struct netif *netif, struct pbuf *pb, const ip_addr_t *ipaddr); #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 */ /* - * Open a PPP connection. + * Initiate a PPP connection. * * 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 * 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) { 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) { return pcb->link_cb->connect(pcb, pcb->link_ctx_cb); } 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; } @@ -291,7 +291,7 @@ ppp_close(ppp_pcb *pcb, u8_t nocarrier) /* holdoff phase, cancel the reconnection */ if (pcb->phase == PPP_PHASE_HOLDOFF) { - sys_untimeout(ppp_do_open, pcb); + sys_untimeout(ppp_do_connect, pcb); new_phase(pcb, PPP_PHASE_DEAD); } @@ -395,7 +395,7 @@ fail: /*** LOCAL FUNCTION DEFINITIONS ***/ /**********************************/ -static void ppp_do_open(void *arg) { +static void ppp_do_connect(void *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);