lwipopts.h 10 KB

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