mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-03 04:13:31 +00:00
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.
This commit is contained in:
parent
d372121d6e
commit
18df3961e9
@ -33,13 +33,11 @@
|
||||
/* 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)
|
||||
|
@ -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"
|
||||
|
@ -32,7 +32,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/api.h"
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/sys.h"
|
||||
|
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/sys.h"
|
||||
|
@ -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"
|
||||
|
@ -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 */
|
||||
|
@ -39,7 +39,7 @@
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/inet.h"
|
||||
|
@ -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"
|
||||
|
@ -39,7 +39,8 @@
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
|
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/inet.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -39,7 +39,7 @@
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
|
@ -30,7 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/inet.h"
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "lwip/opt.h"
|
||||
|
@ -30,7 +30,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
|
@ -38,7 +38,7 @@
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/def.h"
|
||||
|
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/def.h"
|
||||
|
@ -40,15 +40,14 @@
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#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));
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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__ */
|
||||
|
||||
|
@ -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__ */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
@ -66,53 +67,12 @@
|
||||
* 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 */
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#ifndef __LWIP_ERR_H__
|
||||
#define __LWIP_ERR_H__
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "arch/cc.h"
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#ifndef __LWIP_MEM_H__
|
||||
#define __LWIP_MEM_H__
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/arch.h"
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#ifndef __LWIP_MEMP_H__
|
||||
#define __LWIP_MEMP_H__
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
typedef enum {
|
||||
|
@ -32,10 +32,184 @@
|
||||
#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
|
||||
@ -96,6 +270,121 @@
|
||||
#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__ */
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user