lwipopts.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. /**
  2. * @file
  3. *
  4. * lwIP Options Configuration
  5. */
  6. /*
  7. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without modification,
  11. * are permitted provided that the following conditions are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. The name of the author may not be used to endorse or promote products
  19. * derived from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  22. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  23. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  24. * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  25. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  26. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  29. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  30. * OF SUCH DAMAGE.
  31. *
  32. * This file is part of the lwIP TCP/IP stack.
  33. *
  34. * Author: Adam Dunkels <adam@sics.se>
  35. *
  36. */
  37. #ifndef __LWIPOPTS_H__
  38. #define __LWIPOPTS_H__
  39. /*
  40. * Include user defined options first. Anything not defined in these files
  41. * will be set to standard values. Override anything you dont like!
  42. */
  43. #include "lwip/debug.h"
  44. #define LWIP_CHKSUM_ALGORITHM 2
  45. #undef TCP_MSS
  46. #define TCP_MSS 1460
  47. /*
  48. The TCP window size can be adjusted by changing the define TCP_WND. However,
  49. do keep in mind that this should be at least twice the size of TCP_MSS (thus
  50. on ethernet, where TCP_MSS is 1460, it should be set to at least 2920). If
  51. memory allows it, set this as high as possible (16-bit, so 0xFFFF is the highest
  52. value), but keep in mind that for every active connection, the full window may
  53. have to be buffered until it is acknowledged by the remote side (although this
  54. buffer size can still be controlled by TCP_SND_BUF and TCP_SND_QUEUELEN). The
  55. reason for "twice" are both the nagle algorithm and delayed ACK from the
  56. remote peer.
  57. */
  58. #define TCP_WND TCP_MSS*10 // max = 0xffff
  59. #define LWIP_NOASSERT 1
  60. #define TCP_LISTEN_BACKLOG 0
  61. /*------------------------------------------------------------------------------
  62. ---------------------------------- Timers --------------------------------------
  63. ------------------------------------------------------------------------------*/
  64. /*
  65. Be careful about setting this too small. lwIP just counts the number
  66. of times its timer is called and uses this to control time sensitive
  67. operations (such as TCP retransmissions), rather than actually
  68. measuring time using something more accurate. If you call the timer
  69. functions very frequently you may see things (such as retransmissions)
  70. happening sooner than they should.
  71. */
  72. /* these are originally defined in tcp_impl.h */
  73. #ifndef TCP_TMR_INTERVAL
  74. /* The TCP timer interval in milliseconds. */
  75. #define TCP_TMR_INTERVAL 250
  76. #endif /* TCP_TMR_INTERVAL */
  77. #ifndef TCP_FAST_INTERVAL
  78. /* the fine grained timeout in milliseconds */
  79. #define TCP_FAST_INTERVAL TCP_TMR_INTERVAL
  80. #endif /* TCP_FAST_INTERVAL */
  81. #ifndef TCP_SLOW_INTERVALs
  82. /* the coarse grained timeout in milliseconds */
  83. #define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL)
  84. #endif /* TCP_SLOW_INTERVAL */
  85. /*------------------------------------------------------------------------------
  86. --------------------------- Platform specific locking -------------------------
  87. ------------------------------------------------------------------------------*/
  88. /**
  89. * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
  90. * critical regions during buffer allocation, deallocation and memory
  91. * allocation and deallocation.
  92. */
  93. #define SYS_LIGHTWEIGHT_PROT 0
  94. /**
  95. * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  96. * use lwIP facilities.
  97. */
  98. /* set to 1 so we have no thread behaviour */
  99. #define NO_SYS 1
  100. /* set to 1 so we can use our own timers */
  101. #define NO_SYS_NO_TIMERS 1
  102. /*------------------------------------------------------------------------------
  103. -------------------------------- Memory options --------------------------------
  104. ------------------------------------------------------------------------------*/
  105. /* Misc */
  106. #define MEM_LIBC_MALLOC 1
  107. #define MEMP_MEM_MALLOC 1
  108. /**
  109. * MEM_ALIGNMENT: should be set to the alignment of the CPU
  110. * 4 byte alignment -> #define MEM_ALIGNMENT 4
  111. * 2 byte alignment -> #define MEM_ALIGNMENT 2
  112. */
  113. #define MEM_ALIGNMENT 1
  114. /**
  115. * MEM_SIZE: the size of the heap memory. If the application will send
  116. * a lot of data that needs to be copied, this should be set high.
  117. */
  118. #define MEM_SIZE 1024 * 1024 * 64
  119. #define TCP_SND_BUF 1024 * 63
  120. //#define TCP_OVERSIZE TCP_MSS
  121. #define TCP_SND_QUEUELEN 1024
  122. /*------------------------------------------------------------------------------
  123. -------------------------------- Pbuf Options ----------------------------------
  124. ------------------------------------------------------------------------------*/
  125. /**
  126. * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  127. * link level header. The default is 14, the standard value for
  128. * Ethernet.
  129. */
  130. #define PBUF_LINK_HLEN 16
  131. /**
  132. * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
  133. * designed to accomodate single full size TCP frame in one pbuf, including
  134. * TCP_MSS, IP header, and link header.
  135. *
  136. */
  137. #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
  138. /*------------------------------------------------------------------------------
  139. -------------------------- Internal Memory Pool Sizes --------------------------
  140. ------------------------------------------------------------------------------*/
  141. /**
  142. * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
  143. * If the application sends a lot of data out of ROM (or other static memory),
  144. * this should be set high.
  145. */
  146. #define MEMP_NUM_PBUF 256
  147. /**
  148. * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
  149. * (requires the LWIP_RAW option)
  150. */
  151. #define MEMP_NUM_RAW_PCB 128
  152. /**
  153. * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  154. * per active UDP "connection".
  155. * (requires the LWIP_UDP option)
  156. */
  157. #define MEMP_NUM_UDP_PCB 4
  158. /**
  159. * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
  160. * (requires the LWIP_TCP option)
  161. */
  162. #define MEMP_NUM_TCP_PCB 128
  163. /**
  164. * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
  165. * (requires the LWIP_TCP option)
  166. */
  167. #define MEMP_NUM_TCP_PCB_LISTEN 128
  168. /**
  169. * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
  170. * (requires the LWIP_TCP option)
  171. */
  172. #define MEMP_NUM_TCP_SEG 1024
  173. /**
  174. * MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
  175. * reassembly (whole packets, not fragments!)
  176. */
  177. #define MEMP_NUM_REASSDATA 1
  178. /**
  179. * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
  180. * packets (pbufs) that are waiting for an ARP request (to resolve
  181. * their destination address) to finish.
  182. * (requires the ARP_QUEUEING option)
  183. */
  184. #define MEMP_NUM_ARP_QUEUE 2
  185. /**
  186. * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
  187. * (requires NO_SYS==0)
  188. */
  189. #define MEMP_NUM_SYS_TIMEOUT 3
  190. /**
  191. * MEMP_NUM_NETBUF: the number of struct netbufs.
  192. * (only needed if you use the sequential API, like api_lib.c)
  193. */
  194. #define MEMP_NUM_NETBUF 2
  195. /**
  196. * MEMP_NUM_NETCONN: the number of struct netconns.
  197. * (only needed if you use the sequential API, like api_lib.c)
  198. */
  199. #define MEMP_NUM_NETCONN 4
  200. /**
  201. * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
  202. * for callback/timeout API communication.
  203. * (only needed if you use tcpip.c)
  204. */
  205. #define MEMP_NUM_TCPIP_MSG_API 8
  206. /**
  207. * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
  208. * for incoming packets.
  209. * (only needed if you use tcpip.c)
  210. */
  211. #define MEMP_NUM_TCPIP_MSG_INPKT 8
  212. /**
  213. * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
  214. */
  215. #define PBUF_POOL_SIZE 2048 /* was 32 */
  216. /*------------------------------------------------------------------------------
  217. ----------------------------------- ARP options --------------------------------
  218. ------------------------------------------------------------------------------*/
  219. /**
  220. * LWIP_ARP==1: Enable ARP functionality.
  221. */
  222. #define LWIP_ARP 1
  223. /*------------------------------------------------------------------------------
  224. ------------------------------------ IP options---------------------------------
  225. ------------------------------------------------------------------------------*/
  226. /**
  227. * IP_FORWARD==1: Enables the ability to forward IP packets across network
  228. * interfaces. If you are going to run lwIP on a device with only one network
  229. * interface, define this to 0.
  230. */
  231. #define IP_FORWARD 0
  232. /**
  233. * IP_OPTIONS: Defines the behavior for IP options.
  234. * IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
  235. * IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
  236. */
  237. #define IP_OPTIONS_ALLOWED 1
  238. /**
  239. * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
  240. * this option does not affect outgoing packet sizes, which can be controlled
  241. * via IP_FRAG.
  242. */
  243. #define IP_REASSEMBLY 1
  244. /**
  245. * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
  246. * that this option does not affect incoming packet sizes, which can be
  247. * controlled via IP_REASSEMBLY.
  248. */
  249. #define IP_FRAG 1
  250. /**
  251. * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
  252. * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
  253. * in this time, the whole packet is discarded.
  254. */
  255. #define IP_REASS_MAXAGE 3
  256. /**
  257. * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
  258. * Since the received pbufs are enqueued, be sure to configure
  259. * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
  260. * packets even if the maximum amount of fragments is enqueued for reassembly!
  261. */
  262. #define IP_REASS_MAX_PBUFS 4
  263. /**
  264. * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
  265. * fragmentation. Otherwise pbufs are allocated and reference the original
  266. * packet data to be fragmented.
  267. */
  268. #define IP_FRAG_USES_STATIC_BUF 0
  269. /**
  270. * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
  271. */
  272. #define IP_DEFAULT_TTL 255
  273. /*------------------------------------------------------------------------------
  274. ------------------------------- ICMP Options -----------------------------------
  275. ------------------------------------------------------------------------------*/
  276. /**
  277. * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
  278. * Be careful, disable that make your product non-compliant to RFC1122
  279. */
  280. #define LWIP_ICMP 1
  281. /*------------------------------------------------------------------------------
  282. ------------------------------- RAW Options ------------------------------------
  283. ------------------------------------------------------------------------------*/
  284. /**
  285. * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
  286. */
  287. #define LWIP_RAW 1
  288. /*------------------------------------------------------------------------------
  289. ------------------------------- DHCP Options -----------------------------------
  290. ------------------------------------------------------------------------------*/
  291. /**
  292. * LWIP_DHCP==1: Enable DHCP module.
  293. */
  294. #define LWIP_DHCP 0
  295. /*------------------------------------------------------------------------------
  296. ------------------------------ AUTOIP Options ----------------------------------
  297. ------------------------------------------------------------------------------*/
  298. /**
  299. * LWIP_AUTOIP==1: Enable AUTOIP module.
  300. */
  301. #define LWIP_AUTOIP 0
  302. /*------------------------------------------------------------------------------
  303. ------------------------------- SNMP Options -----------------------------------
  304. ------------------------------------------------------------------------------*/
  305. /**
  306. * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
  307. * transport.
  308. */
  309. #define LWIP_SNMP 0
  310. /*------------------------------------------------------------------------------
  311. ------------------------------- IGMP Options -----------------------------------
  312. ------------------------------------------------------------------------------*/
  313. /**
  314. * LWIP_IGMP==1: Turn on IGMP module.
  315. */
  316. #define LWIP_IGMP 0
  317. /*------------------------------------------------------------------------------
  318. -------------------------------- DNS Options -----------------------------------
  319. ------------------------------------------------------------------------------*/
  320. /**
  321. * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
  322. * transport.
  323. */
  324. #define LWIP_DNS 0
  325. /*------------------------------------------------------------------------------
  326. -------------------------------- UDP Options -----------------------------------
  327. ------------------------------------------------------------------------------*/
  328. /**
  329. * LWIP_UDP==1: Turn on UDP.
  330. */
  331. #define LWIP_UDP 1
  332. /*------------------------------------------------------------------------------
  333. -------------------------------- TCP Options -----------------------------------
  334. ------------------------------------------------------------------------------*/
  335. /**
  336. * LWIP_TCP==1: Turn on TCP.
  337. */
  338. #define LWIP_TCP 1
  339. #define LWIP_LISTEN_BACKLOG 0
  340. /*------------------------------------------------------------------------------
  341. --------------------------------- LOOPIF Options -------------------------------
  342. ------------------------------------------------------------------------------*/
  343. /**
  344. * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
  345. */
  346. #define LWIP_HAVE_LOOPIF 0
  347. /*------------------------------------------------------------------------------
  348. ---------------------------- Sequential Layer Options --------------------------
  349. ------------------------------------------------------------------------------*/
  350. /**
  351. * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  352. */
  353. #define LWIP_NETCONN 0
  354. /*------------------------------------------------------------------------------
  355. --------------------------------- Socket Options -------------------------------
  356. ------------------------------------------------------------------------------*/
  357. /**
  358. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  359. */
  360. #define LWIP_SOCKET 0
  361. /*------------------------------------------------------------------------------
  362. ------------------------------ Statistics Options ------------------------------
  363. ------------------------------------------------------------------------------*/
  364. /**
  365. * LWIP_STATS==1: Enable statistics collection in lwip_stats.
  366. */
  367. #define LWIP_STATS 0
  368. /*------------------------------------------------------------------------------
  369. --------------------------------- PPP Options ----------------------------------
  370. ------------------------------------------------------------------------------*/
  371. /**
  372. * PPP_SUPPORT==1: Enable PPP.
  373. */
  374. #define PPP_SUPPORT 0
  375. #endif /* __LWIPOPTS_H__ */