]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
byte-order handling functions are in inet.c now and the uperrcase counterparts are...
authorjani <jani>
Fri, 21 Feb 2003 16:43:46 +0000 (16:43 +0000)
committerjani <jani>
Fri, 21 Feb 2003 16:43:46 +0000 (16:43 +0000)
configurable items debug does not need to be directly included.

37 files changed:
src/api/api_lib.c
src/api/api_msg.c
src/api/sockets.c
src/api/tcpip.c
src/core/dhcp.c
src/core/inet.c
src/core/inet6.c
src/core/ipv4/icmp.c
src/core/ipv4/ip.c
src/core/ipv4/ip_addr.c
src/core/ipv4/ip_frag.c
src/core/ipv6/icmp6.c
src/core/ipv6/ip6.c
src/core/ipv6/ip6_addr.c
src/core/mem.c
src/core/netif.c
src/core/pbuf.c
src/core/stats.c
src/core/sys.c
src/core/tcp.c
src/core/tcp_in.c
src/core/tcp_out.c
src/core/udp.c
src/include/ipv4/lwip/icmp.h
src/include/ipv4/lwip/inet.h
src/include/ipv4/lwip/ip.h
src/include/ipv6/lwip/ip.h
src/include/lwip/debug.h
src/include/lwip/err.h
src/include/lwip/mem.h
src/include/lwip/memp.h
src/include/lwip/opt.h
src/include/lwip/pbuf.h
src/include/lwip/tcp.h
src/netif/etharp.c
src/netif/loopif.c
src/netif/slipif.c

index fd2c9f2ac1bb575e0c6cd0f06a4806addaff8294..e390628b9fdfbce3bc5aa70b194b20b44ec149fc 100644 (file)
 /* This is the part of the API that is linked with
    the application */
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 #include "lwip/api.h"
 #include "lwip/api_msg.h"
 #include "lwip/memp.h"
 
-#include "lwip/debug.h"
-
 /*-----------------------------------------------------------------------------------*/
 struct
 netbuf *netbuf_new(void)
index c9924212e3acb7b166d7e9064b28c4367bcf48d8..c550edd4533919437606743287e9bb71478afcef 100644 (file)
@@ -30,7 +30,7 @@
  *
  */
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 #include "lwip/arch.h"
 #include "lwip/api_msg.h"
 #include "lwip/memp.h"
index d8e8361fdf9de15c1485599a77f5edcb7c8cde2b..643124866402e9fe1d395f80150b6c470c5550b0 100644 (file)
@@ -32,7 +32,7 @@
  *
  */
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 #include "lwip/api.h"
 #include "lwip/arch.h"
 #include "lwip/sys.h"
index 7666fd03da853b02b602261408fab589a7a56297..2027cd39eb7971d3c779850b2bc458dc90815993 100644 (file)
@@ -30,8 +30,6 @@
  *
  */
 
-#include "lwip/debug.h"
-
 #include "lwip/opt.h"
 
 #include "lwip/sys.h"
index 3e1a2e358b7cf360db9a69ce0f92f16af9dbd41a..abf18e751d0f28a5303fbbcd87ad4fdb13715fee 100644 (file)
@@ -60,7 +60,6 @@
  * to remove the DHCP client.
  *
  */
-#include "lwip/debug.h"
 #include "lwip/stats.h"
 #include "lwip/mem.h"
 #include "lwip/udp.h"
index d2bcc3ec799b626f66c2f391bc892222f7f0fa14..9cabcebb015df989d54ea417a8a18cee3656616e 100644 (file)
@@ -39,7 +39,7 @@
  */
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/arch.h"
 
@@ -168,5 +168,33 @@ inet_chksum_pbuf(struct pbuf *p)
   return ~(acc & 0xffffUL);
 }
 
-
+#if BYTE_ORDER == LITTLE_ENDIAN
+/*-----------------------------------------------------------------------------------*/
+u16_t
+htons(u16_t n)
+{
+  return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
+}
+/*-----------------------------------------------------------------------------------*/
+u16_t
+ntohs(u16_t n)
+{
+  return htons(n);
+}
+/*-----------------------------------------------------------------------------------*/
+u32_t
+htonl(u32_t n)
+{
+  return ((n & 0xff) << 24) |
+    ((n & 0xff00) << 8) |
+    ((n & 0xff0000) >> 8) |
+    ((n & 0xff000000) >> 24);
+}
+/*-----------------------------------------------------------------------------------*/
+u32_t
+ntohl(u32_t n)
+{
+  return htonl(n);
+}
 /*-----------------------------------------------------------------------------------*/
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
index 2f636f153151e0348977ea6f1cfbacdb59a1d9dc..b0d087bf591bd8a46b79d58dec2f87d031cb317e 100644 (file)
@@ -39,7 +39,7 @@
  */
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/def.h"
 #include "lwip/inet.h"
