lwip-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-members] Marc's latest patch


From: David Haas
Subject: [lwip-members] Marc's latest patch
Date: Tue, 18 Feb 2003 11:36:01 -0500
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2b) Gecko/20021107

Hi,

I received this patch from Marc Boucher. I think most of it is uncontriversial, but it merges event.h with tcp.h. Now it turns out that tcp.h includes event.h. Anyone have any objection to this.

Regards,
David.

--- Begin Message --- Subject: Re: Your patch (socket changes and lightweight protection) Date: Fri, 14 Feb 2003 18:13:17 +0100 User-agent: Mutt/1.5.1i
Hi David,

Here's an updated patch against the latest CVS to clean up a few
things that were apparently forgotten.

After applying it, src/include/lwip/event.h should be removed.

Regards
Marc


diff -urN lwip-cvs-030221400/doc/sys_arch.txt 
lwip-cvs-030221400-mb/doc/sys_arch.txt
--- lwip-cvs-030221400/doc/sys_arch.txt 2002-10-19 21:48:06.000000000 +0200
+++ lwip-cvs-030221400-mb/doc/sys_arch.txt      2003-02-14 15:56:03.000000000 
+0100
@@ -115,9 +115,9 @@
 such functionality is needed in lwIP, the following function will have
 to be implemented as well:
 
-- void sys_thread_new(void (* thread)(void *arg), void *arg)
+- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg)
 
   Starts a new thread that will begin its execution in the function
   "thread()". The "arg" argument will be passed as an argument to the
-  thread() function.
+  thread() function. The id of the new thread is returned.
 
diff -urN lwip-cvs-030221400/src/api/tcpip.c 
lwip-cvs-030221400-mb/src/api/tcpip.c
--- lwip-cvs-030221400/src/api/tcpip.c  2003-02-07 10:15:59.000000000 +0100
+++ lwip-cvs-030221400-mb/src/api/tcpip.c       2003-02-14 15:56:03.000000000 
+0100
@@ -60,7 +60,7 @@
 
   tcp_tmr();
   if(tcp_active_pcbs || tcp_tw_pcbs) {
-       sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, 
NULL);
+       sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
   } else {
        tcpip_tcp_timer_active = 0;
   }
@@ -71,7 +71,7 @@
 {
   if(!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
        tcpip_tcp_timer_active = 1;
-       sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, 
NULL);
+       sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
   }
 }
 
/*-----------------------------------------------------------------------------------*/
diff -urN lwip-cvs-030221400/src/core/ipv4/ip.c 
lwip-cvs-030221400-mb/src/core/ipv4/ip.c
--- lwip-cvs-030221400/src/core/ipv4/ip.c       2003-02-12 17:44:30.000000000 
+0100
+++ lwip-cvs-030221400-mb/src/core/ipv4/ip.c    2003-02-14 15:56:03.000000000 
+0100
@@ -108,7 +108,6 @@
 #if LWIP_UDP > 0
   case IP_PROTO_UDP:
     return udp_lookup(iphdr, inp);
-    break;
 #endif /* LWIP_UDP */
 #if LWIP_TCP > 0    
   case IP_PROTO_TCP:
@@ -116,7 +115,6 @@
 #endif /* LWIP_TCP */
   case IP_PROTO_ICMP:
     return 1;
-    break;
   default:
     return 0;
   }
diff -urN lwip-cvs-030221400/src/core/ipv4/ip_frag.c 
lwip-cvs-030221400-mb/src/core/ipv4/ip_frag.c
--- lwip-cvs-030221400/src/core/ipv4/ip_frag.c  2003-02-07 10:16:02.000000000 
+0100
+++ lwip-cvs-030221400-mb/src/core/ipv4/ip_frag.c       2003-02-14 
15:56:03.000000000 +0100
@@ -95,7 +95,7 @@
 {
   if(ip_reasstmr > 1) {
     ip_reasstmr--;
-    sys_timeout(IP_REASS_TMO, (sys_timeout_handler) ip_reass_timer, NULL);
+    sys_timeout(IP_REASS_TMO, ip_reass_timer, NULL);
   } else if(ip_reasstmr == 1)
        ip_reasstmr = 0;
 }
@@ -121,7 +121,7 @@
     DEBUGF(IP_REASS_DEBUG, ("ip_reass: new packet\n"));
     memcpy(iphdr, fraghdr, IP_HLEN);
     ip_reasstmr = IP_REASS_MAXAGE;
-    sys_timeout(IP_REASS_TMO, (sys_timeout_handler) ip_reass_timer, NULL);
+    sys_timeout(IP_REASS_TMO, ip_reass_timer, NULL);
     ip_reassflags = 0;
     /* Clear the bitmap. */
     memset(ip_reassbitmap, 0, sizeof(ip_reassbitmap));
@@ -148,7 +148,7 @@
       DEBUGF(IP_REASS_DEBUG,
             ("ip_reass: fragment outside of buffer (%d:%d/%d).\n", offset,
              offset + len, IP_REASS_BUFSIZE));
