mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 12:35:26 +00:00
PPP, PPPoS, SERVER: remove useless struct ppp_addrs* argument from pppos_listen
Now that we have helpers to set those members externaly, pppos_listen struct ppp_addrs* argument does not add any value. In addition it was not a well chosen design choice because the user needed to keep a copy of struct ppp_addrs when listening again for a new connection.
This commit is contained in:
parent
71ca26b212
commit
3d684cda23
@ -505,13 +505,10 @@ err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff);
|
||||
*
|
||||
* This can only be called if PPP is in the dead phase.
|
||||
*
|
||||
* Local and remote interface IP addresses, as well as DNS are
|
||||
* provided through a previously filled struct ppp_addrs.
|
||||
*
|
||||
* If this port connects to a modem, the modem connection must be
|
||||
* established before calling this.
|
||||
*/
|
||||
err_t ppp_listen(ppp_pcb *pcb, const struct ppp_addrs *addrs);
|
||||
err_t ppp_listen(ppp_pcb *pcb);
|
||||
#endif /* PPP_SERVER */
|
||||
|
||||
/*
|
||||
|
@ -141,7 +141,7 @@ struct link_callbacks {
|
||||
err_t (*connect) (ppp_pcb *pcb, void *ctx);
|
||||
#if PPP_SERVER
|
||||
/* Listen for an incoming connection (Passive mode) */
|
||||
err_t (*listen) (ppp_pcb *pcb, void *ctx, const struct ppp_addrs *addrs);
|
||||
err_t (*listen) (ppp_pcb *pcb, void *ctx);
|
||||
#endif /* PPP_SERVER */
|
||||
/* End a connection (i.e. initiate disconnect phase) */
|
||||
void (*disconnect) (ppp_pcb *pcb, void *ctx);
|
||||
|
@ -92,11 +92,6 @@ struct pppapi_msg_msg {
|
||||
struct {
|
||||
u16_t holdoff;
|
||||
} connect;
|
||||
#if PPP_SERVER
|
||||
struct {
|
||||
API_MSG_M_DEF_C(struct ppp_addrs, addrs);
|
||||
} listen;
|
||||
#endif /* PPP_SERVER */
|
||||
struct {
|
||||
u8_t nocarrier;
|
||||
} close;
|
||||
@ -133,7 +128,7 @@ ppp_pcb *pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_add
|
||||
#endif /* PPPOL2TP_SUPPORT */
|
||||
err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff);
|
||||
#if PPP_SERVER
|
||||
err_t pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs);
|
||||
err_t pppapi_listen(ppp_pcb *pcb);
|
||||
#endif /* PPP_SERVER */
|
||||
err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
|
||||
err_t pppapi_free(ppp_pcb *pcb);
|
||||
|
@ -274,13 +274,10 @@ err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) {
|
||||
*
|
||||
* This can only be called if PPP is in the dead phase.
|
||||
*
|
||||
* Local and remote interface IP addresses, as well as DNS are
|
||||
* provided through a previously filled struct ppp_addrs.
|
||||
*
|
||||
* If this port connects to a modem, the modem connection must be
|
||||
* established before calling this.
|
||||
*/
|
||||
err_t ppp_listen(ppp_pcb *pcb, const struct ppp_addrs *addrs) {
|
||||
err_t ppp_listen(ppp_pcb *pcb) {
|
||||
if (pcb->phase != PPP_PHASE_DEAD) {
|
||||
return ERR_ALREADY;
|
||||
}
|
||||
@ -288,7 +285,7 @@ err_t ppp_listen(ppp_pcb *pcb, const struct ppp_addrs *addrs) {
|
||||
PPPDEBUG(LOG_DEBUG, ("ppp_listen[%d]\n", pcb->netif->num));
|
||||
|
||||
if (pcb->link_cb->listen) {
|
||||
return pcb->link_cb->listen(pcb, pcb->link_ctx_cb, addrs);
|
||||
return pcb->link_cb->listen(pcb, pcb->link_ctx_cb);
|
||||
}
|
||||
return ERR_IF;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ pppapi_do_ppp_listen(struct tcpip_api_call_data *m)
|
||||
{
|
||||
struct pppapi_msg *msg = (struct pppapi_msg *)m;
|
||||
|
||||
return ppp_listen(msg->msg.ppp, API_EXPR_REF(msg->msg.msg.listen.addrs));
|
||||
return ppp_listen(msg->msg.ppp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -329,14 +329,13 @@ pppapi_do_ppp_listen(struct tcpip_api_call_data *m)
|
||||
* tcpip_thread context.
|
||||
*/
|
||||
err_t
|
||||
pppapi_listen(ppp_pcb *pcb, struct ppp_addrs *addrs)
|
||||
pppapi_listen(ppp_pcb *pcb)
|
||||
{
|
||||
err_t err;
|
||||
PPPAPI_VAR_DECLARE(msg);
|
||||
PPPAPI_VAR_ALLOC(msg);
|
||||
|
||||
PPPAPI_VAR_REF(msg).msg.ppp = pcb;
|
||||
PPPAPI_VAR_REF(msg).msg.msg.listen.addrs = PPPAPI_VAR_REF(addrs);
|
||||
err = tcpip_api_call(pppapi_do_ppp_listen, &PPPAPI_VAR_REF(msg).call);
|
||||
PPPAPI_VAR_FREE(msg);
|
||||
return err;
|
||||
|
@ -58,7 +58,7 @@ static err_t pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p);
|
||||
static err_t pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u16_t protocol);
|
||||
static err_t pppos_connect(ppp_pcb *ppp, void *ctx);
|
||||
#if PPP_SERVER
|
||||
static err_t pppos_listen(ppp_pcb *ppp, void *ctx, const struct ppp_addrs *addrs);
|
||||
static err_t pppos_listen(ppp_pcb *ppp, void *ctx);
|
||||
#endif /* PPP_SERVER */
|
||||
static void pppos_disconnect(ppp_pcb *ppp, void *ctx);
|
||||
static err_t pppos_destroy(ppp_pcb *ppp, void *ctx);
|
||||
@ -332,15 +332,9 @@ pppos_connect(ppp_pcb *ppp, void *ctx)
|
||||
|
||||
#if PPP_SERVER
|
||||
static err_t
|
||||
pppos_listen(ppp_pcb *ppp, void *ctx, const struct ppp_addrs *addrs)
|
||||
pppos_listen(ppp_pcb *ppp, void *ctx)
|
||||
{
|
||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||
#if PPP_IPV4_SUPPORT
|
||||
ipcp_options *ipcp_wo;
|
||||
#if LWIP_DNS
|
||||
ipcp_options *ipcp_ao;
|
||||
#endif /* LWIP_DNS */
|
||||
#endif /* PPP_IPV4_SUPPORT */
|
||||
lcp_options *lcp_wo;
|
||||
PPPOS_DECL_PROTECT(lev);
|
||||
|
||||
@ -363,21 +357,10 @@ pppos_listen(ppp_pcb *ppp, void *ctx, const struct ppp_addrs *addrs)
|
||||
}
|
||||
#endif /* PPP_AUTH_SUPPORT */
|
||||
|
||||
#if PPP_IPV4_SUPPORT
|
||||
ipcp_wo = &ppp->ipcp_wantoptions;
|
||||
ipcp_wo->ouraddr = ip4_addr_get_u32(&addrs->our_ipaddr);
|
||||
ipcp_wo->hisaddr = ip4_addr_get_u32(&addrs->his_ipaddr);
|
||||
#if LWIP_DNS
|
||||
#if PPP_IPV4_SUPPORT && LWIP_DNS
|
||||
/* Don't accept DNS from peer */
|
||||
ppp->settings.usepeerdns = 0;
|
||||
|
||||
ipcp_ao = &ppp->ipcp_allowoptions;
|
||||
ipcp_ao->dnsaddr[0] = ip4_addr_get_u32(&addrs->dns1);
|
||||
ipcp_ao->dnsaddr[1] = ip4_addr_get_u32(&addrs->dns2);
|
||||
#endif /* LWIP_DNS */
|
||||
#else /* PPP_IPV4_SUPPORT */
|
||||
LWIP_UNUSED_ARG(addrs);
|
||||
#endif /* PPP_IPV4_SUPPORT */
|
||||
#endif /* PPP_IPV4_SUPPORT && LWIP_DNS */
|
||||
|
||||
/*
|
||||
* Default the in and out accm so that escape and flag characters
|
||||
|
Loading…
x
Reference in New Issue
Block a user