index e54a579d2a9a4463b44f3f09e8d629fe50b23ee2..6b52380118f18271d38a6e44506a5f35fe7a162f 100644 (file)
@@ -33,7 +33,7 @@
 /* Some ICMP messages should be passed to the transport protocols. This
    is not implemented. */
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/icmp.h"
 #include "lwip/inet.h"
index 5bfc6e607c018923df76d9e8dd2222b3328df81d..88e3da576950a252d56174844b5cd3d51bb3d65a 100644 (file)
@@ -39,7 +39,8 @@
  */   
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
+
 
 #include "lwip/def.h"
 #include "lwip/mem.h"
index 44432a3d168bdef2471259cc8b723abbd82e0191..24b0497ee65fdc0cd863d74a32019a36f74f3eb6 100644 (file)
@@ -30,7 +30,6 @@
  *
  */
 
-#include "lwip/debug.h"
 #include "lwip/ip_addr.h"
 #include "lwip/inet.h"
 
index dcf21e7d706ec194664f1e194c99bd53d883fbbb..426926b34c8dda9c78de00b6e37e9670acebd08b 100644 (file)
@@ -39,7 +39,7 @@
  */
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 #include "lwip/sys.h"
 #include "lwip/ip.h"
 #include "lwip/ip_frag.h"
index 8f2788f1e925424e2b7729b643147e38a9dd2f90..47c993f166f3b79d04d5bfb3b0f13daf87799838 100644 (file)
@@ -33,7 +33,7 @@
 /* Some ICMP messages should be passed to the transport protocols. This
    is not implemented. */
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/icmp.h"
 #include "lwip/inet.h"
index 0894d9e0fd73a0b6eb8526f80db13930f14999c9..ef60e3a7b16416a6776cb7424faf0ea28edaa7d5 100644 (file)
@@ -39,7 +39,7 @@
  */   
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/def.h"
 #include "lwip/mem.h"
index 9e567e6d5737ee849cbe4b17056be9110169eb43..ed1664ae62eb93ec6b426f0b9d24af65014be1e3 100644 (file)
@@ -30,7 +30,6 @@
  *
  */
 
-#include "lwip/debug.h"
 #include "lwip/ip_addr.h"
 #include "lwip/inet.h"
 
index 3c085e86d0c9048b0ac12ca8c1324c59e2b2c53d..9bfad44766f077dd37901e54f2e0caf55386821b 100644 (file)
@@ -37,7 +37,6 @@
  *
  */
 /*-----------------------------------------------------------------------------------*/
-#include "lwip/debug.h"
 
 #include "lwip/arch.h"
 #include "lwip/opt.h"
index 31396e1ac163571959dca871339364e2e7f18814..487f8caa1e0a504a46eb11773429b8705efc4e4d 100644 (file)
@@ -30,7 +30,7 @@
  *
  */
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/def.h"
 #include "lwip/mem.h"
index 571df8acd3175419dd226d57d17118f2b9c2f58d..e4c56d656b088f00e22ac91e268674947bf825ef 100644 (file)
@@ -38,7 +38,7 @@
  *
  */
 /*-----------------------------------------------------------------------------------*/
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/stats.h"
 
index ad0b8a1f8f337ec7efca6f3d1fd6e7489a75be2e..6685c86a25716eb44a9c7d394c41f39bcb334d9a 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 
-#include "lwip/debug.h"
 #include "lwip/opt.h"
 
 #include "lwip/def.h"
index 79b866c52cc574b4b8a501f58b1113d8d59c792b..ea4d893a6034155cb2c5c9b64dd60a4e1935da1e 100644 (file)
@@ -30,8 +30,6 @@
  *
  */
 
-#include "lwip/debug.h"
-
 #include "lwip/sys.h"
 #include "lwip/opt.h"
 #include "lwip/def.h"
index 7254d47445e1e942df6fb51198d5e330e3c6c9fe..d43ddaece4e412f43e38bb6e73687d1f6351a9a2 100644 (file)
  */
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
 
+#include "lwip/opt.h"
 #include "lwip/def.h"
 #include "lwip/mem.h"
 #include "lwip/memp.h"
 
 #include "lwip/tcp.h"
 
-#include "lwip/opt.h"
 
 /* Incremented every coarse grained timer shot
    (typically every 500 ms, determined by TCP_COARSE_TIMEOUT). */
@@ -430,7 +429,7 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
   TCP_REG(&tcp_active_pcbs, pcb);
   
   /* Build an MSS option */
