lwipopts.h 10 KB

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