lwipopts.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. #ifndef NO_SYS
  40. #define NO_SYS 1
  41. #endif
  42. #define LWIP_SOCKET 0
  43. #define LWIP_NETCONN 0
  44. #define LWIP_NETIF_API (NO_SYS==0)
  45. #define LWIP_IGMP 1
  46. #define LWIP_ICMP 1
  47. #define LWIP_SNMP 1
  48. #define MIB2_STATS LWIP_SNMP
  49. #ifdef LWIP_HAVE_MBEDTLS
  50. #define LWIP_SNMP_V3 (LWIP_SNMP)
  51. #endif
  52. #define LWIP_DNS 0
  53. #define LWIP_MDNS_RESPONDER 0
  54. #define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)
  55. #define LWIP_HAVE_LOOPIF 0
  56. #define LWIP_NETIF_LOOPBACK 0
  57. #define LWIP_LOOPBACK_MAX_PBUFS 10
  58. #define TCP_LISTEN_BACKLOG 1
  59. #define LWIP_COMPAT_SOCKETS 1
  60. #define LWIP_SO_RCVTIMEO 1
  61. #define LWIP_SO_RCVBUF 1
  62. #define LWIP_TCPIP_CORE_LOCKING 1
  63. #define LWIP_NETIF_LINK_CALLBACK 1
  64. #define LWIP_NETIF_STATUS_CALLBACK 1
  65. #define LWIP_NETIF_EXT_STATUS_CALLBACK 1
  66. // #define LWIP_DEBUG 1
  67. #ifdef LWIP_DEBUG
  68. #define LWIP_DBG_MIN_LEVEL 0
  69. #define PPP_DEBUG LWIP_DBG_OFF
  70. #define MEM_DEBUG LWIP_DBG_OFF
  71. #define MEMP_DEBUG LWIP_DBG_OFF
  72. #define PBUF_DEBUG LWIP_DBG_OFF
  73. #define API_LIB_DEBUG LWIP_DBG_OFF
  74. #define API_MSG_DEBUG LWIP_DBG_OFF
  75. #define TCPIP_DEBUG LWIP_DBG_OFF
  76. #define NETIF_DEBUG LWIP_DBG_OFF
  77. #define SOCKETS_DEBUG LWIP_DBG_OFF
  78. #define DNS_DEBUG LWIP_DBG_OFF
  79. #define AUTOIP_DEBUG LWIP_DBG_OFF
  80. #define DHCP_DEBUG LWIP_DBG_OFF
  81. #define IP_DEBUG LWIP_DBG_OFF
  82. #define IP_REASS_DEBUG LWIP_DBG_OFF
  83. #define ICMP_DEBUG LWIP_DBG_OFF
  84. #define IGMP_DEBUG LWIP_DBG_OFF
  85. #define UDP_DEBUG LWIP_DBG_OFF
  86. #define TCP_DEBUG LWIP_DBG_OFF
  87. #define TCP_INPUT_DEBUG LWIP_DBG_OFF
  88. #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
  89. #define TCP_RTO_DEBUG LWIP_DBG_OFF
  90. #define TCP_CWND_DEBUG LWIP_DBG_OFF
  91. #define TCP_WND_DEBUG LWIP_DBG_OFF
  92. #define TCP_FR_DEBUG LWIP_DBG_OFF
  93. #define TCP_QLEN_DEBUG LWIP_DBG_OFF
  94. #define TCP_RST_DEBUG LWIP_DBG_OFF
  95. #define INET_DEBUG LWIP_DBG_OFF
  96. #endif
  97. #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
  98. /* ---------- Memory options ---------- */
  99. /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
  100. lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
  101. byte alignment -> define MEM_ALIGNMENT to 2. */
  102. /* MSVC port: intel processors don't need 4-byte alignment,
  103. but are faster that way! */
  104. #define MEM_ALIGNMENT 4U
  105. /* MEM_SIZE: the size of the heap memory. If the application will send
  106. a lot of data that needs to be copied, this should be set high. */
  107. #define MEM_SIZE 10240
  108. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  109. sends a lot of data out of ROM (or other static memory), this
  110. should be set high. */
  111. #define MEMP_NUM_PBUF 16
  112. /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
  113. per active RAW "connection". */
  114. #define MEMP_NUM_RAW_PCB 3
  115. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  116. per active UDP "connection". */
  117. #define MEMP_NUM_UDP_PCB 8
  118. /* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP
  119. connections. */
  120. #define MEMP_NUM_TCP_PCB 5
  121. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  122. connections. */
  123. #define MEMP_NUM_TCP_PCB_LISTEN 8
  124. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  125. segments. */
  126. #define MEMP_NUM_TCP_SEG 16
  127. /* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
  128. timeouts. */
  129. #define MEMP_NUM_SYS_TIMEOUT 17
  130. /* The following four are used only with the sequential API and can be
  131. set to 0 if the application only will use the raw API. */
  132. /* MEMP_NUM_NETBUF: the number of struct netbufs. */
  133. #define MEMP_NUM_NETBUF 2
  134. /* MEMP_NUM_NETCONN: the number of struct netconns. */
  135. #define MEMP_NUM_NETCONN 12
  136. /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
  137. for sequential API communication and incoming packets. Used in
  138. src/api/tcpip.c. */
  139. #define MEMP_NUM_TCPIP_MSG_API 16
  140. #define MEMP_NUM_TCPIP_MSG_INPKT 16
  141. /* ---------- Pbuf options ---------- */
  142. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  143. #define PBUF_POOL_SIZE 120
  144. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  145. #define PBUF_POOL_BUFSIZE 256
  146. /** SYS_LIGHTWEIGHT_PROT
  147. * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
  148. * for certain critical regions during buffer allocation, deallocation and memory
  149. * allocation and deallocation.
  150. */
  151. #define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
  152. /* ---------- TCP options ---------- */
  153. #define LWIP_TCP 1
  154. #define TCP_TTL 255
  155. #define LWIP_ALTCP (LWIP_TCP)
  156. #ifdef LWIP_HAVE_MBEDTLS
  157. #define LWIP_ALTCP_TLS (LWIP_TCP)
  158. #define LWIP_ALTCP_TLS_MBEDTLS (LWIP_TCP)
  159. #endif
  160. /* Controls if TCP should queue segments that arrive out of
  161. order. Define to 0 if your device is low on memory. */
  162. #define TCP_QUEUE_OOSEQ 1
  163. /* TCP Maximum segment size. */
  164. #define TCP_MSS 1024
  165. /* TCP sender buffer space (bytes). */
  166. #define TCP_SND_BUF 2048
  167. /* TCP sender buffer space (pbufs). This must be at least = 2 *
  168. TCP_SND_BUF/TCP_MSS for things to work. */
  169. #define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
  170. /* TCP writable space (bytes). This must be less than or equal
  171. to TCP_SND_BUF. It is the amount of space which must be
  172. available in the tcp snd_buf for select to return writable */
  173. #define TCP_SNDLOWAT (TCP_SND_BUF/2)
  174. /* TCP receive window. */
  175. #define TCP_WND (20 * 1024)
  176. /* Maximum number of retransmissions of data segments. */
  177. #define TCP_MAXRTX 12
  178. /* Maximum number of retransmissions of SYN segments. */
  179. #define TCP_SYNMAXRTX 4
  180. /* ---------- ARP options ---------- */
  181. #define LWIP_ARP 1
  182. #define ARP_TABLE_SIZE 10
  183. #define ARP_QUEUEING 3
  184. /* ---------- IP options ---------- */
  185. /* Define IP_FORWARD to 1 if you wish to have the ability to forward
  186. IP packets across network interfaces. If you are going to run lwIP
  187. on a device with only one network interface, define this to 0. */
  188. #define IP_FORWARD 0
  189. /* IP reassembly and segmentation.These are orthogonal even
  190. * if they both deal with IP fragments */
  191. #define IP_REASSEMBLY 1
  192. #define IP_REASS_MAX_PBUFS (10 * ((1500 + PBUF_POOL_BUFSIZE - 1) / PBUF_POOL_BUFSIZE))
  193. #define MEMP_NUM_REASSDATA IP_REASS_MAX_PBUFS
  194. #define IP_FRAG 1
  195. #define IPV6_FRAG_COPYHEADER 1
  196. /* ---------- ICMP options ---------- */
  197. #define ICMP_TTL 255
  198. /* ---------- DHCP options ---------- */
  199. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  200. interfaces. */
  201. #define LWIP_DHCP 0
  202. /* 1 if you want to do an ARP check on the offered address
  203. (recommended). */
  204. #define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
  205. /* ---------- AUTOIP options ------- */
  206. #define LWIP_AUTOIP (LWIP_DHCP)
  207. #define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
  208. /* ---------- UDP options ---------- */
  209. #define LWIP_UDP 1
  210. #define LWIP_UDPLITE LWIP_UDP
  211. #define UDP_TTL 255
  212. /* ---------- RAW options ---------- */
  213. #define LWIP_RAW 1
  214. /* ---------- Statistics options ---------- */
  215. #define LWIP_STATS 1
  216. #define LWIP_STATS_DISPLAY 1
  217. #if LWIP_STATS
  218. #define LINK_STATS 1
  219. #define IP_STATS 1
  220. #define ICMP_STATS 1
  221. #define IGMP_STATS 1
  222. #define IPFRAG_STATS 1
  223. #define UDP_STATS 1
  224. #define TCP_STATS 1
  225. #define MEM_STATS 1
  226. #define MEMP_STATS 1
  227. #define PBUF_STATS 1
  228. #define SYS_STATS 1
  229. #endif /* LWIP_STATS */
  230. /* ---------- NETBIOS options ---------- */
  231. #define LWIP_NETBIOS_RESPOND_NAME_QUERY 1
  232. /* ---------- PPP options ---------- */
  233. #define PPP_SUPPORT 0 /* Set > 0 for PPP */
  234. #if PPP_SUPPORT
  235. #define NUM_PPP 1 /* Max PPP sessions. */
  236. /* Select modules to enable. Ideally these would be set in the makefile but
  237. * we're limited by the command line length so you need to modify the settings
  238. * in this file.
  239. */
  240. #define PPPOE_SUPPORT 1
  241. #define PPPOS_SUPPORT 1
  242. #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
  243. #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
  244. #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP */
  245. #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
  246. #define CCP_SUPPORT 0 /* Set > 0 for CCP */
  247. #define VJ_SUPPORT 0 /* Set > 0 for VJ header compression. */
  248. #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
  249. #endif /* PPP_SUPPORT */
  250. #endif /* LWIP_OPTTEST_FILE */
  251. /* The following defines must be done even in OPTTEST mode: */
  252. #if !defined(NO_SYS) || !NO_SYS /* default is 0 */
  253. void sys_check_core_locking(void);
  254. #define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
  255. #endif
  256. #endif /* LWIP_LWIPOPTS_H */