-  optdata = HTONL(((u32_t)2 << 24) | 
+  optdata = htonl(((u32_t)2 << 24) | 
                  ((u32_t)4 << 16) | 
                  (((u32_t)pcb->mss / 256) << 8) |
                  (pcb->mss & 255));
index eb5a5d3ed857050b6e928659c1bcc9d4656f1f4c..df3b89a96c8b80c0ad8a8de3b2fa1598154abe78 100644 (file)
@@ -41,7 +41,6 @@
  */
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
 
 #include "lwip/def.h"
 #include "lwip/opt.h"
@@ -387,7 +386,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
     tcp_parseopt(npcb);
     
     /* Build an MSS option. */
-    optdata = HTONL(((u32_t)2 << 24) | 
+    optdata = htonl(((u32_t)2 << 24) | 
                    ((u32_t)4 << 16) | 
                    (((u32_t)npcb->mss / 256) << 8) |
                    (npcb->mss & 255));
@@ -725,12 +724,10 @@ tcp_receive(struct tcp_pcb *pcb)
        tcp_seg_free(next);
        
        DEBUGF(TCP_QLEN_DEBUG, ("%d (after freeing unacked)\n", pcb->snd_queuelen));
-#ifdef LWIP_DEBUG
        if(pcb->snd_queuelen != 0) {
          LWIP_ASSERT("tcp_receive: valid queue length", pcb->unacked != NULL ||
                 pcb->unsent != NULL);      
        }
-#endif /* LWIP_DEBUG */
       }
       pcb->polltmr = 0;
     }
@@ -756,12 +753,10 @@ tcp_receive(struct tcp_pcb *pcb)
        pcb->snd_queuelen -= pbuf_clen(next->p);
        tcp_seg_free(next);
        DEBUGF(TCP_QLEN_DEBUG, ("%d (after freeing unsent)\n", pcb->snd_queuelen));
-#ifdef LWIP_DEBUG
        if(pcb->snd_queuelen != 0) {
          LWIP_ASSERT("tcp_receive: valid queue length", pcb->unacked != NULL ||
                 pcb->unsent != NULL);      
        }
-#endif /* LWIP_DEBUG */
        
         if(pcb->unsent != NULL) {
           pcb->snd_nxt = htonl(pcb->unsent->tcphdr->seqno);
index 4c9643a4bfc70406e9d8e8288f348940019f5bbb..29b8f4fd6b94c498328ab7f5f71f113299cb94fa 100644 (file)
@@ -38,7 +38,6 @@
  */
 /*-----------------------------------------------------------------------------------*/
 
-#include "lwip/debug.h"
 
 #include "lwip/def.h"
 #include "lwip/opt.h"
@@ -125,12 +124,10 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
     goto memerr;
   }   
 
-#ifdef LWIP_DEBUG
   if(pcb->snd_queuelen != 0) {
     LWIP_ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
     pcb->unsent != NULL);      
   }
-#endif /* LWIP_DEBUG */
 
   seg = NULL;
   seglen = 0;
@@ -306,13 +303,11 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
   pcb->snd_buf -= len;
   pcb->snd_queuelen = queuelen;
   DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %d (after enqueued)\n", pcb->snd_queuelen));
-#ifdef LWIP_DEBUG
   if(pcb->snd_queuelen != 0) {
     LWIP_ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
       pcb->unsent != NULL);
 
   }
-#endif /* LWIP_DEBUG */
 
   /* Set the PSH flag in the last segment that we enqueued, but only
   if the segment has data (indicated by seglen > 0). */
@@ -329,13 +324,11 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
   if(queue != NULL) {
     tcp_segs_free(queue);
   }
-#ifdef LWIP_DEBUG
   if(pcb->snd_queuelen != 0) {
     LWIP_ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
       pcb->unsent != NULL);
 
   }
-#endif /* LWIP_DEBUG */
   DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen));
   return ERR_MEM;
 }
index 42ce7e30547b62a357eb33b740372442680e427a..587747542cc5d8323af0d111576d3d830346eb1c 100644 (file)
@@ -37,7 +37,7 @@
  *
  */
 /*-----------------------------------------------------------------------------------*/
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "lwip/def.h"
 #include "lwip/memp.h"
@@ -94,8 +94,8 @@ udp_lookup(struct ip_hdr *iphdr, struct netif *inp)
 
     udphdr = (struct udp_hdr *)(u8_t *)iphdr + IPH_HL(iphdr) * 4;
 
