Fixed bug #27856: PPP: Set netif link- and status-callback by adding ppp_set_netif_statuscallback()/ppp_set_netif_linkcallback()

This commit is contained in:
goldsimon 2010-01-14 20:04:52 +00:00
parent 2d4e76874c
commit 7ede02ca8b
3 changed files with 45 additions and 4 deletions

View File

@ -19,6 +19,10 @@ HISTORY
++ New features: ++ New features:
2010-01-14: Simon Goldschmidt
* ppp.c/.h: Fixed bug #27856: PPP: Set netif link- and status-callback
by adding ppp_set_netif_statuscallback()/ppp_set_netif_linkcallback()
2010-01-13: Simon Goldschmidt 2010-01-13: Simon Goldschmidt
* mem.c: The heap now may be moved to user-defined memory by defining * mem.c: The heap now may be moved to user-defined memory by defining
LWIP_RAM_HEAP_POINTER as a void pointer to that memory's address LWIP_RAM_HEAP_POINTER as a void pointer to that memory's address

View File

@ -107,6 +107,9 @@
#include "netif/ppp_oe.h" #include "netif/ppp_oe.h"
#endif /* PPPOE_SUPPORT */ #endif /* PPPOE_SUPPORT */
#include "lwip/tcpip.h"
#include "lwip/api.h"
#include <string.h> #include <string.h>
/*************************/ /*************************/
@ -1951,4 +1954,34 @@ drop:
} }
#endif /* PPPOE_SUPPORT */ #endif /* PPPOE_SUPPORT */
#if LWIP_NETIF_STATUS_CALLBACK
/** Set the status callback of a PPP's netif
*
* @param pd The PPP descriptor returned by pppOpen()
* @param status_callback pointer to the status callback function
*
* @see netif_set_status_callback
*/
void
ppp_set_netif_statuscallback(int pd, netif_status_callback_fn status_callback)
{
netif_set_status_callback(&pppControl[pd].netif, status_callback);
}
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK
/** Set the link callback of a PPP's netif
*
* @param pd The PPP descriptor returned by pppOpen()
* @param link_callback pointer to the link callback function
*
* @see netif_set_link_callback
*/
void
ppp_set_netif_linkcallback(int pd, netif_status_callback_fn link_callback)
{
netif_set_link_callback(&pppControl[pd].netif, link_callback);
}
#endif /* LWIP_NETIF_LINK_CALLBACK */
#endif /* PPP_SUPPORT */ #endif /* PPP_SUPPORT */

View File

@ -40,11 +40,8 @@
#include "lwip/def.h" #include "lwip/def.h"
#include "lwip/sio.h" #include "lwip/sio.h"
#include "lwip/api.h"
#include "lwip/sockets.h"
#include "lwip/stats.h" #include "lwip/stats.h"
#include "lwip/mem.h" #include "lwip/mem.h"
#include "lwip/tcpip.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/sys.h" #include "lwip/sys.h"
#include "lwip/timers.h" #include "lwip/timers.h"
@ -107,7 +104,7 @@
* OR MODIFICATIONS. * OR MODIFICATIONS.
*/ */
#define TIMEOUT(f, a, t) sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)) #define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0)
#define UNTIMEOUT(f, a) sys_untimeout((f), (a)) #define UNTIMEOUT(f, a) sys_untimeout((f), (a))
@ -474,6 +471,13 @@ int cifdefaultroute (int, u32_t, u32_t);
/* Get appropriate netmask for address */ /* Get appropriate netmask for address */
u32_t GetMask (u32_t); u32_t GetMask (u32_t);
#if LWIP_NETIF_STATUS_CALLBACK
void ppp_set_netif_statuscallback(int pd, netif_status_callback_fn status_callback);
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK
void ppp_set_netif_linkcallback(int pd, netif_status_callback_fn link_callback);
#endif /* LWIP_NETIF_LINK_CALLBACK */
#endif /* PPP_SUPPORT */ #endif /* PPP_SUPPORT */
#endif /* PPP_H */ #endif /* PPP_H */