blob: 4f4d42e01575fb71863a6ddfb8f4ba4f3d0c23a1 [file] [log] [blame]
/*
*
* Copyright (c) 2012-2013 Nest Labs, Inc.
* All rights reserved.
*
* Description:
* This file describes common compile-time constants used for
* configuring LwIP, shared across all products and platforms.
*
*/
#ifndef __COMMON_LWIPOPTS_H__
#define __COMMON_LWIPOPTS_H__
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
* by your system, set this to 0 and include <sys/time.h> in cc.h
*/
#define LWIP_TIMEVAL_PRIVATE (0)
/**
* LwIP has three memory models it can work with for general memory
* allocation:
*
* 1) Standard C Library APIs and default platform heap.
*
* - Enabled by asserting MEM_LIBC_MALLOC
*
* 2) LwIP APIs and LwIP-internal heap (from BSS data).
*
* - Enabled by deasserting MEM_LIBC_MALLOC
*
* 3) Pre-allocated binned memory and object pools (from BSS data).
*
* - Enabled by deasserting MEM_LIBC_MALLOC and asserting
* MEM_USE_POOLS.
*
*/
/**
* Do use the Standard C Library heap and associated APIs.
*/
#define MEM_LIBC_MALLOC (0)
/**
* Do not use memory pools to create fixed, statically allocated pools of
* memory in lieu of the Standard C Library heap and APIs.
*/
#define MEM_USE_POOLS (0)
/**
* Do not use custom memory pools for specific, named LwIP objects, sourced
* from lwippools.h.
*/
#define MEM_USE_CUSTOM_POOLS (MEM_USE_POOLS)
/**
* MEM_SIZE: The size of the built-in LwIP heap memory.
*
* We size this for:
*
* 2 @ 120 bytes for outstanding transport header
* 5 @ 9 bytes for LwIP heap structure
*
* 288 bytes after 16 byte alignment
*/
#define MEM_SIZE 288
/** Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
* should be used instead
*/
#define LWIP_COMPAT_MUTEX (0)
/**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
* critical regions during buffer allocation, deallocation and memory
* allocation and deallocation.
*/
#define SYS_LIGHTWEIGHT_PROT (1)
/**
* Enable automatic IPv4 link-local address assignment.
*/
#define LWIP_AUTOIP (0)
/**
* Allow DHCP and automatic IPv4 link-local address assignment to
* work cooperatively.
*/
#define LWIP_DHCP_AUTOIP_COOP (0)
/**
* LWIP_PROVIDE_ERRNO: errno definitions from the Standard C Library.
*/
#undef LWIP_PROVIDE_ERRNO
/**
* ERRNO: no errno
*/
#undef ERRNO
/**
* MEMP_NUM_RAW_PCB: Number of raw connection PCBs
* (requires the LWIP_RAW option)
*/
#ifndef MEMP_NUM_RAW_PCB
#define MEMP_NUM_RAW_PCB (5)
#endif
/**
* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
* per active UDP "connection".
* (requires the LWIP_UDP option)
*/
#ifndef MEMP_NUM_UDP_PCB
#define MEMP_NUM_UDP_PCB (7 + (LWIP_DHCP) + (LWIP_DNS))
#endif
/* ARP before DHCP causes multi-second delay - turn it off */
#define DHCP_DOES_ARP_CHECK (0)
/**
* LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
*/
#define LWIP_HAVE_LOOPIF (0)
/**
* LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
* address equal to the netif IP address, looping them back up the stack.
*/
#define LWIP_NETIF_LOOPBACK (0)
/**
* MEMP_NUM_NETCONN: the number of struct netconns.
* (only needed if you use the sequential API, like api_lib.c)
*/
#define MEMP_NUM_NETCONN (1)
/**
* LWIP_SO_RCVTIMEO==1: Enable SO_RCVTIMEO processing.
*/
#define LWIP_SO_RCVTIMEO (1)
/**
* LWIP_IGMP==0: Turn off IGMP module.
*/
#ifndef LWIP_IGMP
#define LWIP_IGMP (0)
#endif
/**
* LWIP_ARP==0: Disable ARP functionality.
*/
#ifndef LWIP_ARP
#define LWIP_ARP (0)
#endif
/**
* SO_REUSE==1: Enable SO_REUSEADDR option.
* Required by IGMP for reuse of multicast address and port by other sockets
*/
#define SO_REUSE (1)
/**
* When using IGMP, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value
*/
#define LWIP_RAND() (u32_t)lrand48()
/**
* LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: Randomize the local port
* for the first local TCP/UDP PCB. This can prevent creating
* predictable port numbers after booting a system (see RFC-6065).
*/
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS (1)
/**
* LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
* transport.
*/
#ifndef LWIP_DNS
#define LWIP_DNS (0)
#endif
/**
* LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
* Disable this option if you use a POSIX operating system that uses the same
* names (read, write & close). (only used if you use sockets.c)
*
* We disable this because this otherwise collides with the Standard C
* Library where both LWIP and its headers are included.
*/
#define LWIP_POSIX_SOCKETS_IO_NAMES (0)
#ifdef LWIP_SO_RCVBUF
#if ( LWIP_SO_RCVBUF == 1 )
#include <limits.h> /* Needed because RECV_BUFSIZE_DEFAULT is defined as INT_MAX */
#endif /* if ( LWIP_SO_RCVBUF == 1 ) */
#endif /* ifdef LWIP_SO_RCVBUF */
/**
* LWIP_STATS : Turn off statistics gathering
*/
#define LWIP_STATS (0)
/**
* LWIP_IPV6==1: Enable IPv6
*/
#define LWIP_IPV6 1
/**
* LWIP_IPV6_AUTOCONFIG==0: Disable stateless address
* autoconfiguration (SLAAC).
*/
#define LWIP_IPV6_AUTOCONFIG (0)
/**
* LWIP_IPV6_REASS -- disable reassembly, already performed by 6lowpan layer.
*/
#define LWIP_IPV6_REASS (0)
/**
* LWIP_IPV6_MLD==1: enable multicast listener discovery protocol.
*/
#define LWIP_IPV6_MLD (1)
/**
*
*/
/**
* LWIP_IPV6_DHCP6==0: Disable DHCPv6 stateful address autoconfiguration.
*/
#ifndef LWIP_IPV6_DHCP6
#define LWIP_IPV6_DHCP6 1
#endif
/**
* Enable locking in the lwip (tcpip) thread.
*/
#ifndef LWIP_TCPIP_CORE_LOCKING
#define LWIP_TCPIP_CORE_LOCKING 1
#endif
/**
* Controls if TCP should queue segments that arrive out of
* order. Define to 0 if your device is low on memory.
* See DOLO-738 as to why buffering of out of order
* segments has been disabled (in short, device runs out of
* pbufs during prolonged download, slowing down a lot.)
*/
#define TCP_QUEUE_OOSEQ 0
/**
* ARP_QUEUEING==1: Multiple outgoing packets are queued during
* hardware address resolution. By default, only the most recent
* packet is queued per IP address. This is sufficient for most
* protocols and mainly reduces TCP connection startup time. Set this
* to 1 if you know your application sends more than one packet in a
* row to an IP address that is not in the ARP cache.
*/
#define ARP_QUEUEING (0)
/**
* MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
* packets (pbufs) that are waiting for an ARP request (to resolve
* their destination address) to finish. (requires the ARP_QUEUEING
* option)
*/
#define MEMP_NUM_ARP_QUEUE (PBUF_POOL_SIZE)
/**
* LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address
* is being resolved.
*/
#define LWIP_ND6_QUEUEING (LWIP_IPV6)
/**
* MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC
* resolution.
*/
#define MEMP_NUM_ND6_QUEUE (PBUF_POOL_SIZE)
/**
* LWIP_MULTICAST_PING: respond to multicast pings (default is unicast only)
*/
#define LWIP_MULTICAST_PING (1)
/**
* Debug printing
* By default enable debug printing for debug build, but set level to off
* This allows user to change any desired debug level to on.
*/
#define LWIP_DEBUG
#define MEMP_OVERFLOW_CHECK ( 0 )
#define MEMP_SANITY_CHECK ( 0 )
#define MEM_DEBUG (LWIP_DBG_OFF)
#define MEMP_DEBUG (LWIP_DBG_ON)
#define PBUF_DEBUG (LWIP_DBG_OFF)
#define API_LIB_DEBUG (LWIP_DBG_OFF)
#define API_MSG_DEBUG (LWIP_DBG_OFF)
#define TCPIP_DEBUG (LWIP_DBG_OFF)
#define NETIF_DEBUG (LWIP_DBG_OFF)
#define SOCKETS_DEBUG (LWIP_DBG_OFF)
#define DEMO_DEBUG (LWIP_DBG_OFF)
#define DHCP_DEBUG (LWIP_DBG_OFF)
#define AUTOIP_DEBUG (LWIP_DBG_OFF)
#define ETHARP_DEBUG (LWIP_DBG_OFF)
#define IP_DEBUG (LWIP_DBG_OFF)
#define IP_REASS_DEBUG (LWIP_DBG_OFF)
#define IP6_DEBUG (LWIP_DBG_OFF)
#define RAW_DEBUG (LWIP_DBG_OFF)
#define ICMP_DEBUG (LWIP_DBG_OFF)
#define UDP_DEBUG (LWIP_DBG_OFF)
#define TCP_DEBUG (LWIP_DBG_OFF)
#define TCP_INPUT_DEBUG (LWIP_DBG_OFF)
#define TCP_OUTPUT_DEBUG (LWIP_DBG_OFF)
#define TCP_RTO_DEBUG (LWIP_DBG_OFF)
#define TCP_CWND_DEBUG (LWIP_DBG_OFF)
#define TCP_WND_DEBUG (LWIP_DBG_OFF)
#define TCP_FR_DEBUG (LWIP_DBG_OFF)
#define TCP_QLEN_DEBUG (LWIP_DBG_OFF)
#define TCP_RST_DEBUG (LWIP_DBG_OFF)
#define PPP_DEBUG (LWIP_DBG_OFF)
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */
/**
* LwIP defaults the size of most mailboxes (i.e. message queues) to
* zero (0). That generally makes RTOSes such as FreeRTOS very
* unhappy. Specify reasonable defaults instead.
*/
#define TCPIP_MBOX_SIZE 6
#define DEFAULT_RAW_RECVMBOX_SIZE 6
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6
/**
* Disable processing of incoming Router Advertisements.
*/
#define LWIP_ND6_LISTEN_RA 0
/**
* Disable IPV6 router discovery.
*/
#define LWIP_IPV6_ROUTER_SUPPORT 0
#endif /* __COMMON_LWIPOPTS_H__ */