-  src = NTOHS(udphdr->src);
-  dest = NTOHS(udphdr->dest);
+  src = ntohs(udphdr->src);
+  dest = ntohs(udphdr->dest);
 
     pcb = pcb_cache;
   if(pcb != NULL &&
@@ -177,8 +177,8 @@ udp_input(struct pbuf *p, struct netif *inp)
   
   DEBUGF(UDP_DEBUG, ("udp_input: received datagram of length %u\n", p->tot_len));
        
-  src = NTOHS(udphdr->src);
-  dest = NTOHS(udphdr->dest);
+  src = ntohs(udphdr->src);
+  dest = ntohs(udphdr->dest);
 
 #if UDP_DEBUG
   udp_debug_print(udphdr);
index 6458cdf07a88f1465cfa36946fb0678cfedccff4..ae201f87fc907a781094154976cacf699082ec24 100644 (file)
@@ -101,11 +101,11 @@ PACK_STRUCT_END
 #  include "arch/epstruct.h"
 #endif
 
-#define ICMPH_TYPE(hdr) (NTOHS((hdr)->_type_code) >> 8)
-#define ICMPH_CODE(hdr) (NTOHS((hdr)->_type_code) & 0xff)
+#define ICMPH_TYPE(hdr) (ntohs((hdr)->_type_code) >> 8)
+#define ICMPH_CODE(hdr) (ntohs((hdr)->_type_code) & 0xff)
 
-#define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = HTONS(ICMPH_CODE(hdr) | ((type) << 8)))
-#define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = HTONS((code) | (ICMPH_TYPE(hdr) << 8)))
+#define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = htons(ICMPH_CODE(hdr) | ((type) << 8)))
+#define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = htons((code) | (ICMPH_TYPE(hdr) << 8)))
 
 #endif /* __LWIP_ICMP_H__ */
          
index de0563229abde697db9180ad2648a45e36a4bce3..8b2aa4123758f6b167d6117c0cb47f78ed9b5433 100644 (file)
@@ -43,20 +43,6 @@ u16_t inet_chksum_pbuf(struct pbuf *p);
 u16_t inet_chksum_pseudo(struct pbuf *p,
                         struct ip_addr *src, struct ip_addr *dest,
                         u8_t proto, u16_t proto_len);
-
-#ifdef HTONS
-#undef HTONS
-#endif /* HTONS */
-#ifdef NTOHS
-#undef NTOHS
-#endif /* NTOHS */
-#ifdef HTONL
-#undef HTONL
-#endif /* HTONL */
-#ifdef NTOHL
-#undef NTOHL
-#endif /* NTOHL */
-
 #ifdef htons
 #undef htons
 #endif /* htons */
@@ -70,36 +56,17 @@ u16_t inet_chksum_pseudo(struct pbuf *p,
 #undef ntohl
 #endif /* ntohl */
 
-
-
-#ifndef HTONS
-#   if BYTE_ORDER == BIG_ENDIAN
-#      define HTONS(n) (n)
-#   else /* BYTE_ORDER == BIG_ENDIAN */
-#      define HTONS(n) (((((u16_t)(n) & 0xff)) << 8) | (((u16_t)(n) & 0xff00) >> 8))
-#   endif /* BYTE_ORDER == BIG_ENDIAN */
-#endif /* HTONS */
-
-#define htons HTONS
-#define NTOHS HTONS
-#define ntohs htons
-
-
-#ifndef HTONL
-#   if BYTE_ORDER == BIG_ENDIAN
-#      define HTONL(n) (n)
-#   else /* BYTE_ORDER == BIG_ENDIAN */
-#      define HTONL(n) (((((u32_t)(n) & 0xff)) << 24) | \
-                        ((((u32_t)(n) & 0xff00)) << 8) | \
-                        ((((u32_t)(n) & 0xff0000)) >> 8) | \
-                        ((((u32_t)(n) & 0xff000000)) >> 24))
-#   endif /* BYTE_ORDER == BIG_ENDIAN */
-#endif /* HTONL */
-
-
-#define htonl HTONL
-#define NTOHL HTONL
-#define ntohl htonl
+#if BYTE_ORDER == BIG_ENDIAN
+#define htons(x) (x)
+#define ntohs(x) (x)
+#define htonl(x) (x)
+#define ntohl(x) (x)
+#else
+u16_t htons(u16_t x);
+u16_t ntohs(u16_t x);
+u32_t htonl(u32_t x);
+u32_t ntohl(u32_t x);
+#endif
 
 #endif /* __LWIP_INET_H__ */
 
index 21b9ba3e0a2009fec0f628c9c1c4a622980b0190..575c8b9f9d78ac2e27913969cf53c7422079608e 100644 (file)
@@ -97,22 +97,22 @@ PACK_STRUCT_END
 #  include "arch/epstruct.h"
 #endif
 
-#define IPH_V(hdr)  (NTOHS((hdr)->_v_hl_tos) >> 12)
-#define IPH_HL(hdr) ((NTOHS((hdr)->_v_hl_tos) >> 8) & 0x0f)
-#define IPH_TOS(hdr) (HTONS((NTOHS((hdr)->_v_hl_tos) & 0xff)))
+#define IPH_V(hdr)  (ntohs((hdr)->_v_hl_tos) >> 12)
+#define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f)
+#define IPH_TOS(hdr) (htons((ntohs((hdr)->_v_hl_tos) & 0xff)))
 #define IPH_LEN(hdr) ((hdr)->_len)
 #define IPH_ID(hdr) ((hdr)->_id)
 #define IPH_OFFSET(hdr) ((hdr)->_offset)
-#define IPH_TTL(hdr) (NTOHS((hdr)->_ttl_proto) >> 8)
-#define IPH_PROTO(hdr) (NTOHS((hdr)->_ttl_proto) & 0xff)
+#define IPH_TTL(hdr) (ntohs((hdr)->_ttl_proto) >> 8)
+#define IPH_PROTO(hdr) (ntohs((hdr)->_ttl_proto) & 0xff)
 #define IPH_CHKSUM(hdr) ((hdr)->_chksum)
 
-#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (HTONS(((v) << 12) | ((hl) << 8) | (tos)))
+#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos)))
 #define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
 #define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
 #define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
-#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (HTONS(IPH_PROTO(hdr) | ((ttl) << 8)))
-#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (HTONS((proto) | (IPH_TTL(hdr) << 8)))
+#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | ((ttl) << 8)))
+#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (htons((proto) | (IPH_TTL(hdr) << 8)))
 #define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
 
 #if IP_DEBUG
index cd33725230355cf01ce845db130652775865109f..74250942633fef36b9ca255588544ccd80261514 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef __LWIP_IP_H__
 #define __LWIP_IP_H__
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 #include "lwip/def.h"
 #include "lwip/pbuf.h"
 #include "lwip/ip_addr.h"
index 18a263b7c3fbfd794c7dc3496008e57b6ffc0d8b..3d4e34cb16761585a5e9162ec45904a622f4c862 100644 (file)
@@ -41,7 +41,7 @@
  * - 3 severe
  */
 #define DBG_MASK_LEVEL 3
-
+#define DBG_TYPES_ON 0
 /** print only debug messages with this level or higher */
 #define DBG_MIN_LEVEL 0
 
@@ -59,6 +59,7 @@
 /** flag for DEBUGF to halt after printing this debug message */
 #define DBG_HALT    0x08
 
+
 #ifdef LWIP_DEBUG
 
 #define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
   * AND is at least DBG_LEVEL */
 #define DEBUGF(debug, x) do { if ((debug & DBG_ON) && (debug & DBG_TYPES_ON) && ((debug & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if (debug & DBG_HALT) while(1); } } while(0)
 #define LWIP_ERROR(x)   do { LWIP_PLATFORM_DIAG(x); } while(0) 
-
 #else /* LWIP_DEBUG */
 
 #define LWIP_ASSERT(x,y) 
 #define DEBUGF(debug, x) 
 #define LWIP_ERROR(x)  
 
-#define DBG_TYPES_ON 0U
-
- /**
- * Disable all debug messages
- */
-#define DEMO_DEBUG       DBG_OFF
-#define ETHARP_DEBUG     DBG_OFF
-#define NETIF_DEBUG      DBG_OFF
-#define PBUF_DEBUG       DBG_OFF
-#define DELIF_DEBUG      DBG_OFF
-#define DROPIF_DEBUG     DBG_OFF
-#define TUNIF_DEBUG      DBG_OFF
-#define UNIXIF_DEBUG     DBG_OFF
-#define TAPIF_DEBUG      DBG_OFF
-#define SIO_FIFO_DEBUG   DBG_OFF
-#define PPP_DEBUG        DBG_OFF
-#define API_LIB_DEBUG    DBG_OFF
-#define API_MSG_DEBUG    DBG_OFF
-#define SOCKETS_DEBUG    DBG_OFF
-#define ICMP_DEBUG       DBG_OFF
-#define INET_DEBUG       DBG_OFF
-#define IP_DEBUG         DBG_OFF
-#define IP_REASS_DEBUG   DBG_OFF
-#define MEM_DEBUG        DBG_OFF
-#define MEMP_DEBUG       DBG_OFF
-#define SYS_DEBUG        DBG_OFF
-#define TCP_DEBUG        DBG_OFF
-#define TCP_INPUT_DEBUG  DBG_OFF
-#define TCP_FR_DEBUG     DBG_OFF
-#define TCP_RTO_DEBUG    DBG_OFF
-#define TCP_REXMIT_DEBUG DBG_OFF
-#define TCP_CWND_DEBUG   DBG_OFF
-#define TCP_WND_DEBUG    DBG_OFF
-#define TCP_OUTPUT_DEBUG DBG_OFF
-#define TCP_RST_DEBUG    DBG_OFF
-#define TCP_QLEN_DEBUG   DBG_OFF
-#define UDP_DEBUG        DBG_OFF
-#define TCPIP_DEBUG      DBG_OFF
-#define TCPDUMP_DEBUG    DBG_OFF
-#define DHCP_DEBUG       DBG_OFF
 
 #endif /* LWIP_DEBUG */
 
index baab539da69591e9e08c768022f626c772ebe981..d68479f87ccd54ea0186974223198bc99a6976ab 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef __LWIP_ERR_H__
 #define __LWIP_ERR_H__
 
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 
 #include "arch/cc.h"
 
index 8683a1033c0abd7ed0bb66a141fb50a6d82504af..2bd55cac6dbac470f935b5675d56f8cfdec664d0 100644 (file)
@@ -32,7 +32,6 @@
 #ifndef __LWIP_MEM_H__
 #define __LWIP_MEM_H__
 
-#include "lwip/debug.h"
 #include "lwip/opt.h"
 #include "lwip/arch.h"
 
index 1563014fb937aaae5fa06e19a4cf0e2f76711a23..ecd0cce0655714fe22a6aa33bc15a8479c55d273 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef __LWIP_MEMP_H__
 #define __LWIP_MEMP_H__
 
-#include "lwip/debug.h"
 #include "lwip/opt.h"
 
 typedef enum {
index 81d81712f0792ce85a6ae5a66215c3bd10e7f691..49e9a4dcd9c288edfdd0d20e10d520f982d55620 100644 (file)
 #ifndef __LWIP_OPT_H__
 #define __LWIP_OPT_H__
 
+#include "lwip/debug.h"
+/* Include user options which override defaults */
 #include "lwipopts.h"
 
 /* Define some handy default values for configuration parameters. */
 
+
+/*FIXME These were taken from unixsim lwipopts.More sensitive values should be here
+ * nicely documented and categorized 
+ **/
+
+#define LWIP_COMPAT_SOCKETS
+/* ---------- Memory options ---------- */
+/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
+   lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
+   byte alignment -> define MEM_ALIGNMENT to 2. */
+#define MEM_ALIGNMENT           1
+
+/* MEM_SIZE: the size of the heap memory. If the application will send
+a lot of data that needs to be copied, this should be set high. */
+#define MEM_SIZE                1600
+
+/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
+   sends a lot of data out of ROM (or other static memory), this
+   should be set high. */
+#define MEMP_NUM_PBUF           16
+/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
+   per active UDP "connection". */
+#define MEMP_NUM_UDP_PCB        4
+/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
+   connections. */
+#define MEMP_NUM_TCP_PCB        5
+/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
+   connections. */
+#define MEMP_NUM_TCP_PCB_LISTEN 8
+/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
+   segments. */
+#define MEMP_NUM_TCP_SEG        16
+/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
+   timeouts. */
+#define MEMP_NUM_SYS_TIMEOUT    3
+
+/* The following four are used only with the sequential API and can be
+   set to 0 if the application only will use the raw API. */
+/* MEMP_NUM_NETBUF: the number of struct netbufs. */
+#define MEMP_NUM_NETBUF         2
+/* MEMP_NUM_NETCONN: the number of struct netconns. */
+#define MEMP_NUM_NETCONN        4
+/* MEMP_NUM_APIMSG: the number of struct api_msg, used for
+   communication between the TCP/IP stack and the sequential
+   programs. */
+#define MEMP_NUM_API_MSG        8
+/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
+   for sequential API communication and incoming packets. Used in
+   src/api/tcpip.c. */
+#define MEMP_NUM_TCPIP_MSG      8
+
+/* These two control is reclaimer functions should be compiled
+   in. Should always be turned on (1). */
+#define MEM_RECLAIM             1
+#define MEMP_RECLAIM            1
+
+/* ---------- Pbuf options ---------- */
+/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
+#define PBUF_POOL_SIZE          100
+
+/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
+#define PBUF_POOL_BUFSIZE       128
+
+/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
+   link level header. */
+#define PBUF_LINK_HLEN          16
+
+/** SYS_LIGHTWEIGHT_PROT
+ * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
+ * for certain critical regions during buffer allocation, deallocation and memory
+ * allocation and deallocation.
+ */
+/*#define SYS_LIGHTWEIGHT_PROT           1*/
+
+/* ---------- TCP options ---------- */
+#define LWIP_TCP                1
+#define TCP_TTL                 255
+
+/* Controls if TCP should queue segments that arrive out of
+   order. Define to 0 if your device is low on memory. */
+#define TCP_QUEUE_OOSEQ         1
+
+/* TCP Maximum segment size. */
+#define TCP_MSS                 128
+
+/* TCP sender buffer space (bytes). */
+#define TCP_SND_BUF             256
+
+/* TCP sender buffer space (pbufs). This must be at least = 2 *
+   TCP_SND_BUF/TCP_MSS for things to work. */
+#define TCP_SND_QUEUELEN        4 * TCP_SND_BUF/TCP_MSS
+
+/* TCP receive window. */
+#define TCP_WND                 1024
+
+/* Maximum number of retransmissions of data segments. */
+#define TCP_MAXRTX              12
+
+/* Maximum number of retransmissions of SYN segments. */
+#define TCP_SYNMAXRTX           4
+
+/* TCP writable space (bytes). This must be less than or equal
+   to TCP_SND_BUF. It is the amount of space which must be
+   available in the tcp snd_buf for select to return writable */
+#define TCP_SNDLOWAT            TCP_SND_BUF/2
+
+/* ---------- ARP options ---------- */
+#define ARP_TABLE_SIZE 10
+#define ARP_QUEUEING 1
+/**
+ * - If enabled, cache entries are generated for every kind of ARP traffic or
+ * broadcast IP traffic. This enhances behaviour for sending to a dynamic set
+ * of hosts, for example if acting as a gateway.
+ * - If disabled, cache entries are generated only for IP destination addresses
+ * in use by lwIP or applications. This enhances performance if sending to a small,
+ * reasonably static number of hosts. Typically for embedded devices.
+ */
+#define ETHARP_ALWAYS_INSERT 1
+
+
+/* ---------- IP options ---------- */
+/* Define IP_FORWARD to 1 if you wish to have the ability to forward
+   IP packets across network interfaces. If you are going to run lwIP
+   on a device with only one network interface, define this to 0. */
+#define IP_FORWARD              1
+
+/* If defined to 1, IP options are allowed (but not parsed). If
+   defined to 0, all packets with IP options are dropped. */
+#define IP_OPTIONS              1
+
+/* IP reassembly and segmentation.These are orthogonal even
+ * if they both deal with IP fragments */
+#define IP_REASSEMBLY     1
+#define IP_FRAG           1
+
+/* ---------- ICMP options ---------- */
+#define ICMP_TTL                255
+
+/* ---------- DHCP options ---------- */
+/* Define LWIP_DHCP to 1 if you want DHCP configuration of
+   interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
+   turning this on does currently not work. */
+#define LWIP_DHCP               0
+
+/* 1 if you want to do an ARP check on the offered address
+   (recommended). */
+#define DHCP_DOES_ARP_CHECK     1
+
+/* ---------- UDP options ---------- */
+#define LWIP_UDP                1
+#define UDP_TTL                 255
+
+
+/* ---------- Statistics options ---------- */
+#define STATS
+
+#ifdef STATS
+#define LINK_STATS
+#define IP_STATS
+#define ICMP_STATS
+#define UDP_STATS
+#define TCP_STATS
+#define MEM_STATS
+#define MEMP_STATS
+#define PBUF_STATS
+#define SYS_STATS
+#endif /* STATS */
+
+
+/*FIXME*/
+
+
 #ifndef ICMP_TTL
 #define ICMP_TTL                255
 #endif
 #define LWIP_CALLBACK_API 0
 #endif /* LWIP_CALLBACK_API */
 
+/* Debugging options all default to off */
+
+#ifndef DEMO_DEBUG
+#define DEMO_DEBUG     DBG_OFF
+#endif
+
+#ifndef ETHARP_DEBUG
+#define ETHARP_DEBUG     DBG_OFF
+#endif
+
+#ifndef NETIF_DEBUG
+#define NETIF_DEBUG      DBG_OFF
+#endif
+
+#ifndef PBUF_DEBUG
+#define PBUF_DEBUG       DBG_OFF
+#endif
+
+#ifndef API_LIB_DEBUG
+#define API_LIB_DEBUG    DBG_OFF
+#endif
+
+#ifndef API_MSG_DEBUG
+#define API_MSG_DEBUG    DBG_OFF
+#endif
+
+#ifndef SOCKETS_DEBUG
+#define SOCKETS_DEBUG    DBG_OFF
+#endif
+
+#ifndef ICMP_DEBUG
+#define ICMP_DEBUG       DBG_OFF
+#endif
+
+#ifndef INET_DEBUG
+#define INET_DEBUG       DBG_OFF
+#endif
+
+#ifndef IP_DEBUG
+#define IP_DEBUG         DBG_OFF
+#endif
+
+#ifndef IP_REASS_DEBUG
+#define IP_REASS_DEBUG   DBG_OFF
+#endif
+
+#ifndef MEM_DEBUG
+#define MEM_DEBUG        DBG_OFF
+#endif
+
+#ifndef MEMP_DEBUG
+#define MEMP_DEBUG       DBG_OFF
+#endif
+
+#ifndef SYS_DEBUG
+#define SYS_DEBUG        DBG_OFF
+#endif
+
+#ifndef TCP_DEBUG
+#define TCP_DEBUG        DBG_OFF
+#endif
+
+#ifndef TCP_INPUT_DEBUG
+#define TCP_INPUT_DEBUG  DBG_OFF
+#endif
+
+#ifndef TCP_FR_DEBUG
+#define TCP_FR_DEBUG     DBG_OFF
+#endif
+
+#ifndef TCP_RTO_DEBUG
+#define TCP_RTO_DEBUG    DBG_OFF
+#endif
+
+#ifndef TCP_REXMIT_DEBUG
+#define TCP_REXMIT_DEBUG DBG_OFF
+#endif
+
+#ifndef TCP_CWND_DEBUG
+#define TCP_CWND_DEBUG   DBG_OFF
+#endif
+
+#ifndef TCP_WND_DEBUG
+#define TCP_WND_DEBUG    DBG_OFF
+#endif
+
+#ifndef TCP_OUTPUT_DEBUG
+#define TCP_OUTPUT_DEBUG DBG_OFF
+#endif
+
+#ifndef TCP_RST_DEBUG
+#define TCP_RST_DEBUG    DBG_OFF
+#endif
+
+#ifndef TCP_QLEN_DEBUG
+#define TCP_QLEN_DEBUG   DBG_OFF
+#endif
+
+#ifndef UDP_DEBUG
+#define UDP_DEBUG        DBG_OFF
+#endif
+
+#ifndef TCPIP_DEBUG
+#define TCPIP_DEBUG      DBG_OFF
+#endif
+
+#ifndef SLIP_DEBUG 
+#define SLIP_DEBUG       DBG_OFF
+#endif
+
+#ifndef DHCP_DEBUG 
+#define DHCP_DEBUG       DBG_OFF
+#endif
+
+
 #endif /* __LWIP_OPT_H__ */
 
 
index 9381312378fdcf20a364629fa12df7fc53d602af..ea39552bfb554f83c24eb6d33b1c24a02dd4fdca 100644 (file)
@@ -33,8 +33,7 @@
 #ifndef __LWIP_PBUF_H__
 #define __LWIP_PBUF_H__
 
-#include "lwip/debug.h"
-#include "lwip/arch.h"
+#include "arch/cc.h"
 
 
 #define PBUF_TRANSPORT_HLEN 20
index e76729e9df54f23623dc8721d6f2d9e06be0a882..74be892dc3d4172e2bbedd0974e934521bfef418 100644 (file)
@@ -168,11 +168,11 @@ PACK_STRUCT_END
 #  include "arch/epstruct.h"
 #endif
 
-#define TCPH_OFFSET(hdr) (NTOHS((hdr)->_offset_flags) >> 8)
-#define TCPH_FLAGS(hdr) (NTOHS((hdr)->_offset_flags) & 0xff)
+#define TCPH_OFFSET(hdr) (ntohs((hdr)->_offset_flags) >> 8)
+#define TCPH_FLAGS(hdr) (ntohs((hdr)->_offset_flags) & 0xff)
 
-#define TCPH_OFFSET_SET(hdr, offset) (hdr)->_offset_flags = HTONS(((offset) << 8) | TCPH_FLAGS(hdr))
-#define TCPH_FLAGS_SET(hdr, flags) (hdr)->_offset_flags = HTONS((TCPH_OFFSET(hdr) << 8) | (flags))
+#define TCPH_OFFSET_SET(hdr, offset) (hdr)->_offset_flags = htons(((offset) << 8) | TCPH_FLAGS(hdr))
+#define TCPH_FLAGS_SET(hdr, flags) (hdr)->_offset_flags = htons((TCPH_OFFSET(hdr) << 8) | (flags))
 
 #define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \
                                        TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0))
