lwipopts.h 10 KB

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