mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
PPP, CORE, functions ppp_set_netif_statuscallback() and ppp_set_netif_linkcallback() replaced with defines
PPP is now pointerful for a while, we don't need anymore accessor functions for the unique PPP local and static control block. Replaced ppp_set_netif_statuscallback() and ppp_set_netif_linkcallback() functions to defines. Removed pppapi_do_ppp_set_netif_statuscallback() and pppapi_do_ppp_set_netif_linkcallback(), they were useless because netif_set_status_callback() and netif_set_link_callback() can be safely called while PPP status is in dead (= non open) state and even before the PPP session is actually created at all.
This commit is contained in:
parent
b4990b5bb4
commit
00bb70a62d
@ -339,57 +339,4 @@ pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
|
||||||
/**
|
|
||||||
* Call ppp_set_netif_statuscallback() inside the tcpip_thread context.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
pppapi_do_ppp_set_netif_statuscallback(struct pppapi_msg_msg *msg)
|
|
||||||
{
|
|
||||||
ppp_set_netif_statuscallback(msg->ppp, msg->msg.netifstatuscallback.status_callback);
|
|
||||||
TCPIP_PPPAPI_ACK(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call ppp_set_netif_statuscallback() in a thread-safe way by running that function inside the
|
|
||||||
* tcpip_thread context.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pppapi_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback)
|
|
||||||
{
|
|
||||||
struct pppapi_msg msg;
|
|
||||||
msg.function = pppapi_do_ppp_set_netif_statuscallback;
|
|
||||||
msg.msg.ppp = pcb;
|
|
||||||
msg.msg.msg.netifstatuscallback.status_callback = status_callback;
|
|
||||||
TCPIP_PPPAPI(&msg);
|
|
||||||
}
|
|
||||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
|
||||||
|
|
||||||
|
|
||||||
#if LWIP_NETIF_LINK_CALLBACK
|
|
||||||
/**
|
|
||||||
* Call ppp_set_netif_linkcallback() inside the tcpip_thread context.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
pppapi_do_ppp_set_netif_linkcallback(struct pppapi_msg_msg *msg)
|
|
||||||
{
|
|
||||||
ppp_set_netif_linkcallback(msg->ppp, msg->msg.netiflinkcallback.link_callback);
|
|
||||||
TCPIP_PPPAPI_ACK(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call ppp_set_netif_linkcallback() in a thread-safe way by running that function inside the
|
|
||||||
* tcpip_thread context.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pppapi_set_netif_linkcallback(ppp_pcb *pcb, netif_status_callback_fn link_callback)
|
|
||||||
{
|
|
||||||
struct pppapi_msg msg;
|
|
||||||
msg.function = pppapi_do_ppp_set_netif_linkcallback;
|
|
||||||
msg.msg.ppp = pcb;
|
|
||||||
msg.msg.msg.netiflinkcallback.link_callback = link_callback;
|
|
||||||
TCPIP_PPPAPI(&msg);
|
|
||||||
}
|
|
||||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
|
||||||
|
|
||||||
#endif /* LWIP_PPP_API */
|
#endif /* LWIP_PPP_API */
|
||||||
|
@ -99,16 +99,6 @@ struct pppapi_msg_msg {
|
|||||||
u8_t cmd;
|
u8_t cmd;
|
||||||
void *arg;
|
void *arg;
|
||||||
} ioctl;
|
} ioctl;
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
|
||||||
struct {
|
|
||||||
netif_status_callback_fn status_callback;
|
|
||||||
} netifstatuscallback;
|
|
||||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
|
||||||
#if LWIP_NETIF_LINK_CALLBACK
|
|
||||||
struct {
|
|
||||||
netif_status_callback_fn link_callback;
|
|
||||||
} netiflinkcallback;
|
|
||||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
|
||||||
} msg;
|
} msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -140,12 +130,6 @@ err_t pppapi_open(ppp_pcb *pcb, u16_t holdoff);
|
|||||||
err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
|
err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier);
|
||||||
err_t pppapi_free(ppp_pcb *pcb);
|
err_t pppapi_free(ppp_pcb *pcb);
|
||||||
err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
|
err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
|
||||||
void pppapi_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback);
|
|
||||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
|
||||||
#if LWIP_NETIF_LINK_CALLBACK
|
|
||||||
void pppapi_set_netif_linkcallback(ppp_pcb *pcb, netif_status_callback_fn link_callback);
|
|
||||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -521,14 +521,13 @@ err_t ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg);
|
|||||||
/* Get the PPP addresses */
|
/* Get the PPP addresses */
|
||||||
#define ppp_addrs(ppp) (&(ppp)->addrs)
|
#define ppp_addrs(ppp) (&(ppp)->addrs)
|
||||||
|
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
|
||||||
/* Set an lwIP-style status-callback for the selected PPP device */
|
/* Set an lwIP-style status-callback for the selected PPP device */
|
||||||
void ppp_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback);
|
#define ppp_set_netif_statuscallback(ppp, status_cb) \
|
||||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
netif_set_status_callback(ppp->netif, status_cb);
|
||||||
#if LWIP_NETIF_LINK_CALLBACK
|
|
||||||
/* Set an lwIP-style link-callback for the selected PPP device */
|
/* Set an lwIP-style link-callback for the selected PPP device */
|
||||||
void ppp_set_netif_linkcallback(ppp_pcb *pcb, netif_status_callback_fn link_callback);
|
#define ppp_set_netif_linkcallback(ppp, link_cb) \
|
||||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
netif_set_link_callback(ppp->netif, link_cb);
|
||||||
|
|
||||||
#endif /* PPP_H */
|
#endif /* PPP_H */
|
||||||
|
|
||||||
|
@ -388,36 +388,6 @@ fail:
|
|||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
|
||||||
/** Set the status callback of a PPP's netif
|
|
||||||
*
|
|
||||||
* @param pcb The PPP descriptor returned by ppp_new()
|
|
||||||
* @param status_callback pointer to the status callback function
|
|
||||||
*
|
|
||||||
* @see netif_set_status_callback
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ppp_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback)
|
|
||||||
{
|
|
||||||
netif_set_status_callback(pcb->netif, status_callback);
|
|
||||||
}
|
|
||||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
|
||||||
|
|
||||||
#if LWIP_NETIF_LINK_CALLBACK
|
|
||||||
/** Set the link callback of a PPP's netif
|
|
||||||
*
|
|
||||||
* @param pcb The PPP descriptor returned by ppp_new()
|
|
||||||
* @param link_callback pointer to the link callback function
|
|
||||||
*
|
|
||||||
* @see netif_set_link_callback
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ppp_set_netif_linkcallback(ppp_pcb *pcb, netif_status_callback_fn link_callback)
|
|
||||||
{
|
|
||||||
netif_set_link_callback(pcb->netif, link_callback);
|
|
||||||
}
|
|
||||||
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
/*** LOCAL FUNCTION DEFINITIONS ***/
|
/*** LOCAL FUNCTION DEFINITIONS ***/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user