index 19e108b2331c16cabec753a35e17afc0017124d9..94f2e26892b75e43fc63c61b679fc3a9d54fadb9 100644 (file)
@@ -3,6 +3,10 @@
  * Address Resolution Protocol module for IP over Ethernet
  *
  * $Log: etharp.c,v $
+ * Revision 1.28  2003/02/21 16:43:46  jani
+ * byte-order handling functions are in inet.c now and the uperrcase counterparts are gone. opt.h has all the
+ * configurable items debug does not need to be directly included.
+ *
  * Revision 1.27  2003/02/20 16:32:24  jani
  * do not directly include lwipopts.h but lwip/opt.h instead
  *
@@ -156,7 +160,6 @@ RFC 3220 4.6          IP Mobility Support for IPv4          January 2002
 */
 
 #include "lwip/opt.h"
-#include "lwip/debug.h"
 #include "lwip/inet.h"
 #include "netif/etharp.h"
 #include "lwip/ip.h"
@@ -182,11 +185,11 @@ RFC 3220 4.6          IP Mobility Support for IPv4          January 2002
 #define ARP_REQUEST 1
 #define ARP_REPLY 2
 
-#define ARPH_HWLEN(hdr) (NTOHS((hdr)->_hwlen_protolen) >> 8)
-#define ARPH_PROTOLEN(hdr) (NTOHS((hdr)->_hwlen_protolen) & 0xff)
+#define ARPH_HWLEN(hdr) (ntohs((hdr)->_hwlen_protolen) >> 8)
+#define ARPH_PROTOLEN(hdr) (ntohs((hdr)->_hwlen_protolen) & 0xff)
 
-#define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8))
-#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8))
+#define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen = htons(ARPH_PROTOLEN(hdr) | ((len) << 8))
+#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = htons((len) | (ARPH_HWLEN(hdr) << 8))
 
 enum etharp_state {
   ETHARP_STATE_EMPTY,
index bdfef8548b5b3ff50fda959d40198cdc3af22dd7..cdb5437c37150d7fed19a386db098bf3577e6f4c 100644 (file)
@@ -29,7 +29,6 @@
  * Author: Adam Dunkels <adam@sics.se>
  *
  */
-#include "lwip/debug.h"
 #include "lwip/mem.h"
 #include "lwip/opt.h"
 #include "netif/loopif.h"
index 49136f1bc6af6f7306c29d0e743bf0150ae7e529..2375db445237dddf91e1fa212b220904c4b757ed 100644 (file)
@@ -37,7 +37,7 @@
  */ 
 
 #include "netif/slipif.h"
-#include "lwip/debug.h"
+#include "lwip/opt.h"
 #include "lwip/def.h"
 #include "lwip/pbuf.h"
 #include "lwip/sys.h"