xref: /FreeRTOS-Plus-TCP-v3.1.0/source/include/FreeRTOSIPConfigDefaults.h (revision 37bdfe577f3b728058de714e2e747d3c78803f26)
1 /*
2  * FreeRTOS+TCP V3.1.0
3  * Copyright (C) 2022 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * http://aws.amazon.com/freertos
25  * http://www.FreeRTOS.org
26  */
27 
28 #ifndef FREERTOS_DEFAULT_IP_CONFIG_H
29 #define FREERTOS_DEFAULT_IP_CONFIG_H
30 
31 /* This file must be included only after the configuration files FreeRTOSConfig.h and
32  * FreeRTOSIPConfig.h have been included already.
33  * Mentioned header files are private to the project, whereas this header
34  * file is part of FreeRTOS+TCP.
35  *
36  * The complete documentation of the configuration parameters can be found here:
37  *
38  * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
39  *
40  */
41 
42 /* The error numbers defined in this file will be moved to the core FreeRTOS
43  * code in future versions of FreeRTOS - at which time the following header file
44  * will be removed. */
45 #include "FreeRTOS_errno_TCP.h"
46 
47 /* This file provides default values for configuration options that are missing
48  * from the FreeRTOSIPConfig.h configuration header file. */
49 
50 /* These macros are used to define away static keyword for CBMC proofs */
51 #ifndef _static
52     #define _static    static
53 #endif
54 
55 /* Through time some macro names have changed. This always
56  * happened for a good reason: clarity or consistency.
57  * Here below there are some ifdef's that will issue an error if any of the
58  * deprecated macros is still defined. */
59 
60 /* Ensure defined configuration constants are using the most up to date naming. */
61 #ifdef tcpconfigIP_TIME_TO_LIVE
62     #error now called: ipconfigTCP_TIME_TO_LIVE
63 #endif
64 
65 #ifdef updconfigIP_TIME_TO_LIVE
66     #error now called: ipconfigUDP_TIME_TO_LIVE
67 #endif
68 
69 #ifdef ipFILLER_SIZE
70     #error now called: ipconfigPACKET_FILLER_SIZE
71 #endif
72 
73 #ifdef dnsMAX_REQUEST_ATTEMPTS
74     #error now called: ipconfigDNS_REQUEST_ATTEMPTS
75 #endif
76 
77 #ifdef ipconfigUDP_TASK_PRIORITY
78     #error now called: ipconfigIP_TASK_PRIORITY
79 #endif
80 
81 #ifdef ipconfigUDP_TASK_STACK_SIZE_WORDS
82     #error now called: ipconfigIP_TASK_STACK_SIZE_WORDS
83 #endif
84 
85 #ifdef ipconfigDRIVER_INCLUDED_RX_IP_FILTERING
86     #error now called: ipconfigETHERNET_DRIVER_FILTERS_PACKETS
87 #endif
88 
89 #ifdef ipconfigMAX_SEND_BLOCK_TIME_TICKS
90     #error now called: ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
91 #endif
92 
93 #ifdef ipconfigUSE_RECEIVE_CONNECT_CALLBACKS
94     #error now called: ipconfigUSE_CALLBACKS
95 #endif
96 
97 #ifdef ipconfigNUM_NETWORK_BUFFERS
98     #error now called: ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
99 #endif
100 
101 #ifdef ipconfigTCP_HANG_PROT
102     #error now called: ipconfigTCP_HANG_PROTECTION
103 #endif
104 
105 #ifdef ipconfigTCP_HANG_PROT_TIME
106     #error now called: ipconfigTCP_HANG_PROTECTION_TIME
107 #endif
108 
109 #ifdef FreeRTOS_lprintf
110     #error now called: FreeRTOS_debug_printf
111 #endif
112 
113 #ifdef  ipconfigBUFFER_ALLOC_FIXED_SIZE
114     #error ipconfigBUFFER_ALLOC_FIXED_SIZE was dropped and replaced by a const value, declared in BufferAllocation[12].c
115 #endif
116 
117 #ifdef  ipconfigNIC_SEND_PASSES_DMA
118     #error now called: ipconfigZERO_COPY_TX_DRIVER
119 #endif
120 
121 #ifdef  HAS_TX_CRC_OFFLOADING
122     #error now called: ipconfigHAS_TX_CRC_OFFLOADING
123 #endif
124 
125 #ifdef  HAS_RX_CRC_OFFLOADING
126     #error now called: ipconfigHAS_RX_CRC_OFFLOADING
127 #endif
128 
129 #ifdef ipconfigTCP_RX_BUF_LEN
130     #error ipconfigTCP_RX_BUF_LEN is now called ipconfigTCP_RX_BUFFER_LENGTH
131 #endif
132 
133 #ifdef ipconfigTCP_TX_BUF_LEN
134     #error ipconfigTCP_TX_BUF_LEN is now called ipconfigTCP_TX_BUFFER_LENGTH
135 #endif
136 
137 #ifdef ipconfigDHCP_USES_USER_HOOK
138     #error ipconfigDHCP_USES_USER_HOOK and its associated callback have been superseded - see http: /*www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP_HOOK */
139 #endif
140 
141 /* The macro 'ipconfigBYTE_ORDER' must be defined as either 'pdFREERTOS_LITTLE_ENDIAN'
142  * or as 'pdFREERTOS_BIG_ENDIAN'.  See also 'projdefs.h'.
143  */
144 #ifndef ipconfigBYTE_ORDER
145     #error The macro 'ipconfigBYTE_ORDER' must be defined at this point
146 #endif
147 
148 /* So far the warnings about deprecated configuration macros. */
149 
150 /*-----------------------------------------------------------*/
151 
152 /* The IP stack executes it its own task (although any application task can make
153  * use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
154  * sets the priority of the task that executes the IP stack.  The priority is a
155  * standard FreeRTOS task priority so can take any value from 0 (the lowest
156  * priority) to (configMAX_PRIORITIES - 1) (the highest priority).
157  * configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
158  * FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
159  * the priority assigned to the task executing the IP stack relative to the
160  * priority assigned to tasks that use the IP stack. */
161 #ifndef ipconfigIP_TASK_PRIORITY
162     #define ipconfigIP_TASK_PRIORITY    ( configMAX_PRIORITIES - 2 )
163 #endif
164 
165 /* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
166  * task.  This setting is less important when the FreeRTOS Win32 simulator is used
167  * as the Win32 simulator only stores a fixed amount of information on the task
168  * stack.  FreeRTOS includes optional stack overflow detection, see:
169  * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
170 #ifndef ipconfigIP_TASK_STACK_SIZE_WORDS
171     #define ipconfigIP_TASK_STACK_SIZE_WORDS    ( configMINIMAL_STACK_SIZE * 5U )
172 #endif
173 
174 /* Include all API's and code that is needed for the TCP protocol.
175  * When defined as zero, the application is UDP-only. */
176 #ifndef ipconfigUSE_TCP
177     #define ipconfigUSE_TCP    ( 1 )
178 #endif
179 
180 #if ( ipconfigUSE_TCP != 0 )
181 
182 /* 'ipconfigUSE_TCP_WIN' enables support for TCP sliding windows.  When
183  * defined as zero, each TCP packet must be acknowledged individually.
184  * That will be slower, but it will result less code. */
185     #ifndef ipconfigUSE_TCP_WIN
186         #define ipconfigUSE_TCP_WIN    ( 1 )
187     #endif
188 
189 /* The total number of outstanding TCP segments, either outgoing or incoming.
190  * This only applies when 'ipconfigUSE_TCP_WIN' is enabled. */
191     #ifndef ipconfigTCP_WIN_SEG_COUNT
192         #define ipconfigTCP_WIN_SEG_COUNT    ( 256 )
193     #endif
194 
195 /* When non-zero, TCP will not send RST packets in reply to
196  * TCP packets which are unknown, or out-of-order.
197  * This is an option used for testing.  It is recommended to
198  * define it as '0'. */
199     #ifndef ipconfigIGNORE_UNKNOWN_PACKETS
200         #define ipconfigIGNORE_UNKNOWN_PACKETS    ( 0 )
201     #endif
202 #endif /* if ipconfigUSE_TCP */
203 
204 /*
205  * For debugging/logging: check if the port number is used for e.g. telnet.
206  * Some events will not be logged for telnet connections
207  * because it would produce logging about the transmission of the logging...
208  * This macro will only be used if FreeRTOS_debug_printf() is defined for logging.
209  * Note that the parameter 'xPort' is already converted to host-endian.
210  */
211 #ifndef ipconfigTCP_MAY_LOG_PORT
212     #define ipconfigTCP_MAY_LOG_PORT( xPort )    ( ( xPort ) != 23U )
213 #endif
214 
215 /* Determine the number of clock ticks that the API's FreeRTOS_recv() and
216  * FreeRTOS_recvfrom() must wait for incoming data. */
217 #ifndef ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME
218     #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME    portMAX_DELAY
219 #endif
220 
221 /* Determine the number of clock ticks that FreeRTOS_send() must wait
222  * for space in the transmission buffer.
223  * For FreeRTOS_sendto(), it limits how long the application
224  * should wait for a network buffer to become available.
225  */
226 #ifndef ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME
227     #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME    portMAX_DELAY
228 #endif
229 
230 /* When sending a UDP packet, a network buffer must be obtained.  This macro
231  * will limit the maximum waiting time that is configured with e.g.
232  * ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME, or when setting the socket option
233  * FREERTOS_SO_SNDTIMEO.
234  * It serves as a protection against a possible dead-lock; a task waiting
235  * for itself to release a network buffer.
236  */
237 #ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
238     #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS    ( pdMS_TO_TICKS( 20U ) )
239 #endif
240 
241 /*
242  * FreeRTOS debug logging routines.
243  * The macro will be called with a printf() format as a parameter.  Users
244  * can define their own logging routine as:
245  *
246  *     extern void my_printf( const char * pcFormat, ... );
247  *     #define FreeRTOS_debug_printf( MSG )         my_printf MSG
248  *
249  * The FreeRTOS_debug_printf() must be thread-safe but does not have to be
250  * interrupt-safe.
251  */
252 #ifdef ipconfigHAS_DEBUG_PRINTF
253     #if ( ipconfigHAS_DEBUG_PRINTF == 0 )
254         #ifdef FreeRTOS_debug_printf
255             #error Do not define FreeRTOS_debug_print if ipconfigHAS_DEBUG_PRINTF is set to 0
256         #endif /* ifdef FreeRTOS_debug_printf */
257     #endif /* ( ipconfigHAS_DEBUG_PRINTF == 0 ) */
258 #endif /* ifdef ipconfigHAS_DEBUG_PRINTF */
259 
260 #ifndef FreeRTOS_debug_printf
261     #define FreeRTOS_debug_printf( MSG )    do {} while( ipFALSE_BOOL )
262     /* MISRA Ref 20.5.1 [Use of undef] */
263     /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */
264     /* coverity[misra_c_2012_rule_20_5_violation] */
265     #undef ipconfigHAS_DEBUG_PRINTF
266     #define ipconfigHAS_DEBUG_PRINTF    0
267 #endif
268 
269 /*
270  * FreeRTOS general logging routine (proposal)
271  * Used in some utility functions such as FreeRTOS_netstat() and FreeRTOS_PrintARPCache()
272  *
273  *     extern void my_printf( const char * pcFormat, ... );
274  *     #define FreeRTOS_printf( MSG )           my_printf MSG
275  *
276  * The FreeRTOS_printf() must be thread-safe but does not have to be interrupt-safe
277  */
278 #ifdef ipconfigHAS_PRINTF
279     #if ( ipconfigHAS_PRINTF == 0 )
280         #ifdef FreeRTOS_printf
281             #error Do not define FreeRTOS_print if ipconfigHAS_PRINTF is set to 0
282         #endif /* ifdef FreeRTOS_debug_printf */
283     #endif /* ( ipconfigHAS_PRINTF == 0 ) */
284 #endif /* ifdef ipconfigHAS_PRINTF */
285 
286 #ifndef FreeRTOS_printf
287     #define FreeRTOS_printf( MSG )    do {} while( ipFALSE_BOOL )
288     /* MISRA Ref 20.5.1 [Use of undef] */
289     /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */
290     /* coverity[misra_c_2012_rule_20_5_violation] */
291     #undef ipconfigHAS_PRINTF
292     #define ipconfigHAS_PRINTF    0
293 #endif
294 
295 /*
296  * In cases where a lot of logging is produced, FreeRTOS_flush_logging( )
297  * will be called to give the logging module a chance to flush the data.
298  */
299 #ifndef FreeRTOS_flush_logging
300     #define FreeRTOS_flush_logging()    do {} while( ipFALSE_BOOL )
301 #endif
302 
303 /* Malloc functions.  Within most applications of FreeRTOS, the couple
304  * pvPortMalloc()/vPortFree() will be used.
305  * If there are different types of RAM, the user may decide to use a different
306  * memory allocator for different purposes:
307  * MallocLarge is used to allocate large TCP buffers (for Rx/Tx)
308  * MallocSocket is used to allocate the space for the sockets
309  */
310 #ifndef pvPortMallocLarge
311     #define pvPortMallocLarge( x )    pvPortMalloc( x )
312 #endif
313 
314 #ifndef vPortFreeLarge
315     #define vPortFreeLarge( ptr )    vPortFree( ptr )
316 #endif
317 
318 #ifndef pvPortMallocSocket
319     #define pvPortMallocSocket( x )    pvPortMalloc( x )
320 #endif
321 
322 #ifndef vPortFreeSocket
323     #define vPortFreeSocket( ptr )    vPortFree( ptr )
324 #endif
325 
326 /*
327  * At several places within the library, random numbers are needed:
328  * - DHCP:    For creating a DHCP transaction number
329  * - TCP:     Set the Initial Sequence Number: this is the value of the first outgoing
330  *            sequence number being used when connecting to a peer.
331  *            Having a well randomized ISN is important to avoid spoofing
332  * - UDP/TCP: for setting the first port number to be used, in case a socket
333  *            uses a 'random' or anonymous port number
334  *
335  * The function is now **deprecated**, in stead the following function must be provided:
336  * BaseType_t xApplicationGetRandomNumber( uint32_t *pulValue );
337  * It will return pdPASS if the random number could be created, otherwise pdFAIL.
338  */
339 #ifndef ipconfigRAND32
340     #define ipconfigRAND32()    rand()
341 #endif
342 
343 /* 'ipconfigUSE_NETWORK_EVENT_HOOK' indicates if an application hook is available
344  * called 'vApplicationIPNetworkEventHook()'.  This function will be called when
345  * the network goes up and when it goes down.  See also FREERTOS_IP.h for further
346  * explanation. */
347 #ifndef ipconfigUSE_NETWORK_EVENT_HOOK
348     #define ipconfigUSE_NETWORK_EVENT_HOOK    0
349 #endif
350 
351 /* Define the number of entries in the ARP cache table. */
352 #ifndef ipconfigARP_CACHE_ENTRIES
353     #define ipconfigARP_CACHE_ENTRIES    10
354 #endif
355 
356 /* The number of times an ARP request is sent when looking
357  * up an IP-address.
358  * The name should have been 'max transmissions', and not
359  * 'max re-transmissions'. */
360 #ifndef ipconfigMAX_ARP_RETRANSMISSIONS
361     #define ipconfigMAX_ARP_RETRANSMISSIONS    ( 5U )
362 #endif
363 
364 /* The maximum age of an entry in the ARP cache table can be
365  * calculated as 'ipARP_TIMER_PERIOD_MS' x 'ipconfigMAX_ARP_AGE'.
366  * The macro 'ipARP_TIMER_PERIOD_MS' is local to FreeRTOSIP.c
367  * but it can be overwritten from FreeRTOSIPConfig.h
368  * The default is 10000 x 150 = 1500000 ms or 1500 seconds
369  */
370 #ifndef ipconfigMAX_ARP_AGE
371     #define ipconfigMAX_ARP_AGE    150U
372 #endif
373 
374 /* 'ipconfigUSE_ARP_REVERSED_LOOKUP' when non-zero, the function
375  * eARPGetCacheEntryByMac() will be included in the code.
376  */
377 #ifndef ipconfigUSE_ARP_REVERSED_LOOKUP
378     #define ipconfigUSE_ARP_REVERSED_LOOKUP    0
379 #endif
380 
381 /* 'ipconfigUSE_ARP_REMOVE_ENTRY' when non-zero, the function
382  * ulARPRemoveCacheEntryByMac() will be included in the code.
383  */
384 #ifndef ipconfigUSE_ARP_REMOVE_ENTRY
385     #define ipconfigUSE_ARP_REMOVE_ENTRY    0
386 #endif
387 
388 /* Normally, the ARP table will only store IP-addresses that are located
389  * in the local subnet.
390  * When enabled, the option 'ipconfigARP_STORES_REMOTE_ADDRESSES' will allow
391  * that remote IP-addresses will also be stored, along with the MAC-address of
392  * the gateway.
393  */
394 #ifndef ipconfigARP_STORES_REMOTE_ADDRESSES
395     #define ipconfigARP_STORES_REMOTE_ADDRESSES    0
396 #endif
397 
398 /* 'ipconfigINCLUDE_FULL_INET_ADDR' used to determine if
399  * the function 'FreeRTOS_inet_addr()' is included.
400  * The macro is now deprecated and the function is included
401  * unconditionally.
402  */
403 #ifndef ipconfigINCLUDE_FULL_INET_ADDR
404     #define ipconfigINCLUDE_FULL_INET_ADDR    1
405 #endif
406 
407 /* This is about how new packets are passed from the network interface
408  * to the IP-task.  By default they will be sent one-by-one.
409  * When 'ipconfigUSE_LINKED_RX_MESSAGES' is non-zero, each message
410  * buffer gets a 'pxNextBuffer' field, to that linked packets can be passed
411  * to the IP-task in a single call to 'xSendEventStructToIPTask()'.
412  * Note that this only works if the Network Interface also supports this
413  * option.
414  */
415 #ifndef ipconfigUSE_LINKED_RX_MESSAGES
416     #define ipconfigUSE_LINKED_RX_MESSAGES    0
417 #endif
418 
419 /* 'ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS' is an important macro: it
420  * determines the number of network buffers that are available in the
421  * entire application.
422  * Note that the default of 45 may be pretty high for smaller
423  * applications.
424  * Also note that when the network interface uses zero-copy reception
425  * ( ipconfigZERO_COPY_RX_DRIVER ), it will reserve a set of network
426  * buffers permanently.
427  * For zero-copy transmission, no network buffers are permanently
428  * "reserved" for transmission.
429  */
430 #ifndef ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS
431     #define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS    45U
432 #endif
433 
434 /* Every task, and also the network interface can send messages
435  * to the IP-task by calling API's.  These messages pass through a
436  * queue which has a maximum size of 'ipconfigEVENT_QUEUE_LENGTH'
437  * items.
438  * When developing an application, it is important to monitor the
439  * actual usage of the queue.  See 'ipconfigCHECK_IP_QUEUE_SPACE'
440  * here below.
441  */
442 #ifndef ipconfigEVENT_QUEUE_LENGTH
443     #define ipconfigEVENT_QUEUE_LENGTH    ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5U )
444 #endif
445 
446 #if ( ipconfigEVENT_QUEUE_LENGTH < ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5U ) )
447     #error The ipconfigEVENT_QUEUE_LENGTH parameter must be at least ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5
448 #endif
449 
450 /* Related to the macro 'ipconfigEVENT_QUEUE_LENGTH' here above:
451  * when developing a new networking application, it can be helpful
452  * to monitor the length of the message queue of the IP-task.
453  * This code is only enabled when 'ipconfigCHECK_IP_QUEUE_SPACE'
454  * is set to 1.  See also the function 'uxGetMinimumIPQueueSpace()'.
455  */
456 #ifndef ipconfigCHECK_IP_QUEUE_SPACE
457     #define ipconfigCHECK_IP_QUEUE_SPACE    0
458 #endif
459 
460 /* When defined as non-zero, this macro allows to use a socket
461  * without first binding it explicitly to a port number.
462  * In that case, it will be bound to a random free port number. */
463 #ifndef ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND
464     #define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND    1
465 #endif
466 
467 /* Configuration to control whether packets with IP options,
468  * received over the network, should be passed up to the
469  * software stack OR should be dropped.
470  * If set to 1, the stack accepts IP packets that contain IP options, but does
471  * not process the options (IP options are not supported).
472  * If set to 0, the stack will drop IP packets that contain IP options.
473  */
474 #ifndef ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS
475     #define ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS    1
476 #endif
477 
478 /* Configuration to control whether all outgoing IP datagrams get their
479  * "don't fragment" flag set.
480  * If set to 1, the stack will set the "don't fragment" flag on all outgoing IP
481  * packets.  If a packet needs to be fragmented somewhere along it's path, it will get
482  * discarded instead of fragmented.
483  * If set to 0, the stack will clear the "don't fragment" flag an all outgoing IP
484  * packets therefore allowing fragmentation if it is needed.
485  */
486 #ifndef ipconfigFORCE_IP_DONT_FRAGMENT
487     #define ipconfigFORCE_IP_DONT_FRAGMENT    0
488 #endif
489 
490 /* Configuration to control whether UDP packets with
491  * checksum value of zero should be passed up the software
492  * stack OR should be dropped.
493  * When enabled, the stack will accept UDP packets that have their checksum
494  * value set to 0.
495  * When disabled, the stack will drop UDP packets that have their checksum
496  * value set to 0, and issue some logging.
497  */
498 #ifndef ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS
499     #define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS    0
500 #endif
501 
502 /* Define the value of the TTL field in outgoing UDP packets. */
503 #ifndef ipconfigUDP_TIME_TO_LIVE
504     #define ipconfigUDP_TIME_TO_LIVE    128
505 #endif
506 
507 /* Define the value of the TTL field in outgoing TCP packets. */
508 #ifndef ipconfigTCP_TIME_TO_LIVE
509     #define ipconfigTCP_TIME_TO_LIVE    128
510 #endif
511 
512 /* Define the value of the TTL field in outgoing TCP packets. */
513 /* The default of 64 is recommend in RFC 1700. */
514 #ifndef ipconfigICMP_TIME_TO_LIVE
515     #define ipconfigICMP_TIME_TO_LIVE    64
516 #endif
517 
518 /* TCP only: when measuring the Smoothed Round Trip Time (SRTT),
519  * the result will be rounded up to a minimum value.
520  * The default has always been 50, but a value of 1000
521  * is recommended ( see RFC6298 ) because hosts often delay the
522  * sending of ACK packets with 200 ms. */
523 #ifndef ipconfigTCP_SRTT_MINIMUM_VALUE_MS
524     #define ipconfigTCP_SRTT_MINIMUM_VALUE_MS    50
525 #endif
526 
527 /* Make positive to define the maximum number of packets which will be buffered
528  * in a UDP socket.
529  * Can be overridden with the socket option 'FREERTOS_SO_UDP_MAX_RX_PACKETS'.
530  */
531 #ifndef ipconfigUDP_MAX_RX_PACKETS
532     #define ipconfigUDP_MAX_RX_PACKETS    0U
533 #endif
534 
535 /* Define the priority of the IP-task.  It is recommended to use this
536  * order of priorities:
537  * Highest : network interface, handling transmission and reception.
538  * Medium  : the IP-task handling API calls from the application.
539  * Lower   : the tasks that make use of the IP-stack.
540  * For other tasks any priority can be chosen.
541  */
542 #ifndef ipconfigIP_TASK_PRIORITY
543     #define ipconfigIP_TASK_PRIORITY    ( configMAX_PRIORITIES - 2 )
544 #endif
545 
546 /* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
547  * task.  This setting is less important when the FreeRTOS Win32 simulator is used
548  * as the Win32 simulator only stores a fixed amount of information on the task
549  * stack.  FreeRTOS includes optional stack overflow detection, see:
550  * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */
551 #ifndef ipconfigIP_TASK_STACK_SIZE_WORDS
552     #define ipconfigIP_TASK_STACK_SIZE_WORDS    ( configMINIMAL_STACK_SIZE * 5 )
553 #endif
554 
555 /* When non-zero, the module FreeRTOS_DHCP.c will be included and called.
556  * Note that the application can override decide to ignore the outcome
557  * of the DHCP negotiation and use a static IP-address. */
558 #ifndef ipconfigUSE_DHCP
559     #define ipconfigUSE_DHCP    1
560 #endif
561 
562 /* During the DHCP process, the driver will call an application hook
563  * if 'ipconfigUSE_DHCP_HOOK' is non-zero.  It lets the application decide
564  * if the DHCP offer shall be accepted.
565  */
566 #ifndef ipconfigUSE_DHCP_HOOK
567     #define ipconfigUSE_DHCP_HOOK    0
568 #endif
569 
570 /* DHCP servers have a table with information about each clients.  One
571  * of the fields in this table contains the host name of the DHCP clients.
572  * When 'ipconfigDHCP_REGISTER_HOSTNAME' is defined as non-zero, the DHCP
573  * driver will call 'pcApplicationHostnameHook()' to obtain the name of
574  * the embedded device.
575  */
576 #ifndef ipconfigDHCP_REGISTER_HOSTNAME
577     #define ipconfigDHCP_REGISTER_HOSTNAME    0
578 #endif
579 
580 /*
581  * Only applicable when DHCP is in use:
582  * If no DHCP server responds, use "Auto-IP" : the
583  * device will allocate a random LinkLayer IP address.
584  */
585 #ifndef ipconfigDHCP_FALL_BACK_AUTO_IP
586     #define ipconfigDHCP_FALL_BACK_AUTO_IP    ( 0 )
587 #endif
588 
589 /* When a link-layer address is assigned, the driver will test
590  * if it is already taken by a different device by sending ARP
591  * requests.  Therefore, 'ipconfigARP_USE_CLASH_DETECTION' must
592  * be defined as non-zero.
593  */
594 #if ( ipconfigDHCP_FALL_BACK_AUTO_IP != 0 )
595     #ifndef ipconfigARP_USE_CLASH_DETECTION
596         #define ipconfigARP_USE_CLASH_DETECTION    1
597     #else
598         #if ( ipconfigARP_USE_CLASH_DETECTION != 1 )
599             #error ipconfigARP_USE_CLASH_DETECTION should be defined as 1 when AUTO_IP is used.
600         #endif
601     #endif
602 #endif
603 
604 /* If ipconfigDHCP_FALL_BACK_AUTO_IP is not used, the code for
605  * clash detection is not needed.
606  */
607 #ifndef ipconfigARP_USE_CLASH_DETECTION
608     #define ipconfigARP_USE_CLASH_DETECTION    0
609 #endif
610 
611 /* An important macro: 'ipconfigNETWORK_MTU' determines the Maximum
612  * transmission unit, which is a network packet minus the size of the
613  * 14-byte Ethernet header.
614  */
615 #ifndef ipconfigNETWORK_MTU
616     #define ipconfigNETWORK_MTU    1500
617 #else
618     /* A sanity check to avoid a possible overflow of size_t. */
619     #if ipconfigNETWORK_MTU > ( SIZE_MAX >> 1 )
620         /* MISRA Ref 20.5.1 [Use of undef] */
621         /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */
622         /* coverity[misra_c_2012_rule_20_5_violation] */
623         #undef ipconfigNETWORK_MTU
624         #define ipconfigNETWORK_MTU    ( SIZE_MAX >> 1 )
625     #endif
626 #endif
627 
628 #if ( ipconfigNETWORK_MTU < 46 )
629     #error ipconfigNETWORK_MTU must be at least 46.
630 #endif
631 
632 /* The maximum segment size used by TCP, it is the maximum size of
633  * the TCP payload per packet.
634  * For IPv4: when MTU equals 1500, the MSS equals 1460.
635  * It is recommended to use the default value defined here.
636  *
637  * In FreeRTOS_TCP_IP.c, there is a local macro called 'tcpREDUCED_MSS_THROUGH_INTERNET'.
638  * When a TCP connection is made outside the local network, the MSS
639  * will be reduced to 'tcpREDUCED_MSS_THROUGH_INTERNET' before the connection
640  * is made.
641  */
642 #ifndef ipconfigTCP_MSS
643     #define ipconfigTCP_MSS    ( ipconfigNETWORK_MTU - ( ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER ) )
644 #endif
645 
646 /* This macro defines the minimum size of an outgoing Ethernet packet.
647  * When zero, there is no minimum.
648  * When non-zero, the packet will be extended to the minimum size.
649  * The extra bytes will be cleared.
650  * In many projects a value of 60 is used.
651  * The 32-bit CRC added in the physical layer is not included.
652  */
653 #ifndef ipconfigETHERNET_MINIMUM_PACKET_BYTES
654     #define ipconfigETHERNET_MINIMUM_PACKET_BYTES    0
655 #endif
656 
657 /* Each TCP socket has circular stream buffers for reception and transmission,
658  * which have a fixed maximum size.
659  * The defaults for these sizes are defined here, although
660  * they can be overridden at runtime by calling FreeRTOS_setsockopt(),
661  * and use 'FREERTOS_SO_RCVBUF', 'FREERTOS_SO_SNDBUF' or
662  * 'FREERTOS_SO_WIN_PROPERTIES'.
663  * A stream buffer will only be created when needed.  A TCP server socket
664  * will never create buffers.
665  */
666 #ifndef ipconfigTCP_RX_BUFFER_LENGTH
667     /* When MTU equals 1500, the buffer length defaults to 5840 bytes */
668     #define ipconfigTCP_RX_BUFFER_LENGTH    ( 4U * ipconfigTCP_MSS )
669 #endif
670 
671 /* Define the size of Tx stream buffer for TCP sockets.
672  */
673 #ifndef ipconfigTCP_TX_BUFFER_LENGTH
674     /* When MTU equals 1500, the buffer length defaults to 5840 bytes */
675     #define ipconfigTCP_TX_BUFFER_LENGTH    ( 4U * ipconfigTCP_MSS )
676 #endif
677 
678 /* 'ipconfigMAXIMUM_DISCOVER_TX_PERIOD' is about DHCP.
679  * It determines the maximum time (in clock-ticks) that the DHCP client
680  * will wait for an offer from a DHCP server. */
681 #ifndef ipconfigMAXIMUM_DISCOVER_TX_PERIOD
682     #ifdef _WINDOWS_
683         #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD    ( pdMS_TO_TICKS( 999U ) )
684     #else
685         #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD    ( pdMS_TO_TICKS( 30000U ) )
686     #endif /* _WINDOWS_ */
687 #endif /* ipconfigMAXIMUM_DISCOVER_TX_PERIOD */
688 
689 #if ( ipconfigUSE_DNS == 0 )
690     /* The DNS module will not be included. */
691     #if ( ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) )
692         /* LLMNR and NBNS depend on DNS because those protocols share a lot of code. */
693         #error When either LLMNR or NBNS is used, ipconfigUSE_DNS must be defined
694     #endif
695 #endif
696 
697 /* By default, the DNS client is included.  Note that LLMNR and
698  * NBNS also need the code from FreeRTOS_DNS.c
699  */
700 #ifndef ipconfigUSE_DNS
701     #define ipconfigUSE_DNS    1
702 #endif
703 
704 /* When looking up a host with DNS, this macro determines how long the
705  * call to FreeRTOS_recvfrom() will wait for a reply.
706  * When there is no reply, the request will be repeated up to
707  * 'ipconfigDNS_REQUEST_ATTEMPTS' attempts. */
708 #ifndef ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS
709     #define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS    pdMS_TO_TICKS( 5000U )
710 #endif
711 
712 /* When looking up a host with DNS, this macro determines how long the
713  * call to FreeRTOS_sendto() will block to wait for a free buffer. */
714 #ifndef ipconfigDNS_SEND_BLOCK_TIME_TICKS
715     #define ipconfigDNS_SEND_BLOCK_TIME_TICKS    pdMS_TO_TICKS( 500U )
716 #endif
717 
718 /* The number of times a DNS request will be send before giving up. */
719 #ifndef ipconfigDNS_REQUEST_ATTEMPTS
720     #define ipconfigDNS_REQUEST_ATTEMPTS    5
721 #endif
722 
723 /* The results of DNS lookup's can be stored in a cache table. */
724 #ifndef ipconfigUSE_DNS_CACHE
725     #define ipconfigUSE_DNS_CACHE    0
726 #endif
727 
728 #if ( ipconfigUSE_DNS_CACHE != 0 )
729 
730 /* Per https://tools.ietf.org/html/rfc1035, 253 is the maximum string length
731  * of a DNS name.  The following default accounts for a null terminator. */
732     #ifndef ipconfigDNS_CACHE_NAME_LENGTH
733         #define ipconfigDNS_CACHE_NAME_LENGTH    254U
734     #endif
735 
736 /* The number of entries in the DNS cache table.
737  * The default of 1 is maybe too economic. */
738     #ifndef ipconfigDNS_CACHE_ENTRIES
739         #define ipconfigDNS_CACHE_ENTRIES    1U
740     #endif
741 
742 #endif /* ipconfigUSE_DNS_CACHE != 0 */
743 
744 /* When accessing services which have multiple IP addresses, setting this
745  * greater than 1 can improve reliability by returning different IP address
746  * answers on successive calls to FreeRTOS_gethostbyname(). */
747 #ifndef ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY
748     #define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY    1
749 #endif
750 
751 /* When 'ipconfigDNS_USE_CALLBACKS' is defined, a function 'FreeRTOS_gethostbyname_a()'
752  * will become available.
753  * It is used for asynchronous DNS lookups.
754  * This function will start a DNS-lookup and set an application hook.
755  * This hook will be called when either the URL has been found, or when
756  * a time-out has been reached.
757  * Note that the function 'FreeRTOS_gethostbyname_a()' will not make use of the
758  * macros 'ipconfigDNS_SEND_BLOCK_TIME_TICKS', 'ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS'
759  * or 'ipconfigDNS_REQUEST_ATTEMPTS'.
760  */
761 #ifndef ipconfigDNS_USE_CALLBACKS
762     #define ipconfigDNS_USE_CALLBACKS    0
763 #endif
764 
765 /* Include support for LLMNR: Link-local Multicast Name Resolution. */
766 #ifndef ipconfigUSE_LLMNR
767     #define ipconfigUSE_LLMNR    ( 0 )
768 #endif
769 
770 /* Include support for NBNS: NetBIOS Name Server. */
771 #ifndef ipconfigUSE_NBNS
772     #define ipconfigUSE_NBNS    0
773 #endif
774 
775 /* It is recommended to let the application respond to incoming ping
776  * requests. */
777 #ifndef ipconfigREPLY_TO_INCOMING_PINGS
778     #define ipconfigREPLY_TO_INCOMING_PINGS    1
779 #endif
780 
781 /* Add code for outgoing pings as well. */
782 #ifndef ipconfigSUPPORT_OUTGOING_PINGS
783     #define ipconfigSUPPORT_OUTGOING_PINGS    0
784 #endif
785 
786 /* A MISRA note: The macros 'ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES'
787  * and 'ipconfigETHERNET_DRIVER_FILTERS_PACKETS' are too long:
788  * the first 32 bytes are equal, which might cause problems
789  * for some compilers. */
790 
791 /* Beside that, there is some overlap between the following 3 macros.  Here is
792  * a summary:
793  *
794  * 1) ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES
795  *        When disabled, the IP-task will call 'eConsiderFrameForProcessing()'
796  *        to check incoming packets.
797  * 2) ipconfigETHERNET_DRIVER_FILTERS_PACKETS
798  *        When disabled, the IP-task will perform sanity checks on the IP-header,
799  *        also checking the target IP address.
800  *        Also when disabled, xPortHasUDPSocket() won't be included.  That means
801  *        that the IP-task can access the 'xBoundUDPSocketsList' without locking.
802  * 3) ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES
803  *        When enabled, the function 'eConsiderFrameForProcessing()' will also
804  *        check if the Ethernet frame type is acceptable.
805  */
806 
807 /* The following macro determines if the network interface will
808  * do checks on the incoming packets.  When false, the IP-task will
809  * perform these checks in the function eConsiderFrameForProcessing().
810  *
811  * It should be noted that it is most efficient to drop unwanted packets
812  * as early as possible.
813  */
814 
815 #ifndef ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES
816     #define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES    1
817 #endif
818 
819 /* When ipconfigETHERNET_DRIVER_FILTERS_PACKETS is enabled, the network
820  * interface will inspect the incoming packets to see if they can be
821  * accepted.
822  * When enabled, the function 'xPortHasUDPSocket()' will become available.
823  * That function checks if there is a UDP socket listening to a
824  * given port number.
825  */
826 #ifndef ipconfigETHERNET_DRIVER_FILTERS_PACKETS
827     #define ipconfigETHERNET_DRIVER_FILTERS_PACKETS    ( 0 )
828 #endif
829 
830 /* When defined as 1, the driver will drop all packets with an unknown
831  * frame type.
832  * This macro is only looked at when 'ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES'
833  * is disabled.
834  */
835 #ifndef ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES
836     #define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES    1
837 #endif
838 
839 
840 /* The macro 'ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS' was
841  * introduced to enable a tracing system.
842  * Currently it is only used in BufferAllocation_2.c.
843  */
844 #ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS
845     #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS    0
846 #else
847     #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS    configINCLUDE_TRACE_RELATED_CLI_COMMANDS
848 #endif
849 
850 /* This macro will be called in every loop the IP-task makes.  It may be
851  * replaced by user-code that triggers a watchdog */
852 #ifndef ipconfigWATCHDOG_TIMER
853     #define ipconfigWATCHDOG_TIMER()
854 #endif
855 
856 /* The option 'ipconfigUSE_CALLBACKS' allows to assign specific application
857  * hooks to a socket.  Each hook will be set with a specific socket option:
858  *
859  *  FREERTOS_SO_TCP_CONN_HANDLER  * Callback for (dis) connection events.
860  *                                * Supply pointer to 'F_TCP_UDP_Handler_t'
861  *  FREERTOS_SO_TCP_RECV_HANDLER  * Callback for receiving TCP data.
862  *                                * Supply pointer to 'F_TCP_UDP_Handler_t'
863  *  FREERTOS_SO_TCP_SENT_HANDLER  * Callback for sending TCP data.
864  *                                * Supply pointer to 'F_TCP_UDP_Handler_t'
865  *  FREERTOS_SO_UDP_RECV_HANDLER  * Callback for receiving UDP data.
866  *                                * Supply pointer to 'F_TCP_UDP_Handler_t'
867  *  FREERTOS_SO_UDP_SENT_HANDLER  * Callback for sending UDP data.
868  *                                * Supply pointer to 'F_TCP_UDP_Handler_t'
869  *
870  * Note that the call-back functions will run in the IP-task, so very little
871  * things can be done.  Better not to call any networking API, because that
872  * could easily lead to a deadlock situation.
873  */
874 #ifndef ipconfigUSE_CALLBACKS
875     #define ipconfigUSE_CALLBACKS    ( 0 )
876 #endif
877 
878 /* Replace this macro with a test returning non-zero if the memory pointer to by
879  * pxAddress is valid memory which can contain executable code.
880  * In fact this is an extra safety measure: if a handler points to invalid memory,
881  * it will not be called.
882  * The parameter 'pxAddress' is in fact a pointer to a function.
883  */
884 #if ( ipconfigUSE_CALLBACKS != 0 )
885     #ifndef ipconfigIS_VALID_PROG_ADDRESS
886         #define ipconfigIS_VALID_PROG_ADDRESS( pxAddress )    ( ( pxAddress ) != NULL )
887     #endif
888 #endif
889 
890 /* The macro 'ipconfigHAS_INLINE_FUNCTIONS' is now deprecated. */
891 #ifndef ipconfigHAS_INLINE_FUNCTIONS
892     #define ipconfigHAS_INLINE_FUNCTIONS    ( 1 )
893 #endif
894 
895 /* Since all code is made compatible with the MISRA rules, the inline functions
896  * disappear.  'portINLINE' should normally be defined in FreeRTOSCOnfig.h
897  */
898 #ifndef portINLINE
899     #define portINLINE    inline
900 #endif
901 
902 /* When non-zero, the buffers passed to xNetworkInterfaceOutput() will be passed
903  * directly to DMA.  As soon as sending is ready, the buffers must be released by
904  * calling vReleaseNetworkBufferAndDescriptor(). */
905 #ifndef ipconfigZERO_COPY_TX_DRIVER
906     #define ipconfigZERO_COPY_TX_DRIVER    ( 0 )
907 #endif
908 
909 /* When enabled, the network interface will pass the network buffers directly to
910  * the DMA descriptors. When a packet has been received, the function
911  * pxPacketBuffer_to_NetworkBuffer() will translate a buffer address to a
912  * network packet, so it can be passed to the IP-task. */
913 #ifndef ipconfigZERO_COPY_RX_DRIVER
914     #define ipconfigZERO_COPY_RX_DRIVER    ( 0 )
915 #endif
916 
917 /* When ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM is defined as non-zero,
918  * the network interface is responsible for setting the checksums
919  * of the outgoing packets.
920  * This can be either done in hardware, or by calling the checksum
921  * routines from 'xNetworkInterfaceOutput()'.
922  */
923 #ifndef ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM
924     #define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM    0
925 #endif
926 
927 /* When ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM is enabled,
928  * the network interface is responsible for checking the checksums
929  * of the incoming packets.
930  * This can be either done in hardware, or by calling the checksum
931  * functions.
932  */
933 #ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM
934     #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM    0
935 #endif
936 
937 /* The macro 'ipconfigSOCKET_HAS_USER_SEMAPHORE' is rarely used, yet it
938  * can be very useful.  IT applies to both TCP and UDP sockets.
939  *
940  * The application can register a semaphore ( of type 'SemaphoreHandle_t' )
941  * in a socket with the option 'FREERTOS_SO_SET_SEMAPHORE'.
942  * Once set, the semaphore will be signalled after every important socket event:
943  * READ, WRITE, EXCEPTION.
944  * Note that a READ event is also generated for a TCP socket in listen mode,
945  * and a WRITE event is generated when a call to connect() has succeeded.
946  * Beside that, READ and WRITE are the normal events that occur when
947  * data has been received or delivered.
948  */
949 #ifndef ipconfigSOCKET_HAS_USER_SEMAPHORE
950     #define ipconfigSOCKET_HAS_USER_SEMAPHORE    0
951 #endif
952 
953 /* The macro 'ipconfigSOCKET_HAS_USER_WAKE_CALLBACK' allows to use a call-back
954  * function that will be called at the moment one of the above events occurs.
955  * Use the socket option 'FREERTOS_SO_WAKEUP_CALLBACK' to install a function
956  * of the type 'void callback( Socket_t pxSocket )'.
957  * Note that the call-back function runs in the IP-task, so very little things
958  * can be done.  Better not to call any networking API, because that could
959  * easily lead to a deadlock situation.
960  */
961 #ifndef ipconfigSOCKET_HAS_USER_WAKE_CALLBACK
962     #define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK    0
963 #endif
964 
965 /* Yet another possibility that makes it easy to handle multiple socket in
966  * a single task FreeRTOS_select().  The code for this functionality will
967  * be included when 'ipconfigSUPPORT_SELECT_FUNCTION' is defined as non-zero.
968  */
969 #ifndef ipconfigSUPPORT_SELECT_FUNCTION
970     #define ipconfigSUPPORT_SELECT_FUNCTION    0
971 #endif
972 
973 /* If the select function will be called simultaneously from more that one task
974  * e.g. one for 'eSELECT_READ', and the other for the other flags, it is strongly
975  * recommended to define 'ipconfigSELECT_USES_NOTIFY'.
976  * The problem is 'eSELECT_CALL_IP': 2 tasks would be waiting for the same bit
977  * in the event group, and both will try to reset this bit.
978  * When ipconfigSELECT_USES_NOTIFY is used, the IP-task will wakeup the calling
979  * task by notifying it.
980  */
981 #ifndef ipconfigSELECT_USES_NOTIFY
982     #define ipconfigSELECT_USES_NOTIFY    0
983 #endif
984 
985 /* TCP only: if the 'ipconfigTCP_KEEP_ALIVE' macro is defined as 1,
986  * sockets in state "ESTABLISHED" can be protected using keep-alive packets.
987  * These packets will be sent as soon as there hasn't been any activity
988  * for a while.
989  * The macro 'ipconfigTCP_KEEP_ALIVE_INTERVAL' determines the interval at
990  * which keep-alive packets are sent.
991  */
992 #ifndef ipconfigTCP_KEEP_ALIVE
993     #define ipconfigTCP_KEEP_ALIVE    0
994 #endif
995 
996 /* The period of non-activity ( in seconds ) after which the driver will
997  * start sending a keep-alive packet to the TCP peer.  The default is 20 seconds.
998  */
999 #ifndef ipconfigTCP_KEEP_ALIVE_INTERVAL
1000     #define  ipconfigTCP_KEEP_ALIVE_INTERVAL    20U
1001 #endif
1002 
1003 /* Another less used option: signals.  This macro makes it possible to interrupt
1004  * a blocking call to one of the API's by calling either FreeRTOS_SignalSocket() or
1005  * FreeRTOS_SignalSocketFromISR() for that socket.
1006  * When an API got interrupted, it will return the error value -pdFREERTOS_ERRNO_EINTR.
1007  */
1008 #ifndef ipconfigSUPPORT_SIGNALS
1009     #define ipconfigSUPPORT_SIGNALS    0
1010 #endif
1011 
1012 /* Hang protection can help reduce the impact of SYN floods.
1013  * When a SYN packet comes in, it will first be checked if there is a listening
1014  * socket for the port number. If not, it will be replied to with a RESET packet.
1015  * If there is a listing socket for that port number, a new socket will be created.
1016  * This socket will be owned temporarily by the IP-task.  Only when the SYN/ACK
1017  * handshake is finished, the new socket will be passed to the application,
1018  * resulting in a successful call to FreeRTOS_accept().
1019  * The option 'ipconfigTCP_HANG_PROTECTION' will make sure that the socket will be
1020  * deleted in case the SYN-handshake doesn't come to a good end.
1021  * See also ipconfigTCP_HANG_PROTECTION_TIME time.
1022  */
1023 #ifndef ipconfigTCP_HANG_PROTECTION
1024     #define ipconfigTCP_HANG_PROTECTION    1
1025 #endif
1026 
1027 /* ipconfigTCP_HANG_PROTECTION_TIME defines the maximum time that a socket stays
1028  * in one of these "in-between" states:
1029  *
1030  * eCONNECT_SYN, eSYN_FIRST, eSYN_RECEIVED, eFIN_WAIT_1, eFIN_WAIT_2, eCLOSING,
1031  * eLAST_ACK, or eTIME_WAIT.
1032  */
1033 #ifndef ipconfigTCP_HANG_PROTECTION_TIME
1034     #define ipconfigTCP_HANG_PROTECTION_TIME    30U
1035 #endif
1036 
1037 /* Initially, 'ipconfigTCP_IP_SANITY' was introduced to include all code that checks
1038  * the correctness of the algorithms.  However, it is only used in BufferAllocation_1.c
1039  * When defined as non-zero, some extra code will check the validity of network buffers.
1040  */
1041 #ifndef ipconfigTCP_IP_SANITY
1042     #define ipconfigTCP_IP_SANITY    0
1043 #endif
1044 
1045 /* Expert option: define a value for 'ipBUFFER_PADDING'.
1046  * When 'ipconfigBUFFER_PADDING' equals 0,
1047  * 'ipBUFFER_PADDING' will get a default value of 8 + 2 bytes. */
1048 #ifndef ipconfigBUFFER_PADDING
1049     #define ipconfigBUFFER_PADDING    0U
1050 #endif
1051 
1052 /* This library treats the network packets as structs, containing 16- and 32-bit
1053  * variables.  However, due to the size of the Ethernet header, the 32-byte
1054  * variables are badly aligned.
1055  * This is corrected with the macro 'ipconfigPACKET_FILLER_SIZE' which has a default
1056  * of two.  Thanks to this offset, ( almost ) all 32-bit numbers can be read and
1057  * written in a single assembler instruction.
1058  */
1059 #ifndef ipconfigPACKET_FILLER_SIZE
1060     #define ipconfigPACKET_FILLER_SIZE    2U
1061 #endif
1062 
1063 /* Set to 1 if you plan on processing custom Ethernet protocols or protocols
1064  * that are not yet supported by the FreeRTOS+TCP stack.  If set to 1,
1065  * the user must define eFrameProcessingResult_t eApplicationProcessCustomFrameHook( NetworkBufferDescriptor_t * const pxNetworkBuffer )
1066  * which will be called by the stack for any frame with an unsupported EtherType. */
1067 #ifndef ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES
1068     #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES    0
1069 #endif
1070 
1071 #endif /* FREERTOS_DEFAULT_IP_CONFIG_H */
1072