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