lwipopts.h 12 KB

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