lwipopts.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. /*
  2. * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice,
  9. * this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and/or other materials provided with the distribution.
  13. * 3. The name of the author may not be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  17. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  19. * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  21. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  24. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  25. * OF SUCH DAMAGE.
  26. *
  27. * This file is part of the lwIP TCP/IP stack.
  28. *
  29. * Author: Adam Dunkels <adam@sics.se>
  30. *
  31. */
  32. #ifndef LWIP_LWIPOPTS_H
  33. #define LWIP_LWIPOPTS_H
  34. #ifdef LWIP_OPTTEST_FILE
  35. #include "lwipopts_test.h"
  36. #else /* LWIP_OPTTEST_FILE */
  37. #define LWIP_IPV4 1
  38. #define LWIP_IPV6 1
  39. #define NO_SYS 0
  40. #define LWIP_SOCKET (NO_SYS==0)
  41. #define LWIP_NETCONN (NO_SYS==0)
  42. #define LWIP_NETIF_API (NO_SYS==0)
  43. #define LWIP_IGMP LWIP_IPV4
  44. #define LWIP_ICMP LWIP_IPV4
  45. #define LWIP_SNMP LWIP_UDP
  46. #define MIB2_STATS LWIP_SNMP
  47. #ifdef LWIP_HAVE_MBEDTLS
  48. #define LWIP_SNMP_V3 (LWIP_SNMP)
  49. #endif
  50. #define LWIP_DNS LWIP_UDP
  51. #define LWIP_MDNS_RESPONDER LWIP_UDP
  52. #define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)
  53. #define LWIP_HAVE_LOOPIF 1
  54. #define LWIP_NETIF_LOOPBACK 1
  55. #define LWIP_LOOPBACK_MAX_PBUFS 10
  56. #define TCP_LISTEN_BACKLOG 1
  57. #define LWIP_COMPAT_SOCKETS 1
  58. #define LWIP_SO_RCVTIMEO 1
  59. #define LWIP_SO_RCVBUF 1
  60. #define LWIP_TCPIP_CORE_LOCKING 1
  61. #define LWIP_NETIF_LINK_CALLBACK 1
  62. #define LWIP_NETIF_STATUS_CALLBACK 1
  63. #define LWIP_NETIF_EXT_STATUS_CALLBACK 1
  64. #ifdef LWIP_DEBUG
  65. #define LWIP_DBG_MIN_LEVEL 0
  66. #define PPP_DEBUG LWIP_DBG_OFF
  67. #define MEM_DEBUG LWIP_DBG_OFF
  68. #define MEMP_DEBUG LWIP_DBG_OFF
  69. #define PBUF_DEBUG LWIP_DBG_OFF
  70. #define API_LIB_DEBUG LWIP_DBG_OFF
  71. #define API_MSG_DEBUG LWIP_DBG_OFF
  72. #define TCPIP_DEBUG LWIP_DBG_OFF
  73. #define NETIF_DEBUG LWIP_DBG_OFF
  74. #define SOCKETS_DEBUG LWIP_DBG_OFF
  75. #define DNS_DEBUG LWIP_DBG_OFF
  76. #define AUTOIP_DEBUG LWIP_DBG_OFF
  77. #define DHCP_DEBUG LWIP_DBG_OFF
  78. #define IP_DEBUG LWIP_DBG_OFF
  79. #define IP_REASS_DEBUG LWIP_DBG_OFF
  80. #define ICMP_DEBUG LWIP_DBG_OFF
  81. #define IGMP_DEBUG LWIP_DBG_OFF
  82. #define UDP_DEBUG LWIP_DBG_OFF
  83. #define TCP_DEBUG LWIP_DBG_OFF
  84. #define TCP_INPUT_DEBUG LWIP_DBG_OFF
  85. #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
  86. #define TCP_RTO_DEBUG LWIP_DBG_OFF
  87. #define TCP_CWND_DEBUG LWIP_DBG_OFF
  88. #define TCP_WND_DEBUG LWIP_DBG_OFF
  89. #define TCP_FR_DEBUG LWIP_DBG_OFF
  90. #define TCP_QLEN_DEBUG LWIP_DBG_OFF
  91. #define TCP_RST_DEBUG LWIP_DBG_OFF
  92. #endif
  93. #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
  94. /* ---------- Memory options ---------- */
  95. /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
  96. lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
  97. byte alignment -> define MEM_ALIGNMENT to 2. */
  98. /* MSVC port: intel processors don't need 4-byte alignment,
  99. but are faster that way! */
  100. #define MEM_ALIGNMENT 4U
  101. /* MEM_SIZE: the size of the heap memory. If the application will send
  102. a lot of data that needs to be copied, this should be set high. */
  103. #define MEM_SIZE 10240
  104. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  105. sends a lot of data out of ROM (or other static memory), this
  106. should be set high. */
  107. #define MEMP_NUM_PBUF 16
  108. /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
  109. per active RAW "connection". */
  110. #define MEMP_NUM_RAW_PCB 3
  111. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  112. per active UDP "connection". */
  113. #define MEMP_NUM_UDP_PCB 8
  114. /* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP
  115. connections. */
  116. #define MEMP_NUM_TCP_PCB 5
  117. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  118. connections. */
  119. #define MEMP_NUM_TCP_PCB_LISTEN 8
  120. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  121. segments. */
  122. #define MEMP_NUM_TCP_SEG 16
  123. /* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
  124. timeouts. */
  125. #define MEMP_NUM_SYS_TIMEOUT 17
  126. /* The following four are used only with the sequential API and can be
  127. set to 0 if the application only will use the raw API. */
  128. /* MEMP_NUM_NETBUF: the number of struct netbufs. */
  129. #define MEMP_NUM_NETBUF 2
  130. /* MEMP_NUM_NETCONN: the number of struct netconns. */
  131. #define MEMP_NUM_NETCONN 12
  132. /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
  133. for sequential API communication and incoming packets. Used in
  134. src/api/tcpip.c. */
  135. #define MEMP_NUM_TCPIP_MSG_API 16
  136. #define MEMP_NUM_TCPIP_MSG_INPKT 16
  137. /* ---------- Pbuf options ---------- */
  138. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  139. #define PBUF_POOL_SIZE 120
  140. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  141. #define PBUF_POOL_BUFSIZE 256
  142. /** SYS_LIGHTWEIGHT_PROT
  143. * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
  144. * for certain critical regions during buffer allocation, deallocation and memory
  145. * allocation and deallocation.
  146. */
  147. #define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
  148. /* ---------- TCP options ---------- */
  149. #define LWIP_TCP 1
  150. #define TCP_TTL 255
  151. #define LWIP_ALTCP (LWIP_TCP)
  152. #ifdef LWIP_HAVE_MBEDTLS
  153. #define LWIP_ALTCP_TLS (LWIP_TCP)
  154. #define LWIP_ALTCP_TLS_MBEDTLS (LWIP_TCP)
  155. #endif
  156. /* Controls if TCP should queue segments that arrive out of
  157. order. Define to 0 if your device is low on memory. */
  158. #define TCP_QUEUE_OOSEQ 1
  159. /* TCP Maximum segment size. */
  160. #define TCP_MSS 1024
  161. /* TCP sender buffer space (bytes). */
  162. #define TCP_SND_BUF 2048
  163. /* TCP sender buffer space (pbufs). This must be at least = 2 *
  164. TCP_SND_BUF/TCP_MSS for things to work. */
  165. #define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
  166. /* TCP writable space (bytes). This must be less than or equal
  167. to TCP_SND_BUF. It is the amount of space which must be
  168. available in the tcp snd_buf for select to return writable */
  169. #define TCP_SNDLOWAT (TCP_SND_BUF/2)
  170. /* TCP receive window. */
  171. #define TCP_WND (20 * 1024)
  172. /* Maximum number of retransmissions of data segments. */
  173. #define TCP_MAXRTX 12
  174. /* Maximum number of retransmissions of SYN segments. */
  175. #define TCP_SYNMAXRTX 4
  176. /* ---------- ARP options ---------- */
  177. #define LWIP_ARP 1
  178. #define ARP_TABLE_SIZE 10
  179. #define ARP_QUEUEING 1
  180. /* ---------- IP options ---------- */
  181. /* Define IP_FORWARD to 1 if you wish to have the ability to forward
  182. IP packets across network interfaces. If you are going to run lwIP
  183. on a device with only one network interface, define this to 0. */
  184. #define IP_FORWARD 1
  185. /* IP reassembly and segmentation.These are orthogonal even
  186. * if they both deal with IP fragments */
  187. #define IP_REASSEMBLY 1
  188. #define IP_REASS_MAX_PBUFS (10 * ((1500 + PBUF_POOL_BUFSIZE - 1) / PBUF_POOL_BUFSIZE))
  189. #define MEMP_NUM_REASSDATA IP_REASS_MAX_PBUFS
  190. #define IP_FRAG 1
  191. #define IPV6_FRAG_COPYHEADER 1
  192. /* ---------- ICMP options ---------- */
  193. #define ICMP_TTL 255
  194. /* ---------- DHCP options ---------- */
  195. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  196. interfaces. */
  197. #define LWIP_DHCP LWIP_UDP
  198. /* 1 if you want to do an ARP check on the offered address
  199. (recommended). */
  200. #define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
  201. /* ---------- AUTOIP options ------- */
  202. #define LWIP_AUTOIP (LWIP_DHCP)
  203. #define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
  204. /* ---------- UDP options ---------- */
  205. #define LWIP_UDP 1
  206. #define LWIP_UDPLITE LWIP_UDP
  207. #define UDP_TTL 255
  208. /* ---------- RAW options ---------- */
  209. #define LWIP_RAW 1
  210. /* ---------- Statistics options ---------- */
  211. #define LWIP_STATS 1
  212. #define LWIP_STATS_DISPLAY 1
  213. #if LWIP_STATS
  214. #define LINK_STATS 1
  215. #define IP_STATS 1
  216. #define ICMP_STATS 1
  217. #define IGMP_STATS 1
  218. #define IPFRAG_STATS 1
  219. #define UDP_STATS 1
  220. #define TCP_STATS 1
  221. #define MEM_STATS 1
  222. #define MEMP_STATS 1
  223. #define PBUF_STATS 1
  224. #define SYS_STATS 1
  225. #endif /* LWIP_STATS */
  226. /* ---------- NETBIOS options ---------- */
  227. #define LWIP_NETBIOS_RESPOND_NAME_QUERY 1
  228. /* ---------- PPP options ---------- */
  229. #define PPP_SUPPORT 1 /* Set > 0 for PPP */
  230. #if PPP_SUPPORT
  231. #define NUM_PPP 1 /* Max PPP sessions. */
  232. /* Select modules to enable. Ideally these would be set in the makefile but
  233. * we're limited by the command line length so you need to modify the settings
  234. * in this file.
  235. */
  236. #define PPPOE_SUPPORT 1
  237. #define PPPOS_SUPPORT 1
  238. #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
  239. #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
  240. #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP */
  241. #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
  242. #define CCP_SUPPORT 0 /* Set > 0 for CCP */
  243. #define VJ_SUPPORT 0 /* Set > 0 for VJ header compression. */
  244. #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
  245. #endif /* PPP_SUPPORT */
  246. #endif /* LWIP_OPTTEST_FILE */
  247. /* The following defines must be done even in OPTTEST mode: */
  248. #if !defined(NO_SYS) || !NO_SYS /* default is 0 */
  249. void sys_check_core_locking(void);
  250. #define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
  251. #endif
  252. #ifndef LWIP_PLATFORM_ASSERT
  253. /* Define LWIP_PLATFORM_ASSERT to something to catch missing stdio.h includes */
  254. void lwip_example_app_platform_assert(const char *msg, int line, const char *file);
  255. #define LWIP_PLATFORM_ASSERT(x) lwip_example_app_platform_assert(x, __LINE__, __FILE__)
  256. #endif
  257. #endif /* LWIP_LWIPOPTS_H */