mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
Done some work on task #1549 (function documentation) and minor changes to meet coding standard
This commit is contained in:
parent
a14bc9ed44
commit
8a30754e9c
@ -32,6 +32,12 @@
|
|||||||
|
|
||||||
#if LWIP_NETIF_API
|
#if LWIP_NETIF_API
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call netif_add() in a thread-safe way by running that function inside the
|
||||||
|
* tcpip_thread context.
|
||||||
|
*
|
||||||
|
* @note for params @see netif_add()
|
||||||
|
*/
|
||||||
err_t
|
err_t
|
||||||
netifapi_netif_add(struct netif *netif,
|
netifapi_netif_add(struct netif *netif,
|
||||||
struct ip_addr *ipaddr,
|
struct ip_addr *ipaddr,
|
||||||
@ -40,7 +46,8 @@ netifapi_netif_add( struct netif *netif,
|
|||||||
void *state,
|
void *state,
|
||||||
err_t (* init)(struct netif *netif),
|
err_t (* init)(struct netif *netif),
|
||||||
err_t (* input)(struct pbuf *p, struct netif *netif))
|
err_t (* input)(struct pbuf *p, struct netif *netif))
|
||||||
{ struct netifapi_msg msg;
|
{
|
||||||
|
struct netifapi_msg msg;
|
||||||
msg.type = NETIFAPI_MSG_NETIF_ADD;
|
msg.type = NETIFAPI_MSG_NETIF_ADD;
|
||||||
msg.netif = netif;
|
msg.netif = netif;
|
||||||
msg.msg.add.ipaddr = ipaddr;
|
msg.msg.add.ipaddr = ipaddr;
|
||||||
@ -53,36 +60,65 @@ netifapi_netif_add( struct netif *netif,
|
|||||||
return msg.err;
|
return msg.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call netif_remove() in a thread-safe way by running that function inside the
|
||||||
|
* tcpip_thread context.
|
||||||
|
*
|
||||||
|
* @note for params @see netif_remove()
|
||||||
|
*/
|
||||||
err_t
|
err_t
|
||||||
netifapi_netif_remove(struct netif *netif)
|
netifapi_netif_remove(struct netif *netif)
|
||||||
{ struct netifapi_msg msg;
|
{
|
||||||
|
struct netifapi_msg msg;
|
||||||
msg.type = NETIFAPI_MSG_NETIF_REMOVE;
|
msg.type = NETIFAPI_MSG_NETIF_REMOVE;
|
||||||
msg.netif = netif;
|
msg.netif = netif;
|
||||||
tcpip_apimsg(&msg);
|
tcpip_apimsg(&msg);
|
||||||
return msg.err;
|
return msg.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call dhcp_start() in a thread-safe way by running that function inside the
|
||||||
|
* tcpip_thread context.
|
||||||
|
*
|
||||||
|
* @note for params @see dhcp_start()
|
||||||
|
*/
|
||||||
err_t
|
err_t
|
||||||
netifapi_dhcp_start(struct netif *netif)
|
netifapi_dhcp_start(struct netif *netif)
|
||||||
{ struct netifapi_msg msg;
|
{
|
||||||
|
struct netifapi_msg msg;
|
||||||
msg.type = NETIFAPI_MSG_DHCP_START;
|
msg.type = NETIFAPI_MSG_DHCP_START;
|
||||||
msg.netif = netif;
|
msg.netif = netif;
|
||||||
tcpip_apimsg(&msg);
|
tcpip_apimsg(&msg);
|
||||||
return msg.err;
|
return msg.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call dhcp_stop() in a thread-safe way by running that function inside the
|
||||||
|
* tcpip_thread context.
|
||||||
|
*
|
||||||
|
* @note for params @see dhcp_stop()
|
||||||
|
*/
|
||||||
err_t
|
err_t
|
||||||
netifapi_dhcp_stop(struct netif *netif)
|
netifapi_dhcp_stop(struct netif *netif)
|
||||||
{ struct netifapi_msg msg;
|
{
|
||||||
|
struct netifapi_msg msg;
|
||||||
msg.type = NETIFAPI_MSG_DHCP_STOP;
|
msg.type = NETIFAPI_MSG_DHCP_STOP;
|
||||||
msg.netif = netif;
|
msg.netif = netif;
|
||||||
tcpip_apimsg(&msg);
|
tcpip_apimsg(&msg);
|
||||||
return msg.err;
|
return msg.err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function processes the messages posted to the tcpip_thread
|
||||||
|
* by the above functions.
|
||||||
|
*
|
||||||
|
* It is responsible for doing the actual work inside the thread context
|
||||||
|
* of tcpip_thread.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
netifapi_msg_input(struct netifapi_msg *msg)
|
netifapi_msg_input(struct netifapi_msg *msg)
|
||||||
{ msg->err = ERR_OK;
|
{
|
||||||
|
msg->err = ERR_OK;
|
||||||
switch (msg->type) {
|
switch (msg->type) {
|
||||||
case NETIFAPI_MSG_NETIF_ADD: {
|
case NETIFAPI_MSG_NETIF_ADD: {
|
||||||
if (!netif_add( msg->netif,
|
if (!netif_add( msg->netif,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user