]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/net/lwip_tcpip/v2_0/include/lwip/opt.h
Initial revision
[karo-tx-redboot.git] / packages / net / lwip_tcpip / v2_0 / include / lwip / opt.h
1 /*
2  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
3  * All rights reserved. 
4  * 
5  * Redistribution and use in source and binary forms, with or without modification, 
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  *    derived from this software without specific prior written permission. 
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
25  * OF SUCH DAMAGE.
26  *
27  * This file is part of the lwIP TCP/IP stack.
28  * 
29  * Author: Adam Dunkels <adam@sics.se>
30  *
31  */
32 #ifndef __LWIP_OPT_H__
33 #define __LWIP_OPT_H__
34
35 /* Include user defined options first */
36 #include "lwipopts.h"
37 #include "lwip/debug.h"
38
39 /* Define default values for unconfigured parameters. */
40
41 /* Platform specific locking */
42
43 /*
44  * enable SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
45  * for certain critical regions during buffer allocation, deallocation and memory
46  * allocation and deallocation.
47  */
48 #ifndef SYS_LIGHTWEIGHT_PROT
49 #define SYS_LIGHTWEIGHT_PROT            0
50 #endif
51
52 #ifndef NO_SYS
53 #define NO_SYS                          0
54 #endif
55 /* ---------- Memory options ---------- */
56 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
57    lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
58    byte alignment -> define MEM_ALIGNMENT to 2. */
59
60 #ifndef MEM_ALIGNMENT
61 #define MEM_ALIGNMENT                   1
62 #endif
63
64 /* MEM_SIZE: the size of the heap memory. If the application will send
65 a lot of data that needs to be copied, this should be set high. */
66 #ifndef MEM_SIZE
67 #define MEM_SIZE                        1600
68 #endif
69
70 #ifndef MEMP_SANITY_CHECK
71 #define MEMP_SANITY_CHECK               0
72 #endif
73
74 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
75    sends a lot of data out of ROM (or other static memory), this
76    should be set high. */
77 #ifndef MEMP_NUM_PBUF
78 #define MEMP_NUM_PBUF                   16
79 #endif
80
81 /* Number of raw connection PCBs */
82 #ifndef MEMP_NUM_RAW_PCB
83 #define MEMP_NUM_RAW_PCB                4
84 #endif
85
86 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
87    per active UDP "connection". */
88 #ifndef MEMP_NUM_UDP_PCB
89 #define MEMP_NUM_UDP_PCB                4
90 #endif
91 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
92    connections. */
93 #ifndef MEMP_NUM_TCP_PCB
94 #define MEMP_NUM_TCP_PCB                5
95 #endif
96 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
97    connections. */
98 #ifndef MEMP_NUM_TCP_PCB_LISTEN
99 #define MEMP_NUM_TCP_PCB_LISTEN         8
100 #endif
101 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
102    segments. */
103 #ifndef MEMP_NUM_TCP_SEG
104 #define MEMP_NUM_TCP_SEG                16
105 #endif
106 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
107    timeouts. */
108 #ifndef MEMP_NUM_SYS_TIMEOUT
109 #define MEMP_NUM_SYS_TIMEOUT            3
110 #endif
111
112 /* The following four are used only with the sequential API and can be
113    set to 0 if the application only will use the raw API. */
114 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
115 #ifndef MEMP_NUM_NETBUF
116 #define MEMP_NUM_NETBUF                 2
117 #endif
118 /* MEMP_NUM_NETCONN: the number of struct netconns. */
119 #ifndef MEMP_NUM_NETCONN
120 #define MEMP_NUM_NETCONN                4
121 #endif
122 /* MEMP_NUM_APIMSG: the number of struct api_msg, used for
123    communication between the TCP/IP stack and the sequential
124    programs. */
125 #ifndef MEMP_NUM_API_MSG
126 #define MEMP_NUM_API_MSG                8
127 #endif
128 /* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
129    for sequential API communication and incoming packets. Used in
130    src/api/tcpip.c. */
131 #ifndef MEMP_NUM_TCPIP_MSG
132 #define MEMP_NUM_TCPIP_MSG              8
133 #endif
134
135 /* ---------- Pbuf options ---------- */
136 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
137
138 #ifndef PBUF_POOL_SIZE
139 #define PBUF_POOL_SIZE                  16
140 #endif
141
142 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
143
144 #ifndef PBUF_POOL_BUFSIZE
145 #define PBUF_POOL_BUFSIZE               128
146 #endif
147
148 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
149    link level header. */
150
151 #ifndef PBUF_LINK_HLEN
152 #define PBUF_LINK_HLEN                  0
153 #endif
154
155
156
157 /* ---------- ARP options ---------- */
158
159 /** Number of active hardware address, IP address pairs cached */
160 #ifndef ARP_TABLE_SIZE
161 #define ARP_TABLE_SIZE                  10
162 #endif
163
164 /**
165  * If enabled, outgoing packets are queued during hardware address
166  * resolution. The etharp.c implementation queues 1 packet only.
167  */
168 #ifndef ARP_QUEUEING
169 #define ARP_QUEUEING                    1
170 #endif
171 /** If enabled, the first packet queued will not be overwritten by
172  * later packets. If disabled, later packets overwrite early packets
173  * in the queue. Default is disabled, which is recommended. 
174  */
175 #ifndef ARP_QUEUE_FIRST
176 #define ARP_QUEUE_FIRST                 0
177 #endif
178
179 /* This option is removed to comply with the ARP standard */
180 #ifdef ETHARP_ALWAYS_INSERT
181 #error ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h.
182 #endif
183
184 /* ---------- IP options ---------- */
185 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
186    IP packets across network interfaces. If you are going to run lwIP
187    on a device with only one network interface, define this to 0. */
188 #ifndef IP_FORWARD
189 #define IP_FORWARD                      0
190 #endif
191
192 /* If defined to 1, IP options are allowed (but not parsed). If
193    defined to 0, all packets with IP options are dropped. */
194 #ifndef IP_OPTIONS
195 #define IP_OPTIONS                      1
196 #endif
197
198 /** IP reassembly and segmentation. Even if they both deal with IP
199  *  fragments, note that these are orthogonal, one dealing with incoming
200  *  packets, the other with outgoing packets
201  */
202
203 /** Reassemble incoming fragmented IP packets */
204 #ifndef IP_REASSEMBLY
205 #define IP_REASSEMBLY                   1
206 #endif
207
208 /** Fragment outgoing IP packets if their size exceeds MTU */
209 #ifndef IP_FRAG
210 #define IP_FRAG                         1
211 #endif
212
213 /* ---------- ICMP options ---------- */
214
215 #ifndef ICMP_TTL
216 #define ICMP_TTL                        255
217 #endif
218
219 /* ---------- RAW options ---------- */
220
221 #ifndef LWIP_RAW
222 #define LWIP_RAW                        1
223 #endif
224
225 #ifndef RAW_TTL
226 #define RAW_TTL                        255
227 #endif
228
229 /* ---------- DHCP options ---------- */
230
231 #ifndef LWIP_DHCP
232 #define LWIP_DHCP                       0
233 #endif
234
235 /* 1 if you want to do an ARP check on the offered address
236    (recommended). */
237 #ifndef DHCP_DOES_ARP_CHECK
238 #define DHCP_DOES_ARP_CHECK             1
239 #endif
240
241 /* ---------- UDP options ---------- */
242 #ifndef LWIP_UDP
243 #define LWIP_UDP                        1
244 #endif
245
246 #ifndef UDP_TTL
247 #define UDP_TTL                         255
248 #endif
249
250 /* ---------- TCP options ---------- */
251 #ifndef LWIP_TCP
252 #define LWIP_TCP                        1
253 #endif
254
255 #ifndef TCP_TTL
256 #define TCP_TTL                         255
257 #endif
258
259 #ifndef TCP_WND
260 #define TCP_WND                         2048
261 #endif 
262
263 #ifndef TCP_MAXRTX
264 #define TCP_MAXRTX                      12
265 #endif
266
267 #ifndef TCP_SYNMAXRTX
268 #define TCP_SYNMAXRTX                   6
269 #endif
270
271
272 /* Controls if TCP should queue segments that arrive out of
273    order. Define to 0 if your device is low on memory. */
274 #ifndef TCP_QUEUE_OOSEQ
275 #define TCP_QUEUE_OOSEQ                 1
276 #endif
277
278 /* TCP Maximum segment size. */
279 #ifndef TCP_MSS
280 #define TCP_MSS                         128 /* A *very* conservative default. */
281 #endif
282
283 /* TCP sender buffer space (bytes). */
284 #ifndef TCP_SND_BUF
285 #define TCP_SND_BUF                     256
286 #endif
287
288 /* TCP sender buffer space (pbufs). This must be at least = 2 *
289    TCP_SND_BUF/TCP_MSS for things to work. */
290 #ifndef TCP_SND_QUEUELEN
291 #define TCP_SND_QUEUELEN                4 * TCP_SND_BUF/TCP_MSS
292 #endif
293
294
295 /* Maximum number of retransmissions of data segments. */
296
297 /* Maximum number of retransmissions of SYN segments. */
298
299 /* TCP writable space (bytes). This must be less than or equal
300    to TCP_SND_BUF. It is the amount of space which must be
301    available in the tcp snd_buf for select to return writable */
302 #ifndef TCP_SNDLOWAT
303 #define TCP_SNDLOWAT                    TCP_SND_BUF/2
304 #endif
305
306 /* Support loop interface (127.0.0.1) */
307 #ifndef LWIP_HAVE_LOOPIF
308 #define LWIP_HAVE_LOOPIF                1
309 #endif
310
311 #ifndef LWIP_EVENT_API
312 #define LWIP_EVENT_API                  0
313 #define LWIP_CALLBACK_API               1
314 #else 
315 #define LWIP_EVENT_API                  1
316 #define LWIP_CALLBACK_API               0
317 #endif 
318
319 #ifndef LWIP_COMPAT_SOCKETS
320 #define LWIP_COMPAT_SOCKETS             1
321 #endif
322
323
324 #ifndef TCPIP_THREAD_PRIO
325 #define TCPIP_THREAD_PRIO               1
326 #endif
327
328 #ifndef SLIPIF_THREAD_PRIO
329 #define SLIPIF_THREAD_PRIO              1
330 #endif
331
332 #ifndef PPP_THREAD_PRIO
333 #define PPP_THREAD_PRIO                 1
334 #endif
335
336 #ifndef DEFAULT_THREAD_PRIO
337 #define DEFAULT_THREAD_PRIO             1
338 #endif
339
340
341 /* ---------- Socket Options ---------- */
342 /* Enable SO_REUSEADDR and SO_REUSEPORT options */ 
343 #ifndef SO_REUSE
344 # define SO_REUSE 1
345 #endif                                                                        
346
347
348 /* ---------- Statistics options ---------- */
349 #ifndef LWIP_STATS
350 #define LWIP_STATS                      1
351 #endif
352
353 #if LWIP_STATS
354
355 #ifndef LWIP_STATS_DISPLAY
356 #define LWIP_STATS_DISPLAY 0
357 #endif
358
359 #ifndef LINK_STATS
360 #define LINK_STATS      1
361 #endif
362
363 #ifndef IP_STATS
364 #define IP_STATS        1
365 #endif
366
367 #ifndef IPFRAG_STATS
368 #define IPFRAG_STATS    1
369 #endif
370
371 #ifndef ICMP_STATS
372 #define ICMP_STATS      1
373 #endif
374
375 #ifndef UDP_STATS
376 #define UDP_STATS       1
377 #endif
378
379 #ifndef TCP_STATS
380 #define TCP_STATS       1
381 #endif
382
383 #ifndef MEM_STATS
384 #define MEM_STATS       1
385 #endif
386
387 #ifndef MEMP_STATS
388 #define MEMP_STATS      1
389 #endif
390
391 #ifndef PBUF_STATS
392 #define PBUF_STATS      1
393 #endif
394
395 #ifndef SYS_STATS
396 #define SYS_STATS       1
397 #endif
398
399 #ifndef RAW_STATS
400 #define RAW_STATS       0
401 #endif
402
403 #else
404
405 #define LINK_STATS      0
406 #define IP_STATS        0
407 #define IPFRAG_STATS    0
408 #define ICMP_STATS      0
409 #define UDP_STATS       0
410 #define TCP_STATS       0
411 #define MEM_STATS       0
412 #define MEMP_STATS      0
413 #define PBUF_STATS      0
414 #define SYS_STATS       0
415 #define RAW_STATS       0
416 #define LWIP_STATS_DISPLAY      0
417
418 #endif /* LWIP_STATS */
419
420 /* ---------- PPP options ---------- */
421
422 #ifndef PPP_SUPPORT
423 #define PPP_SUPPORT                     0      /* Set for PPP */
424 #endif
425
426 #if PPP_SUPPORT 
427
428 #define NUM_PPP                         1      /* Max PPP sessions. */
429
430
431
432 #ifndef PAP_SUPPORT
433 #define PAP_SUPPORT                     0      /* Set for PAP. */
434 #endif
435
436 #ifndef CHAP_SUPPORT
437 #define CHAP_SUPPORT                    0      /* Set for CHAP. */
438 #endif
439
440 #define MSCHAP_SUPPORT                  0      /* Set for MSCHAP (NOT FUNCTIONAL!) */
441 #define CBCP_SUPPORT                    0      /* Set for CBCP (NOT FUNCTIONAL!) */
442 #define CCP_SUPPORT                     0      /* Set for CCP (NOT FUNCTIONAL!) */
443
444 #ifndef VJ_SUPPORT
445 #define VJ_SUPPORT                      0      /* Set for VJ header compression. */
446 #endif
447
448 #ifndef MD5_SUPPORT
449 #define MD5_SUPPORT                     0      /* Set for MD5 (see also CHAP) */
450 #endif
451
452
453 /*
454  * Timeouts.
455  */
456 #define FSM_DEFTIMEOUT                  6       /* Timeout time in seconds */
457 #define FSM_DEFMAXTERMREQS              2       /* Maximum Terminate-Request transmissions */
458 #define FSM_DEFMAXCONFREQS              10      /* Maximum Configure-Request transmissions */
459 #define FSM_DEFMAXNAKLOOPS              5       /* Maximum number of nak loops */
460
461 #define UPAP_DEFTIMEOUT                 6       /* Timeout (seconds) for retransmitting req */
462 #define UPAP_DEFREQTIME                 30      /* Time to wait for auth-req from peer */
463
464 #define CHAP_DEFTIMEOUT                 6       /* Timeout time in seconds */
465 #define CHAP_DEFTRANSMITS               10      /* max # times to send challenge */
466
467
468 /* Interval in seconds between keepalive echo requests, 0 to disable. */
469 #if 1
470 #define LCP_ECHOINTERVAL                0
471 #else
472 #define LCP_ECHOINTERVAL                10
473 #endif
474
475 /* Number of unanswered echo requests before failure. */
476 #define LCP_MAXECHOFAILS                3
477
478 /* Max Xmit idle time (in jiffies) before resend flag char. */
479 #define PPP_MAXIDLEFLAG                 100
480
481 /*
482  * Packet sizes
483  *
484  * Note - lcp shouldn't be allowed to negotiate stuff outside these
485  *    limits.  See lcp.h in the pppd directory.
486  * (XXX - these constants should simply be shared by lcp.c instead
487  *    of living in lcp.h)
488  */
489 #define PPP_MTU                         1500     /* Default MTU (size of Info field) */
490 #if 0
491 #define PPP_MAXMTU  65535 - (PPP_HDRLEN + PPP_FCSLEN)
492 #else
493 #define PPP_MAXMTU                      1500 /* Largest MTU we allow */
494 #endif
495 #define PPP_MINMTU                      64
496 #define PPP_MRU                         1500     /* default MRU = max length of info field */
497 #define PPP_MAXMRU                      1500     /* Largest MRU we allow */
498 #define PPP_DEFMRU                      296             /* Try for this */
499 #define PPP_MINMRU                      128             /* No MRUs below this */
500
501
502 #define MAXNAMELEN                      256     /* max length of hostname or name for auth */
503 #define MAXSECRETLEN                    256     /* max length of password or secret */
504
505 #endif /* PPP_SUPPORT */
506
507 /* checksum options - set to zero for hardware checksum support */
508
509 #ifndef CHECKSUM_GEN_IP
510 #define CHECKSUM_GEN_IP                 1
511 #endif
512  
513 #ifndef CHECKSUM_GEN_UDP
514 #define CHECKSUM_GEN_UDP                1
515 #endif
516  
517 #ifndef CHECKSUM_GEN_TCP
518 #define CHECKSUM_GEN_TCP                1
519 #endif
520  
521 #ifndef CHECKSUM_CHECK_IP
522 #define CHECKSUM_CHECK_IP               1
523 #endif
524  
525 #ifndef CHECKSUM_CHECK_UDP
526 #define CHECKSUM_CHECK_UDP              1
527 #endif
528
529 #ifndef CHECKSUM_CHECK_TCP
530 #define CHECKSUM_CHECK_TCP              1
531 #endif
532
533 /* Debugging options all default to off */
534
535 #ifndef DBG_TYPES_ON
536 #define DBG_TYPES_ON                    0
537 #endif
538
539 #ifndef ETHARP_DEBUG
540 #define ETHARP_DEBUG                    DBG_OFF
541 #endif
542
543 #ifndef NETIF_DEBUG
544 #define NETIF_DEBUG                     DBG_OFF
545 #endif
546
547 #ifndef PBUF_DEBUG
548 #define PBUF_DEBUG                      DBG_OFF
549 #endif
550
551 #ifndef API_LIB_DEBUG
552 #define API_LIB_DEBUG                   DBG_OFF
553 #endif
554
555 #ifndef API_MSG_DEBUG
556 #define API_MSG_DEBUG                   DBG_OFF
557 #endif
558
559 #ifndef SOCKETS_DEBUG
560 #define SOCKETS_DEBUG                   DBG_OFF
561 #endif
562
563 #ifndef ICMP_DEBUG
564 #define ICMP_DEBUG                      DBG_OFF
565 #endif
566
567 #ifndef INET_DEBUG
568 #define INET_DEBUG                      DBG_OFF
569 #endif
570
571 #ifndef IP_DEBUG
572 #define IP_DEBUG                        DBG_OFF
573 #endif
574
575 #ifndef IP_REASS_DEBUG
576 #define IP_REASS_DEBUG                  DBG_OFF
577 #endif
578
579 #ifndef RAW_DEBUG
580 #define RAW_DEBUG                       DBG_OFF
581 #endif
582
583 #ifndef MEM_DEBUG
584 #define MEM_DEBUG                       DBG_OFF
585 #endif
586
587 #ifndef MEMP_DEBUG
588 #define MEMP_DEBUG                      DBG_OFF
589 #endif
590
591 #ifndef SYS_DEBUG
592 #define SYS_DEBUG                       DBG_OFF
593 #endif
594
595 #ifndef TCP_DEBUG
596 #define TCP_DEBUG                       DBG_OFF
597 #endif
598
599 #ifndef TCP_INPUT_DEBUG
600 #define TCP_INPUT_DEBUG                 DBG_OFF
601 #endif
602
603 #ifndef TCP_FR_DEBUG
604 #define TCP_FR_DEBUG                    DBG_OFF
605 #endif
606
607 #ifndef TCP_RTO_DEBUG
608 #define TCP_RTO_DEBUG                   DBG_OFF
609 #endif
610
611 #ifndef TCP_REXMIT_DEBUG
612 #define TCP_REXMIT_DEBUG                DBG_OFF
613 #endif
614
615 #ifndef TCP_CWND_DEBUG
616 #define TCP_CWND_DEBUG                  DBG_OFF
617 #endif
618
619 #ifndef TCP_WND_DEBUG
620 #define TCP_WND_DEBUG                   DBG_OFF
621 #endif
622
623 #ifndef TCP_OUTPUT_DEBUG
624 #define TCP_OUTPUT_DEBUG                DBG_OFF
625 #endif
626
627 #ifndef TCP_RST_DEBUG
628 #define TCP_RST_DEBUG                   DBG_OFF
629 #endif
630
631 #ifndef TCP_QLEN_DEBUG
632 #define TCP_QLEN_DEBUG                  DBG_OFF
633 #endif
634
635 #ifndef UDP_DEBUG
636 #define UDP_DEBUG                       DBG_OFF
637 #endif
638
639 #ifndef TCPIP_DEBUG
640 #define TCPIP_DEBUG                     DBG_OFF
641 #endif
642
643 #ifndef PPP_DEBUG 
644 #define PPP_DEBUG                       DBG_OFF
645 #endif
646
647 #ifndef SLIP_DEBUG 
648 #define SLIP_DEBUG                      DBG_OFF
649 #endif
650
651 #ifndef DHCP_DEBUG 
652 #define DHCP_DEBUG                      DBG_OFF
653 #endif
654
655
656 #ifndef DBG_MIN_LEVEL
657 #define DBG_MIN_LEVEL                   DBG_LEVEL_OFF
658 #endif
659
660 #endif /* __LWIP_OPT_H__ */
661
662
663