diff --git a/CHANGELOG b/CHANGELOG index d3779bb5..b4563abc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -245,9 +245,9 @@ HISTORY 2007-05-11 Frédéric Bernon * sockets.c, api_lib.c, api_msg.h, api_msg.c, netifapi.h, netifapi.c, tcpip.c: - Include a function pointer instead of a table index in the message to reduce - footprint. Disable some part of lwip_send and lwip_sendto if some options are - not set (LWIP_TCP, LWIP_UDP, LWIP_RAW). + Include a function pointer instead of a table index in the message to reduce + footprint. Disable some part of lwip_send and lwip_sendto if some options are + not set (LWIP_TCP, LWIP_UDP, LWIP_RAW). 2007-05-10 Simon Goldschmidt * *.h (except netif/ppp/*.h): Included patch #5448: include '#ifdef __cplusplus @@ -311,7 +311,7 @@ HISTORY device, and we can use ARP with it to do a "gratuitous ARP" (RFC 3220 "IP Mobility Support for IPv4" section 4.6) when interface is "up" with netif_set_up(). - 2007-03-26 Frédéric Bernon, Jonathan Larmour + 2007-03-26 Frédéric Bernon, Jonathan Larmour * opt.h, tcpip.c: New configuration option LWIP_ARP allow to disable ARP init at build time if you only use PPP or SLIP. The default is enable. Note we don't have to call etharp_init in your port's initilization sequence if you use tcpip.c, because this call @@ -340,7 +340,7 @@ HISTORY be configured at run time with LWIP_TCP_KEEPALIVE, but don't change this unless you know what you're doing (default are RFC1122 compliant). Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set in seconds. - + 2007-03-08 Frédéric Bernon * tcp.h: Keepalive values can be configured at compile time, but don't change this unless you know what you're doing (default are RFC1122 compliant). @@ -349,7 +349,7 @@ HISTORY * sockets.c, api.h, api_lib.c, tcpip.c, sys.h, sys.c, err.c, opt.h: Implement LWIP_SO_RCVTIMEO configuration option to enable/disable SO_RCVTIMEO on UDP sockets/netconn. - + 2007-03-08 Simon Goldschmidt * snmp_msg.h, msg_in.c: SNMP UDP ports can be configured at compile time. @@ -730,7 +730,7 @@ HISTORY 2007-03-20 Frédéric Bernon * memp.h, stats.c: Fix stats_display function where memp_names table wasn't synchronized with memp.h. - + 2007-03-20 Frédéric Bernon * tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input, tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with @@ -743,10 +743,10 @@ HISTORY 2007-03-19 Frédéric Bernon * api_msg.h, api_msg.c, tcpip.h, tcpip.c: Add return types to tcpip_apimsg() and api_msg_post(). - + 2007-03-19 Frédéric Bernon * Remove unimplemented "memp_realloc" function from memp.h. - + 2007-03-11 Simon Goldschmidt * pbuf.c: checked in patch #5796: pbuf_alloc: len field claculation caused memory corruption. @@ -785,15 +785,15 @@ HISTORY (protecting ARP layer against concurrent access). You can also disable old code using tcp_input with new define ETHARP_TCPIP_INPUT set to 0. Older ports have to use tcpip_ethinput. - + 2007-03-06 Simon Goldschmidt (based on patch from Dmitry Potapov) * err.h, err.c: fixed compiler warning "initialization dircards qualifiers from pointer target type" - + 2007-03-05 Frédéric Bernon * opt.h, sockets.h: add new configuration options (LWIP_POSIX_SOCKETS_IO_NAMES, ETHARP_TRUST_IP_MAC, review SO_REUSE) - + 2007-03-04 Frédéric Bernon * api_msg.c: Remove some compiler warnings : parameter "pcb" was never referenced. @@ -802,7 +802,7 @@ HISTORY * api_lib.c: Fix "[patch #5764] api_lib.c cleanup: after patch #5687" (from Dmitry Potapov). The api_msg struct stay on the stack (not moved to netconn struct). - + 2007-03-04 Simon Goldschmidt (based on patch from Dmitry Potapov) * pbuf.c: Fix BUG#19168 - pbuf_free can cause deadlock (if SYS_LIGHTWEIGHT_PROT=1 & freeing PBUF_RAM when mem_sem is not available) @@ -859,7 +859,7 @@ HISTORY 2006-08-08 Christiaan Simons * etharp.{c,h}: added etharp_find_addr() to read (stable) ethernet/IP address pair from ARP table - + 2006-07-14 Christiaan Simons * mib_structs.c: added * include/lwip/snmp_structs.h: added @@ -871,7 +871,7 @@ HISTORY * snmp/msg_{in,out}.c added * include/lwip/snmp_asn1.h added * include/lwip/snmp_msg.h added - * doc/snmp_agent.txt added + * doc/snmp_agent.txt added 2006-03-29 Christiaan Simons * inet.c, inet.h: Added platform byteswap support. @@ -879,7 +879,7 @@ HISTORY optional LWIP_PLATFORM_HTONS(), LWIP_PLATFORM_HTONL() macros. ++ Bug fixes: - + 2006-11-30 Christiaan Simons * dhcp.c: Fixed false triggers of request_timeout. @@ -901,7 +901,7 @@ HISTORY 2006-08-07 Christiaan Simons * api_msg.c: Flushing TCP output in do_close() (bug #15926). - + 2006-06-27 Christiaan Simons * api_msg.c: Applied patch for cold case (bug #11135). In accept_function() ensure newconn->callback is always initialized. @@ -935,7 +935,7 @@ HISTORY 2005-12-20 Leon Woestenberg * tcp.c: Remove PCBs which stay in LAST_ACK state too long. Patch submitted by Mitrani Hiroshi. - + 2005-12-15 Christiaan Simons * inet.c: Disabled the added summing routine to preserve code space. @@ -951,7 +951,7 @@ HISTORY 2005-11-25 Christiaan Simons * udp.c tcp.c: Removed SO_REUSE hack. Should reside in socket code only. * *.c: introduced cc.h LWIP_DEBUG formatters matching the u16_t, s16_t, - u32_t, s32_t typedefs. This solves most debug word-length assumes. + u32_t, s32_t typedefs. This solves most debug word-length assumes. 2005-07-17 Leon Woestenberg * inet.c: Fixed unaligned 16-bit access in the standard checksum @@ -980,7 +980,7 @@ HISTORY ETHARP_MAX_PENDING now should be at least 2. This prevents the counter from reaching 0 right away (which would allow too little time for ARP responses to be received). - + 2004-11-25 Leon Woestenberg * dhcp.c: Decline messages were not multicast but unicast. * etharp.c: ETHARP_CREATE is renamed to ETHARP_TRY_HARD. @@ -1038,7 +1038,7 @@ HISTORY of raw_recv() in raw.h and so avoid compiler error. * sockets.c: Added trivial (int) cast to keep compiler happier. * ip.c, netif.c Changed debug statements to use the tidier ip4_addrN() macros. - + (STABLE-1_0_0) ++ Changes: @@ -1078,7 +1078,7 @@ HISTORY is not queued, and gets lost. Fixed the case where the packets destination address is already known; we now always queue the packet and perform an ARP request. - + (STABLE-0_7_0) ++ Bug fixes: diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 89bb605d..570e9bf2 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -39,14 +39,16 @@ /* This is the part of the API that is linked with the application */ -#include #include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + #include "lwip/api.h" #include "lwip/api_msg.h" #include "lwip/tcpip.h" #include "lwip/memp.h" -#if !NO_SYS +#include /** * Create a new netconn (of a specific type) that has a callback function. @@ -185,9 +187,12 @@ netconn_peer(struct netconn *conn, struct ip_addr *addr, u16_t *port) { LWIP_ERROR("netconn_peer: invalid conn", (conn != NULL), return ERR_ARG;); switch (NETCONNTYPE_GROUP(conn->type)) { +#if LWIP_RAW case NETCONN_RAW: /* return an error as connecting is only a helper for upper layers */ return ERR_CONN; +#endif /* LWIP_RAW */ +#if LWIP_UDP case NETCONN_UDP: if (conn->pcb.udp == NULL || ((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0)) @@ -195,12 +200,15 @@ netconn_peer(struct netconn *conn, struct ip_addr *addr, u16_t *port) *addr = (conn->pcb.udp->remote_ip); *port = conn->pcb.udp->remote_port; break; +#endif /* LWIP_UDP */ +#if LWIP_TCP case NETCONN_TCP: if (conn->pcb.tcp == NULL) return ERR_CONN; *addr = (conn->pcb.tcp->remote_ip); *port = conn->pcb.tcp->remote_port; break; +#endif /* LWIP_TCP */ } return ERR_OK; } @@ -221,18 +229,24 @@ netconn_addr(struct netconn *conn, struct ip_addr **addr, u16_t *port) LWIP_ERROR("netconn_addr: invalid addr", (addr != NULL), return ERR_ARG;); LWIP_ERROR("netconn_addr: invalid port", (port != NULL), return ERR_ARG;); switch (NETCONNTYPE_GROUP(conn->type)) { +#if LWIP_RAW case NETCONN_RAW: *addr = &(conn->pcb.raw->local_ip); *port = conn->pcb.raw->protocol; break; +#endif /* LWIP_RAW */ +#if LWIP_UDP case NETCONN_UDP: *addr = &(conn->pcb.udp->local_ip); *port = conn->pcb.udp->local_port; break; +#endif /* LWIP_UDP */ +#if LWIP_TCP case NETCONN_TCP: *addr = &(conn->pcb.tcp->local_ip); *port = conn->pcb.tcp->local_port; break; +#endif /* LWIP_TCP */ } return ERR_OK; } @@ -607,4 +621,4 @@ netconn_join_leave_group(struct netconn *conn, } #endif /* LWIP_IGMP */ -#endif /* !NO_SYS */ +#endif /* LWIP_NETCONN */ diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 9c4439c4..afc2b737 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -37,15 +37,15 @@ */ #include "lwip/opt.h" -#include "lwip/arch.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + #include "lwip/api_msg.h" #include "lwip/memp.h" #include "lwip/sys.h" #include "lwip/tcpip.h" #include "lwip/igmp.h" -#if !NO_SYS - /* forward declarations */ #if LWIP_TCP static err_t do_writemore(struct netconn *conn); @@ -931,4 +931,4 @@ do_join_leave_group(struct api_msg_msg *msg) } #endif /* LWIP_IGMP */ -#endif /* !NO_SYS */ +#endif /* LWIP_NETCONN */ diff --git a/src/api/netbuf.c b/src/api/netbuf.c index 0e03177c..27120eb5 100644 --- a/src/api/netbuf.c +++ b/src/api/netbuf.c @@ -36,11 +36,15 @@ * */ -#include #include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + #include "lwip/netbuf.h" #include "lwip/memp.h" +#include + /** * Create (allocate) and initialize a new netbuf. * The netbuf doesn't yet contain a packet buffer! @@ -227,3 +231,5 @@ netbuf_first(struct netbuf *buf) LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;); buf->ptr = buf->p; } + +#endif /* LWIP_NETCONN */ diff --git a/src/api/netifapi.c b/src/api/netifapi.c index 530ceeb3..e11efd91 100644 --- a/src/api/netifapi.c +++ b/src/api/netifapi.c @@ -32,12 +32,12 @@ */ #include "lwip/opt.h" -#include "lwip/arch.h" + +#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ + #include "lwip/netifapi.h" #include "lwip/tcpip.h" -#if LWIP_NETIF_API - /** * Call netif_add() in a thread-safe way by running that function inside the * tcpip_thread context. diff --git a/src/api/sockets.c b/src/api/sockets.c index 581c1dff..4287408a 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -38,20 +38,19 @@ * */ -#include "lwip/sockets.h" - -#include - #include "lwip/opt.h" + +#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/sockets.h" #include "lwip/api.h" -#include "lwip/arch.h" #include "lwip/sys.h" #include "lwip/igmp.h" #include "lwip/inet.h" #include "lwip/tcp.h" #include "lwip/tcpip.h" -#if !NO_SYS +#include #define NUM_SOCKETS MEMP_NUM_NETCONN @@ -1081,11 +1080,13 @@ int lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optl if (*optlen < sizeof(int)) { err = EINVAL; } +#if LWIP_UDP if ((sock->conn->type != NETCONN_UDP) || ((udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) { /* this flag is only available for UDP, not for UDP lite */ err = EAFNOSUPPORT; } +#endif /* LWIP_UDP */ break; default: @@ -1278,9 +1279,11 @@ static void lwip_getsockopt_internal(void *arg) *(int *)optval = sock->conn->recv_timeout; break; #endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_UDP case SO_NO_CHECK: *(int*)optval = (udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_NOCHKSUM) ? 1 : 0; break; +#endif /* LWIP_UDP*/ } /* switch (optname) */ break; @@ -1405,11 +1408,13 @@ int lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t if (optlen < sizeof(int)) { err = EINVAL; } +#if LWIP_UDP if ((sock->conn->type != NETCONN_UDP) || ((udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) { /* this flag is only available for UDP, not for UDP lite */ err = EAFNOSUPPORT; } +#endif /* LWIP_UDP */ break; default: LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, SOL_SOCKET, UNIMPL: optname=0x%x, ..)\n", @@ -1585,11 +1590,12 @@ static void lwip_setsockopt_internal(void *arg) LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, SOL_SOCKET, optname=0x%x, ..) -> %s\n", s, optname, (*(int*)optval?"on":"off"))); break; -#if LWIP_SO_RCVTIMEO +#if LWIP_SO_RCVTIMEO case SO_RCVTIMEO: sock->conn->recv_timeout = ( *(int*)optval ); break; #endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_UDP case SO_NO_CHECK: if (*(int*)optval) { udp_setflags(sock->conn->pcb.udp, udp_flags(sock->conn->pcb.udp) | UDP_FLAGS_NOCHKSUM); @@ -1597,6 +1603,7 @@ static void lwip_setsockopt_internal(void *arg) udp_setflags(sock->conn->pcb.udp, udp_flags(sock->conn->pcb.udp) & ~UDP_FLAGS_NOCHKSUM); } break; +#endif /* LWIP_UDP */ } /* switch (optname) */ break; @@ -1755,4 +1762,4 @@ int lwip_ioctl(int s, long cmd, void *argp) } /* switch (cmd) */ } -#endif /* !NO_SYS */ +#endif /* LWIP_SOCKET */ diff --git a/src/api/tcpip.c b/src/api/tcpip.c index 476fa7ae..f9ccc736 100644 --- a/src/api/tcpip.c +++ b/src/api/tcpip.c @@ -38,21 +38,17 @@ #include "lwip/opt.h" -#include "lwip/sys.h" +#if !NO_SYS /* don't build if not configured for use in lwipopts.h */ +#include "lwip/sys.h" #include "lwip/memp.h" #include "lwip/pbuf.h" - -#include "netif/etharp.h" -#include "netif/ppp_oe.h" - #include "lwip/ip_frag.h" #include "lwip/igmp.h" - #include "lwip/tcpip.h" #include "lwip/init.h" - -#if !NO_SYS +#include "netif/etharp.h" +#include "netif/ppp_oe.h" /* global variables */ static void (* tcpip_init_done)(void *arg) = NULL; diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 40b11992..572591fe 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -67,23 +67,23 @@ * to remove the DHCP client. * */ - -#include - + +#include "lwip/opt.h" + +#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/stats.h" #include "lwip/mem.h" #include "lwip/udp.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" #include "lwip/inet.h" -#include "netif/etharp.h" - #include "lwip/sys.h" -#include "lwip/opt.h" #include "lwip/dhcp.h" #include "lwip/autoip.h" +#include "netif/etharp.h" -#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */ +#include /** global transaction identifier, must be * unique for each DHCP request. We simply increment, starting diff --git a/src/core/inet.c b/src/core/inet.c index 008595d1..76fa356f 100644 --- a/src/core/inet.c +++ b/src/core/inet.c @@ -39,11 +39,8 @@ #include "lwip/opt.h" -#include "lwip/arch.h" - #include "lwip/def.h" #include "lwip/inet.h" - #include "lwip/sys.h" /* These are some reference implementations of the checksum algorithm, with the diff --git a/src/core/init.c b/src/core/init.c index 6f15e1fe..f7de191e 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -37,6 +37,7 @@ */ #include "lwip/opt.h" + #include "lwip/init.h" #include "lwip/stats.h" #include "lwip/sys.h" @@ -45,14 +46,13 @@ #include "lwip/pbuf.h" #include "lwip/netif.h" #include "lwip/sockets.h" -#include "netif/etharp.h" #include "lwip/ip.h" #include "lwip/raw.h" #include "lwip/udp.h" #include "lwip/tcp.h" #include "lwip/autoip.h" #include "lwip/igmp.h" - +#include "netif/etharp.h" /* Compile-time sanity checks for configuration errors. * These can be done independently of LWIP_DEBUG, without penalty. diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 33df78c9..bef32de9 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -62,8 +62,10 @@ * */ -#include -#include +#include "lwip/opt.h" + +#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/mem.h" #include "lwip/udp.h" #include "lwip/ip_addr.h" @@ -71,7 +73,8 @@ #include "lwip/autoip.h" #include "netif/etharp.h" -#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ +#include +#include /* pseudo random macro based on netif informations. You could use "rand()" from the C Library if you define LWIP_AUTOIP_RAND in lwipopts.h */ #ifndef LWIP_AUTOIP_RAND diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index 6163132b..e9dec868 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -39,9 +39,10 @@ /* Some ICMP messages should be passed to the transport protocols. This is not implemented. */ -#include - #include "lwip/opt.h" + +#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/icmp.h" #include "lwip/inet.h" #include "lwip/ip.h" @@ -49,7 +50,7 @@ #include "lwip/stats.h" #include "lwip/snmp.h" -#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ +#include /** * Processes ICMP input packets, called from ip_input(). diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index d5bc0b7f..1045d598 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -77,6 +77,10 @@ Steve Reynolds * Includes *----------------------------------------------------------------------------*/ +#include "lwip/opt.h" + +#if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/debug.h" #include "lwip/def.h" #include "lwip/mem.h" @@ -89,12 +93,8 @@ Steve Reynolds #include "lwip/stats.h" #include "lwip/igmp.h" -#include "arch/perf.h" - #include "string.h" -#if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ - /*----------------------------------------------------------------------------- * Globales *----------------------------------------------------------------------------*/ diff --git a/src/core/ipv4/ip.c b/src/core/ipv4/ip.c index c2117e97..de58019f 100644 --- a/src/core/ipv4/ip.c +++ b/src/core/ipv4/ip.c @@ -39,7 +39,6 @@ */ #include "lwip/opt.h" - #include "lwip/def.h" #include "lwip/mem.h" #include "lwip/ip.h" @@ -47,22 +46,14 @@ #include "lwip/inet.h" #include "lwip/netif.h" #include "lwip/icmp.h" +#include "lwip/igmp.h" #include "lwip/raw.h" #include "lwip/udp.h" #include "lwip/tcp.h" - -#include "lwip/stats.h" - -#include "arch/perf.h" - #include "lwip/snmp.h" -#if LWIP_DHCP -# include "lwip/dhcp.h" -#endif /* LWIP_DHCP */ - -#if LWIP_IGMP -# include "lwip/igmp.h" -#endif /* LWIP_IGMP */ +#include "lwip/dhcp.h" +#include "lwip/stats.h" +#include "arch/perf.h" /** * Initializes the IP layer. diff --git a/src/core/ipv4/ip_addr.c b/src/core/ipv4/ip_addr.c index dafcd761..94bf4678 100644 --- a/src/core/ipv4/ip_addr.c +++ b/src/core/ipv4/ip_addr.c @@ -36,6 +36,7 @@ * */ +#include "lwip/opt.h" #include "lwip/ip_addr.h" #include "lwip/inet.h" #include "lwip/netif.h" diff --git a/src/core/ipv4/ip_frag.c b/src/core/ipv4/ip_frag.c index ff23ac43..c34fd223 100644 --- a/src/core/ipv4/ip_frag.c +++ b/src/core/ipv4/ip_frag.c @@ -37,8 +37,6 @@ * */ -#include - #include "lwip/opt.h" #include "lwip/ip.h" #include "lwip/ip_frag.h" @@ -46,6 +44,8 @@ #include "lwip/snmp.h" #include "lwip/stats.h" +#include + #if IP_REASSEMBLY static u8_t ip_reassbuf[IP_HLEN + IP_REASS_BUFSIZE]; static u8_t ip_reassbitmap[IP_REASS_BUFSIZE / (8 * 8) + 1]; diff --git a/src/core/ipv6/icmp6.c b/src/core/ipv6/icmp6.c index ec5d2adb..d552e63b 100644 --- a/src/core/ipv6/icmp6.c +++ b/src/core/ipv6/icmp6.c @@ -35,15 +35,14 @@ #include "lwip/opt.h" +#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/icmp.h" #include "lwip/inet.h" #include "lwip/ip.h" #include "lwip/def.h" - #include "lwip/stats.h" -#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ - void icmp_input(struct pbuf *p, struct netif *inp) { diff --git a/src/core/ipv6/ip6_addr.c b/src/core/ipv6/ip6_addr.c index f35b40ab..2da6cea4 100644 --- a/src/core/ipv6/ip6_addr.c +++ b/src/core/ipv6/ip6_addr.c @@ -34,7 +34,6 @@ #include "lwip/ip_addr.h" #include "lwip/inet.h" - u8_t ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2, struct ip_addr *mask) diff --git a/src/core/mem.c b/src/core/mem.c index 115e126d..1adad3b5 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -37,18 +37,17 @@ * */ -#include - -#include "lwip/arch.h" #include "lwip/opt.h" + +#if !MEM_LIBC_MALLOC /* don't build if not configured for use in lwipopts.h */ + #include "lwip/def.h" #include "lwip/mem.h" - #include "lwip/sys.h" - #include "lwip/stats.h" -#if !MEM_LIBC_MALLOC +#include + #if MEM_USE_POOLS /* lwIP head implemented with different sized pools */ @@ -511,4 +510,5 @@ void *mem_calloc(size_t count, size_t size) } return p; } + #endif /* !MEM_LIBC_MALLOC */ diff --git a/src/core/memp.c b/src/core/memp.c index 05d18dd1..0e1d7943 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -36,9 +36,8 @@ * */ -#include - #include "lwip/opt.h" + #include "lwip/memp.h" #include "lwip/pbuf.h" #include "lwip/udp.h" @@ -50,10 +49,9 @@ #include "lwip/tcpip.h" #include "lwip/sys.h" #include "lwip/stats.h" - -#if ARP_QUEUEING #include "netif/etharp.h" -#endif + +#include struct memp { struct memp *next; diff --git a/src/core/netif.c b/src/core/netif.c index 30f97cc5..e00a2d60 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -44,10 +44,7 @@ #include "lwip/tcp.h" #include "lwip/snmp.h" #include "lwip/igmp.h" - -#if LWIP_ARP #include "netif/etharp.h" -#endif /* LWIP_ARP */ #if LWIP_NETIF_STATUS_CALLBACK #define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); } diff --git a/src/core/pbuf.c b/src/core/pbuf.c index fb7c08d4..ef97298b 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -61,9 +61,8 @@ * */ -#include - #include "lwip/opt.h" + #include "lwip/stats.h" #include "lwip/def.h" #include "lwip/mem.h" @@ -72,6 +71,8 @@ #include "lwip/sys.h" #include "arch/perf.h" +#include + #define SIZEOF_STRUCT_PBUF LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) /* Since the pool is created in memp, PBUF_POOL_BUFSIZE will be automatically aligned there. Therefore, PBUF_POOL_BUFSIZE_ALIGNED can be used here. */ diff --git a/src/core/raw.c b/src/core/raw.c index fb3f97b8..421c4933 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -38,23 +38,21 @@ * */ -#include - #include "lwip/opt.h" +#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ + #include "lwip/def.h" #include "lwip/memp.h" #include "lwip/inet.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" #include "lwip/raw.h" - #include "lwip/stats.h" - -#include "arch/perf.h" #include "lwip/snmp.h" +#include "arch/perf.h" -#if LWIP_RAW +#include /** The list of RAW PCBs */ static struct raw_pcb *raw_pcbs = NULL; diff --git a/src/core/snmp/asn1_dec.c b/src/core/snmp/asn1_dec.c index eec4380e..650fb403 100644 --- a/src/core/snmp/asn1_dec.c +++ b/src/core/snmp/asn1_dec.c @@ -36,7 +36,8 @@ #include "lwip/opt.h" -#if LWIP_SNMP +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/snmp_asn1.h" /** @@ -654,4 +655,3 @@ snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw } #endif /* LWIP_SNMP */ - diff --git a/src/core/snmp/asn1_enc.c b/src/core/snmp/asn1_enc.c index 4d04f285..77af6b4b 100644 --- a/src/core/snmp/asn1_enc.c +++ b/src/core/snmp/asn1_enc.c @@ -36,7 +36,8 @@ #include "lwip/opt.h" -#if LWIP_SNMP +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/snmp_asn1.h" /** diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index 6f37f938..8c379343 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -37,17 +37,17 @@ #include "lwip/opt.h" -#if LWIP_SNMP +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ #include "lwip/snmp.h" #include "lwip/netif.h" -#include "netif/etharp.h" #include "lwip/ip.h" #include "lwip/ip_frag.h" #include "lwip/tcp.h" #include "lwip/udp.h" #include "lwip/snmp_asn1.h" #include "lwip/snmp_structs.h" +#include "netif/etharp.h" /** * IANA assigned enterprise ID for lwIP is 26381 diff --git a/src/core/snmp/mib_structs.c b/src/core/snmp/mib_structs.c index 939e220e..ba78f857 100644 --- a/src/core/snmp/mib_structs.c +++ b/src/core/snmp/mib_structs.c @@ -34,12 +34,11 @@ #include "lwip/opt.h" -#if LWIP_SNMP +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/snmp_structs.h" #include "lwip/mem.h" - - /** .iso.org.dod.internet address prefix, @see snmp_iso_*() */ const s32_t prefix[4] = {1, 3, 6, 1}; @@ -1182,4 +1181,3 @@ snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret) } #endif /* LWIP_SNMP */ - diff --git a/src/core/snmp/msg_in.c b/src/core/snmp/msg_in.c index 8a558da4..ab8b5216 100644 --- a/src/core/snmp/msg_in.c +++ b/src/core/snmp/msg_in.c @@ -34,19 +34,18 @@ #include "lwip/opt.h" -#if LWIP_SNMP +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ -#include #include "lwip/ip_addr.h" #include "lwip/mem.h" #include "lwip/udp.h" #include "lwip/stats.h" - #include "lwip/snmp.h" #include "lwip/snmp_asn1.h" #include "lwip/snmp_msg.h" #include "lwip/snmp_structs.h" +#include /* public (non-static) constants */ /** SNMP v1 == 0 */ diff --git a/src/core/snmp/msg_out.c b/src/core/snmp/msg_out.c index 81d051c2..b705aaca 100644 --- a/src/core/snmp/msg_out.c +++ b/src/core/snmp/msg_out.c @@ -44,11 +44,10 @@ #include "lwip/opt.h" -#if LWIP_SNMP +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ #include "lwip/udp.h" #include "lwip/netif.h" - #include "lwip/snmp.h" #include "lwip/snmp_asn1.h" #include "lwip/snmp_msg.h" diff --git a/src/core/stats.c b/src/core/stats.c index add1e6e0..640baab5 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -36,17 +36,16 @@ * */ -#include - #include "lwip/opt.h" -#include "lwip/def.h" +#if LWIP_STATS /* don't build if not configured for use in lwipopts.h */ +#include "lwip/def.h" #include "lwip/stats.h" #include "lwip/mem.h" +#include -#if LWIP_STATS struct stats_ lwip_stats; void @@ -141,5 +140,6 @@ stats_display(void) #endif } #endif /* LWIP_STATS_DISPLAY */ + #endif /* LWIP_STATS */ diff --git a/src/core/sys.c b/src/core/sys.c index 2c4f32c2..8f209277 100644 --- a/src/core/sys.c +++ b/src/core/sys.c @@ -36,14 +36,15 @@ * */ -#include "lwip/sys.h" #include "lwip/opt.h" + +#if (NO_SYS == 0) /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/sys.h" #include "lwip/def.h" #include "lwip/memp.h" #include "lwip/tcpip.h" -#if (NO_SYS == 0) - /** * Struct used for sys_sem_wait_timeout() to tell wether the time * has run out or the semaphore has really become available. diff --git a/src/core/tcp.c b/src/core/tcp.c index afdc0f6c..ae14bb1c 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -40,16 +40,17 @@ * */ -#include - #include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/def.h" #include "lwip/mem.h" #include "lwip/memp.h" #include "lwip/snmp.h" - #include "lwip/tcp.h" -#if LWIP_TCP + +#include /* Incremented every coarse grained timer shot (typically every 500 ms). */ u32_t tcp_ticks; @@ -1322,4 +1323,5 @@ tcp_pcbs_sane(void) return 1; } #endif /* TCP_DEBUG */ + #endif /* LWIP_TCP */ diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index fca912e1..8e212cc4 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -41,22 +41,21 @@ * */ -#include "lwip/def.h" #include "lwip/opt.h" +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/def.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" #include "lwip/mem.h" #include "lwip/memp.h" - #include "lwip/inet.h" #include "lwip/tcp.h" - #include "lwip/stats.h" -#include "arch/perf.h" #include "lwip/snmp.h" +#include "arch/perf.h" -#if LWIP_TCP /* These variables are global to all functions involved in the input processing of TCP segments. They are set by the tcp_input() function. */ @@ -1279,4 +1278,5 @@ tcp_parseopt(struct tcp_pcb *pcb) } } } + #endif /* LWIP_TCP */ diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 8aee39cb..0eabea4e 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -38,10 +38,11 @@ * */ -#include +#include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ #include "lwip/def.h" -#include "lwip/opt.h" #include "lwip/mem.h" #include "lwip/memp.h" #include "lwip/sys.h" @@ -52,7 +53,7 @@ #include "lwip/stats.h" #include "lwip/snmp.h" -#if LWIP_TCP +#include /* Forward declarations.*/ static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb); diff --git a/src/core/udp.c b/src/core/udp.c index 95dda50c..8f259a1c 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -43,10 +43,10 @@ * */ -#include - #include "lwip/opt.h" +#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/def.h" #include "lwip/memp.h" #include "lwip/inet.h" @@ -54,14 +54,13 @@ #include "lwip/netif.h" #include "lwip/udp.h" #include "lwip/icmp.h" - #include "lwip/stats.h" - -#include "arch/perf.h" #include "lwip/snmp.h" +#include "arch/perf.h" + +#include /* The list of UDP PCBs */ -#if LWIP_UDP /* exported in udp.h (was static) */ struct udp_pcb *udp_pcbs = NULL; diff --git a/src/include/ipv4/lwip/autoip.h b/src/include/ipv4/lwip/autoip.h index 2ef530d7..076a2ed2 100644 --- a/src/include/ipv4/lwip/autoip.h +++ b/src/include/ipv4/lwip/autoip.h @@ -45,6 +45,9 @@ #define __LWIP_AUTOIP_H__ #include "lwip/opt.h" + +#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/netif.h" #include "lwip/udp.h" #include "netif/etharp.h" @@ -97,4 +100,6 @@ void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr); /** Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds */ void autoip_tmr(void); +#endif /* LWIP_AUTOIP */ + #endif /* __LWIP_AUTOIP_H__ */ diff --git a/src/include/ipv4/lwip/icmp.h b/src/include/ipv4/lwip/icmp.h index 072e17e4..59a31f9c 100644 --- a/src/include/ipv4/lwip/icmp.h +++ b/src/include/ipv4/lwip/icmp.h @@ -32,16 +32,14 @@ #ifndef __LWIP_ICMP_H__ #define __LWIP_ICMP_H__ -#include "lwip/arch.h" - #include "lwip/opt.h" -#include "lwip/pbuf.h" - -#include "lwip/ip_addr.h" -#include "lwip/netif.h" #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/ipv4/lwip/inet.h b/src/include/ipv4/lwip/inet.h index 2725150c..6dfad143 100644 --- a/src/include/ipv4/lwip/inet.h +++ b/src/include/ipv4/lwip/inet.h @@ -32,9 +32,8 @@ #ifndef __LWIP_INET_H__ #define __LWIP_INET_H__ -#include "lwip/arch.h" - #include "lwip/opt.h" + #include "lwip/pbuf.h" #include "lwip/ip_addr.h" diff --git a/src/include/ipv4/lwip/ip.h b/src/include/ipv4/lwip/ip.h index dc50b73d..47bd55d5 100644 --- a/src/include/ipv4/lwip/ip.h +++ b/src/include/ipv4/lwip/ip.h @@ -32,15 +32,13 @@ #ifndef __LWIP_IP_H__ #define __LWIP_IP_H__ -#include "lwip/arch.h" +#include "lwip/opt.h" #include "lwip/def.h" #include "lwip/pbuf.h" #include "lwip/ip_addr.h" - #include "lwip/err.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/ipv4/lwip/ip_addr.h b/src/include/ipv4/lwip/ip_addr.h index 84ec6e5d..0302277e 100644 --- a/src/include/ipv4/lwip/ip_addr.h +++ b/src/include/ipv4/lwip/ip_addr.h @@ -32,7 +32,7 @@ #ifndef __LWIP_IP_ADDR_H__ #define __LWIP_IP_ADDR_H__ -#include "lwip/arch.h" +#include "lwip/opt.h" #ifdef __cplusplus extern "C" { diff --git a/src/include/ipv6/lwip/icmp.h b/src/include/ipv6/lwip/icmp.h index 987e3eb3..87e9ffd9 100644 --- a/src/include/ipv6/lwip/icmp.h +++ b/src/include/ipv6/lwip/icmp.h @@ -32,15 +32,13 @@ #ifndef __LWIP_ICMP_H__ #define __LWIP_ICMP_H__ -#include "lwip/arch.h" - #include "lwip/opt.h" -#include "lwip/pbuf.h" - -#include "lwip/netif.h" #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ +#include "lwip/pbuf.h" +#include "lwip/netif.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/ipv6/lwip/inet.h b/src/include/ipv6/lwip/inet.h index 8228c205..de1a0b63 100644 --- a/src/include/ipv6/lwip/inet.h +++ b/src/include/ipv6/lwip/inet.h @@ -32,8 +32,6 @@ #ifndef __LWIP_INET_H__ #define __LWIP_INET_H__ -#include "lwip/arch.h" - #include "lwip/opt.h" #include "lwip/pbuf.h" #include "lwip/ip_addr.h" diff --git a/src/include/ipv6/lwip/ip_addr.h b/src/include/ipv6/lwip/ip_addr.h index 02e6cee4..b2d8ae56 100644 --- a/src/include/ipv6/lwip/ip_addr.h +++ b/src/include/ipv6/lwip/ip_addr.h @@ -32,7 +32,7 @@ #ifndef __LWIP_IP_ADDR_H__ #define __LWIP_IP_ADDR_H__ -#include "lwip/arch.h" +#include "lwip/opt.h" #ifdef __cplusplus extern "C" { diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index f16d8215..63df91dd 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -33,16 +33,16 @@ #define __LWIP_API_H__ #include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + #include "lwip/pbuf.h" #include "lwip/netbuf.h" #include "lwip/sys.h" - #include "lwip/ip.h" - #include "lwip/raw.h" #include "lwip/udp.h" #include "lwip/tcp.h" - #include "lwip/err.h" #ifdef __cplusplus @@ -122,7 +122,7 @@ struct netconn { this temporarily stores whether to wake up the original application task if data couldn't be sent in the first try. */ u8_t write_delayed; -#endif +#endif /* LWIP_TCPIP_CORE_LOCKING */ void (* callback)(struct netconn *, enum netconn_evt, u16_t len); }; @@ -174,4 +174,6 @@ err_t netconn_join_leave_group (struct netconn *conn, } #endif +#endif /* LWIP_NETCONN */ + #endif /* __LWIP_API_H__ */ diff --git a/src/include/lwip/api_msg.h b/src/include/lwip/api_msg.h index c98f30e6..9f25f756 100644 --- a/src/include/lwip/api_msg.h +++ b/src/include/lwip/api_msg.h @@ -33,14 +33,14 @@ #define __LWIP_API_MSG_H__ #include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + #include "lwip/pbuf.h" #include "lwip/sys.h" - #include "lwip/ip.h" - #include "lwip/udp.h" #include "lwip/tcp.h" - #include "lwip/api.h" #ifdef __cplusplus @@ -102,4 +102,6 @@ void do_join_leave_group( struct api_msg_msg *msg); } #endif +#endif /* LWIP_NETCONN */ + #endif /* __LWIP_API_MSG_H__ */ diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index 8e5c8d2b..6f9f208c 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -5,6 +5,9 @@ #define __LWIP_DHCP_H__ #include "lwip/opt.h" + +#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/netif.h" #include "lwip/udp.h" @@ -236,4 +239,6 @@ void dhcp_fine_tmr(void); } #endif +#endif /* LWIP_DHCP */ + #endif /*__LWIP_DHCP_H__*/ diff --git a/src/include/lwip/init.h b/src/include/lwip/init.h index 3f4be01b..c0869cfd 100644 --- a/src/include/lwip/init.h +++ b/src/include/lwip/init.h @@ -33,7 +33,6 @@ #define __LWIP_INIT_H__ #include "lwip/opt.h" -#include "lwip/arch.h" #ifdef __cplusplus extern "C" { diff --git a/src/include/lwip/mem.h b/src/include/lwip/mem.h index 36c8781b..8018b18b 100644 --- a/src/include/lwip/mem.h +++ b/src/include/lwip/mem.h @@ -33,7 +33,6 @@ #define __LWIP_MEM_H__ #include "lwip/opt.h" -#include "lwip/arch.h" #ifdef __cplusplus extern "C" { diff --git a/src/include/lwip/memp.h b/src/include/lwip/memp.h index 2d5f41e2..a0438633 100644 --- a/src/include/lwip/memp.h +++ b/src/include/lwip/memp.h @@ -91,4 +91,4 @@ void memp_free(memp_t type, void *mem); } #endif -#endif /* __LWIP_MEMP_H__ */ +#endif /* __LWIP_MEMP_H__ */ diff --git a/src/include/lwip/netifapi.h b/src/include/lwip/netifapi.h index 19b84735..b9bb90e0 100644 --- a/src/include/lwip/netifapi.h +++ b/src/include/lwip/netifapi.h @@ -29,13 +29,14 @@ #define __LWIP_NETIFAPI_H__ #include "lwip/opt.h" + +#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ + #include "lwip/sys.h" #include "lwip/netif.h" #include "lwip/dhcp.h" #include "lwip/autoip.h" -#if LWIP_NETIF_API - #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h index f08c0af6..cbc17c34 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h @@ -33,7 +33,7 @@ #ifndef __LWIP_PBUF_H__ #define __LWIP_PBUF_H__ -#include "lwip/arch.h" +#include "lwip/opt.h" #include "lwip/err.h" #ifdef __cplusplus diff --git a/src/include/lwip/raw.h b/src/include/lwip/raw.h index 6d141c51..56d21b18 100644 --- a/src/include/lwip/raw.h +++ b/src/include/lwip/raw.h @@ -32,7 +32,9 @@ #ifndef __LWIP_RAW_H__ #define __LWIP_RAW_H__ -#include "lwip/arch.h" +#include "lwip/opt.h" + +#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ #include "lwip/pbuf.h" #include "lwip/inet.h" @@ -89,4 +91,6 @@ void raw_init (void); } #endif +#endif /* LWIP_RAW */ + #endif /* __LWIP_RAW_H__ */ diff --git a/src/include/lwip/snmp.h b/src/include/lwip/snmp.h index 9cf8fcba..36a087b4 100644 --- a/src/include/lwip/snmp.h +++ b/src/include/lwip/snmp.h @@ -79,8 +79,7 @@ enum snmp_ifType { snmp_ifType_frame_relay }; -/* SNMP support available? */ -#if defined(LWIP_SNMP) && (LWIP_SNMP > 0) +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ /** fixed maximum length for object identifier type */ #define LWIP_SNMP_OBJ_ID_LEN 32 @@ -350,7 +349,7 @@ void snmp_get_snmpenableauthentraps(u8_t *value); #define snmp_set_snmpenableauthentraps(value) #define snmp_get_snmpenableauthentraps(value) -#endif +#endif /* LWIP_SNMP */ #ifdef __cplusplus } diff --git a/src/include/lwip/snmp_asn1.h b/src/include/lwip/snmp_asn1.h index a2a5bffc..3d70d330 100644 --- a/src/include/lwip/snmp_asn1.h +++ b/src/include/lwip/snmp_asn1.h @@ -94,4 +94,4 @@ err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw); } #endif -#endif +#endif /* __LWIP_SNMP_ASN1_H__ */ diff --git a/src/include/lwip/snmp_msg.h b/src/include/lwip/snmp_msg.h index 5eeead0b..d2028255 100644 --- a/src/include/lwip/snmp_msg.h +++ b/src/include/lwip/snmp_msg.h @@ -304,4 +304,4 @@ void snmp_authfail_trap(void); } #endif -#endif +#endif /* __LWIP_SNMP_MSG_H__ */ diff --git a/src/include/lwip/snmp_structs.h b/src/include/lwip/snmp_structs.h index 22c96dc7..9f3f8a94 100644 --- a/src/include/lwip/snmp_structs.h +++ b/src/include/lwip/snmp_structs.h @@ -38,7 +38,8 @@ #define __LWIP_SNMP_STRUCTS_H__ #include "lwip/opt.h" -#if LWIP_SNMP + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ #include "lwip/snmp.h" @@ -257,4 +258,5 @@ u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oi #endif #endif /* LWIP_SNMP */ -#endif + +#endif /* __LWIP_SNMP_STRUCTS_H__ */ diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index d8d48c26..e1da4865 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -35,6 +35,9 @@ #define __LWIP_SOCKETS_H__ #include "lwip/opt.h" + +#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ + #include "lwip/ip_addr.h" #include "lwip/inet.h" @@ -327,4 +330,6 @@ int lwip_ioctl(int s, long cmd, void *argp); } #endif +#endif /* LWIP_SOCKET */ + #endif /* __LWIP_SOCKETS_H__ */ diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h index 5ae63a26..9d05f59e 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -32,14 +32,15 @@ #ifndef __LWIP_TCP_H__ #define __LWIP_TCP_H__ +#include "lwip/opt.h" + +/*#if LWIP_TCP*/ /* don't build if not configured for use in lwipopts.h */ + #include "lwip/sys.h" #include "lwip/mem.h" - #include "lwip/pbuf.h" -#include "lwip/opt.h" #include "lwip/ip.h" #include "lwip/icmp.h" - #include "lwip/err.h" #ifdef __cplusplus @@ -591,4 +592,6 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ } #endif +/*#endif*/ /* LWIP_TCP */ + #endif /* __LWIP_TCP_H__ */ diff --git a/src/include/lwip/tcpip.h b/src/include/lwip/tcpip.h index 3695a5dc..f395c38c 100644 --- a/src/include/lwip/tcpip.h +++ b/src/include/lwip/tcpip.h @@ -64,9 +64,7 @@ err_t tcpip_apimsg(struct api_msg *apimsg); err_t tcpip_apimsg_lock(struct api_msg *apimsg); #endif /* LWIP_TCPIP_CORE_LOCKING */ -#if LWIP_ARP err_t tcpip_input(struct pbuf *p, struct netif *inp); -#endif /* LWIP_ARP */ #if LWIP_NETIF_API err_t tcpip_netifapi(struct netifapi_msg *netifapimsg); @@ -81,9 +79,7 @@ err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); enum tcpip_msg_type { TCPIP_MSG_API, -#if LWIP_ARP TCPIP_MSG_INPKT, -#endif /* LWIP_ARP */ #if LWIP_NETIF_API TCPIP_MSG_NETIFAPI, #endif /* LWIP_NETIF_API */ @@ -99,12 +95,10 @@ struct tcpip_msg { #if LWIP_NETIF_API struct netifapi_msg *netifapimsg; #endif /* LWIP_NETIF_API */ -#if LWIP_ARP struct { struct pbuf *p; struct netif *netif; } inp; -#endif /* LWIP_ARP */ struct { void (*f)(void *ctx); void *ctx; diff --git a/src/include/lwip/udp.h b/src/include/lwip/udp.h index 04b4e757..afc152da 100644 --- a/src/include/lwip/udp.h +++ b/src/include/lwip/udp.h @@ -32,7 +32,9 @@ #ifndef __LWIP_UDP_H__ #define __LWIP_UDP_H__ -#include "lwip/arch.h" +#include "lwip/opt.h" + +#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */ #include "lwip/pbuf.h" #include "lwip/inet.h" @@ -135,4 +137,6 @@ void udp_debug_print(struct udp_hdr *udphdr); } #endif +#endif /* LWIP_UDP */ + #endif /* __LWIP_UDP_H__ */ diff --git a/src/include/netif/etharp.h b/src/include/netif/etharp.h index 0080e2bd..dfe44019 100644 --- a/src/include/netif/etharp.h +++ b/src/include/netif/etharp.h @@ -36,6 +36,9 @@ #define __NETIF_ETHARP_H__ #include "lwip/opt.h" + +#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/pbuf.h" #include "lwip/ip_addr.h" #include "lwip/netif.h" @@ -136,7 +139,7 @@ struct etharp_q_entry { struct etharp_q_entry *next; struct pbuf *p; }; -#endif +#endif /* ARP_QUEUEING */ void etharp_init(void); void etharp_tmr(void); @@ -165,4 +168,6 @@ extern const struct eth_addr ethbroadcast, ethzero; } #endif +#endif /* LWIP_ARP */ + #endif /* __NETIF_ARP_H__ */ diff --git a/src/netif/etharp.c b/src/netif/etharp.c index 90a75ab8..f611c3ea 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -43,22 +43,19 @@ * This file is part of the lwIP TCP/IP stack. * */ -#include + #include "lwip/opt.h" + +#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */ + #include "lwip/inet.h" -#include "netif/etharp.h" #include "lwip/ip.h" #include "lwip/stats.h" #include "lwip/snmp.h" - -/* ARP needs to inform DHCP of any ARP replies? */ -#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK) -# include "lwip/dhcp.h" -#endif /* LWIP_DHCP && DHCP_DOES_ARP_CHECK */ -/* ARP needs to inform AUTOIP of any ARP replies? */ -#if (LWIP_AUTOIP) -# include "lwip/autoip.h" -#endif /* LWIP_AUTOIP */ +#include "lwip/dhcp.h" +#include "lwip/autoip.h" +#include "netif/etharp.h" +#include /** the time an ARP entry stays valid after its last update, * for ARP_TMR_INTERVAL = 5000, this is @@ -1086,3 +1083,5 @@ etharp_request(struct netif *netif, struct ip_addr *ipaddr) (struct eth_addr *)netif->hwaddr, &netif->ip_addr, ðzero, ipaddr, ARP_REQUEST); } + +#endif /* LWIP_ARP */