]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ankh/lib/lwip/lwipopts.h
update
[l4.git] / l4 / pkg / ankh / lib / lwip / lwipopts.h
1 #pragma once
2
3 #define LWIP_DEBUG 0
4
5 /**
6  * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
7  * critical regions during buffer allocation, deallocation and memory
8  * allocation and deallocation.
9  */
10 #ifndef SYS_LIGHTWEIGHT_PROT
11 #define SYS_LIGHTWEIGHT_PROT            1
12 #endif
13
14 /*
15    ------------------------------------
16    ---------- Memory options ----------
17    ------------------------------------
18 */
19 /**
20  * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
21  * instead of the lwip internal allocator. Can save code size if you
22  * already use it.
23  */
24 #ifndef MEM_LIBC_MALLOC
25 #define MEM_LIBC_MALLOC                 1
26 #endif
27
28 /**
29 * MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
30 * Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
31 * speed and usage from interrupts!
32 */
33 #ifndef MEMP_MEM_MALLOC
34 #define MEMP_MEM_MALLOC                 1
35 #endif
36
37 /**
38  * MEM_ALIGNMENT: should be set to the alignment of the CPU
39  *    4 byte alignment -> #define MEM_ALIGNMENT 4
40  *    2 byte alignment -> #define MEM_ALIGNMENT 2
41  */
42 #ifndef MEM_ALIGNMENT
43 #define MEM_ALIGNMENT                   4
44 #endif
45
46 /**
47  * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable
48  * amount of bytes before and after each memp element in every pool and fills
49  * it with a prominent default value.
50  *    MEMP_OVERFLOW_CHECK == 0 no checking
51  *    MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed
52  *    MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
53  *      memp_malloc() or memp_free() is called (useful but slow!)
54  */
55 #ifndef MEMP_OVERFLOW_CHECK
56 #define MEMP_OVERFLOW_CHECK             1
57 #endif
58
59 /**
60  * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make
61  * sure that there are no cycles in the linked lists.
62  */
63 #ifndef MEMP_SANITY_CHECK
64 #define MEMP_SANITY_CHECK               1
65 #endif
66
67 /*
68    ---------------------------------
69    ---------- ARP options ----------
70    ---------------------------------
71 */
72 /**
73  * LWIP_ARP==1: Enable ARP functionality.
74  */
75 #ifndef LWIP_ARP
76 #define LWIP_ARP                        1
77 #endif
78
79 /**
80  * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached.
81  */
82 #ifndef ARP_TABLE_SIZE
83 #define ARP_TABLE_SIZE                  16
84 #endif
85
86 /**
87  * ARP_QUEUEING==1: Outgoing packets are queued during hardware address
88  * resolution.
89  */
90 #ifndef ARP_QUEUEING
91 #define ARP_QUEUEING                    1
92 #endif
93
94 /**
95  * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be
96  * updated with the source MAC and IP addresses supplied in the packet.
97  * You may want to disable this if you do not trust LAN peers to have the
98  * correct addresses, or as a limited approach to attempt to handle
99  * spoofing. If disabled, lwIP will need to make a new ARP request if
100  * the peer is not already in the ARP table, adding a little latency.
101  */
102 #ifndef ETHARP_TRUST_IP_MAC
103 #define ETHARP_TRUST_IP_MAC             1
104 #endif
105
106 /*
107    --------------------------------
108    ---------- IP options ----------
109    --------------------------------
110 */
111 /**
112  * IP_FORWARD==1: Enables the ability to forward IP packets across network
113  * interfaces. If you are going to run lwIP on a device with only one network
114  * interface, define this to 0.
115  */
116 #ifndef IP_FORWARD
117 #define IP_FORWARD                      0
118 #endif
119
120 /**
121  * IP_OPTIONS_ALLOWED: Defines the behavior for IP options.
122  *      IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
123  *      IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
124  */
125 #ifndef IP_OPTIONS_ALLOWED
126 #define IP_OPTIONS_ALLOWED              1
127 #endif
128
129 /**
130  * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
131  * this option does not affect outgoing packet sizes, which can be controlled
132  * via IP_FRAG.
133  */
134 #ifndef IP_REASSEMBLY
135 #define IP_REASSEMBLY                   1
136 #endif
137
138 /**
139  * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
140  * that this option does not affect incoming packet sizes, which can be
141  * controlled via IP_REASSEMBLY.
142  */
143 #ifndef IP_FRAG
144 #define IP_FRAG                         1
145 #endif
146
147 /**
148  * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
149  * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
150  * in this time, the whole packet is discarded.
151  */
152 #ifndef IP_REASS_MAXAGE
153 #define IP_REASS_MAXAGE                 3
154 #endif
155
156 /**
157  * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
158  * Since the received pbufs are enqueued, be sure to configure
159  * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
160  * packets even if the maximum amount of fragments is enqueued for reassembly!
161  */
162 #ifndef IP_REASS_MAX_PBUFS
163 #define IP_REASS_MAX_PBUFS              10
164 #endif
165
166 /**
167  * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
168  * fragmentation. Otherwise pbufs are allocated and reference the original
169  * packet data to be fragmented.
170  */
171 #ifndef IP_FRAG_USES_STATIC_BUF
172 #define IP_FRAG_USES_STATIC_BUF         1
173 #endif
174
175 /**
176  * IP_FRAG_MAX_MTU: Assumed max MTU on any interface for IP frag buffer
177  * (requires IP_FRAG_USES_STATIC_BUF==1)
178  */
179 #if IP_FRAG_USES_STATIC_BUF && !defined(IP_FRAG_MAX_MTU)
180 #define IP_FRAG_MAX_MTU                 1500
181 #endif
182
183 /**
184  * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
185  */
186 #ifndef IP_DEFAULT_TTL
187 #define IP_DEFAULT_TTL                  255
188 #endif
189
190 /**
191  * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast
192  * filter per pcb on udp and raw send operations. To enable broadcast filter
193  * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1.
194  */
195 #ifndef IP_SOF_BROADCAST
196 #define IP_SOF_BROADCAST                0
197 #endif
198
199 /**
200  * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
201  * filter on recv operations.
202  */
203 #ifndef IP_SOF_BROADCAST_RECV
204 #define IP_SOF_BROADCAST_RECV           0
205 #endif
206
207 /*
208    ----------------------------------
209    ---------- ICMP options ----------
210    ----------------------------------
211 */
212 /**
213  * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
214  * Be careful, disable that make your product non-compliant to RFC1122
215  */
216 #ifndef LWIP_ICMP
217 #define LWIP_ICMP                       1
218 #endif
219
220 /**
221  * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
222  */
223 #ifndef ICMP_TTL
224 #define ICMP_TTL                       (IP_DEFAULT_TTL)
225 #endif
226
227 /**
228  * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
229  */
230 #ifndef LWIP_BROADCAST_PING
231 #define LWIP_BROADCAST_PING             0
232 #endif
233
234 /**
235  * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
236  */
237 #ifndef LWIP_MULTICAST_PING
238 #define LWIP_MULTICAST_PING             0
239 #endif
240
241 /*
242    ---------------------------------
243    ---------- RAW options ----------
244    ---------------------------------
245 */
246 /**
247  * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
248  */
249 #ifndef LWIP_RAW
250 #define LWIP_RAW                        1
251 #endif
252
253 /**
254  * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
255  */
256 #ifndef RAW_TTL
257 #define RAW_TTL                        (IP_DEFAULT_TTL)
258 #endif
259
260 /*
261    ----------------------------------
262    ---------- DHCP options ----------
263    ----------------------------------
264 */
265 /**
266  * LWIP_DHCP==1: Enable DHCP module.
267  */
268 #ifndef LWIP_DHCP
269 #define LWIP_DHCP                       1
270 #endif
271
272 /**
273  * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
274  */
275 #ifndef DHCP_DOES_ARP_CHECK
276 #define DHCP_DOES_ARP_CHECK             ((LWIP_DHCP) && (LWIP_ARP))
277 #endif
278
279 /*
280    ------------------------------------
281    ---------- AUTOIP options ----------
282    ------------------------------------
283 */
284 /**
285  * LWIP_AUTOIP==1: Enable AUTOIP module.
286  */
287 #ifndef LWIP_AUTOIP
288 #define LWIP_AUTOIP                     0
289 #endif
290
291 /**
292  * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on
293  * the same interface at the same time.
294  */
295 #ifndef LWIP_DHCP_AUTOIP_COOP
296 #define LWIP_DHCP_AUTOIP_COOP           0
297 #endif
298
299 /**
300  * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
301  * that should be sent before falling back on AUTOIP. This can be set
302  * as low as 1 to get an AutoIP address very quickly, but you should
303  * be prepared to handle a changing IP address when DHCP overrides
304  * AutoIP.
305  */
306 #ifndef LWIP_DHCP_AUTOIP_COOP_TRIES
307 #define LWIP_DHCP_AUTOIP_COOP_TRIES     9
308 #endif
309
310 /*
311    ----------------------------------
312    ---------- SNMP options ----------
313    ----------------------------------
314 */
315 /**
316  * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
317  * transport.
318  */
319 #ifndef LWIP_SNMP
320 #define LWIP_SNMP                       1
321 #endif
322
323 /**
324  * SNMP_CONCURRENT_REQUESTS: Number of concurrent requests the module will
325  * allow. At least one request buffer is required. 
326  */
327 #ifndef SNMP_CONCURRENT_REQUESTS
328 #define SNMP_CONCURRENT_REQUESTS        1
329 #endif
330
331 /**
332  * SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap
333  * destination is required
334  */
335 #ifndef SNMP_TRAP_DESTINATIONS
336 #define SNMP_TRAP_DESTINATIONS          1
337 #endif
338
339 /**
340  * SNMP_PRIVATE_MIB: 
341  */
342 #ifndef SNMP_PRIVATE_MIB
343 #define SNMP_PRIVATE_MIB                0
344 #endif
345
346 /**
347  * Only allow SNMP write actions that are 'safe' (e.g. disabeling netifs is not
348  * a safe action and disabled when SNMP_SAFE_REQUESTS = 1).
349  * Unsafe requests are disabled by default!
350  */
351 #ifndef SNMP_SAFE_REQUESTS
352 #define SNMP_SAFE_REQUESTS              1
353 #endif
354
355 /*
356    ----------------------------------
357    ---------- IGMP options ----------
358    ----------------------------------
359 */
360 /**
361  * LWIP_IGMP==1: Turn on IGMP module. 
362  */
363 #ifndef LWIP_IGMP
364 #define LWIP_IGMP                       1
365 #endif
366
367 /*
368    ----------------------------------
369    ---------- DNS options -----------
370    ----------------------------------
371 */
372 /**
373  * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
374  * transport.
375  */
376 #ifndef LWIP_DNS
377 #define LWIP_DNS                        1
378 #endif
379
380 /** DNS maximum number of entries to maintain locally. */
381 #ifndef DNS_TABLE_SIZE
382 #define DNS_TABLE_SIZE                  8
383 #endif
384
385 /** DNS maximum host name length supported in the name table. */
386 #ifndef DNS_MAX_NAME_LENGTH
387 #define DNS_MAX_NAME_LENGTH             256
388 #endif
389
390 /** The maximum of DNS servers */
391 #ifndef DNS_MAX_SERVERS
392 #define DNS_MAX_SERVERS                 2
393 #endif
394
395 /** DNS do a name checking between the query and the response. */
396 #ifndef DNS_DOES_NAME_CHECK
397 #define DNS_DOES_NAME_CHECK             1
398 #endif
399
400 /** DNS use a local buffer if DNS_USES_STATIC_BUF=0, a static one if
401     DNS_USES_STATIC_BUF=1, or a dynamic one if DNS_USES_STATIC_BUF=2.
402     The buffer will be of size DNS_MSG_SIZE */
403 #ifndef DNS_USES_STATIC_BUF
404 #define DNS_USES_STATIC_BUF             1
405 #endif
406
407 /** DNS message max. size. Default value is RFC compliant. */
408 #ifndef DNS_MSG_SIZE
409 #define DNS_MSG_SIZE                    512
410 #endif
411
412 /** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled,
413  *  you have to define
414  *    #define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}}
415  *  (an array of structs name/address, where address is an u32_t in network
416  *  byte order).
417  *
418  *  Instead, you can also use an external function:
419  *  #define DNS_LOOKUP_LOCAL_EXTERN(x) extern u32_t my_lookup_function(const char *name)
420  *  that returns the IP address or INADDR_NONE if not found.
421  */
422 #ifndef DNS_LOCAL_HOSTLIST
423 #define DNS_LOCAL_HOSTLIST              1
424 #endif /* DNS_LOCAL_HOSTLIST */
425
426 /** If this is turned on, the local host-list can be dynamically changed
427  *  at runtime. */
428 #ifndef DNS_LOCAL_HOSTLIST_IS_DYNAMIC
429 #define DNS_LOCAL_HOSTLIST_IS_DYNAMIC   1
430 #endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
431
432 #define LWIP_DNS_API_DECLARE_H_ERRNO 0
433
434 /*
435    ---------------------------------
436    ---------- UDP options ----------
437    ---------------------------------
438 */
439 /**
440  * LWIP_UDP==1: Turn on UDP.
441  */
442 #ifndef LWIP_UDP
443 #define LWIP_UDP                        1
444 #endif
445
446 /**
447  * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
448  */
449 #ifndef LWIP_UDPLITE
450 #define LWIP_UDPLITE                    1
451 #endif
452
453 /**
454  * UDP_TTL: Default Time-To-Live value.
455  */
456 #ifndef UDP_TTL
457 #define UDP_TTL                         (IP_DEFAULT_TTL)
458 #endif
459
460 /*
461    ---------------------------------
462    ---------- TCP options ----------
463    ---------------------------------
464 */
465 /**
466  * LWIP_TCP==1: Turn on TCP.
467  */
468 #ifndef LWIP_TCP
469 #define LWIP_TCP                        1
470 #endif
471
472 /**
473  * TCP_TTL: Default Time-To-Live value.
474  */
475 #ifndef TCP_TTL
476 #define TCP_TTL                         (IP_DEFAULT_TTL)
477 #endif
478
479 /**
480  * TCP_WND: The size of a TCP window.  This must be at least 
481  * (2 * TCP_MSS) for things to work well
482  */
483 #ifndef TCP_WND
484 #define TCP_WND                         2048
485 #endif 
486
487 /**
488  * TCP_MAXRTX: Maximum number of retransmissions of data segments.
489  */
490 #ifndef TCP_MAXRTX
491 #define TCP_MAXRTX                      12
492 #endif
493
494 /**
495  * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
496  */
497 #ifndef TCP_SYNMAXRTX
498 #define TCP_SYNMAXRTX                   6
499 #endif
500
501 /**
502  * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
503  * Define to 0 if your device is low on memory.
504  */
505 #ifndef TCP_QUEUE_OOSEQ
506 #define TCP_QUEUE_OOSEQ                 (LWIP_TCP)
507 #endif
508
509 /**
510  * TCP_MSS: TCP Maximum segment size. (default is 128, a *very*
511  * conservative default.)
512  * For the receive side, this MSS is advertised to the remote side
513  * when opening a connection. For the transmit size, this MSS sets
514  * an upper limit on the MSS advertised by the remote host.
515  */
516 #ifndef TCP_MSS
517 #define TCP_MSS                         128
518 #endif
519
520 /**
521  * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
522  * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
523  * reflects the available reassembly buffer size at the remote host) and the
524  * largest size permitted by the IP layer" (RFC 1122)
525  * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
526  * netif used for a connection and limits the MSS if it would be too big otherwise.
527  */
528 #ifndef TCP_CALCULATE_EFF_SEND_MSS
529 #define TCP_CALCULATE_EFF_SEND_MSS      1
530 #endif
531
532
533 /**
534  * TCP_SND_BUF: TCP sender buffer space (bytes). 
535  */
536 #ifndef TCP_SND_BUF
537 #define TCP_SND_BUF                     256
538 #endif
539
540 /**
541  * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
542  * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
543  */
544 #ifndef TCP_SND_QUEUELEN
545 #define TCP_SND_QUEUELEN                (4 * (TCP_SND_BUF/TCP_MSS))
546 #endif
547
548 /**
549  * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than or equal
550  * to TCP_SND_BUF. It is the amount of space which must be available in the
551  * TCP snd_buf for select to return writable.
552  */
553 #ifndef TCP_SNDLOWAT
554 #define TCP_SNDLOWAT                    (TCP_SND_BUF/2)
555 #endif
556
557 /**
558  * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
559  */
560 #ifndef TCP_LISTEN_BACKLOG
561 #define TCP_LISTEN_BACKLOG              0
562 #endif
563
564 /**
565  * The maximum allowed backlog for TCP listen netconns.
566  * This backlog is used unless another is explicitly specified.
567  * 0xff is the maximum (u8_t).
568  */
569 #ifndef TCP_DEFAULT_LISTEN_BACKLOG
570 #define TCP_DEFAULT_LISTEN_BACKLOG      0xff
571 #endif
572
573 /**
574  * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
575  */
576 #ifndef LWIP_TCP_TIMESTAMPS
577 #define LWIP_TCP_TIMESTAMPS             0
578 #endif
579
580 /**
581  * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an
582  * explicit window update
583  */
584 #ifndef TCP_WND_UPDATE_THRESHOLD
585 #define TCP_WND_UPDATE_THRESHOLD   (TCP_WND / 4)
586 #endif
587
588 /**
589  * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
590  * (requires NO_SYS==0)
591  */
592 #ifndef MEMP_NUM_SYS_TIMEOUT
593 #define MEMP_NUM_SYS_TIMEOUT            16
594 #endif