-      sys_timeout_remove((sys_timeout_handler) ip_reass_timer, NULL);
+      sys_untimeout(ip_reass_timer, NULL);
       ip_reasstmr = 0;
       goto nullreturn;
     }
@@ -236,7 +236,7 @@
       /* If we have come this far, we have a full packet in the
          buffer, so we allocate a pbuf and copy the packet into it. We
          also reset the timer. */
-      sys_timeout_remove((sys_timeout_handler) ip_reass_timer, NULL);
+      sys_untimeout(ip_reass_timer, NULL);
       ip_reasstmr = 0;
       pbuf_free(p);
       p = pbuf_alloc(PBUF_LINK, ip_reasslen, PBUF_POOL);
diff -urN lwip-cvs-030221400/src/core/memp.c 
lwip-cvs-030221400-mb/src/core/memp.c
--- lwip-cvs-030221400/src/core/memp.c  2003-02-14 14:53:02.000000000 +0100
+++ lwip-cvs-030221400-mb/src/core/memp.c       2003-02-14 15:56:03.000000000 
+0100
@@ -110,7 +110,9 @@
                                        sizeof(struct memp)))];
 
 
/*-----------------------------------------------------------------------------------*/
+#ifndef SYS_LIGHTWEIGHT_PROT
 static sys_sem_t mutex;
+#endif
 
/*-----------------------------------------------------------------------------------*/
 #ifdef LWIP_DEBUG
 static int
@@ -168,7 +170,9 @@
     }
   }
 
+#ifndef SYS_LIGHTWEIGHT_PROT
   mutex = sys_sem_new(1);
+#endif
 
   
 }
diff -urN lwip-cvs-030221400/src/core/sys.c lwip-cvs-030221400-mb/src/core/sys.c
--- lwip-cvs-030221400/src/core/sys.c   2003-02-12 17:44:30.000000000 +0100
+++ lwip-cvs-030221400-mb/src/core/sys.c        2003-02-14 16:00:45.000000000 
+0100
@@ -206,7 +206,7 @@
 */
 
/*-----------------------------------------------------------------------------------*/
 void
-sys_timeout_remove(sys_timeout_handler h, void *arg)
+sys_untimeout(sys_timeout_handler h, void *arg)
 {
     struct sys_timeouts *timeouts;
     struct sys_timeout *prev_t, *t;
@@ -245,7 +245,7 @@
 {
     struct sswt_cb *sswt_cb = (struct sswt_cb *) arg;
     
-    /* Timeout. Set flag to TRUE and signal semephore */
+    /* Timeout. Set flag to TRUE and signal semaphore */
     sswt_cb->timeflag = 1;
     sys_sem_signal(*(sswt_cb->psem));
 }
@@ -274,7 +274,7 @@
         return 0;
     } else {
         /* Not a timeout. Remove timeout entry */
-        sys_timeout_remove(sswt_handler, &sswt_cb);
+        sys_untimeout(sswt_handler, &sswt_cb);
         return 1;
     }
     
diff -urN lwip-cvs-030221400/src/include/lwip/debug.h 
lwip-cvs-030221400-mb/src/include/lwip/debug.h
--- lwip-cvs-030221400/src/include/lwip/debug.h 2003-02-12 17:44:30.000000000 
+0100
+++ lwip-cvs-030221400-mb/src/include/lwip/debug.h      2003-02-14 
16:32:23.000000000 +0100
@@ -36,9 +36,9 @@
 
 #ifdef LWIP_DEBUG
 
-#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x) } while(0)
-#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(x) } while(0)
-#define LWIP_ERROR(x)   do { LWIP_PLATFORM_DIAG(x) } while(0)  
+#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
+#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(x); } while(0)
+#define LWIP_ERROR(x)   do { LWIP_PLATFORM_DIAG(x); } while(0) 
 
 /* These defines control the amount of debugging output: */
 #define MEM_TRACKING
diff -urN lwip-cvs-030221400/src/include/lwip/event.h 
lwip-cvs-030221400-mb/src/include/lwip/event.h
--- lwip-cvs-030221400/src/include/lwip/event.h 2002-10-19 15:00:10.000000000 
+0200
+++ lwip-cvs-030221400-mb/src/include/lwip/event.h      1970-01-01 
01:00:00.000000000 +0100
@@ -1,29 +0,0 @@
-#ifndef __LWIP_EVENT_H__
-#define __LWIP_EVENT_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_EVENT_API
-
-#include "lwip/pbuf.h"
-
-enum lwip_event {
-  LWIP_EVENT_ACCEPT,
-  LWIP_EVENT_SENT,
-  LWIP_EVENT_RECV,
-  LWIP_EVENT_CONNECTED,
-  LWIP_EVENT_POLL,
-  LWIP_EVENT_ERR
-};
-
-struct tcp_pcb;
-
-err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
-                    enum lwip_event,
-                    struct pbuf *p,
-                    u16_t size,
-                    err_t err);
-
-#endif /* LWIP_EVENT_API */
-
-#endif /* __LWIP_EVENT_H__ */
diff -urN lwip-cvs-030221400/src/include/lwip/sys.h 
lwip-cvs-030221400-mb/src/include/lwip/sys.h
--- lwip-cvs-030221400/src/include/lwip/sys.h   2003-02-14 14:53:02.000000000 
+0100
+++ lwip-cvs-030221400-mb/src/include/lwip/sys.h        2003-02-14 
15:56:03.000000000 +0100
@@ -87,7 +87,7 @@
  *
  */
 void sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
