]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Fixed bug #27856: PPP: Set netif link- and status-callback by adding ppp_set_netif_st...
authorgoldsimon <goldsimon>
Thu, 14 Jan 2010 20:04:52 +0000 (20:04 +0000)
committergoldsimon <goldsimon>
Thu, 14 Jan 2010 20:04:52 +0000 (20:04 +0000)
CHANGELOG
src/netif/ppp/ppp.c
src/netif/ppp/ppp.h

index 9dc0ed2c3a14a5bef11589dcb920f2adf553a1b5..b774a95175637efa274a858d4cdbede112e109bd 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,10 @@ HISTORY
 
   ++ 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
   * 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
index d187967434836bc320b166994c7c936ad7f26eee..3f9f7fd93d78f0a94b071774e4e47ab9fe33ba7b 100644 (file)
 #include "netif/ppp_oe.h"
 #endif /* PPPOE_SUPPORT */
 
+#include "lwip/tcpip.h"
+#include "lwip/api.h"
+
 #include <string.h>
 
 /*************************/
@@ -1951,4 +1954,34 @@ drop:
 }
 #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 */
index f070b7ed70cc6f5fee0b10776785cb2ad8547d66..a8c81135dab06285be09dd5ca9bd2eddbd57d9ca 100644 (file)
 
 #include "lwip/def.h"
 #include "lwip/sio.h"
-#include "lwip/api.h"
-#include "lwip/sockets.h"
 #include "lwip/stats.h"
 #include "lwip/mem.h"
-#include "lwip/tcpip.h"
 #include "lwip/netif.h"
 #include "lwip/sys.h"
 #include "lwip/timers.h"
  * 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))
 
 
@@ -474,6 +471,13 @@ int  cifdefaultroute (int, u32_t, u32_t);
 /* Get appropriate netmask for address */
 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_H */