lwipopts.h 11 KB

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