lwipopts.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. #ifndef __LWIPOPTS_H__
  2. #define __LWIPOPTS_H__
  3. #include <rtconfig.h>
  4. #define ERRNO 1
  5. #define NO_SYS 0
  6. #define LWIP_SOCKET 1
  7. #define LWIP_NETCONN 1
  8. #ifdef RT_LWIP_IGMP
  9. #define LWIP_IGMP 1
  10. #else
  11. #define LWIP_IGMP 0
  12. #endif
  13. #ifdef RT_LWIP_ICMP
  14. #define LWIP_ICMP 1
  15. #else
  16. #define LWIP_ICMP 0
  17. #endif
  18. #ifdef RT_LWIP_SNMP
  19. #define LWIP_SNMP 1
  20. #else
  21. #define LWIP_SNMP 0
  22. #endif
  23. #ifdef RT_LWIP_DNS
  24. #define LWIP_DNS 1
  25. #else
  26. #define LWIP_DNS 0
  27. #endif
  28. #define LWIP_HAVE_LOOPIF 0
  29. #define LWIP_PLATFORM_BYTESWAP 0
  30. #define BYTE_ORDER LITTLE_ENDIAN
  31. /* Enable SO_RCVTIMEO processing. */
  32. #define LWIP_SO_RCVTIMEO 1
  33. /* #define RT_LWIP_DEBUG */
  34. #ifdef RT_LWIP_DEBUG
  35. #define LWIP_DEBUG
  36. #endif
  37. /* ---------- Debug options ---------- */
  38. #ifdef LWIP_DEBUG
  39. #define SYS_DEBUG LWIP_DBG_OFF
  40. #define ETHARP_DEBUG LWIP_DBG_OFF
  41. #define PPP_DEBUG LWIP_DBG_OFF
  42. #define MEM_DEBUG LWIP_DBG_OFF
  43. #define MEMP_DEBUG LWIP_DBG_OFF
  44. #define PBUF_DEBUG LWIP_DBG_OFF
  45. #define API_LIB_DEBUG LWIP_DBG_OFF
  46. #define API_MSG_DEBUG LWIP_DBG_OFF
  47. #define TCPIP_DEBUG LWIP_DBG_OFF
  48. #define NETIF_DEBUG LWIP_DBG_OFF
  49. #define SOCKETS_DEBUG LWIP_DBG_OFF
  50. #define DNS_DEBUG LWIP_DBG_OFF
  51. #define AUTOIP_DEBUG LWIP_DBG_OFF
  52. #define DHCP_DEBUG LWIP_DBG_OFF
  53. #define IP_DEBUG LWIP_DBG_OFF
  54. #define IP_REASS_DEBUG LWIP_DBG_OFF
  55. #define ICMP_DEBUG LWIP_DBG_OFF
  56. #define IGMP_DEBUG LWIP_DBG_OFF
  57. #define UDP_DEBUG LWIP_DBG_OFF
  58. #define TCP_DEBUG LWIP_DBG_OFF
  59. #define TCP_INPUT_DEBUG LWIP_DBG_OFF
  60. #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
  61. #define TCP_RTO_DEBUG LWIP_DBG_OFF
  62. #define TCP_CWND_DEBUG LWIP_DBG_OFF
  63. #define TCP_WND_DEBUG LWIP_DBG_OFF
  64. #define TCP_FR_DEBUG LWIP_DBG_OFF
  65. #define TCP_QLEN_DEBUG LWIP_DBG_OFF
  66. #define TCP_RST_DEBUG LWIP_DBG_OFF
  67. #endif
  68. #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
  69. /* ---------- Memory options ---------- */
  70. #ifdef RT_LWIP_ALIGN_SIZE
  71. #define MEM_ALIGNMENT RT_LWIP_ALIGN_SIZE
  72. #else
  73. #define MEM_ALIGNMENT 4
  74. #endif
  75. #define MEM_LIBC_MALLOC 1
  76. #define mem_malloc rt_malloc
  77. #define mem_free rt_free
  78. #define mem_calloc rt_calloc
  79. #ifdef RT_LWIP_USING_RT_MEM
  80. #define MEMP_MEM_MALLOC 1
  81. #else
  82. #define MEMP_MEM_MALLOC 0
  83. #endif
  84. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  85. sends a lot of data out of ROM (or other static memory), this
  86. should be set high. */
  87. #define MEMP_NUM_PBUF 16
  88. /* the number of UDP protocol control blocks. One per active RAW "connection". */
  89. #ifdef RT_LWIP_RAW_PCB_NUM
  90. #define MEMP_NUM_RAW_PCB RT_LWIP_RAW_PCB_NUM
  91. #endif
  92. /* the number of UDP protocol control blocks. One per active UDP "connection". */
  93. #ifdef RT_LWIP_UDP_PCB_NUM
  94. #define MEMP_NUM_UDP_PCB RT_LWIP_UDP_PCB_NUM
  95. #endif
  96. /* the number of simulatenously active TCP connections. */
  97. #ifdef RT_LWIP_TCP_PCB_NUM
  98. #define MEMP_NUM_TCP_PCB RT_LWIP_TCP_PCB_NUM
  99. #endif
  100. /* the number of simultaneously queued TCP */
  101. #ifdef RT_LWIP_TCP_SEG_NUM
  102. #define MEMP_NUM_TCP_SEG RT_LWIP_TCP_SEG_NUM
  103. #endif
  104. /* The following four are used only with the sequential API and can be
  105. set to 0 if the application only will use the raw API. */
  106. /* MEMP_NUM_NETBUF: the number of struct netbufs. */
  107. #define MEMP_NUM_NETBUF 2
  108. /* MEMP_NUM_NETCONN: the number of struct netconns. */
  109. #define MEMP_NUM_NETCONN 4
  110. /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
  111. for sequential API communication and incoming packets. Used in
  112. src/api/tcpip.c. */
  113. #define MEMP_NUM_TCPIP_MSG_API 16
  114. #define MEMP_NUM_TCPIP_MSG_INPKT 16
  115. /* ---------- Pbuf options ---------- */
  116. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  117. #ifdef RT_LWIP_PBUF_NUM
  118. #define PBUF_POOL_SIZE RT_LWIP_PBUF_NUM
  119. #endif
  120. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  121. #ifdef RT_LWIP_PBUF_POOL_BUFSIZE
  122. #define PBUF_POOL_BUFSIZE RT_LWIP_PBUF_POOL_BUFSIZE
  123. #endif
  124. /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  125. link level header. */
  126. #define PBUF_LINK_HLEN 16
  127. #ifdef RT_LWIP_ETH_PAD_SIZE
  128. #define ETH_PAD_SIZE RT_LWIP_ETH_PAD_SIZE
  129. #endif
  130. /** SYS_LIGHTWEIGHT_PROT
  131. * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
  132. * for certain critical regions during buffer allocation, deallocation and memory
  133. * allocation and deallocation.
  134. */
  135. #define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
  136. /* ---------- TCP options ---------- */
  137. #ifdef RT_LWIP_TCP
  138. #define LWIP_TCP 1
  139. #else
  140. #define LWIP_TCP 0
  141. #endif
  142. #define TCP_TTL 255
  143. /* Controls if TCP should queue segments that arrive out of
  144. order. Define to 0 if your device is low on memory. */
  145. #define TCP_QUEUE_OOSEQ 1
  146. /* TCP Maximum segment size. */
  147. #define TCP_MSS 1460
  148. /* TCP sender buffer space (bytes). */
  149. #ifdef RT_LWIP_TCP_SND_BUF
  150. #define TCP_SND_BUF RT_LWIP_TCP_SND_BUF
  151. #else
  152. #define TCP_SND_BUF (TCP_MSS * 2)
  153. #endif
  154. /* TCP sender buffer space (pbufs). This must be at least = 2 *
  155. TCP_SND_BUF/TCP_MSS for things to work. */
  156. #define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
  157. /* TCP writable space (bytes). This must be less than or equal
  158. to TCP_SND_BUF. It is the amount of space which must be
  159. available in the tcp snd_buf for select to return writable */
  160. #define TCP_SNDLOWAT (TCP_SND_BUF/2)
  161. /* TCP receive window. */
  162. #ifdef RT_LWIP_TCP_WND
  163. #define TCP_WND RT_LWIP_TCP_WND
  164. #else
  165. #define TCP_WND (TCP_MSS * 2)
  166. #endif
  167. /* Maximum number of retransmissions of data segments. */
  168. #define TCP_MAXRTX 12
  169. /* Maximum number of retransmissions of SYN segments. */
  170. #define TCP_SYNMAXRTX 4
  171. /* tcpip thread options */
  172. #ifdef RT_LWIP_TCPTHREAD_PRIORITY
  173. #define TCPIP_MBOX_SIZE RT_LWIP_TCPTHREAD_MBOX_SIZE
  174. #define TCPIP_THREAD_PRIO RT_LWIP_TCPTHREAD_PRIORITY
  175. #define TCPIP_THREAD_STACKSIZE RT_LWIP_TCPTHREAD_STACKSIZE
  176. #else
  177. #define TCPIP_MBOX_SIZE 8
  178. #define TCPIP_THREAD_PRIO 128
  179. #define TCPIP_THREAD_STACKSIZE 4096
  180. #endif
  181. #define TCPIP_THREAD_NAME "tcpip"
  182. #define DEFAULT_TCP_RECVMBOX_SIZE 10
  183. /* ---------- ARP options ---------- */
  184. #define LWIP_ARP 1
  185. #define ARP_TABLE_SIZE 10
  186. #define ARP_QUEUEING 1
  187. /* ---------- IP options ---------- */
  188. /* Define IP_FORWARD to 1 if you wish to have the ability to forward
  189. IP packets across network interfaces. If you are going to run lwIP
  190. on a device with only one network interface, define this to 0. */
  191. #define IP_FORWARD 0
  192. /* IP reassembly and segmentation.These are orthogonal even
  193. * if they both deal with IP fragments */
  194. #define IP_REASSEMBLY 0
  195. #define IP_REASS_MAX_PBUFS 10
  196. #define MEMP_NUM_REASSDATA 10
  197. #define IP_FRAG 0
  198. /* ---------- ICMP options ---------- */
  199. #define ICMP_TTL 255
  200. /* ---------- DHCP options ---------- */
  201. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  202. interfaces. */
  203. #ifdef RT_LWIP_DHCP
  204. #define LWIP_DHCP 1
  205. #else
  206. #define LWIP_DHCP 0
  207. #endif
  208. /* 1 if you want to do an ARP check on the offered address
  209. (recommended). */
  210. #define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
  211. /* ---------- AUTOIP options ------- */
  212. #define LWIP_AUTOIP 0
  213. #define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
  214. /* ---------- UDP options ---------- */
  215. #ifdef RT_LWIP_UDP
  216. #define LWIP_UDP 1
  217. #else
  218. #define LWIP_UDP 0
  219. #endif
  220. #define LWIP_UDPLITE 0
  221. #define UDP_TTL 255
  222. #define DEFAULT_UDP_RECVMBOX_SIZE 1
  223. /* ---------- RAW options ---------- */
  224. #define DEFAULT_RAW_RECVMBOX_SIZE 1
  225. #define DEFAULT_ACCEPTMBOX_SIZE 10
  226. /* ---------- Statistics options ---------- */
  227. #ifdef RT_LWIP_STATS
  228. #define LWIP_STATS 1
  229. #define LWIP_STATS_DISPLAY 1
  230. #else
  231. #define LWIP_STATS 0
  232. #endif
  233. #if LWIP_STATS
  234. #define LINK_STATS 1
  235. #define IP_STATS 1
  236. #define ICMP_STATS 1
  237. #define IGMP_STATS 1
  238. #define IPFRAG_STATS 1
  239. #define UDP_STATS 1
  240. #define TCP_STATS 1
  241. #define MEM_STATS 1
  242. #define MEMP_STATS 1
  243. #define PBUF_STATS 1
  244. #define SYS_STATS 1
  245. #endif /* LWIP_STATS */
  246. /* ---------- PPP options ---------- */
  247. #ifdef RT_LWIP_PPP
  248. #define PPP_SUPPORT 1 /* Set > 0 for PPP */
  249. #else
  250. #define PPP_SUPPORT 0 /* Set > 0 for PPP */
  251. #endif
  252. #if PPP_SUPPORT
  253. #define NUM_PPP 1 /* Max PPP sessions. */
  254. /* Select modules to enable. Ideally these would be set in the makefile but
  255. * we're limited by the command line length so you need to modify the settings
  256. * in this file.
  257. */
  258. #define PPPOE_SUPPORT 0
  259. #define PPPOS_SUPPORT 1
  260. #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
  261. #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
  262. #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
  263. #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
  264. #define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
  265. #define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
  266. #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
  267. #endif /* PPP_SUPPORT */
  268. /* no read/write/close for socket */
  269. #define LWIP_POSIX_SOCKETS_IO_NAMES 0
  270. #define LWIP_NETIF_API 1
  271. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
  272. #define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)
  273. #ifdef LWIP_IGMP
  274. #include <stdlib.h>
  275. #define LWIP_RAND rand
  276. #endif
  277. #endif /* __LWIPOPTS_H__ */