lwipopts.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. #ifndef __LWIPOPTS_H__
  2. #define __LWIPOPTS_H__
  3. #include <rtconfig.h>
  4. #define ERRNO 1
  5. #define LWIP_IPV4 1
  6. #ifdef RT_USING_LWIP_IPV6
  7. #define LWIP_IPV6 1
  8. #else
  9. #define LWIP_IPV6 0
  10. #endif /* RT_USING_LWIP_IPV6 */
  11. #define NO_SYS 0
  12. #define LWIP_SOCKET 1
  13. #define LWIP_NETCONN 1
  14. #ifdef RT_LWIP_IGMP
  15. #define LWIP_IGMP 1
  16. #else
  17. #define LWIP_IGMP 0
  18. #endif
  19. #ifdef RT_LWIP_ICMP
  20. #define LWIP_ICMP 1
  21. #else
  22. #define LWIP_ICMP 0
  23. #endif
  24. #ifdef RT_LWIP_SNMP
  25. #define LWIP_SNMP 1
  26. #else
  27. #define LWIP_SNMP 0
  28. #endif
  29. #ifdef RT_LWIP_DNS
  30. #define LWIP_DNS 1
  31. #else
  32. #define LWIP_DNS 0
  33. #endif
  34. #define LWIP_HAVE_LOOPIF 0
  35. #define LWIP_PLATFORM_BYTESWAP 0
  36. #ifndef BYTE_ORDER
  37. #define BYTE_ORDER LITTLE_ENDIAN
  38. #endif
  39. /* #define RT_LWIP_DEBUG */
  40. #ifdef RT_LWIP_DEBUG
  41. #define LWIP_DEBUG
  42. #endif
  43. /* ---------- Debug options ---------- */
  44. #ifdef LWIP_DEBUG
  45. #define SYS_DEBUG LWIP_DBG_OFF
  46. #define ETHARP_DEBUG LWIP_DBG_OFF
  47. #define PPP_DEBUG LWIP_DBG_OFF
  48. #define MEM_DEBUG LWIP_DBG_OFF
  49. #define MEMP_DEBUG LWIP_DBG_OFF
  50. #define PBUF_DEBUG LWIP_DBG_OFF
  51. #define API_LIB_DEBUG LWIP_DBG_OFF
  52. #define API_MSG_DEBUG LWIP_DBG_OFF
  53. #define TCPIP_DEBUG LWIP_DBG_OFF
  54. #define NETIF_DEBUG LWIP_DBG_OFF
  55. #define SOCKETS_DEBUG LWIP_DBG_OFF
  56. #define DNS_DEBUG LWIP_DBG_OFF
  57. #define AUTOIP_DEBUG LWIP_DBG_OFF
  58. #define DHCP_DEBUG LWIP_DBG_OFF
  59. #define IP_DEBUG LWIP_DBG_OFF
  60. #define IP_REASS_DEBUG LWIP_DBG_OFF
  61. #define ICMP_DEBUG LWIP_DBG_OFF
  62. #define IGMP_DEBUG LWIP_DBG_OFF
  63. #define UDP_DEBUG LWIP_DBG_OFF
  64. #define TCP_DEBUG LWIP_DBG_OFF
  65. #define TCP_INPUT_DEBUG LWIP_DBG_OFF
  66. #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
  67. #define TCP_RTO_DEBUG LWIP_DBG_OFF
  68. #define TCP_CWND_DEBUG LWIP_DBG_OFF
  69. #define TCP_WND_DEBUG LWIP_DBG_OFF
  70. #define TCP_FR_DEBUG LWIP_DBG_OFF
  71. #define TCP_QLEN_DEBUG LWIP_DBG_OFF
  72. #define TCP_RST_DEBUG LWIP_DBG_OFF
  73. #endif
  74. #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
  75. /* ---------- Memory options ---------- */
  76. #define MEM_ALIGNMENT 4
  77. #define MEMP_OVERFLOW_CHECK 1 ////
  78. #define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 ////
  79. //#define MEM_LIBC_MALLOC 1
  80. //#define MEM_USE_POOLS 1
  81. //#define MEMP_USE_CUSTOM_POOLS 1
  82. //#define MEM_SIZE (1024*64)
  83. #define MEMP_MEM_MALLOC 0
  84. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  85. sends a lot of data out of ROM (or other static memory), this
  86. should be set high. */
  87. #define MEMP_NUM_PBUF 32 //16
  88. /* the number of struct netconns */
  89. #ifdef RT_MEMP_NUM_NETCONN
  90. #define MEMP_NUM_NETCONN RT_MEMP_NUM_NETCONN
  91. #endif
  92. /* the number of UDP protocol control blocks. One per active RAW "connection". */
  93. #ifdef RT_LWIP_RAW_PCB_NUM
  94. #define MEMP_NUM_RAW_PCB RT_LWIP_RAW_PCB_NUM
  95. #endif
  96. /* the number of UDP protocol control blocks. One per active UDP "connection". */
  97. #ifdef RT_LWIP_UDP_PCB_NUM
  98. #define MEMP_NUM_UDP_PCB RT_LWIP_UDP_PCB_NUM
  99. #endif
  100. /* the number of simulatenously active TCP connections. */
  101. #ifdef RT_LWIP_TCP_PCB_NUM
  102. #define MEMP_NUM_TCP_PCB RT_LWIP_TCP_PCB_NUM
  103. #endif
  104. /* the number of simultaneously queued TCP */
  105. #ifdef RT_LWIP_TCP_SEG_NUM
  106. #define MEMP_NUM_TCP_SEG RT_LWIP_TCP_SEG_NUM
  107. #else
  108. #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
  109. #endif
  110. /*
  111. * You can re-define following setting in rtcofnig.h to overwrite the default
  112. * setting in the lwip opts.h
  113. */
  114. /* MEMP_NUM_NETBUF: the number of struct netbufs. */
  115. // #define MEMP_NUM_NETBUF 2
  116. /* MEMP_NUM_NETCONN: the number of struct netconns. */
  117. // #define MEMP_NUM_NETCONN 4
  118. /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
  119. for sequential API communication and incoming packets. Used in
  120. src/api/tcpip.c. */
  121. // #define MEMP_NUM_TCPIP_MSG_API 16
  122. // #define MEMP_NUM_TCPIP_MSG_INPKT 16
  123. /* ---------- Pbuf options ---------- */
  124. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  125. #ifdef RT_LWIP_PBUF_NUM
  126. #define PBUF_POOL_SIZE RT_LWIP_PBUF_NUM
  127. #endif
  128. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  129. #ifdef RT_LWIP_PBUF_POOL_BUFSIZE
  130. #define PBUF_POOL_BUFSIZE RT_LWIP_PBUF_POOL_BUFSIZE
  131. #endif
  132. /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  133. link level header. */
  134. #define PBUF_LINK_HLEN 16
  135. #ifdef RT_LWIP_ETH_PAD_SIZE
  136. #define ETH_PAD_SIZE RT_LWIP_ETH_PAD_SIZE
  137. #endif
  138. /** SYS_LIGHTWEIGHT_PROT
  139. * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
  140. * for certain critical regions during buffer allocation, deallocation and memory
  141. * allocation and deallocation.
  142. */
  143. #define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
  144. #ifdef LWIP_USING_NAT
  145. #define IP_NAT 1
  146. #else
  147. #define IP_NAT 0
  148. #endif
  149. /* ---------- TCP options ---------- */
  150. #ifdef RT_LWIP_TCP
  151. #define LWIP_TCP 1
  152. #else
  153. #define LWIP_TCP 0
  154. #endif
  155. #define TCP_TTL 255
  156. /* Controls if TCP should queue segments that arrive out of
  157. order. Define to 0 if your device is low on memory. */
  158. #define TCP_QUEUE_OOSEQ 1
  159. /* TCP Maximum segment size. */
  160. #define TCP_MSS 1460
  161. /* TCP sender buffer space (bytes). */
  162. #ifdef RT_LWIP_TCP_SND_BUF
  163. #define TCP_SND_BUF RT_LWIP_TCP_SND_BUF
  164. #else
  165. #define TCP_SND_BUF (TCP_MSS * 2)
  166. #endif
  167. /* TCP sender buffer space (pbufs). This must be at least = 2 *
  168. TCP_SND_BUF/TCP_MSS for things to work. */
  169. #define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
  170. /* TCP writable space (bytes). This must be less than or equal
  171. to TCP_SND_BUF. It is the amount of space which must be
  172. available in the tcp snd_buf for select to return writable */
  173. #define TCP_SNDLOWAT (TCP_SND_BUF/2)
  174. #define TCP_SNDQUEUELOWAT TCP_SND_QUEUELEN/2
  175. /* TCP receive window. */
  176. #ifdef RT_LWIP_TCP_WND
  177. #define TCP_WND RT_LWIP_TCP_WND
  178. #else
  179. #define TCP_WND (TCP_MSS * 2)
  180. #endif
  181. /* Maximum number of retransmissions of data segments. */
  182. #define TCP_MAXRTX 12
  183. /* Maximum number of retransmissions of SYN segments. */
  184. #define TCP_SYNMAXRTX 4
  185. /* tcpip thread options */
  186. #ifdef RT_LWIP_TCPTHREAD_PRIORITY
  187. #define TCPIP_MBOX_SIZE RT_LWIP_TCPTHREAD_MBOX_SIZE
  188. #define TCPIP_THREAD_PRIO RT_LWIP_TCPTHREAD_PRIORITY
  189. #define TCPIP_THREAD_STACKSIZE RT_LWIP_TCPTHREAD_STACKSIZE
  190. #else
  191. #define TCPIP_MBOX_SIZE 8
  192. #define TCPIP_THREAD_PRIO 128
  193. #define TCPIP_THREAD_STACKSIZE 4096
  194. #endif
  195. #define TCPIP_THREAD_NAME "tcpip"
  196. #define DEFAULT_TCP_RECVMBOX_SIZE 10
  197. /* ---------- ARP options ---------- */
  198. #define LWIP_ARP 1
  199. #define ARP_TABLE_SIZE 10
  200. #define ARP_QUEUEING 1
  201. /* ---------- IP options ---------- */
  202. /* Define IP_FORWARD to 1 if you wish to have the ability to forward
  203. IP packets across network interfaces. If you are going to run lwIP
  204. on a device with only one network interface, define this to 0. */
  205. #define IP_FORWARD 0
  206. /* IP reassembly and segmentation.These are orthogonal even
  207. * if they both deal with IP fragments */
  208. #ifdef RT_LWIP_REASSEMBLY_FRAG
  209. #define IP_REASSEMBLY 1
  210. #define IP_FRAG 1
  211. #define IP_REASS_MAX_PBUFS 10
  212. #define MEMP_NUM_REASSDATA 10
  213. #else
  214. #define IP_REASSEMBLY 0
  215. #define IP_FRAG 0
  216. #endif
  217. /* ---------- ICMP options ---------- */
  218. #define ICMP_TTL 255
  219. /* ---------- DHCP options ---------- */
  220. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  221. interfaces. */
  222. #ifdef RT_LWIP_DHCP
  223. #define LWIP_DHCP 1
  224. #else
  225. #define LWIP_DHCP 0
  226. #endif
  227. /* 1 if you want to do an ARP check on the offered address
  228. (recommended). */
  229. #define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
  230. /* ---------- AUTOIP options ------- */
  231. #define LWIP_AUTOIP 0
  232. #define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
  233. /* ---------- UDP options ---------- */
  234. #ifdef RT_LWIP_UDP
  235. #define LWIP_UDP 1
  236. #else
  237. #define LWIP_UDP 0
  238. #endif
  239. #define LWIP_UDPLITE 0
  240. #define UDP_TTL 255
  241. #define DEFAULT_UDP_RECVMBOX_SIZE 1
  242. /* ---------- RAW options ---------- */
  243. #ifdef RT_LWIP_RAW
  244. #define LWIP_RAW 1
  245. #else
  246. #define LWIP_RAW 0
  247. #endif
  248. #define DEFAULT_RAW_RECVMBOX_SIZE 1
  249. #define DEFAULT_ACCEPTMBOX_SIZE 10
  250. /* ---------- Statistics options ---------- */
  251. #ifdef RT_LWIP_STATS
  252. #define LWIP_STATS 1
  253. #define LWIP_STATS_DISPLAY 1
  254. #else
  255. #define LWIP_STATS 0
  256. #endif
  257. #if LWIP_STATS
  258. #define LINK_STATS 1
  259. #define IP_STATS 1
  260. #define ICMP_STATS 1
  261. #define IGMP_STATS 1
  262. #define IPFRAG_STATS 1
  263. #define UDP_STATS 1
  264. #define TCP_STATS 1
  265. #define MEM_STATS 1
  266. #define MEMP_STATS 1
  267. #define PBUF_STATS 1
  268. #define SYS_STATS 1
  269. #endif /* LWIP_STATS */
  270. /* ---------- PPP options ---------- */
  271. #ifdef RT_LWIP_PPP
  272. #define PPP_SUPPORT 1 /* Set > 0 for PPP */
  273. #else
  274. #define PPP_SUPPORT 0 /* Set > 0 for PPP */
  275. #endif
  276. #if PPP_SUPPORT
  277. #define NUM_PPP 1 /* Max PPP sessions. */
  278. /* Select modules to enable. Ideally these would be set in the makefile but
  279. * we're limited by the command line length so you need to modify the settings
  280. * in this file.
  281. */
  282. #ifdef RT_LWIP_PPPOE
  283. #define PPPOE_SUPPORT 1
  284. #else
  285. #define PPPOE_SUPPORT 0
  286. #endif
  287. #ifdef RT_LWIP_PPPOS
  288. #define PPPOS_SUPPORT 1
  289. #else
  290. #define PPPOS_SUPPORT 0
  291. #endif
  292. #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
  293. #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
  294. #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
  295. #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
  296. #define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
  297. #define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
  298. #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
  299. #endif /* PPP_SUPPORT */
  300. /**
  301. * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
  302. * Disable this option if you use a POSIX operating system that uses the same
  303. * names (read, write & close). (only used if you use sockets.c)
  304. */
  305. #ifndef LWIP_POSIX_SOCKETS_IO_NAMES
  306. #define LWIP_POSIX_SOCKETS_IO_NAMES 0
  307. #endif
  308. /**
  309. * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
  310. * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
  311. * in seconds. (does not require sockets.c, and will affect tcp.c)
  312. */
  313. #ifndef LWIP_TCP_KEEPALIVE
  314. #define LWIP_TCP_KEEPALIVE 1
  315. #endif
  316. /**
  317. * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
  318. */
  319. #ifndef LWIP_NETIF_API
  320. #define LWIP_NETIF_API 1
  321. #endif
  322. #ifdef LWIP_IGMP
  323. #include <stdlib.h>
  324. #define LWIP_RAND rand
  325. #endif
  326. /*
  327. ------------------------------------
  328. ---------- Socket options ----------
  329. ------------------------------------
  330. */
  331. /*
  332. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  333. */
  334. #ifndef LWIP_SOCKET
  335. #define LWIP_SOCKET 1
  336. #endif
  337. /*
  338. * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
  339. * (only used if you use sockets.c)
  340. */
  341. #ifdef RT_USING_DFS_NET
  342. #define LWIP_COMPAT_SOCKETS 0
  343. #else
  344. #ifndef LWIP_COMPAT_SOCKETS
  345. #define LWIP_COMPAT_SOCKETS 1
  346. #endif
  347. #endif
  348. /**
  349. * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
  350. * SO_SNDTIMEO processing.
  351. */
  352. #ifndef LWIP_SO_SNDTIMEO
  353. #define LWIP_SO_SNDTIMEO 1
  354. #endif
  355. /**
  356. * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
  357. * SO_RCVTIMEO processing.
  358. */
  359. #ifndef LWIP_SO_RCVTIMEO
  360. #define LWIP_SO_RCVTIMEO 1
  361. #endif
  362. /**
  363. * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
  364. */
  365. #ifndef LWIP_SO_RCVBUF
  366. #define LWIP_SO_RCVBUF 1
  367. #endif
  368. /**
  369. * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
  370. */
  371. #ifndef RECV_BUFSIZE_DEFAULT
  372. #define RECV_BUFSIZE_DEFAULT 8192
  373. #endif
  374. /**
  375. * SO_REUSE==1: Enable SO_REUSEADDR option.
  376. */
  377. #ifndef SO_REUSE
  378. #define SO_REUSE 0
  379. #endif
  380. /*
  381. ------------------------------------
  382. ------- Applications options -------
  383. ------------------------------------
  384. */
  385. /**
  386. * Max. length of TFTP filename
  387. */
  388. #ifdef RT_LWIP_TFTP_MAX_FILENAME_LEN
  389. #define TFTP_MAX_FILENAME_LEN RT_LWIP_TFTP_MAX_FILENAME_LEN
  390. #elif defined(RT_DFS_ELM_MAX_LFN)
  391. #define TFTP_MAX_FILENAME_LEN RT_DFS_ELM_MAX_LFN
  392. #else
  393. #define TFTP_MAX_FILENAME_LEN 64
  394. #endif
  395. #endif /* __LWIPOPTS_H__ */