lwipopts.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. #define MEM_ALIGNMENT RT_ALIGN_SIZE
  71. #define MEM_LIBC_MALLOC 1
  72. #define mem_malloc rt_malloc
  73. #define mem_free rt_free
  74. #define mem_calloc rt_calloc
  75. #ifdef RT_LWIP_USING_RT_MEM
  76. #define MEMP_MEM_MALLOC 1
  77. #else
  78. #define MEMP_MEM_MALLOC 0
  79. #endif
  80. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  81. sends a lot of data out of ROM (or other static memory), this
  82. should be set high. */
  83. #define MEMP_NUM_PBUF 16
  84. /* the number of UDP protocol control blocks. One per active RAW "connection". */
  85. #ifdef RT_LWIP_RAW_PCB_NUM
  86. #define MEMP_NUM_RAW_PCB RT_LWIP_RAW_PCB_NUM
  87. #endif
  88. /* the number of UDP protocol control blocks. One per active UDP "connection". */
  89. #ifdef RT_LWIP_UDP_PCB_NUM
  90. #define MEMP_NUM_UDP_PCB RT_LWIP_UDP_PCB_NUM
  91. #endif
  92. /* the number of simulatenously active TCP connections. */
  93. #ifdef RT_LWIP_TCP_PCB_NUM
  94. #define MEMP_NUM_TCP_PCB RT_LWIP_TCP_PCB_NUM
  95. #endif
  96. /* the number of simultaneously queued TCP */
  97. #ifdef RT_LWIP_TCP_SEG_NUM
  98. #define MEMP_NUM_TCP_SEG RT_LWIP_TCP_SEG_NUM
  99. #endif
  100. /* The following four are used only with the sequential API and can be
  101. set to 0 if the application only will use the raw API. */
  102. /* MEMP_NUM_NETBUF: the number of struct netbufs. */
  103. #define MEMP_NUM_NETBUF 2
  104. /* MEMP_NUM_NETCONN: the number of struct netconns. */
  105. #define MEMP_NUM_NETCONN 4
  106. /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
  107. for sequential API communication and incoming packets. Used in
  108. src/api/tcpip.c. */
  109. #define MEMP_NUM_TCPIP_MSG_API 16
  110. #define MEMP_NUM_TCPIP_MSG_INPKT 16
  111. /* ---------- Pbuf options ---------- */
  112. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  113. #ifdef RT_LWIP_PBUF_NUM
  114. #define PBUF_POOL_SIZE RT_LWIP_PBUF_NUM
  115. #endif
  116. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  117. #define PBUF_POOL_BUFSIZE 1500
  118. /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  119. link level header. */
  120. #define PBUF_LINK_HLEN 16
  121. #ifdef RT_LWIP_ETH_PAD_SIZE
  122. #define ETH_PAD_SIZE RT_LWIP_ETH_PAD_SIZE
  123. #endif
  124. /** SYS_LIGHTWEIGHT_PROT
  125. * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
  126. * for certain critical regions during buffer allocation, deallocation and memory
  127. * allocation and deallocation.
  128. */
  129. #define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
  130. /* ---------- TCP options ---------- */
  131. #ifdef RT_LWIP_TCP
  132. #define LWIP_TCP 1
  133. #else
  134. #define LWIP_TCP 0
  135. #endif
  136. #define TCP_TTL 255
  137. /* Controls if TCP should queue segments that arrive out of
  138. order. Define to 0 if your device is low on memory. */
  139. #define TCP_QUEUE_OOSEQ 1
  140. /* TCP Maximum segment size. */
  141. #define TCP_MSS 1460
  142. /* TCP sender buffer space (bytes). */
  143. #ifdef RT_LWIP_TCP_SND_BUF
  144. #define TCP_SND_BUF RT_LWIP_TCP_SND_BUF
  145. #else
  146. #define TCP_SND_BUF (TCP_MSS * 2)
  147. #endif
  148. /* TCP sender buffer space (pbufs). This must be at least = 2 *
  149. TCP_SND_BUF/TCP_MSS for things to work. */
  150. #define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
  151. /* TCP writable space (bytes). This must be less than or equal
  152. to TCP_SND_BUF. It is the amount of space which must be
  153. available in the tcp snd_buf for select to return writable */
  154. #define TCP_SNDLOWAT (TCP_SND_BUF/2)
  155. /* TCP receive window. */
  156. #ifdef RT_LWIP_TCP_WND
  157. #define TCP_WND RT_LWIP_TCP_WND
  158. #else
  159. #define TCP_WND (TCP_MSS * 2)
  160. #endif
  161. /* Maximum number of retransmissions of data segments. */
  162. #define TCP_MAXRTX 12
  163. /* Maximum number of retransmissions of SYN segments. */
  164. #define TCP_SYNMAXRTX 4
  165. /* tcpip thread options */
  166. #ifdef RT_LWIP_TCPTHREAD_PRIORITY
  167. #define TCPIP_MBOX_SIZE RT_LWIP_TCPTHREAD_MBOX_SIZE
  168. #define TCPIP_THREAD_PRIO RT_LWIP_TCPTHREAD_PRIORITY
  169. #define TCPIP_THREAD_STACKSIZE RT_LWIP_TCPTHREAD_STACKSIZE
  170. #else
  171. #define TCPIP_MBOX_SIZE 8
  172. #define TCPIP_THREAD_PRIO 128
  173. #define TCPIP_THREAD_STACKSIZE 4096
  174. #endif
  175. #define TCPIP_THREAD_NAME "tcpip"
  176. #define DEFAULT_TCP_RECVMBOX_SIZE 10
  177. /* ---------- ARP options ---------- */
  178. #define LWIP_ARP 1
  179. #define ARP_TABLE_SIZE 10
  180. #define ARP_QUEUEING 1
  181. /* ---------- IP options ---------- */
  182. /* Define IP_FORWARD to 1 if you wish to have the ability to forward
  183. IP packets across network interfaces. If you are going to run lwIP
  184. on a device with only one network interface, define this to 0. */
  185. #define IP_FORWARD 0
  186. /* IP reassembly and segmentation.These are orthogonal even
  187. * if they both deal with IP fragments */
  188. #define IP_REASSEMBLY 0
  189. #define IP_REASS_MAX_PBUFS 10
  190. #define MEMP_NUM_REASSDATA 10
  191. #define IP_FRAG 0
  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. #ifdef RT_LWIP_DHCP
  198. #define LWIP_DHCP 1
  199. #else
  200. #define LWIP_DHCP 0
  201. #endif
  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 0
  207. #define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
  208. /* ---------- UDP options ---------- */
  209. #ifdef RT_LWIP_UDP
  210. #define LWIP_UDP 1
  211. #else
  212. #define LWIP_UDP 0
  213. #endif
  214. #define LWIP_UDPLITE 0
  215. #define UDP_TTL 255
  216. #define DEFAULT_UDP_RECVMBOX_SIZE 1
  217. /* ---------- RAW options ---------- */
  218. #define DEFAULT_RAW_RECVMBOX_SIZE 1
  219. #define DEFAULT_ACCEPTMBOX_SIZE 10
  220. /* ---------- Statistics options ---------- */
  221. #ifdef RT_LWIP_STATS
  222. #define LWIP_STATS 1
  223. #define LWIP_STATS_DISPLAY 1
  224. #else
  225. #define LWIP_STATS 0
  226. #endif
  227. #if LWIP_STATS
  228. #define LINK_STATS 1
  229. #define IP_STATS 1
  230. #define ICMP_STATS 1
  231. #define IGMP_STATS 1
  232. #define IPFRAG_STATS 1
  233. #define UDP_STATS 1
  234. #define TCP_STATS 1
  235. #define MEM_STATS 1
  236. #define MEMP_STATS 1
  237. #define PBUF_STATS 1
  238. #define SYS_STATS 1
  239. #endif /* LWIP_STATS */
  240. /* ---------- PPP options ---------- */
  241. #ifdef RT_LWIP_PPP
  242. #define PPP_SUPPORT 1 /* Set > 0 for PPP */
  243. #else
  244. #define PPP_SUPPORT 0 /* Set > 0 for PPP */
  245. #endif
  246. #if PPP_SUPPORT
  247. #define NUM_PPP 1 /* Max PPP sessions. */
  248. /* Select modules to enable. Ideally these would be set in the makefile but
  249. * we're limited by the command line length so you need to modify the settings
  250. * in this file.
  251. */
  252. #define PPPOE_SUPPORT 0
  253. #define PPPOS_SUPPORT 1
  254. #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
  255. #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
  256. #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
  257. #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
  258. #define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
  259. #define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
  260. #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
  261. #endif /* PPP_SUPPORT */
  262. /* no read/write/close for socket */
  263. #define LWIP_POSIX_SOCKETS_IO_NAMES 0
  264. #define LWIP_NETIF_API 1
  265. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
  266. #define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)
  267. #ifdef LWIP_IGMP
  268. #include <stdlib.h>
  269. #define LWIP_RAND rand
  270. #endif
  271. #endif /* __LWIPOPTS_H__ */