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