lwipopts.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-02-23 Meco Man integrate v1.4.1 v2.0.3 and v2.1.2 porting layer
  9. * 2022-02-25 xiangxistu modify the default config through v1.4.1
  10. */
  11. #ifndef __LWIPOPTS_H__
  12. #define __LWIPOPTS_H__
  13. #include <rtconfig.h>
  14. /* ---------- LIBC and standard header files ---------- */
  15. #include <limits.h>
  16. #include <fcntl.h>
  17. #include <sys/ioctl.h>
  18. #include <stdlib.h>
  19. #include <sys/time.h>
  20. #include <sys/errno.h>
  21. #define LWIP_ERRNO_INCLUDE "sys/errno.h"
  22. #define LWIP_TIMEVAL_PRIVATE 0
  23. #define LWIP_NO_UNISTD_H 0
  24. #define LWIP_NO_STDDEF_H 0
  25. #define LWIP_NO_STDINT_H 0
  26. #define LWIP_NO_INTTYPES_H 0
  27. #define LWIP_NO_LIMITS_H 0
  28. #define LWIP_NO_CTYPE_H 0
  29. #define LWIP_SOCKET_SELECT 1
  30. #define LWIP_SOCKET_POLL 1
  31. #define LWIP_RAND rand
  32. #ifndef SSIZE_MAX
  33. #define SSIZE_MAX INT_MAX
  34. #endif
  35. /* some errno not defined in newlib */
  36. #ifndef ENSRNOTFOUND
  37. #define ENSRNOTFOUND 163 /* Domain name not found */
  38. #endif
  39. /* ---------- Basic Configuration ---------- */
  40. #define LWIP_IPV4 1
  41. #ifdef RT_USING_LWIP_IPV6
  42. #define LWIP_IPV6 1
  43. #else
  44. #define LWIP_IPV6 0
  45. #endif /* RT_USING_LWIP_IPV6 */
  46. #define NO_SYS 0
  47. #define SYS_LIGHTWEIGHT_PROT 1
  48. #define LWIP_SOCKET 1
  49. #define LWIP_NETCONN 1
  50. #ifdef RT_LWIP_IGMP
  51. #define LWIP_IGMP 1
  52. #else
  53. #define LWIP_IGMP 0
  54. #endif
  55. #ifdef RT_LWIP_ICMP
  56. #define LWIP_ICMP 1
  57. #else
  58. #define LWIP_ICMP 0
  59. #endif
  60. #ifdef RT_LWIP_SNMP
  61. #define LWIP_SNMP 1
  62. #else
  63. #define LWIP_SNMP 0
  64. #endif
  65. #ifdef RT_LWIP_DNS
  66. #define LWIP_DNS 1
  67. #else
  68. #define LWIP_DNS 0
  69. #endif
  70. #define LWIP_HAVE_LOOPIF 0
  71. #define LWIP_PLATFORM_BYTESWAP 0
  72. /* #define RT_LWIP_DEBUG */
  73. #ifdef RT_LWIP_DEBUG
  74. #define LWIP_DEBUG
  75. #endif
  76. /* ---------- Debug options ---------- */
  77. #ifdef LWIP_DEBUG
  78. #ifdef RT_LWIP_SYS_DEBUG
  79. #define SYS_DEBUG LWIP_DBG_ON
  80. #else
  81. #define SYS_DEBUG LWIP_DBG_OFF
  82. #endif
  83. #ifdef RT_LWIP_ETHARP_DEBUG
  84. #define ETHARP_DEBUG LWIP_DBG_ON
  85. #else
  86. #define ETHARP_DEBUG LWIP_DBG_OFF
  87. #endif
  88. #ifdef RT_LWIP_PPP_DEBUG
  89. #define PPP_DEBUG LWIP_DBG_ON
  90. #else
  91. #define PPP_DEBUG LWIP_DBG_OFF
  92. #endif
  93. #ifdef RT_LWIP_MEM_DEBUG
  94. #define MEM_DEBUG LWIP_DBG_ON
  95. #else
  96. #define MEM_DEBUG LWIP_DBG_OFF
  97. #endif
  98. #ifdef RT_LWIP_MEMP_DEBUG
  99. #define MEMP_DEBUG LWIP_DBG_ON
  100. #else
  101. #define MEMP_DEBUG LWIP_DBG_OFF
  102. #endif
  103. #ifdef RT_LWIP_PBUF_DEBUG
  104. #define PBUF_DEBUG LWIP_DBG_ON
  105. #else
  106. #define PBUF_DEBUG LWIP_DBG_OFF
  107. #endif
  108. #ifdef RT_LWIP_API_LIB_DEBUG
  109. #define API_LIB_DEBUG LWIP_DBG_ON
  110. #else
  111. #define API_LIB_DEBUG LWIP_DBG_OFF
  112. #endif
  113. #ifdef RT_LWIP_API_MSG_DEBUG
  114. #define API_MSG_DEBUG LWIP_DBG_ON
  115. #else
  116. #define API_MSG_DEBUG LWIP_DBG_OFF
  117. #endif
  118. #ifdef RT_LWIP_TCPIP_DEBUG
  119. #define TCPIP_DEBUG LWIP_DBG_ON
  120. #else
  121. #define TCPIP_DEBUG LWIP_DBG_OFF
  122. #endif
  123. #ifdef RT_LWIP_NETIF_DEBUG
  124. #define NETIF_DEBUG LWIP_DBG_ON
  125. #else
  126. #define NETIF_DEBUG LWIP_DBG_OFF
  127. #endif
  128. #ifdef RT_LWIP_SOCKETS_DEBUG
  129. #define SOCKETS_DEBUG LWIP_DBG_ON
  130. #else
  131. #define SOCKETS_DEBUG LWIP_DBG_OFF
  132. #endif
  133. #ifdef RT_LWIP_DNS_DEBUG
  134. #define DNS_DEBUG LWIP_DBG_ON
  135. #else
  136. #define DNS_DEBUG LWIP_DBG_OFF
  137. #endif
  138. #ifdef RT_LWIP_AUTOIP_DEBUG
  139. #define AUTOIP_DEBUG LWIP_DBG_ON
  140. #else
  141. #define AUTOIP_DEBUG LWIP_DBG_OFF
  142. #endif
  143. #ifdef RT_LWIP_DHCP_DEBUG
  144. #define DHCP_DEBUG LWIP_DBG_ON
  145. #else
  146. #define DHCP_DEBUG LWIP_DBG_OFF
  147. #endif
  148. #ifdef RT_LWIP_IP_DEBUG
  149. #define IP_DEBUG LWIP_DBG_ON
  150. #else
  151. #define IP_DEBUG LWIP_DBG_OFF
  152. #endif
  153. #ifdef RT_LWIP_IP_REASS_DEBUG
  154. #define IP_REASS_DEBUG LWIP_DBG_ON
  155. #else
  156. #define IP_REASS_DEBUG LWIP_DBG_OFF
  157. #endif
  158. #ifdef RT_LWIP_ICMP_DEBUG
  159. #define ICMP_DEBUG LWIP_DBG_ON
  160. #else
  161. #define ICMP_DEBUG LWIP_DBG_OFF
  162. #endif
  163. #ifdef RT_LWIP_IGMP_DEBUG
  164. #define IGMP_DEBUG LWIP_DBG_ON
  165. #else
  166. #define IGMP_DEBUG LWIP_DBG_OFF
  167. #endif
  168. #ifdef RT_LWIP_UDP_DEBUG
  169. #define UDP_DEBUG LWIP_DBG_ON
  170. #else
  171. #define UDP_DEBUG LWIP_DBG_OFF
  172. #endif
  173. #ifdef RT_LWIP_TCP_DEBUG
  174. #define TCP_DEBUG LWIP_DBG_ON
  175. #else
  176. #define TCP_DEBUG LWIP_DBG_OFF
  177. #endif
  178. #ifdef RT_LWIP_TCP_INPUT_DEBUG
  179. #define TCP_INPUT_DEBUG LWIP_DBG_ON
  180. #else
  181. #define TCP_INPUT_DEBUG LWIP_DBG_OFF
  182. #endif
  183. #ifdef RT_LWIP_TCP_OUTPUT_DEBUG
  184. #define TCP_OUTPUT_DEBUG LWIP_DBG_ON
  185. #else
  186. #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
  187. #endif
  188. #ifdef RT_LWIP_TCP_RTO_DEBUG
  189. #define TCP_RTO_DEBUG LWIP_DBG_ON
  190. #else
  191. #define TCP_RTO_DEBUG LWIP_DBG_OFF
  192. #endif
  193. #ifdef RT_LWIP_TCP_CWND_DEBUG
  194. #define TCP_CWND_DEBUG LWIP_DBG_ON
  195. #else
  196. #define TCP_CWND_DEBUG LWIP_DBG_OFF
  197. #endif
  198. #ifdef RT_LWIP_TCP_WND_DEBUG
  199. #define TCP_WND_DEBUG LWIP_DBG_ON
  200. #else
  201. #define TCP_WND_DEBUG LWIP_DBG_OFF
  202. #endif
  203. #ifdef RT_LWIP_TCP_FR_DEBUG
  204. #define TCP_FR_DEBUG LWIP_DBG_ON
  205. #else
  206. #define TCP_FR_DEBUG LWIP_DBG_OFF
  207. #endif
  208. #ifdef RT_LWIP_TCP_QLEN_DEBUG
  209. #define TCP_QLEN_DEBUG LWIP_DBG_ON
  210. #else
  211. #define TCP_QLEN_DEBUG LWIP_DBG_OFF
  212. #endif
  213. #ifdef RT_LWIP_TCP_RST_DEBUG
  214. #define TCP_RST_DEBUG LWIP_DBG_ON
  215. #else
  216. #define TCP_RST_DEBUG LWIP_DBG_OFF
  217. #endif
  218. #endif /* LWIP_DEBUG */
  219. #define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
  220. /* ---------- Memory options ---------- */
  221. #define MEMCPY(dst,src,len) rt_memcpy(dst,src,len)
  222. #define SMEMCPY(dst,src,len) MEMCPY(dst,src,len)
  223. #ifdef RT_LWIP_MEM_ALIGNMENT
  224. #define MEM_ALIGNMENT RT_LWIP_MEM_ALIGNMENT
  225. #else
  226. #define MEM_ALIGNMENT 4
  227. #endif
  228. #define MEMP_OVERFLOW_CHECK 1
  229. #define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
  230. //#define MEM_LIBC_MALLOC 1
  231. //#define MEM_USE_POOLS 1
  232. //#define MEMP_USE_CUSTOM_POOLS 1
  233. //#define MEM_SIZE (1024*64)
  234. #define MEMP_MEM_MALLOC 0
  235. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  236. sends a lot of data out of ROM (or other static memory), this
  237. should be set high. */
  238. #define MEMP_NUM_PBUF 32 //16
  239. /* the number of struct netconns */
  240. #ifdef RT_MEMP_NUM_NETCONN
  241. #define MEMP_NUM_NETCONN RT_MEMP_NUM_NETCONN
  242. #endif
  243. /* the number of UDP protocol control blocks. One per active RAW "connection". */
  244. #ifdef RT_LWIP_RAW_PCB_NUM
  245. #define MEMP_NUM_RAW_PCB RT_LWIP_RAW_PCB_NUM
  246. #endif
  247. /* the number of UDP protocol control blocks. One per active UDP "connection". */
  248. #ifdef RT_LWIP_UDP_PCB_NUM
  249. #define MEMP_NUM_UDP_PCB RT_LWIP_UDP_PCB_NUM
  250. #endif
  251. /* the number of simulatenously active TCP connections. */
  252. #ifdef RT_LWIP_TCP_PCB_NUM
  253. #define MEMP_NUM_TCP_PCB RT_LWIP_TCP_PCB_NUM
  254. #endif
  255. /* the number of simultaneously queued TCP */
  256. #ifdef RT_LWIP_TCP_SEG_NUM
  257. #define MEMP_NUM_TCP_SEG RT_LWIP_TCP_SEG_NUM
  258. #else
  259. #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
  260. #endif
  261. /*
  262. * You can re-define following setting in rtcofnig.h to overwrite the default
  263. * setting in the lwip opts.h
  264. */
  265. /* MEMP_NUM_NETBUF: the number of struct netbufs. */
  266. // #define MEMP_NUM_NETBUF 2
  267. /* MEMP_NUM_NETCONN: the number of struct netconns. */
  268. // #define MEMP_NUM_NETCONN 4
  269. /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
  270. for sequential API communication and incoming packets. Used in
  271. src/api/tcpip.c. */
  272. // #define MEMP_NUM_TCPIP_MSG_API 16
  273. // #define MEMP_NUM_TCPIP_MSG_INPKT 16
  274. /* ---------- Pbuf options ---------- */
  275. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  276. #ifdef RT_LWIP_PBUF_NUM
  277. #define PBUF_POOL_SIZE RT_LWIP_PBUF_NUM
  278. #endif
  279. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  280. #ifdef RT_LWIP_PBUF_POOL_BUFSIZE
  281. #define PBUF_POOL_BUFSIZE RT_LWIP_PBUF_POOL_BUFSIZE
  282. #endif
  283. /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
  284. link level header. */
  285. #define PBUF_LINK_HLEN 16
  286. #ifdef RT_LWIP_ETH_PAD_SIZE
  287. #define ETH_PAD_SIZE RT_LWIP_ETH_PAD_SIZE
  288. #endif
  289. #ifdef LWIP_USING_NAT
  290. #define IP_NAT 1
  291. #else
  292. #define IP_NAT 0
  293. #endif
  294. /* ---------- TCP options ---------- */
  295. #ifdef RT_LWIP_TCP
  296. #define LWIP_TCP 1
  297. #else
  298. #define LWIP_TCP 0
  299. #endif
  300. #define TCP_TTL 255
  301. /* Controls if TCP should queue segments that arrive out of
  302. order. Define to 0 if your device is low on memory. */
  303. #define TCP_QUEUE_OOSEQ 1
  304. /* TCP Maximum segment size. */
  305. #define TCP_MSS 1460
  306. /* TCP sender buffer space (bytes). */
  307. #ifdef RT_LWIP_TCP_SND_BUF
  308. #define TCP_SND_BUF RT_LWIP_TCP_SND_BUF
  309. #else
  310. #define TCP_SND_BUF (TCP_MSS * 2)
  311. #endif
  312. /* TCP sender buffer space (pbufs). This must be at least = 2 *
  313. TCP_SND_BUF/TCP_MSS for things to work. */
  314. #define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
  315. /* TCP writable space (bytes). This must be less than or equal
  316. to TCP_SND_BUF. It is the amount of space which must be
  317. available in the tcp snd_buf for select to return writable */
  318. #define TCP_SNDLOWAT (TCP_SND_BUF/2)
  319. #define TCP_SNDQUEUELOWAT TCP_SND_QUEUELEN/2
  320. /* TCP receive window. */
  321. #ifdef RT_LWIP_TCP_WND
  322. #define TCP_WND RT_LWIP_TCP_WND
  323. #else
  324. #define TCP_WND (TCP_MSS * 2)
  325. #endif
  326. /* Maximum number of retransmissions of data segments. */
  327. #define TCP_MAXRTX 12
  328. /* Maximum number of retransmissions of SYN segments. */
  329. #define TCP_SYNMAXRTX 4
  330. /* tcpip thread options */
  331. #ifdef RT_LWIP_TCPTHREAD_PRIORITY
  332. #define TCPIP_MBOX_SIZE RT_LWIP_TCPTHREAD_MBOX_SIZE
  333. #define TCPIP_THREAD_PRIO RT_LWIP_TCPTHREAD_PRIORITY
  334. #define TCPIP_THREAD_STACKSIZE RT_LWIP_TCPTHREAD_STACKSIZE
  335. #else
  336. #define TCPIP_MBOX_SIZE 8
  337. #define TCPIP_THREAD_PRIO 128
  338. #define TCPIP_THREAD_STACKSIZE 4096
  339. #endif
  340. #define TCPIP_THREAD_NAME "tcpip"
  341. #define DEFAULT_TCP_RECVMBOX_SIZE 10
  342. /* ---------- ARP options ---------- */
  343. #define LWIP_ARP 1
  344. #define ARP_TABLE_SIZE 10
  345. #define ARP_QUEUEING 1
  346. /* ---------- Checksum options ---------- */
  347. #ifdef RT_LWIP_USING_HW_CHECKSUM
  348. #define CHECKSUM_GEN_IP 0
  349. #define CHECKSUM_GEN_UDP 0
  350. #define CHECKSUM_GEN_TCP 0
  351. #define CHECKSUM_GEN_ICMP 0
  352. #define CHECKSUM_CHECK_IP 0
  353. #define CHECKSUM_CHECK_UDP 0
  354. #define CHECKSUM_CHECK_TCP 0
  355. #define CHECKSUM_CHECK_ICMP 0
  356. #endif
  357. /* ---------- IP options ---------- */
  358. /* Define IP_FORWARD to 1 if you wish to have the ability to forward
  359. IP packets across network interfaces. If you are going to run lwIP
  360. on a device with only one network interface, define this to 0. */
  361. #define IP_FORWARD 0
  362. /* IP reassembly and segmentation.These are orthogonal even
  363. * if they both deal with IP fragments */
  364. #ifdef RT_LWIP_REASSEMBLY_FRAG
  365. #define IP_REASSEMBLY 1
  366. #define IP_FRAG 1
  367. #define IP_REASS_MAX_PBUFS 10
  368. #define MEMP_NUM_REASSDATA 10
  369. #else
  370. #define IP_REASSEMBLY 0
  371. #define IP_FRAG 0
  372. #endif
  373. /* ---------- ICMP options ---------- */
  374. #define ICMP_TTL 255
  375. /* ---------- DHCP options ---------- */
  376. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  377. interfaces. */
  378. #ifdef RT_LWIP_DHCP
  379. #define LWIP_DHCP 1
  380. #else
  381. #define LWIP_DHCP 0
  382. #endif
  383. /* 1 if you want to do an ARP check on the offered address
  384. (recommended). */
  385. #define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
  386. /* ---------- AUTOIP options ------- */
  387. #define LWIP_AUTOIP 0
  388. #define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
  389. /* ---------- UDP options ---------- */
  390. #ifdef RT_LWIP_UDP
  391. #define LWIP_UDP 1
  392. #else
  393. #define LWIP_UDP 0
  394. #endif
  395. #define LWIP_UDPLITE 0
  396. #define UDP_TTL 255
  397. #define DEFAULT_UDP_RECVMBOX_SIZE 1
  398. /* ---------- RAW options ---------- */
  399. #ifdef RT_LWIP_RAW
  400. #define LWIP_RAW 1
  401. #else
  402. #define LWIP_RAW 0
  403. #endif
  404. #define DEFAULT_RAW_RECVMBOX_SIZE 1
  405. #define DEFAULT_ACCEPTMBOX_SIZE 10
  406. /* ---------- Statistics options ---------- */
  407. #ifdef RT_LWIP_STATS
  408. #define LWIP_STATS 1
  409. #define LWIP_STATS_DISPLAY 1
  410. #else
  411. #define LWIP_STATS 0
  412. #endif
  413. #if LWIP_STATS
  414. #define LINK_STATS 1
  415. #define IP_STATS 1
  416. #define ICMP_STATS 1
  417. #define IGMP_STATS 1
  418. #define IPFRAG_STATS 1
  419. #define UDP_STATS 1
  420. #define TCP_STATS 1
  421. #define MEM_STATS 1
  422. #define MEMP_STATS 1
  423. #define PBUF_STATS 1
  424. #define SYS_STATS 1
  425. #define MIB2_STATS 1
  426. #endif /* LWIP_STATS */
  427. /* ---------- PPP options ---------- */
  428. #ifdef RT_LWIP_PPP
  429. #define PPP_SUPPORT 1 /* Set > 0 for PPP */
  430. #else
  431. #define PPP_SUPPORT 0 /* Set > 0 for PPP */
  432. #endif
  433. #if PPP_SUPPORT
  434. #define NUM_PPP 1 /* Max PPP sessions. */
  435. /* Select modules to enable. Ideally these would be set in the makefile but
  436. * we're limited by the command line length so you need to modify the settings
  437. * in this file.
  438. */
  439. #ifdef RT_LWIP_PPPOE
  440. #define PPPOE_SUPPORT 1
  441. #else
  442. #define PPPOE_SUPPORT 0
  443. #endif
  444. #ifdef RT_LWIP_PPPOS
  445. #define PPPOS_SUPPORT 1
  446. #else
  447. #define PPPOS_SUPPORT 0
  448. #endif
  449. #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
  450. #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
  451. #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
  452. #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
  453. #define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
  454. #define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
  455. #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
  456. #endif /* PPP_SUPPORT */
  457. /**
  458. * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
  459. * Disable this option if you use a POSIX operating system that uses the same
  460. * names (read, write & close). (only used if you use sockets.c)
  461. */
  462. #ifndef LWIP_POSIX_SOCKETS_IO_NAMES
  463. #define LWIP_POSIX_SOCKETS_IO_NAMES 0
  464. #endif
  465. /**
  466. * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
  467. * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
  468. * in seconds. (does not require sockets.c, and will affect tcp.c)
  469. */
  470. #ifndef LWIP_TCP_KEEPALIVE
  471. #define LWIP_TCP_KEEPALIVE 1
  472. #endif
  473. /**
  474. * LWIP_NETIF_HOSTNAME==1: Support netif hostname
  475. */
  476. #ifndef LWIP_NETIF_HOSTNAME
  477. #define LWIP_NETIF_HOSTNAME 1
  478. #endif
  479. /**
  480. * RT_LWIP_NETIF_NAMESIZE support netif name length(in netif.c)
  481. */
  482. #ifdef RT_LWIP_NETIF_NAMESIZE
  483. #if (RT_LWIP_NETIF_NAMESIZE < 2)
  484. #warning NETIF_NAMESIZE too small, the value must be greater than or equal to 6.
  485. #endif
  486. #define NETIF_NAMESIZE RT_LWIP_NETIF_NAMESIZE
  487. #endif /* RT_LWIP_NETIF_NAMESIZE */
  488. /**
  489. * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
  490. */
  491. #ifndef LWIP_NETIF_API
  492. #define LWIP_NETIF_API 1
  493. #endif
  494. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
  495. #define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT + (LWIP_IPV6 ? (1 + (2*LWIP_IPV6)) : 0))
  496. /*
  497. * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
  498. * (only used if you use sockets.c)
  499. */
  500. #ifdef SAL_USING_POSIX
  501. #define LWIP_COMPAT_SOCKETS 0
  502. #else
  503. #ifndef LWIP_COMPAT_SOCKETS
  504. #define LWIP_COMPAT_SOCKETS 1
  505. #endif
  506. #endif
  507. /**
  508. * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and
  509. * SO_SNDTIMEO processing.
  510. */
  511. #ifndef LWIP_SO_SNDTIMEO
  512. #define LWIP_SO_SNDTIMEO 1
  513. #endif
  514. /**
  515. * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and
  516. * SO_RCVTIMEO processing.
  517. */
  518. #ifndef LWIP_SO_RCVTIMEO
  519. #define LWIP_SO_RCVTIMEO 1
  520. #endif
  521. /**
  522. * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
  523. */
  524. #ifndef LWIP_SO_RCVBUF
  525. #define LWIP_SO_RCVBUF 1
  526. #endif
  527. /**
  528. * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
  529. */
  530. #ifndef RECV_BUFSIZE_DEFAULT
  531. #define RECV_BUFSIZE_DEFAULT 8192
  532. #endif
  533. /**
  534. * SO_REUSE==1: Enable SO_REUSEADDR option.
  535. */
  536. #ifndef SO_REUSE
  537. #define SO_REUSE 0
  538. #endif
  539. #if RT_USING_LWIP_VER_NUM >= 0x20000 /* >= v2.0.0 */
  540. #if RT_USING_LWIP_VER_NUM < 0x20102 /* >= v2.0.0 && < v2.1.2 */
  541. #define LWIP_HOOK_IP4_ROUTE_SRC(dest, src) lwip_ip4_route_src(dest, src)
  542. #else /* >= v2.1.2 */
  543. #define LWIP_HOOK_IP4_ROUTE_SRC(src, dest) lwip_ip4_route_src(dest, src)
  544. #endif
  545. #endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
  546. #endif /* __LWIPOPTS_H__ */