-void sys_timeout_remove(sys_timeout_handler h, void *arg);
+void sys_untimeout(sys_timeout_handler h, void *arg);
 struct sys_timeouts *sys_arch_timeouts(void);
 
 /* Semaphore functions. */
diff -urN lwip-cvs-030221400/src/include/lwip/tcp.h 
lwip-cvs-030221400-mb/src/include/lwip/tcp.h
--- lwip-cvs-030221400/src/include/lwip/tcp.h   2003-02-12 17:44:30.000000000 
+0100
+++ lwip-cvs-030221400-mb/src/include/lwip/tcp.h        2003-02-14 
15:56:03.000000000 +0100
@@ -44,8 +44,6 @@
 
 #include "lwip/err.h"
 
-#include "lwip/event.h"
-
 struct tcp_pcb;
 
 /* Functions for interfacing with TCP: */
@@ -307,6 +305,22 @@
 };
 
 #if LWIP_EVENT_API
+
+enum lwip_event {
+  LWIP_EVENT_ACCEPT,
+  LWIP_EVENT_SENT,
+  LWIP_EVENT_RECV,
+  LWIP_EVENT_CONNECTED,
+  LWIP_EVENT_POLL,
+  LWIP_EVENT_ERR
+};
+
+err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
+                    enum lwip_event,
+                    struct pbuf *p,
+                    u16_t size,
+                    err_t err);
+
 #define TCP_EVENT_ACCEPT(pcb,err,ret)    ret = 
lwip_tcp_event((pcb)->callback_arg, (pcb),\
                                                    LWIP_EVENT_ACCEPT, NULL, 0, 
err)
 #define TCP_EVENT_SENT(pcb,space,ret) ret = 
lwip_tcp_event((pcb)->callback_arg, (pcb),\
diff -urN lwip-cvs-030221400/src/netif/ethernetif.c 
lwip-cvs-030221400-mb/src/netif/ethernetif.c
--- lwip-cvs-030221400/src/netif/ethernetif.c   2003-01-13 14:26:39.000000000 
+0100
+++ lwip-cvs-030221400-mb/src/netif/ethernetif.c        2003-02-14 
15:56:03.000000000 +0100
@@ -312,7 +312,7 @@
 arp_timer(void *arg)
 {
   arp_tmr();
-  sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL);
+  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
 }
 
/*-----------------------------------------------------------------------------------*/
 /*
@@ -341,6 +341,6 @@
   low_level_init(netif);
   arp_init();
 
-  sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL);
+  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
 }
 
/*-----------------------------------------------------------------------------------*/
diff -ur contrib/ports/coldfire/include/arch/cc.h 
contrib-mb/ports/coldfire/include/arch/cc.h
--- contrib/ports/coldfire/include/arch/cc.h    2003-02-14 14:52:44.000000000 
+0100
+++ contrib-mb/ports/coldfire/include/arch/cc.h 2003-02-14 17:09:15.000000000 
+0100
@@ -99,12 +99,12 @@
 #include <stdlib.h>
 /* Plaform specific diagnostic output */
 #ifndef LWIP_PLATFORM_DIAG
-#define LWIP_PLATFORM_DIAG(x)  {printf x;}
+#define LWIP_PLATFORM_DIAG(x)  do {printf x;} while(0)
 #endif
 
 #ifndef LWIP_PLATFORM_ASSERT
-#define LWIP_PLATFORM_ASSERT(x)  {printf("Assertion \"%s\" failed at line %d 
in %s\n", \
-                                     x, __LINE__, __FILE__); fflush(NULL); 
abort();}
+#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d 
in %s\n", \
+                                     x, __LINE__, __FILE__); fflush(NULL); 
abort();} while(0)
 #endif
 
 
diff -ur contrib/ports/unix/include/arch/cc.h 
contrib-mb/ports/unix/include/arch/cc.h
--- contrib/ports/unix/include/arch/cc.h        2003-02-12 17:45:18.000000000 
+0100
+++ contrib-mb/ports/unix/include/arch/cc.h     2003-02-14 17:09:37.000000000 
+0100
@@ -60,8 +60,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 /* Plaform specific diagnostic output */
-#define LWIP_PLATFORM_DIAG(x)  {printf x;}
+#define LWIP_PLATFORM_DIAG(x)  do {printf x;} while(0)
 
-#define LWIP_PLATFORM_ASSERT(x)  {printf("Assertion \"%s\" failed at line %d 
in %s\n", \
-                                     x, __LINE__, __FILE__); fflush(NULL); 
abort();}
+#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d 
in %s\n", \
+                                     x, __LINE__, __FILE__); fflush(NULL); 
abort();} while(0)
 #endif /* __ARCH_CC_H__ */



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]