lwipopts.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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 <[email protected]>
  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 "lwipopts.h"
  44. #include "lwip/debug.h"
  45. /*
  46. #define LWIP_MALLOC_MEMPOOL 1
  47. */
  48. /*
  49. #define LWIP_CHECKSUM_ON_COPY 1
  50. #define TCP_OVERSIZE TCP_MSS
  51. */
  52. //#define TCP_SND_QUEUELEN 128
  53. //#define TCP_WND
  54. //#define PBUF_POOL_BUFSIZE 2048
  55. #define TCP_MSS 2048
  56. #define TCP_WND 512
  57. /*------------------------------------------------------------------------------
  58. ---------------------------------- Timers --------------------------------------
  59. ------------------------------------------------------------------------------*/
  60. /* these are originally defined in tcp_impl.h */
  61. #ifndef TCP_TMR_INTERVAL
  62. /* The TCP timer interval in milliseconds. */
  63. #define TCP_TMR_INTERVAL 250
  64. #endif /* TCP_TMR_INTERVAL */
  65. #ifndef TCP_FAST_INTERVAL
  66. /* the fine grained timeout in milliseconds */
  67. #define TCP_FAST_INTERVAL TCP_TMR_INTERVAL
  68. #endif /* TCP_FAST_INTERVAL */
  69. #ifndef TCP_SLOW_INTERVALs
  70. /* the coarse grained timeout in milliseconds */
  71. #define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL)
  72. #endif /* TCP_SLOW_INTERVAL */
  73. /*------------------------------------------------------------------------------
  74. --------------------------- Platform specific locking -------------------------
  75. ------------------------------------------------------------------------------*/
  76. /**
  77. * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
  78. * critical regions during buffer allocation, deallocation and memory
  79. * allocation and deallocation.
  80. */
  81. #define SYS_LIGHTWEIGHT_PROT 0
  82. /**
  83. * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  84. * use lwIP facilities.
  85. */
  86. /* set to 1 so we have no thread behaviour */
  87. #define NO_SYS 1
  88. /* set to 1 so we can use our own timers */
  89. #define NO_SYS_NO_TIMERS 1
  90. /*------------------------------------------------------------------------------
  91. -------------------------------- Memory options --------------------------------
  92. ------------------------------------------------------------------------------*/
  93. #define LWIP_CHKSUM_ALGORITHM 2
  94. /**
  95. * MEM_ALIGNMENT: should be set to the alignment of the CPU
  96. * 4 byte alignment -> #define MEM_ALIGNMENT 4
  97. * 2 byte alignment -> #define MEM_ALIGNMENT 2
  98. */
  99. #define MEM_ALIGNMENT 1
  100. /**
  101. * MEM_SIZE: the size of the heap memory. If the application will send
  102. * a lot of data that needs to be copied, this should be set high.
  103. */
  104. #define MEM_SIZE 1024 * 1024 * 64
  105. #define TCP_SND_BUF 1024 * 63
  106. /*------------------------------------------------------------------------------
  107. -------------------------- Internal Memory Pool Sizes --------------------------
  108. ------------------------------------------------------------------------------*/
  109. /**
  110. * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
  111. * If the application sends a lot of data out of ROM (or other static memory),
  112. * this should be set high.
  113. */
  114. #define MEMP_NUM_PBUF 256
  115. /**
  116. * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
  117. * (requires the LWIP_RAW option)
  118. */
  119. #define MEMP_NUM_RAW_PCB 32
  120. /**
  121. * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  122. * per active UDP "connection".
  123. * (requires the LWIP_UDP option)
  124. */
  125. #define MEMP_NUM_UDP_PCB 4
  126. /**
  127. * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
  128. * (requires the LWIP_TCP option)
  129. */
  130. #define MEMP_NUM_TCP_PCB 128
  131. /**
  132. * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
  133. * (requires the LWIP_TCP option)
  134. */
  135. #define MEMP_NUM_TCP_PCB_LISTEN 128
  136. /**
  137. * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
  138. * (requires the LWIP_TCP option)
  139. */
  140. #define MEMP_NUM_TCP_SEG 128
  141. /**
  142. * MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
  143. * reassembly (whole packets, not fragments!)
  144. */
  145. #define MEMP_NUM_REASSDATA 1
  146. /**
  147. * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
  148. * packets (pbufs) that are waiting for an ARP request (to resolve
  149. * their destination address) to finish.
  150. * (requires the ARP_QUEUEING option)
  151. */
  152. #define MEMP_NUM_ARP_QUEUE 2
  153. /**
  154. * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
  155. * (requires NO_SYS==0)
  156. */
  157. #define MEMP_NUM_SYS_TIMEOUT 3
  158. /**
  159. * MEMP_NUM_NETBUF: the number of struct netbufs.
  160. * (only needed if you use the sequential API, like api_lib.c)
  161. */
  162. #define MEMP_NUM_NETBUF 2
  163. /**
  164. * MEMP_NUM_NETCONN: the number of struct netconns.
  165. * (only needed if you use the sequential API, like api_lib.c)
  166. */
  167. #define MEMP_NUM_NETCONN 4
  168. /**
  169. * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
  170. * for callback/timeout API communication.
  171. * (only needed if you use tcpip.c)
  172. */
  173. #define MEMP_NUM_TCPIP_MSG_API 8
  174. /**
  175. * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
  176. * for incoming packets.
  177. * (only needed if you use tcpip.c)
  178. */
  179. #define MEMP_NUM_TCPIP_MSG_INPKT 8
  180. /**
  181. * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
  182. */
  183. #define PBUF_POOL_SIZE 128 /* was 32 */
  184. /*------------------------------------------------------------------------------
  185. ----------------------------------- ARP options --------------------------------
  186. ------------------------------------------------------------------------------*/
  187. /**
  188. * LWIP_ARP==1: Enable ARP functionality.
  189. */
  190. #define LWIP_ARP 1
  191. /*------------------------------------------------------------------------------
  192. ------------------------------------ IP options---------------------------------
  193. ------------------------------------------------------------------------------*/
  194. /**
  195. * IP_FORWARD==1: Enables the ability to forward IP packets across network
  196. * interfaces. If you are going to run lwIP on a device with only one network
  197. * interface, define this to 0.
  198. */
  199. #define IP_FORWARD 0
  200. /**
  201. * IP_OPTIONS: Defines the behavior for IP options.
  202. * IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
  203. * IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
  204. */
  205. #define IP_OPTIONS_ALLOWED 1
  206. /**
  207. * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
  208. * this option does not affect outgoing packet sizes, which can be controlled
  209. * via IP_FRAG.
  210. */
  211. #define IP_REASSEMBLY 1
  212. /**
  213. * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
  214. * that this option does not affect incoming packet sizes, which can be
  215. * controlled via IP_REASSEMBLY.
  216. */
  217. #define IP_FRAG 1
  218. /**
  219. * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
  220. * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
  221. * in this time, the whole packet is discarded.
  222. */
  223. #define IP_REASS_MAXAGE 3
  224. /**
  225. * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
  226. * Since the received pbufs are enqueued, be sure to configure
  227. * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
  228. * packets even if the maximum amount of fragments is enqueued for reassembly!
  229. */
  230. #define IP_REASS_MAX_PBUFS 4
  231. /**
  232. * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
  233. * fragmentation. Otherwise pbufs are allocated and reference the original
  234. * packet data to be fragmented.
  235. */
  236. #define IP_FRAG_USES_STATIC_BUF 0
  237. /**
  238. * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
  239. */
  240. #define IP_DEFAULT_TTL 255
  241. /*------------------------------------------------------------------------------
  242. ------------------------------- ICMP Options -----------------------------------
  243. ------------------------------------------------------------------------------*/
  244. /**
  245. * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
  246. * Be careful, disable that make your product non-compliant to RFC1122
  247. */
  248. #define LWIP_ICMP 1
  249. /*------------------------------------------------------------------------------
  250. ------------------------------- RAW Options ------------------------------------
  251. ------------------------------------------------------------------------------*/
  252. /**
  253. * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
  254. */
  255. #define LWIP_RAW 1
  256. /*------------------------------------------------------------------------------
  257. ------------------------------- DHCP Options -----------------------------------
  258. ------------------------------------------------------------------------------*/
  259. /**
  260. * LWIP_DHCP==1: Enable DHCP module.
  261. */
  262. #define LWIP_DHCP 0
  263. /*------------------------------------------------------------------------------
  264. ------------------------------ AUTOIP Options ----------------------------------
  265. ------------------------------------------------------------------------------*/
  266. /**
  267. * LWIP_AUTOIP==1: Enable AUTOIP module.
  268. */
  269. #define LWIP_AUTOIP 0
  270. /*------------------------------------------------------------------------------
  271. ------------------------------- SNMP Options -----------------------------------
  272. ------------------------------------------------------------------------------*/
  273. /**
  274. * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
  275. * transport.
  276. */
  277. #define LWIP_SNMP 0
  278. /*------------------------------------------------------------------------------
  279. ------------------------------- IGMP Options -----------------------------------
  280. ------------------------------------------------------------------------------*/
  281. /**
  282. * LWIP_IGMP==1: Turn on IGMP module.
  283. */
  284. #define LWIP_IGMP 0
  285. /*------------------------------------------------------------------------------
  286. -------------------------------- DNS Options -----------------------------------
  287. ------------------------------------------------------------------------------*/
  288. /**
  289. * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
  290. * transport.
  291. */
  292. #define LWIP_DNS 0
  293. /*------------------------------------------------------------------------------
  294. -------------------------------- UDP Options -----------------------------------
  295. ------------------------------------------------------------------------------*/
  296. /**
  297. * LWIP_UDP==1: Turn on UDP.
  298. */
  299. #define LWIP_UDP 1
  300. /*------------------------------------------------------------------------------
  301. -------------------------------- TCP Options -----------------------------------
  302. ------------------------------------------------------------------------------*/
  303. /**
  304. * LWIP_TCP==1: Turn on TCP.
  305. */
  306. #define LWIP_TCP 1
  307. #define LWIP_LISTEN_BACKLOG 0
  308. /*------------------------------------------------------------------------------
  309. -------------------------------- Pbuf Options ----------------------------------
  310. ------------------------------------------------------------------------------*/
  311. /**
  312. * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  313. * link level header. The default is 14, the standard value for
  314. * Ethernet.
  315. */
  316. #define PBUF_LINK_HLEN 16
  317. /**
  318. * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
  319. * designed to accomodate single full size TCP frame in one pbuf, including
  320. * TCP_MSS, IP header, and link header.
  321. *
  322. */
  323. #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
  324. /*------------------------------------------------------------------------------
  325. --------------------------------- LOOPIF Options -------------------------------
  326. ------------------------------------------------------------------------------*/
  327. /**
  328. * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
  329. */
  330. #define LWIP_HAVE_LOOPIF 0
  331. /*------------------------------------------------------------------------------
  332. ---------------------------- Sequential Layer Options --------------------------
  333. ------------------------------------------------------------------------------*/
  334. /**
  335. * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  336. */
  337. #define LWIP_NETCONN 0
  338. /*------------------------------------------------------------------------------
  339. --------------------------------- Socket Options -------------------------------
  340. ------------------------------------------------------------------------------*/
  341. /**
  342. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  343. */
  344. #define LWIP_SOCKET 0
  345. /*------------------------------------------------------------------------------
  346. ------------------------------ Statistics Options ------------------------------
  347. ------------------------------------------------------------------------------*/
  348. /**
  349. * LWIP_STATS==1: Enable statistics collection in lwip_stats.
  350. */
  351. #define LWIP_STATS 1
  352. /*------------------------------------------------------------------------------
  353. --------------------------------- PPP Options ----------------------------------
  354. ------------------------------------------------------------------------------*/
  355. /**
  356. * PPP_SUPPORT==1: Enable PPP.
  357. */
  358. #define PPP_SUPPORT 0
  359. /* Misc */
  360. #define MEM_LIBC_MALLOC 1
  361. #define MEMP_MEM_MALLOC 0
  362. #endif /* __LWIPOPTS_H__ */