diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 620f77fd4..25f89f920 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -206,6 +206,7 @@ DEAS DEBR DEBUGEN DEBUGF +DECASECONDS DEFFERRALCHECK DEFR Deglitchers diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 307da48ca..0740d4da5 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -5,6 +5,7 @@ set_property(TARGET freertos_plus_tcp PROPERTY C_STANDARD 90) target_sources( freertos_plus_tcp PRIVATE include/FreeRTOSIPConfigDefaults.h + include/FreeRTOSIPDeprecatedDefinitions.h include/FreeRTOS_ARP.h include/FreeRTOS_BitConfig.h include/FreeRTOS_DHCP.h @@ -40,7 +41,6 @@ target_sources( freertos_plus_tcp include/FreeRTOS_TCP_Utils.h include/FreeRTOS_TCP_WIN.h include/FreeRTOS_UDP_IP.h - include/FreeRTOS_errno_TCP.h include/IPTraceMacroDefaults.h include/NetworkBufferManagement.h include/NetworkInterface.h diff --git a/source/FreeRTOS_IP_Utils.c b/source/FreeRTOS_IP_Utils.c index f9d50158b..73ad81c10 100644 --- a/source/FreeRTOS_IP_Utils.c +++ b/source/FreeRTOS_IP_Utils.c @@ -1489,7 +1489,7 @@ uint16_t usGenerateChecksum( uint16_t usSum, /** * @brief Utility function: Convert error number to a human readable - * string. Declaration in FreeRTOS_errno_TCP.h. + * string. * * @param[in] xErrnum The error number. * @param[in] pcBuffer Buffer big enough to be filled with the human readable message. diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index 85b6efe31..0d900d0cd 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -572,10 +572,9 @@ static BaseType_t prvDetermineSocketSize( BaseType_t xDomain, { uint16_t usDifference = ipSIZE_OF_IPv6_HEADER - ipSIZE_OF_IPv4_HEADER; - if( pxSocket->u.xTCP.usMSS > usDifference ) - { - pxSocket->u.xTCP.usMSS = ( uint16_t ) ( pxSocket->u.xTCP.usMSS - usDifference ); - } + /* Because ipconfigTCP_MSS is guaranteed not less than tcpMINIMUM_SEGMENT_LENGTH by FreeRTOSIPConfigDefaults.h, + * it's unnecessary to check if xSocket->u.xTCP.usMSS is greater than difference. */ + pxSocket->u.xTCP.usMSS = ( uint16_t ) ( pxSocket->u.xTCP.usMSS - usDifference ); } #endif /* ipconfigUSE_IPv6 != 0 */ @@ -1259,8 +1258,7 @@ static int32_t prvRecvFrom_CopyPacket( uint8_t * pucEthernetBuffer, * (24-bytes) for compatibility. * * @return The number of bytes received. Or else, an error code is returned. When it - * returns a negative value, the cause can be looked-up in - * 'FreeRTOS_errno_TCP.h'. + * returns a negative value, the cause can be looked-up in 'FreeRTOS-Kernel/projdefs.h'. */ int32_t FreeRTOS_recvfrom( const ConstSocket_t xSocket, void * pvBuffer, @@ -1570,7 +1568,7 @@ static int32_t prvSendTo_ActualSend( const FreeRTOS_Socket_t * pxSocket, * Berkeley sockets standard. Else, it is not used. * * @return When positive: the total number of bytes sent, when negative an error - * has occurred: it can be looked-up in 'FreeRTOS_errno_TCP.h'. + * has occurred: it can be looked-up in 'FreeRTOS-Kernel/projdefs.h'. */ int32_t FreeRTOS_sendto( Socket_t xSocket, const void * pvBuffer, diff --git a/source/FreeRTOS_TCP_IP.c b/source/FreeRTOS_TCP_IP.c index eed44bc14..820aba5f2 100644 --- a/source/FreeRTOS_TCP_IP.c +++ b/source/FreeRTOS_TCP_IP.c @@ -301,9 +301,11 @@ { /* A socket was in the connecting phase but something * went wrong and it should be closed. */ - FreeRTOS_debug_printf( ( "Move from %s to %s\n", - FreeRTOS_GetTCPStateName( ( UBaseType_t ) xPreviousState ), - FreeRTOS_GetTCPStateName( eTCPState ) ) ); + #if ( ipconfigHAS_DEBUG_PRINTF != 0 ) + FreeRTOS_debug_printf( ( "Move from %s to %s\n", + FreeRTOS_GetTCPStateName( ( UBaseType_t ) xPreviousState ), + FreeRTOS_GetTCPStateName( eTCPState ) ) ); + #endif /* Set the flag to show that it was connected before and that the * status has changed now. This will cause the control flow to go diff --git a/source/FreeRTOS_TCP_Utils_IPv6.c b/source/FreeRTOS_TCP_Utils_IPv6.c index 7e3b52894..96de389d1 100644 --- a/source/FreeRTOS_TCP_Utils_IPv6.c +++ b/source/FreeRTOS_TCP_Utils_IPv6.c @@ -82,18 +82,10 @@ void prvSocketSetMSS_IPV6( FreeRTOS_Socket_t * pxSocket ) /* Compared to IPv4, an IPv6 header is 20 bytes longer. * It must be subtracted from the MSS. */ size_t uxDifference = ipSIZE_OF_IPv6_HEADER - ipSIZE_OF_IPv4_HEADER; - /* Do not allow MSS smaller than tcpMINIMUM_SEGMENT_LENGTH. */ - #if ( ipconfigTCP_MSS >= tcpMINIMUM_SEGMENT_LENGTH ) - { - ulMSS = ipconfigTCP_MSS; - } - #else - { - ulMSS = tcpMINIMUM_SEGMENT_LENGTH; - } - #endif - ulMSS = ( uint32_t ) ( ulMSS - uxDifference ); + /* Because ipconfigTCP_MSS is guaranteed not less than tcpMINIMUM_SEGMENT_LENGTH by FreeRTOSIPConfigDefaults.h, + * it's unnecessary to check if xSocket->u.xTCP.usMSS is greater than difference. */ + ulMSS = ( uint32_t ) ( ipconfigTCP_MSS - uxDifference ); IPv6_Type_t eType = xIPv6_GetIPType( &( pxSocket->u.xTCP.xRemoteIP.xIP_IPv6 ) ); if( eType == eIPv6_Global ) diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index 93a384f64..97a0b0868 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -1,6 +1,6 @@ /* * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT * @@ -25,1139 +25,3298 @@ * http://www.FreeRTOS.org */ -#ifndef FREERTOS_DEFAULT_IP_CONFIG_H -#define FREERTOS_DEFAULT_IP_CONFIG_H - -/* This file must be included only after the configuration files FreeRTOSConfig.h and - * FreeRTOSIPConfig.h have been included already. - * Mentioned header files are private to the project, whereas this header - * file is part of FreeRTOS+TCP. - * - * The complete documentation of the configuration parameters can be found here: - * - * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html - * +/** + * @file FreeRTOSIPConfigDefaults.h + * @brief File that provides default values for configuration options that are + * missing from FreeRTOSIPConfig.h. The complete documentation of the + * configuration parameters can be found here: + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html */ -/* The error numbers defined in this file will be moved to the core FreeRTOS - * code in future versions of FreeRTOS - at which time the following header file - * will be removed. */ -#include "FreeRTOS_errno_TCP.h" - -/* This file provides default values for configuration options that are missing - * from the FreeRTOSIPConfig.h configuration header file. */ - -/* These macros are used to define away static keyword for CBMC proofs */ -#ifndef _static - #define _static static -#endif - -/* Through time some macro names have changed. This always - * happened for a good reason: clarity or consistency. - * Here below there are some ifdef's that will issue an error if any of the - * deprecated macros is still defined. */ - -/* Ensure defined configuration constants are using the most up to date naming. */ -#ifdef tcpconfigIP_TIME_TO_LIVE - #error now called: ipconfigTCP_TIME_TO_LIVE -#endif - -#ifdef updconfigIP_TIME_TO_LIVE - #error now called: ipconfigUDP_TIME_TO_LIVE -#endif +#ifndef FREERTOS_IP_CONFIG_DEFAULTS_H +#define FREERTOS_IP_CONFIG_DEFAULTS_H -#ifdef ipFILLER_SIZE - #error now called: ipconfigPACKET_FILLER_SIZE +#ifndef FREERTOS_CONFIG_H + #error FreeRTOSConfig.h has not been included yet #endif -#ifndef ipconfigENDPOINT_DNS_ADDRESS_COUNT - #define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2U +#ifndef FREERTOS_IP_CONFIG_H + #error FreeRTOSIPConfig.h has not been included yet #endif -#ifdef dnsMAX_REQUEST_ATTEMPTS - #error now called: ipconfigDNS_REQUEST_ATTEMPTS -#endif +#include "FreeRTOSIPDeprecatedDefinitions.h" -#ifdef ipconfigUDP_TASK_PRIORITY - #error now called: ipconfigIP_TASK_PRIORITY -#endif +#include -#ifdef ipconfigUDP_TASK_STACK_SIZE_WORDS - #error now called: ipconfigIP_TASK_STACK_SIZE_WORDS -#endif +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* MACROS */ +/*===========================================================================*/ -#ifdef ipconfigDRIVER_INCLUDED_RX_IP_FILTERING - #error now called: ipconfigETHERNET_DRIVER_FILTERS_PACKETS -#endif +/*---------------------------------------------------------------------------*/ -#ifdef ipconfigMAX_SEND_BLOCK_TIME_TICKS - #error now called: ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS -#endif +/* + * MACROS details : + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html + */ +/*---------------------------------------------------------------------------*/ -#ifdef ipconfigUSE_RECEIVE_CONNECT_CALLBACKS - #error now called: ipconfigUSE_CALLBACKS -#endif +/* + * Used to define away static keyword for CBMC proofs + */ -#ifdef ipconfigNUM_NETWORK_BUFFERS - #error now called: ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS +#ifndef _static + #define _static static #endif -#ifdef ipconfigTCP_HANG_PROT - #error now called: ipconfigTCP_HANG_PROTECTION -#endif +/*---------------------------------------------------------------------------*/ -#ifdef ipconfigTCP_HANG_PROT_TIME - #error now called: ipconfigTCP_HANG_PROTECTION_TIME -#endif +/* + * Since all code is made compatible with the MISRA rules, the inline functions + * disappear. Normally defined in portmacro.h or FreeRTOSConfig.h. + */ -#ifdef FreeRTOS_lprintf - #error now called: FreeRTOS_debug_printf +#ifndef portINLINE + #define portINLINE inline #endif -#ifdef ipconfigBUFFER_ALLOC_FIXED_SIZE - #error ipconfigBUFFER_ALLOC_FIXED_SIZE was dropped and replaced by a const value, declared in BufferAllocation[12].c -#endif +/*---------------------------------------------------------------------------*/ -#ifdef ipconfigNIC_SEND_PASSES_DMA - #error now called: ipconfigZERO_COPY_TX_DRIVER -#endif +/* + * Used to standardize macro checks since ( MACRO == 1 ) and ( MACRO != 0 ) + * are used inconsistently. + */ -#ifdef HAS_TX_CRC_OFFLOADING - #error now called: ipconfigHAS_TX_CRC_OFFLOADING +#ifndef ipconfigENABLE + #define ipconfigENABLE ( 1 ) #endif -#ifdef HAS_RX_CRC_OFFLOADING - #error now called: ipconfigHAS_RX_CRC_OFFLOADING +#ifndef ipconfigDISABLE + #define ipconfigDISABLE ( 0 ) #endif -#ifdef ipconfigTCP_RX_BUF_LEN - #error ipconfigTCP_RX_BUF_LEN is now called ipconfigTCP_RX_BUFFER_LENGTH +#ifndef ipconfigIS_ENABLED + #define ipconfigIS_ENABLED( x ) ( ( x ) != ipconfigDISABLE ) #endif -#ifdef ipconfigTCP_TX_BUF_LEN - #error ipconfigTCP_TX_BUF_LEN is now called ipconfigTCP_TX_BUFFER_LENGTH +#ifndef ipconfigIS_DISABLED + #define ipconfigIS_DISABLED( x ) ( ( x ) == ipconfigDISABLE ) #endif -#ifdef ipconfigDHCP_USES_USER_HOOK - #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 */ -#endif +/*---------------------------------------------------------------------------*/ -/* The macro 'ipconfigBYTE_ORDER' must be defined as either 'pdFREERTOS_LITTLE_ENDIAN' - * or as 'pdFREERTOS_BIG_ENDIAN'. See also 'projdefs.h'. +/* + * pdFREERTOS_ERRNO_EAFNOSUPPORT + * + * Address family not supported by protocol. + * + * Note: Now included in FreeRTOS-Kernel/projdefs.h, so this serves as a + * temporary kernel version check. To be removed in a future version. */ -#ifndef ipconfigBYTE_ORDER - #error The macro 'ipconfigBYTE_ORDER' must be defined at this point -#endif -/* So far the warnings about deprecated configuration macros. */ +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* IP CONFIG */ +/*===========================================================================*/ -/*-----------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ -/* The IP stack executes it its own task (although any application task can make - * use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY - * sets the priority of the task that executes the IP stack. The priority is a - * standard FreeRTOS task priority so can take any value from 0 (the lowest - * priority) to (configMAX_PRIORITIES - 1) (the highest priority). - * configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in - * FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to - * the priority assigned to the task executing the IP stack relative to the - * priority assigned to tasks that use the IP stack. +/* + * ipconfigIPv4_BACKWARD_COMPATIBLE + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) * - * Define the priority of the IP-task. It is recommended to use this - * order of priorities: - * Highest : network interface, handling transmission and reception. - * Medium : the IP-task handling API calls from the application. - * Lower : the tasks that make use of the IP-stack. - * For other tasks any priority can be chosen. + * Enables the APIs that are backward compatible with single end point IPv4 + * version V3.x.x or older. */ -#ifndef ipconfigIP_TASK_PRIORITY - #define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) -#endif -/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP - * task. This setting is less important when the FreeRTOS Win32 simulator is used - * as the Win32 simulator only stores a fixed amount of information on the task - * stack. FreeRTOS includes optional stack overflow detection, see: - * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ -#ifndef ipconfigIP_TASK_STACK_SIZE_WORDS - #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5U ) +#ifndef ipconfigIPv4_BACKWARD_COMPATIBLE + #define ipconfigIPv4_BACKWARD_COMPATIBLE ipconfigDISABLE #endif -/* Include all API's and code that is needed for the TCP protocol. - * When defined as zero, the application is UDP-only. */ -#ifndef ipconfigUSE_TCP - #define ipconfigUSE_TCP ( 1 ) +#if ( ( ipconfigIPv4_BACKWARD_COMPATIBLE != ipconfigDISABLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE != ipconfigENABLE ) ) + #error Invalid ipconfigIPv4_BACKWARD_COMPATIBLE configuration #endif -#ifndef ipconfigCOMPATIBLE_WITH_SINGLE - #define ipconfigCOMPATIBLE_WITH_SINGLE ( 0 ) -#endif +/*---------------------------------------------------------------------------*/ -#ifndef ipconfigMULTI_INTERFACE - #define ipconfigMULTI_INTERFACE ( 1 ) -#endif +/* + * ipconfigUSE_IPv4 + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for the IPv4 protocol. + * + * If disabled, the application must enable IPv6. + */ -/* Disable DHCPv6 by default. */ -#ifndef ipconfigUSE_DHCPv6 - #define ipconfigUSE_DHCPv6 ( 0 ) +#ifndef ipconfigUSE_IPv4 + #define ipconfigUSE_IPv4 ipconfigENABLE #endif -#if ( ipconfigUSE_TCP != 0 ) - -/* 'ipconfigUSE_TCP_WIN' enables support for TCP sliding windows. When - * defined as zero, each TCP packet must be acknowledged individually. - * That will be slower, but it will result less code. */ - #ifndef ipconfigUSE_TCP_WIN - #define ipconfigUSE_TCP_WIN ( 1 ) - #endif - -/* The total number of outstanding TCP segments, either outgoing or incoming. - * This only applies when 'ipconfigUSE_TCP_WIN' is enabled. */ - #ifndef ipconfigTCP_WIN_SEG_COUNT - #define ipconfigTCP_WIN_SEG_COUNT ( 256 ) - #endif +#if ( ( ipconfigUSE_IPv4 != ipconfigDISABLE ) && ( ipconfigUSE_IPv4 != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_IPv4 configuration +#endif -/* When non-zero, TCP will not send RST packets in reply to - * TCP packets which are unknown, or out-of-order. - * This is an option used for testing. It is recommended to - * define it as '0'. */ - #ifndef ipconfigIGNORE_UNKNOWN_PACKETS - #define ipconfigIGNORE_UNKNOWN_PACKETS ( 0 ) - #endif -#endif /* if ipconfigUSE_TCP */ +/*---------------------------------------------------------------------------*/ /* - * For debugging/logging: check if the port number is used for e.g. telnet. - * Some events will not be logged for telnet connections - * because it would produce logging about the transmission of the logging... - * This macro will only be used if FreeRTOS_debug_printf() is defined for logging. - * Note that the parameter 'xPort' is already converted to host-endian. + * ipconfigUSE_IPv6 + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for the IPv6 protocol. + * + * If disabled, the application must enable IPv4. */ -#ifndef ipconfigTCP_MAY_LOG_PORT - #define ipconfigTCP_MAY_LOG_PORT( xPort ) ( ( xPort ) != 23U ) -#endif -/* Include all API's and code that is needed for the IPv4 protocol. - * When defined as zero, the application should uses IPv6. */ -#ifndef ipconfigUSE_IPv4 - #define ipconfigUSE_IPv4 ( 1 ) +#ifndef ipconfigUSE_IPv6 + #define ipconfigUSE_IPv6 ipconfigENABLE #endif -/* Include all API's and code that is needed for the IPv6 protocol. - * When defined as zero, the application should uses IPv4. */ -#ifndef ipconfigUSE_IPv6 - #define ipconfigUSE_IPv6 ( 1 ) +#if ( ( ipconfigUSE_IPv6 != ipconfigDISABLE ) && ( ipconfigUSE_IPv6 != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_IPv6 configuration #endif -#if ( ipconfigUSE_IPv4 != 1 ) && ( ipconfigUSE_IPv6 != 1 ) - #error "Invalid build configuration" +#if ( ipconfigIS_DISABLED( ipconfigUSE_IPv4 ) && ipconfigIS_DISABLED( ipconfigUSE_IPv6 ) ) + #error Either ipconfigUSE_IPv4 or ipconfigUSE_IPv6 must be enabled #endif +/*---------------------------------------------------------------------------*/ + /* - * If defined this macro enables the APIs that are backward compatible - * with single end point IPv4 version of the FreeRTOS+TCP library. + * ipconfigND_CACHE_ENTRIES + * + * Type: size_t + * Unit: length of NDCacheRow_t array + * Minimum: 1 + * + * Maximum number of entries in the Neighbour Discovery cache of IPv6 addresses + * & MAC addresses */ -#ifndef ipconfigIPv4_BACKWARD_COMPATIBLE - #define ipconfigIPv4_BACKWARD_COMPATIBLE 0 -#endif -/* Determine the number of clock ticks that the API's FreeRTOS_recv() and - * FreeRTOS_recvfrom() must wait for incoming data. */ -#ifndef ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME - #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME portMAX_DELAY +#ifndef ipconfigND_CACHE_ENTRIES + #define ipconfigND_CACHE_ENTRIES ( 24 ) #endif -/* Determine the number of clock ticks that FreeRTOS_send() must wait - * for space in the transmission buffer. - * For FreeRTOS_sendto(), it limits how long the application - * should wait for a network buffer to become available. - */ -#ifndef ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME - #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME portMAX_DELAY +#if ( ipconfigND_CACHE_ENTRIES < 1 ) + #error ipconfigND_CACHE_ENTRIES must be at least 1 #endif -/* When sending a UDP packet, a network buffer must be obtained. This macro - * will limit the maximum waiting time that is configured with e.g. - * ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME, or when setting the socket option - * FREERTOS_SO_SNDTIMEO. - * It serves as a protection against a possible dead-lock; a task waiting - * for itself to release a network buffer. - */ -#ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS - #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( pdMS_TO_TICKS( 20U ) ) +#if ( ipconfigND_CACHE_ENTRIES > SIZE_MAX ) + #error ipconfigND_CACHE_ENTRIES overflows a size_t #endif +/*---------------------------------------------------------------------------*/ + /* - * FreeRTOS debug logging routines. - * The macro will be called with a printf() format as a parameter. Users - * can define their own logging routine as: + * ipconfigUSE_RA * - * extern void my_printf( const char * pcFormat, ... ); - * #define FreeRTOS_debug_printf( MSG ) my_printf MSG + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) * - * The FreeRTOS_debug_printf() must be thread-safe but does not have to be - * interrupt-safe. + * Include support for Router Advertisement (RA). */ -#ifdef ipconfigHAS_DEBUG_PRINTF - #if ( ipconfigHAS_DEBUG_PRINTF == 0 ) - #ifdef FreeRTOS_debug_printf - #error Do not define FreeRTOS_debug_print if ipconfigHAS_DEBUG_PRINTF is set to 0 - #endif /* ifdef FreeRTOS_debug_printf */ - #endif /* ( ipconfigHAS_DEBUG_PRINTF == 0 ) */ -#endif /* ifdef ipconfigHAS_DEBUG_PRINTF */ -#ifndef FreeRTOS_debug_printf - #define FreeRTOS_debug_printf( MSG ) do {} while( ipFALSE_BOOL ) -/* MISRA Ref 20.5.1 [Use of undef] */ -/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */ -/* coverity[misra_c_2012_rule_20_5_violation] */ - #undef ipconfigHAS_DEBUG_PRINTF - #define ipconfigHAS_DEBUG_PRINTF 0 +#ifndef ipconfigUSE_RA + #define ipconfigUSE_RA ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_RA != ipconfigDISABLE ) && ( ipconfigUSE_RA != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_RA configuration #endif +/*---------------------------------------------------------------------------*/ + /* - * FreeRTOS general logging routine (proposal) - * Used in some utility functions such as FreeRTOS_netstat() and FreeRTOS_PrintARPCache() + * ipconfigRA_SEARCH_COUNT * - * extern void my_printf( const char * pcFormat, ... ); - * #define FreeRTOS_printf( MSG ) my_printf MSG + * Type: UBaseType_t + * Minimum: 0 * - * The FreeRTOS_printf() must be thread-safe but does not have to be interrupt-safe + * Sets the amount of times a router solicitation message can + * be retransmitted after timing out. + * + * A Router Solicitation will be sent. It will wait for ipconfigRA_SEARCH_TIME_OUT_MSEC ms. + * When there is no response, it will be repeated ipconfigRA_SEARCH_COUNT times. + * Then it will be checked if the chosen IP-address already exists, repeating this + * ipconfigRA_IP_TEST_COUNT times, each time with a timeout of ipconfigRA_IP_TEST_TIME_OUT_MSEC ms. + * Finally the end-point will go in the UP state. */ -#ifdef ipconfigHAS_PRINTF - #if ( ipconfigHAS_PRINTF == 0 ) - #ifdef FreeRTOS_printf - #error Do not define FreeRTOS_print if ipconfigHAS_PRINTF is set to 0 - #endif /* ifdef FreeRTOS_debug_printf */ - #endif /* ( ipconfigHAS_PRINTF == 0 ) */ -#endif /* ifdef ipconfigHAS_PRINTF */ -#ifndef FreeRTOS_printf - #define FreeRTOS_printf( MSG ) do {} while( ipFALSE_BOOL ) -/* MISRA Ref 20.5.1 [Use of undef] */ -/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */ -/* coverity[misra_c_2012_rule_20_5_violation] */ - #undef ipconfigHAS_PRINTF - #define ipconfigHAS_PRINTF 0 +#ifndef ipconfigRA_SEARCH_COUNT + #define ipconfigRA_SEARCH_COUNT ( 3 ) #endif -/* - * In cases where a lot of logging is produced, FreeRTOS_flush_logging( ) - * will be called to give the logging module a chance to flush the data. - */ -#ifndef FreeRTOS_flush_logging - #define FreeRTOS_flush_logging() do {} while( ipFALSE_BOOL ) +#if ( ipconfigRA_SEARCH_COUNT < 0 ) + #error ipconfigRA_SEARCH_COUNT must be at least 0 #endif -/* Malloc functions. Within most applications of FreeRTOS, the couple - * pvPortMalloc()/vPortFree() will be used. - * If there are different types of RAM, the user may decide to use a different - * memory allocator for different purposes: - * MallocLarge is used to allocate large TCP buffers (for Rx/Tx) - * MallocSocket is used to allocate the space for the sockets - */ -#ifndef pvPortMallocLarge - #define pvPortMallocLarge( x ) pvPortMalloc( x ) +#if ( ipconfigRA_SEARCH_COUNT > UINT_FAST8_MAX ) + #error ipconfigRA_SEARCH_COUNT overflows a UBaseType_t #endif -#ifndef vPortFreeLarge - #define vPortFreeLarge( ptr ) vPortFree( ptr ) +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigRA_SEARCH_TIME_OUT_MSEC + * + * Type: TickType_t + * Unit: milliseconds + * Minimum: 0 + * Maximum: portMAX_DELAY * portTICK_PERIOD_MS + * + * Sets the timeout to wait for a response to a router + * solicitation message. + */ + +#ifndef ipconfigRA_SEARCH_TIME_OUT_MSEC + #define ipconfigRA_SEARCH_TIME_OUT_MSEC ( 10000 ) #endif -#ifndef pvPortMallocSocket - #define pvPortMallocSocket( x ) pvPortMalloc( x ) +#if ( ipconfigRA_SEARCH_TIME_OUT_MSEC < 0 ) + #error ipconfigRA_SEARCH_TIME_OUT_MSEC must be at least 0 #endif -#ifndef vPortFreeSocket - #define vPortFreeSocket( ptr ) vPortFree( ptr ) +#if ( ipconfigRA_SEARCH_TIME_OUT_MSEC > SIZE_MAX ) + #error ipconfigRA_SEARCH_TIME_OUT_MSEC must be at most portMAX_DELAY * portTICK_PERIOD_MS #endif +/*---------------------------------------------------------------------------*/ + /* - * At several places within the library, random numbers are needed: - * - DHCP: For creating a DHCP transaction number - * - TCP: Set the Initial Sequence Number: this is the value of the first outgoing - * sequence number being used when connecting to a peer. - * Having a well randomized ISN is important to avoid spoofing - * - UDP/TCP: for setting the first port number to be used, in case a socket - * uses a 'random' or anonymous port number + * ipconfigRA_IP_TEST_COUNT + * + * Type: UBaseType_t + * Unit: max iterations of RA wait state process + * Minimum: 0 * - * The function is now **deprecated**, in stead the following function must be provided: - * BaseType_t xApplicationGetRandomNumber( uint32_t *pulValue ); - * It will return pdPASS if the random number could be created, otherwise pdFAIL. + * Sets the amount of times a neighbour solicitation message can be + * retransmitted after timing out. */ -#ifndef ipconfigRAND32 - #define ipconfigRAND32() rand() -#endif -/* 'ipconfigUSE_NETWORK_EVENT_HOOK' indicates if an application hook is available - * called 'vApplicationIPNetworkEventHook()' ( if ipconfigIPv4_BACKWARD_COMPATIBLE enabled, - * otherwise vApplicationIPNetworkEventHook_Multi() ). - * This function will be called when - * the network goes up and when it goes down. See also FREERTOS_IP.h for further - * explanation. */ -#ifndef ipconfigUSE_NETWORK_EVENT_HOOK - #define ipconfigUSE_NETWORK_EVENT_HOOK 0 +#ifndef ipconfigRA_IP_TEST_COUNT + #define ipconfigRA_IP_TEST_COUNT ( 3 ) #endif -/* Define the number of entries in the ARP cache table. */ -#ifndef ipconfigARP_CACHE_ENTRIES - #define ipconfigARP_CACHE_ENTRIES 10 +#if ( ipconfigRA_IP_TEST_COUNT < 0 ) + #error ipconfigRA_IP_TEST_COUNT must be at least 0 #endif -/* The number of times an ARP request is sent when looking - * up an IP-address. - * The name should have been 'max transmissions', and not - * 'max re-transmissions'. */ -#ifndef ipconfigMAX_ARP_RETRANSMISSIONS - #define ipconfigMAX_ARP_RETRANSMISSIONS ( 5U ) +#if ( ipconfigRA_IP_TEST_COUNT > UINT_FAST8_MAX ) + #error ipconfigRA_IP_TEST_COUNT overflows a UBaseType_t #endif -/* The maximum age of an entry in the ARP cache table can be - * calculated as 'ipARP_TIMER_PERIOD_MS' x 'ipconfigMAX_ARP_AGE'. - * The macro 'ipARP_TIMER_PERIOD_MS' is local to FreeRTOSIP.c - * but it can be overwritten from FreeRTOSIPConfig.h - * The default is 10000 x 150 = 1500000 ms or 1500 seconds - */ -#ifndef ipconfigMAX_ARP_AGE - #define ipconfigMAX_ARP_AGE 150U -#endif +/*---------------------------------------------------------------------------*/ -/* 'ipconfigUSE_ARP_REVERSED_LOOKUP' when non-zero, the function - * eARPGetCacheEntryByMac() will be included in the code. +/* + * ipconfigRA_IP_TEST_TIME_OUT_MSEC + * + * Type: TickType_t + * Unit: milliseconds + * Minimum: 0 + * Maximum: portMAX_DELAY * portTICK_PERIOD_MS + * + * Sets the timeout to wait for a response to a neighbour solicitation message. */ -#ifndef ipconfigUSE_ARP_REVERSED_LOOKUP - #define ipconfigUSE_ARP_REVERSED_LOOKUP 0 -#endif -/* 'ipconfigUSE_ARP_REMOVE_ENTRY' when non-zero, the function - * ulARPRemoveCacheEntryByMac() will be included in the code. - */ -#ifndef ipconfigUSE_ARP_REMOVE_ENTRY - #define ipconfigUSE_ARP_REMOVE_ENTRY 0 +#ifndef ipconfigRA_IP_TEST_TIME_OUT_MSEC + #define ipconfigRA_IP_TEST_TIME_OUT_MSEC ( 1500 ) #endif -/* Normally, the ARP table will only store IP-addresses that are located - * in the local subnet. - * When enabled, the option 'ipconfigARP_STORES_REMOTE_ADDRESSES' will allow - * that remote IP-addresses will also be stored, along with the MAC-address of - * the gateway. - */ -#ifndef ipconfigARP_STORES_REMOTE_ADDRESSES - #define ipconfigARP_STORES_REMOTE_ADDRESSES 0 +#if ( ipconfigRA_IP_TEST_TIME_OUT_MSEC < 0 ) + #error ipconfigRA_IP_TEST_TIME_OUT_MSEC must be at least 0 #endif -/* 'ipconfigINCLUDE_FULL_INET_ADDR' used to determine if - * the function 'FreeRTOS_inet_addr()' is included. - * The macro is now deprecated and the function is included - * unconditionally. - */ -#ifndef ipconfigINCLUDE_FULL_INET_ADDR - #define ipconfigINCLUDE_FULL_INET_ADDR 1 +#if ( ipconfigRA_IP_TEST_TIME_OUT_MSEC > SIZE_MAX ) + #error ipconfigRA_IP_TEST_TIME_OUT_MSEC must be at most portMAX_DELAY * portTICK_PERIOD_MS #endif -/* This is about how new packets are passed from the network interface - * to the IP-task. By default they will be sent one-by-one. - * When 'ipconfigUSE_LINKED_RX_MESSAGES' is non-zero, each message - * buffer gets a 'pxNextBuffer' field, to that linked packets can be passed - * to the IP-task in a single call to 'xSendEventStructToIPTask()'. - * Note that this only works if the Network Interface also supports this - * option. - */ -#ifndef ipconfigUSE_LINKED_RX_MESSAGES - #define ipconfigUSE_LINKED_RX_MESSAGES 0 -#endif +/*---------------------------------------------------------------------------*/ -/* 'ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS' is an important macro: it - * determines the number of network buffers that are available in the - * entire application. - * Note that the default of 45 may be pretty high for smaller - * applications. - * Also note that when the network interface uses zero-copy reception - * ( ipconfigZERO_COPY_RX_DRIVER ), it will reserve a set of network - * buffers permanently. - * For zero-copy transmission, no network buffers are permanently - * "reserved" for transmission. +/* + * ipconfigENDPOINT_DNS_ADDRESS_COUNT + * + * Type: uint8_t + * Unit: max count of IP addresses of DNS servers + * Minimum: 1 + * + * Sets the length of the array of addresses of Domain Name Servers for each + * endpoint. + * + * The field ucDNSIndex in the IP parameters of a NetworkEndPoint_t will point + * to the DNS in use. When a DNS times out, ucDNSIndex will be moved to the + * next available DNS. */ -#ifndef ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS - #define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 45U + +#ifndef ipconfigENDPOINT_DNS_ADDRESS_COUNT + #define ipconfigENDPOINT_DNS_ADDRESS_COUNT ( 2 ) #endif -/* Every task, and also the network interface can send messages - * to the IP-task by calling API's. These messages pass through a - * queue which has a maximum size of 'ipconfigEVENT_QUEUE_LENGTH' - * items. - * When developing an application, it is important to monitor the - * actual usage of the queue. See 'ipconfigCHECK_IP_QUEUE_SPACE' - * here below. - */ -#ifndef ipconfigEVENT_QUEUE_LENGTH - #define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5U ) +#if ( ipconfigENDPOINT_DNS_ADDRESS_COUNT < 1 ) + #error ipconfigENDPOINT_DNS_ADDRESS_COUNT must be at least 1 #endif -#if ( ipconfigEVENT_QUEUE_LENGTH < ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5U ) ) - #error The ipconfigEVENT_QUEUE_LENGTH parameter must be at least ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 +#if ( ipconfigENDPOINT_DNS_ADDRESS_COUNT > UINT8_MAX ) + #error ipconfigENDPOINT_DNS_ADDRESS_COUNT overflows a uint8_t #endif -/* Related to the macro 'ipconfigEVENT_QUEUE_LENGTH' here above: - * when developing a new networking application, it can be helpful - * to monitor the length of the message queue of the IP-task. - * This code is only enabled when 'ipconfigCHECK_IP_QUEUE_SPACE' - * is set to 1. See also the function 'uxGetMinimumIPQueueSpace()'. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigFORCE_IP_DONT_FRAGMENT + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigFORCE_IP_DONT_FRAGMENT + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Sets the ipFRAGMENT_FLAGS_DONT_FRAGMENT flag in an IP header. + * + * When sending an IP-packet over the internet, a big packet may be split up + * into smaller parts which are then combined by the receiver. The sender can + * determine if this fragmentation is allowed or not. + * + * Note that the FreeRTOS-Plus-TCP stack does not accept received fragmented + * packets. */ -#ifndef ipconfigCHECK_IP_QUEUE_SPACE - #define ipconfigCHECK_IP_QUEUE_SPACE 0 + +#ifndef ipconfigFORCE_IP_DONT_FRAGMENT + #define ipconfigFORCE_IP_DONT_FRAGMENT ipconfigDISABLE #endif -/* When defined as non-zero, this macro allows to use a socket - * without first binding it explicitly to a port number. - * In that case, it will be bound to a random free port number. */ -#ifndef ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND - #define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1 +#if ( ( ipconfigFORCE_IP_DONT_FRAGMENT != ipconfigDISABLE ) && ( ipconfigFORCE_IP_DONT_FRAGMENT != ipconfigENABLE ) ) + #error Invalid ipconfigFORCE_IP_DONT_FRAGMENT configuration #endif -/* Configuration to control whether packets with IP options, - * received over the network, should be passed up to the - * software stack OR should be dropped. - * If set to 1, the stack accepts IP packets that contain IP options, but does - * not process the options (IP options are not supported). - * If set to 0, the stack will drop IP packets that contain IP options. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Determines if IP packets with IP options are accepted (but not processed). */ + #ifndef ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS - #define ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS 1 + #define ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS ipconfigENABLE #endif -/* Configuration to control whether all outgoing IP datagrams get their - * "don't fragment" flag set. - * If set to 1, the stack will set the "don't fragment" flag on all outgoing IP - * packets. If a packet needs to be fragmented somewhere along it's path, it will get - * discarded instead of fragmented. - * If set to 0, the stack will clear the "don't fragment" flag an all outgoing IP - * packets therefore allowing fragmentation if it is needed. - */ -#ifndef ipconfigFORCE_IP_DONT_FRAGMENT - #define ipconfigFORCE_IP_DONT_FRAGMENT 0 +#if ( ( ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS != ipconfigDISABLE ) && ( ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS != ipconfigENABLE ) ) + #error Invalid ipconfigIP_PASS_PACKETS_WITH_IP_OPTIONS configuration #endif -/* Configuration to control whether UDP packets with - * checksum value of zero should be passed up the software - * stack OR should be dropped. - * When enabled, the stack will accept UDP packets that have their checksum - * value set to 0. - * When disabled, the stack will drop UDP packets that have their checksum - * value set to 0, and issue some logging. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigMAX_IP_TASK_SLEEP_TIME + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * The maximum time the IP task is allowed to remain in the Blocked state if no + * events are posted to the network event queue. */ -#ifndef ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS - #define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS 0 -#endif -/* Define the value of the TTL field in outgoing UDP packets. */ -#ifndef ipconfigUDP_TIME_TO_LIVE - #define ipconfigUDP_TIME_TO_LIVE 128 +#ifndef ipconfigMAX_IP_TASK_SLEEP_TIME + #define ipconfigMAX_IP_TASK_SLEEP_TIME pdMS_TO_TICKS( 10000 ) #endif -/* Define the value of the TTL field in outgoing TCP packets. */ -#ifndef ipconfigTCP_TIME_TO_LIVE - #define ipconfigTCP_TIME_TO_LIVE 128 -#endif +/*---------------------------------------------------------------------------*/ -/* Define the value of the TTL field in outgoing TCP packets. */ -/* The default of 64 is recommend in RFC 1700. */ -#ifndef ipconfigICMP_TIME_TO_LIVE - #define ipconfigICMP_TIME_TO_LIVE 64 -#endif +/*===========================================================================*/ +/* IP CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DRIVER CONFIG */ +/*===========================================================================*/ -/* TCP only: when measuring the Smoothed Round Trip Time (SRTT), - * the result will be rounded up to a minimum value. - * The default has always been 50, but a value of 1000 - * is recommended ( see RFC6298 ) because hosts often delay the - * sending of ACK packets with 200 ms. */ -#ifndef ipconfigTCP_SRTT_MINIMUM_VALUE_MS - #define ipconfigTCP_SRTT_MINIMUM_VALUE_MS 50 -#endif +/*---------------------------------------------------------------------------*/ -/* Make positive to define the maximum number of packets which will be buffered - * in a UDP socket. - * Can be overridden with the socket option 'FREERTOS_SO_UDP_MAX_RX_PACKETS'. +/* + * ipconfigBUFFER_PADDING + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigBUFFER_PADDING + * + * Type: size_t + * Unit: bytes + * Minimum: 0 + * + * Advanced driver implementation use only. + * + * When the application requests a network buffer, the size of the network + * buffer is specified by the application writer, but the size of the network + * buffer actually obtained is increased by ipconfigBUFFER_PADDING bytes. The + * first ipconfigBUFFER_PADDING bytes of the buffer is then used to hold + * metadata about the buffer, and the area that actually stores the data + * follows the metadata. This mechanism is transparent to the user as the user + * only sees a pointer to the area within the buffer actually used to hold + * network data. + * + * Some network hardware has very specific byte alignment requirements, so + * ipconfigBUFFER_PADDING is provided as a configurable parameter to allow the + * writer of the network driver to influence the alignment of the start of the + * data that follows the metadata. + * + * When defined as zero ( default ), the driver will determine the optimal + * padding as: + * + * #define ipBUFFER_PADDING ( 8U + ipconfigPACKET_FILLER_SIZE ) + * + * See ipconfigPACKET_FILLER_SIZE. */ -#ifndef ipconfigUDP_MAX_RX_PACKETS - #define ipconfigUDP_MAX_RX_PACKETS 0U -#endif -/* When non-zero, the module FreeRTOS_DHCP.c will be included and called. - * Note that the application can override decide to ignore the outcome - * of the DHCP negotiation and use a static IP-address. */ -#ifndef ipconfigUSE_DHCP - #define ipconfigUSE_DHCP 1 +#ifndef ipconfigBUFFER_PADDING + #define ipconfigBUFFER_PADDING ( 0 ) #endif -/* During the DHCP process, the driver will call an application hook - * if 'ipconfigUSE_DHCP_HOOK' is non-zero. It lets the application decide - * if the DHCP offer shall be accepted. - */ -#ifndef ipconfigUSE_DHCP_HOOK - #define ipconfigUSE_DHCP_HOOK 1 +#if ( ipconfigBUFFER_PADDING < 0 ) + #error ipconfigBUFFER_PADDING must be at least 0 #endif -/* DHCP servers have a table with information about each clients. One - * of the fields in this table contains the host name of the DHCP clients. - * When 'ipconfigDHCP_REGISTER_HOSTNAME' is defined as non-zero, the DHCP - * driver will call 'pcApplicationHostnameHook()' to obtain the name of - * the embedded device. - */ -#ifndef ipconfigDHCP_REGISTER_HOSTNAME - #define ipconfigDHCP_REGISTER_HOSTNAME 0 +#if ( ipconfigBUFFER_PADDING > SIZE_MAX ) + #error ipconfigBUFFER_PADDING overflows a size_t #endif +/*---------------------------------------------------------------------------*/ + /* - * Only applicable when DHCP is in use: - * If no DHCP server responds, use "Auto-IP" : the - * device will allocate a random LinkLayer IP address. + * ipconfigPACKET_FILLER_SIZE + * + * Type: size_t + * Unit: bytes + * Minimum: 0 + * + * In most projects, network buffers are 32-bit aligned plus 16 bits. + * The two extra bytes are called "filler bytes". They make sure that the + * IP-header starts at a 32-bit aligned address. That makes the code + * very efficient and easy to maintain. An 'uint32_t' can be assigned/ + * changed without having to worry about alignment. + * + * See ipconfigBUFFER_PADDING. */ -#ifndef ipconfigDHCP_FALL_BACK_AUTO_IP - #define ipconfigDHCP_FALL_BACK_AUTO_IP ( 0 ) -#endif -/* When a link-layer address is assigned, the driver will test - * if it is already taken by a different device by sending ARP - * requests. Therefore, 'ipconfigARP_USE_CLASH_DETECTION' must - * be defined as non-zero. - */ -#if ( ipconfigDHCP_FALL_BACK_AUTO_IP != 0 ) - #ifndef ipconfigARP_USE_CLASH_DETECTION - #define ipconfigARP_USE_CLASH_DETECTION 1 - #else - #if ( ipconfigARP_USE_CLASH_DETECTION != 1 ) - #error ipconfigARP_USE_CLASH_DETECTION should be defined as 1 when AUTO_IP is used. - #endif - #endif +#ifndef ipconfigPACKET_FILLER_SIZE + #define ipconfigPACKET_FILLER_SIZE ( 2 ) #endif -/* If ipconfigDHCP_FALL_BACK_AUTO_IP is not used, the code for - * clash detection is not needed. - */ -#ifndef ipconfigARP_USE_CLASH_DETECTION - #define ipconfigARP_USE_CLASH_DETECTION 0 +#if ( ipconfigPACKET_FILLER_SIZE < 0 ) + #error ipconfigPACKET_FILLER_SIZE must be at least 0 #endif -/* An important macro: 'ipconfigNETWORK_MTU' determines the Maximum - * transmission unit, which is a network packet minus the size of the - * 14-byte Ethernet header. - */ -#ifndef ipconfigNETWORK_MTU - #define ipconfigNETWORK_MTU 1500 -#else - /* A sanity check to avoid a possible overflow of size_t. */ - #if ipconfigNETWORK_MTU > ( SIZE_MAX >> 1 ) - /* MISRA Ref 20.5.1 [Use of undef] */ - /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-2051 */ - /* coverity[misra_c_2012_rule_20_5_violation] */ - #undef ipconfigNETWORK_MTU - #define ipconfigNETWORK_MTU ( SIZE_MAX >> 1 ) - #endif +#if ( ipconfigPACKET_FILLER_SIZE > SIZE_MAX ) + #error ipconfigPACKET_FILLER_SIZE overflows a size_t #endif -#if ( ipconfigNETWORK_MTU < 46 ) - #error ipconfigNETWORK_MTU must be at least 46. -#endif +/*---------------------------------------------------------------------------*/ -/* The maximum segment size used by TCP, it is the maximum size of - * the TCP payload per packet. - * For IPv4: when MTU equals 1500, the MSS equals 1460. - * It is recommended to use the default value defined here. +/* + * ipconfigBYTE_ORDER + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigBYTE_ORDER * - * In FreeRTOS_TCP_IP.c, there is a local macro called 'tcpREDUCED_MSS_THROUGH_INTERNET'. - * When a TCP connection is made outside the local network, the MSS - * will be reduced to 'tcpREDUCED_MSS_THROUGH_INTERNET' before the connection - * is made. + * Type: BaseType_t ( pdFREERTOS_LITTLE_ENDIAN | pdFREERTOS_BIG_ENDIAN ) + * + * If the microcontroller on which FreeRTOS-Plus-TCP is running is big endian + * then ipconfigBYTE_ORDER must be set to pdFREERTOS_BIG_ENDIAN. If the + * microcontroller is little endian then ipconfigBYTE_ORDER must be set to + * pdFREERTOS_LITTLE_ENDIAN. The Byte Order and Endian section of the Embedded + * Networking Basics and Glossary page provides an explanation of byte order + * considerations in IP networks. */ -#ifndef ipconfigTCP_MSS - #define ipconfigTCP_MSS ( ipconfigNETWORK_MTU - ( ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER ) ) -#endif -/* This macro defines the minimum size of an outgoing Ethernet packet. - * When zero, there is no minimum. - * When non-zero, the packet will be extended to the minimum size. - * The extra bytes will be cleared. - * In many projects a value of 60 is used. - * The 32-bit CRC added in the physical layer is not included. - */ -#ifndef ipconfigETHERNET_MINIMUM_PACKET_BYTES - #define ipconfigETHERNET_MINIMUM_PACKET_BYTES 0 +#ifndef ipconfigBYTE_ORDER + #error ipconfigBYTE_ORDER must be defined #endif -/* Each TCP socket has circular stream buffers for reception and transmission, - * which have a fixed maximum size. - * The defaults for these sizes are defined here, although - * they can be overridden at runtime by calling FreeRTOS_setsockopt(), - * and use 'FREERTOS_SO_RCVBUF', 'FREERTOS_SO_SNDBUF' or - * 'FREERTOS_SO_WIN_PROPERTIES'. - * A stream buffer will only be created when needed. A TCP server socket - * will never create buffers. - */ -#ifndef ipconfigTCP_RX_BUFFER_LENGTH - /* When MTU equals 1500, the buffer length defaults to 5840 bytes */ - #define ipconfigTCP_RX_BUFFER_LENGTH ( 4U * ipconfigTCP_MSS ) +#if ( ( ipconfigBYTE_ORDER != pdFREERTOS_LITTLE_ENDIAN ) && ( ipconfigBYTE_ORDER != pdFREERTOS_BIG_ENDIAN ) ) + #error ipconfigBYTE_ORDER should be pdFREERTOS_LITTLE_ENDIAN or pdFREERTOS_BIG_ENDIAN #endif -/* Define the size of Tx stream buffer for TCP sockets. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * When ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM is enabled, the network interface + * is responsible for checking the checksums of the incoming packets. If hardware + * supports checking TCP checksum only, the network interface layer should handle + * the same for other protocols, such as IP/UDP/ICMP/etc, and give the checksum + * verified packets to the FreeRTOS-plus-TCP stack. otherwise set + * ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to ipconfigDISABLE. + * + * Throughput and processor load are greatly improved by implementing drivers + * that make use of hardware checksum calculations, so-called "checksum offloading". + * + * Note: From FreeRTOS-Plus-TCP V2.3.0, the length is checked in software even + * when it has already been checked in hardware. */ -#ifndef ipconfigTCP_TX_BUFFER_LENGTH - /* When MTU equals 1500, the buffer length defaults to 5840 bytes */ - #define ipconfigTCP_TX_BUFFER_LENGTH ( 4U * ipconfigTCP_MSS ) -#endif -/* 'ipconfigMAXIMUM_DISCOVER_TX_PERIOD' is about DHCP. - * It determines the maximum time (in clock-ticks) that the DHCP client - * will wait for an offer from a DHCP server. */ -#ifndef ipconfigMAXIMUM_DISCOVER_TX_PERIOD - #ifdef _WINDOWS_ - #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( pdMS_TO_TICKS( 999U ) ) - #else - #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( pdMS_TO_TICKS( 30000U ) ) - #endif /* _WINDOWS_ */ -#endif /* ipconfigMAXIMUM_DISCOVER_TX_PERIOD */ - -#if ( ipconfigUSE_DNS == 0 ) - /* The DNS module will not be included. */ - #if ( ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) ) - /* LLMNR and NBNS depend on DNS because those protocols share a lot of code. */ - #error When either LLMNR or NBNS is used, ipconfigUSE_DNS must be defined - #endif +#ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM + #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM ipconfigDISABLE #endif -/* By default, the DNS client is included. Note that LLMNR and - * NBNS also need the code from FreeRTOS_DNS.c - */ -#ifndef ipconfigUSE_DNS - #define ipconfigUSE_DNS 1 +#if ( ( ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM != ipconfigDISABLE ) && ( ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM != ipconfigENABLE ) ) + #error Invalid ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM configuration #endif -#if ( ipconfigUSE_IPv4 == 0 ) && ( ipconfigUSE_DNS != 0 ) - #error "IPv4 (ipconfigUSE_IPv4) needs to be enabled to use DNS" +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * If the network driver or network hardware is calculating the IP, TCP and UDP + * checksums of outgoing packets then set + * ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM to 1, otherwise set + * ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM to 0. + * + * Throughput and processor load are greatly improved by implementing drivers + * that make use of hardware checksum calculations. + */ + +#ifndef ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM + #define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM ipconfigDISABLE +#endif + +#if ( ( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM != ipconfigDISABLE ) && ( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM != ipconfigENABLE ) ) + #error Invalid ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * A MISRA note: The macros 'ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES' + * and 'ipconfigETHERNET_DRIVER_FILTERS_PACKETS' are too long: the first 32 + * bytes are equal, which might cause problems for some compilers. + */ + +/* + * ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Ethernet/hardware MAC addresses are used to address Ethernet frames. If the + * network driver or hardware is discarding packets that do not contain a MAC + * address of interest then set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to + * 1. Otherwise set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0. + * + * Throughput and processor load are greatly improved by implementing network + * address filtering in hardware. Most network interfaces allow multiple MAC + * addresses to be defined so filtering can allow through the unique hardware + * address of the node, the broadcast address, and various multicast addresses. + * + * When disabled, the IP-task will call 'eConsiderFrameForProcessing()' + * to check incoming packets. + */ + +#ifndef ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES + #define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES ipconfigENABLE +#endif + +#if ( ( ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES != ipconfigDISABLE ) && ( ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES != ipconfigENABLE ) ) + #error Invalid ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * A MISRA note: The macros 'ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES' + * and 'ipconfigETHERNET_DRIVER_FILTERS_PACKETS' are too long: the first 32 + * bytes are equal, which might cause problems for some compilers. + */ + +/* + * ipconfigETHERNET_DRIVER_FILTERS_PACKETS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigETHERNET_DRIVER_FILTERS_PACKETS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * For expert users only. + * + * Whereas ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is used to specify + * whether or not the network driver or hardware filters Ethernet frames, + * ipconfigETHERNET_DRIVER_FILTERS_PACKETS is used to specify whether or not + * the network driver filters the IP, UDP or TCP data within the Ethernet + * frame. + * + * The TCP/IP stack is only interested in receiving data that is either + * addresses to a socket (IP address and port number) on the local node, or is + * a broadcast or multicast packet. Throughput and process load can be greatly + * improved by preventing packets that do not meet these criteria from being + * sent to the TCP/IP stack. FreeRTOS provides some features that allow such + * filtering to take place in the network driver. For example, + * xPortHasUDPSocket() can be used as follows: + * + * if( ( xPortHasUdpSocket( xUDPHeader->usDestinationPort ) ) + * #if( ipconfigUSE_DNS == 1 ) * DNS is also UDP. * + * || ( xUDPHeader->usSourcePort == FreeRTOS_ntohs( ipDNS_PORT ) ) + * #endif + * #if( ipconfigUSE_LLMNR == 1 ) * LLMNR is also UDP. * + * || ( xUDPHeader->usDestinationPort == FreeRTOS_ntohs( ipLLMNR_PORT ) ) + * #endif + * #if( ipconfigUSE_NBNS == 1 ) * NBNS is also UDP. * + * || ( xUDPHeader->usDestinationPort == FreeRTOS_ntohs( ipNBNS_PORT ) ) + * #endif + * ) + * { + * * Forward packet to the IP-stack. * + * } + * else + * { + * * Discard the UDP packet. * + * } + * + * When disabled, the IP-task will perform sanity checks on the IP-header, + * also checking the target IP address. Also when disabled, xPortHasUDPSocket() + * won't be included. That means that the IP-task can access the + * 'xBoundUDPSocketsList' without locking. + */ + +#ifndef ipconfigETHERNET_DRIVER_FILTERS_PACKETS + #define ipconfigETHERNET_DRIVER_FILTERS_PACKETS ipconfigDISABLE +#endif + +#if ( ( ipconfigETHERNET_DRIVER_FILTERS_PACKETS != ipconfigDISABLE ) && ( ipconfigETHERNET_DRIVER_FILTERS_PACKETS != ipconfigENABLE ) ) + #error Invalid ipconfigETHERNET_DRIVER_FILTERS_PACKETS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigETHERNET_MINIMUM_PACKET_BYTES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigETHERNET_MINIMUM_PACKET_BYTES + * + * Type: size_t + * Unit: minimum size of packet in bytes + * Minimum: 0 + * + * When the device is connected to a LAN, it is strongly recommended to give + * each outgoing packet a minimum length of 60 bytes (plus 4 bytes CRC). The + * macro ipconfigETHERNET_MINIMUM_PACKET_BYTES determines the minimum length. + * By default, it is defined as zero, meaning that packets will be sent as they + * are. A minimum packet length is needed to be able to detect collisions of + * short packets as well. By default, packets of any size can be sent. + */ + +#ifndef ipconfigETHERNET_MINIMUM_PACKET_BYTES + #define ipconfigETHERNET_MINIMUM_PACKET_BYTES ( 0 ) +#endif + +#if ( ipconfigETHERNET_MINIMUM_PACKET_BYTES < 0 ) + #error ipconfigETHERNET_MINIMUM_PACKET_BYTES must be at least 0 +#endif + +#if ( ipconfigETHERNET_MINIMUM_PACKET_BYTES > SIZE_MAX ) + #error ipconfigETHERNET_MINIMUM_PACKET_BYTES overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet + * frames that are not in Ethernet II format will be dropped. This option + * is included for potential future IP stack developments. + * + * When enabled, the function 'eConsiderFrameForProcessing()' will also + * check if the Ethernet frame type is acceptable. + */ + +#ifndef ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES + #define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES ipconfigENABLE +#endif + +#if ( ( ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES != ipconfigDISABLE ) && ( ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES != ipconfigENABLE ) ) + #error Invalid ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigNETWORK_MTU + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigNETWORK_MTU + * + * Type: size_t + * Unit: bytes + * Minimum: 46 + * + * The MTU is the maximum number of bytes the payload of a network frame can + * contain. For normal Ethernet V2 frames the maximum MTU is 1500 (although a + * lower number may be required for Internet routing). Setting a lower value + * can save RAM, depending on the buffer management scheme used. + */ + +#ifndef ipconfigNETWORK_MTU + #define ipconfigNETWORK_MTU ( 1500 ) +#endif + +#if ( ipconfigNETWORK_MTU < 46 ) + #error ipconfigNETWORK_MTU must be at least 46 +#endif + +#if ( ipconfigNETWORK_MTU > SIZE_MAX ) + #error ipconfigNETWORK_MTU overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + * + * Type: size_t + * Unit: Count of network buffers + * Minimum: 1 + * + * Defines the total number of network buffers that are available to the TCP/IP + * stack. The total number of network buffers is limited to ensure the total + * amount of RAM that can be consumed by the TCP/IP stack is capped to a + * pre-determinable value. How the storage area is actually allocated to the + * network buffer structures is not fixed, but part of the portable layer. + * The simplest scheme simply allocates the exact amount of storage as it is + * required. + */ + +#ifndef ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + #define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS ( 45 ) +#endif + +#if ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS < 1 ) + #error ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS must be at least 1 +#endif + +#if ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS > SIZE_MAX ) + #error ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_LINKED_RX_MESSAGES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_LINKED_RX_MESSAGES + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * When enabled it is possible to reduce CPU load during periods of heavy + * network traffic by linking multiple received packets together, then passing + * all the linked packets to the IP RTOS task in one go. + * + * By default packets will be sent one-by-one. If 'ipconfigUSE_LINKED_RX_MESSAGES' + * is non-zero, each message buffer gets a 'pxNextBuffer' field, to that linked + * packets can be passed to the IP-task in a single call to 'xSendEventStructToIPTask()'. + * Note that this only works if the Network Interface also supports this + * option. + */ + +#ifndef ipconfigUSE_LINKED_RX_MESSAGES + #define ipconfigUSE_LINKED_RX_MESSAGES ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_LINKED_RX_MESSAGES != ipconfigDISABLE ) && ( ipconfigUSE_LINKED_RX_MESSAGES != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_LINKED_RX_MESSAGES configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigZERO_COPY_RX_DRIVER + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigZERO_COPY_RX_DRIVER + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * When enabled the network interface will assign network buffers + * NetworkBufferDescriptor_t::pucEthernetBuffer to the DMA of the EMAC. + * When a packet is received, no data is copied. Instead, the + * buffer is sent directly to the IP-task. If the RX zero-copy option is + * disabled, every received packet will be copied from the DMA buffer to the + * network buffer of type NetworkBufferDescriptor_t. + */ + +#ifndef ipconfigZERO_COPY_RX_DRIVER + #define ipconfigZERO_COPY_RX_DRIVER ipconfigDISABLE +#endif + +#if ( ( ipconfigZERO_COPY_RX_DRIVER != ipconfigDISABLE ) && ( ipconfigZERO_COPY_RX_DRIVER != ipconfigENABLE ) ) + #error Invalid ipconfigZERO_COPY_RX_DRIVER configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigZERO_COPY_TX_DRIVER + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigZERO_COPY_TX_DRIVER + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * When enabled the driver function xNetworkInterfaceOutput() will always be + * called with its bReleaseAfterSend parameter set to pdTRUE - meaning it is + * always the driver that is responsible for freeing the network buffer and + * network buffer descriptor. + * + * This is useful if the driver implements a zero-copy scheme whereby the + * packet data is sent directly from within the network buffer (for example by + * pointing a DMA descriptor at the data within the network buffer), instead of + * copying the data out of the network buffer before the data is sent (for + * example by copying the data into a separate pre-allocated DMA descriptor). + * In such cases the driver needs to take ownership of the network buffer + * because the network buffer can only be freed after the data has actually + * been transmitted - which might be some time after the + * xNetworkInterfaceOutput() function returns. See the examples on the Porting + * FreeRTOS to a Different Microcontroller documentation page for worked + * examples. + */ + +#ifndef ipconfigZERO_COPY_TX_DRIVER + #define ipconfigZERO_COPY_TX_DRIVER ipconfigDISABLE +#endif + +#if ( ( ipconfigZERO_COPY_TX_DRIVER != ipconfigDISABLE ) && ( ipconfigZERO_COPY_TX_DRIVER != ipconfigENABLE ) ) + #error Invalid ipconfigZERO_COPY_TX_DRIVER configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSUPPORT_NETWORK_DOWN_EVENT + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Set to 1 if you want to receive eNetworkDown notification via vApplicationIPNetworkEventHook_Multi() callback. + * Not all drivers support this feature. + */ + +#ifndef ipconfigSUPPORT_NETWORK_DOWN_EVENT + #define ipconfigSUPPORT_NETWORK_DOWN_EVENT ipconfigDISABLE +#endif + +#if ( ( ipconfigSUPPORT_NETWORK_DOWN_EVENT != ipconfigDISABLE ) && ( ipconfigSUPPORT_NETWORK_DOWN_EVENT != ipconfigENABLE ) ) + #error Invalid ipconfigSUPPORT_NETWORK_DOWN_EVENT configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigPHY_LS_HIGH_CHECK_TIME_MS + * + * Type: uint32_t + * Unit: milliseconds + * + * Interval in which to check if the LinkStatus in the PHY is still high after + * not receiving packets. + */ + +#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS + #define ipconfigPHY_LS_HIGH_CHECK_TIME_MS ( 15000 ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigPHY_LS_LOW_CHECK_TIME_MS + * + * Type: uint32_t + * Unit: milliseconds + * + * Interval in which to check if the LinkStatus in the PHY is still low. + */ + +#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS + #define ipconfigPHY_LS_LOW_CHECK_TIME_MS ( 1000 ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigHAS_TX_CRC_OFFLOADING + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + */ + +#ifndef ipconfigHAS_TX_CRC_OFFLOADING + #define ipconfigHAS_TX_CRC_OFFLOADING ipconfigDISABLE +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigPHY_MAX_PORTS + * + * Type: size_t + * Unit: count of ports + * Minimum: 0 + * Maximum: 32 + */ + +#ifndef ipconfigPHY_MAX_PORTS + #define ipconfigPHY_MAX_PORTS ( 4 ) +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* DRIVER CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* TCP/IP TASK CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigEVENT_QUEUE_LENGTH + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigEVENT_QUEUE_LENGTH + * + * Type: size_t + * Unit: count of queue spaces + * Minimum: 1 + * + * A FreeRTOS queue is used to send events from application tasks to the IP + * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can + * be queued for processing at any one time. The event queue must be a minimum + * of 5 greater than the total number of network buffers. + * + * The actual number of items in the event queue can be monitored. + * See 'ipconfigCHECK_IP_QUEUE_SPACE' described here below. + * + * Tasks should never have to wait for space in the 'xNetworkEventQueue'. + */ + +#ifndef ipconfigEVENT_QUEUE_LENGTH + #define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) +#endif + +#if ( ipconfigEVENT_QUEUE_LENGTH < ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) ) + #error ipconfigEVENT_QUEUE_LENGTH must be at least ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 +#endif + +#if ( ipconfigEVENT_QUEUE_LENGTH > SIZE_MAX ) + #error ipconfigEVENT_QUEUE_LENGTH overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigIP_TASK_PRIORITY + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigIP_TASK_PRIORITY + * + * Type: UBaseType_t + * Unit: task priority + * Minimum: 0 + * Maximum: configMAX_PRIORITIES - 1 + * + * The TCP/IP stack executes in its own RTOS task (although any application + * RTOS task can make use of its services through the published sockets API). + * ipconfigIP_TASK_PRIORITY sets the priority of the RTOS task that executes + * the TCP/IP stack. + * + * The priority is a standard FreeRTOS task priority so it can take any value + * from 0 (the lowest priority) to (configMAX_PRIORITIES - 1) + * (the highest priority). configMAX_PRIORITIES is a standard FreeRTOS + * configuration parameter defined in FreeRTOSConfig.h, not FreeRTOSIPConfig.h. + * + * Consideration needs to be given as to the priority assigned to the RTOS task + * executing the TCP/IP stack relative to the priority assigned to tasks that + * use the TCP/IP stack. + * + * It is recommended to assign the following task priorities: + * + * Higher : EMAC task "Deferred interrupt handler" + * Medium : IP-task + * Lower : User tasks that make use of the TCP/IP stack + */ + +#ifndef ipconfigIP_TASK_PRIORITY + #define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) +#endif + +#if ( ipconfigIP_TASK_PRIORITY < 0 ) + #error ipconfigIP_TASK_PRIORITY must be at least 0 +#endif + +#if ( ipconfigIP_TASK_PRIORITY > ( configMAX_PRIORITIES - 1 ) ) + #error ipconfigIP_TASK_PRIORITY must be at most configMAX_PRIORITIES - 1 +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigIP_TASK_STACK_SIZE_WORDS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigIP_TASK_STACK_SIZE_WORDS + * + * Type: size_t + * Unit: words + * Minimum: configMINIMAL_STACK_SIZE + * + * The size, in words (not bytes), of the stack allocated to the + * FreeRTOS-Plus-TCP RTOS task. FreeRTOS includes optional stack overflow + * detection. + */ + +#ifndef ipconfigIP_TASK_STACK_SIZE_WORDS + #define ipconfigIP_TASK_STACK_SIZE_WORDS configMINIMAL_STACK_SIZE +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables usage of an application defined hook to process any unknown frame, + * that is, any frame that expects ARP or IP. If set to 1, the user must define + * eApplicationProcessCustomFrameHook function which will be called by the stack + * for any frame with an unsupported EtherType. + * + * Function prototype: + * + * eFrameProcessingResult_t eApplicationProcessCustomFrameHook( NetworkBufferDescriptor_t * const pxNetworkBuffer ) + */ + +#ifndef ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES + #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES ipconfigDISABLE +#endif + +#if ( ( ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES != ipconfigDISABLE ) && ( ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES != ipconfigENABLE ) ) + #error Invalid ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_NETWORK_EVENT_HOOK + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_NETWORK_EVENT_HOOK + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables usage of a hook to process network events. The function will be called when + * the network goes up and when it goes down. + * + * This hook is affected by ipconfigIPv4_BACKWARD_COMPATIBLE. + * + * Function prototype if ipconfigIPv4_BACKWARD_COMPATIBLE is enabled: + * + * void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) + * + * Function prototype by default: + * + * void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent, + * struct xNetworkEndPoint * pxEndPoint ) + */ + +#ifndef ipconfigUSE_NETWORK_EVENT_HOOK + #define ipconfigUSE_NETWORK_EVENT_HOOK ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_NETWORK_EVENT_HOOK != ipconfigDISABLE ) && ( ipconfigUSE_NETWORK_EVENT_HOOK != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_NETWORK_EVENT_HOOK configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* TCP/IP TASK CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* TCP CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_TCP + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_TCP + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for TCP. + */ + +#ifndef ipconfigUSE_TCP + #define ipconfigUSE_TCP ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_TCP != ipconfigDISABLE ) && ( ipconfigUSE_TCP != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_TCP configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigIGNORE_UNKNOWN_PACKETS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigIGNORE_UNKNOWN_PACKETS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * Prevents sending RESET responses to TCP packets that have a bad or unknown + * destination. This is an option used for testing. It is recommended to + * define it as '0'. + */ + +#ifndef ipconfigIGNORE_UNKNOWN_PACKETS + #define ipconfigIGNORE_UNKNOWN_PACKETS ipconfigDISABLE +#endif + +#if ( ( ipconfigIGNORE_UNKNOWN_PACKETS != ipconfigDISABLE ) && ( ipconfigIGNORE_UNKNOWN_PACKETS != ipconfigENABLE ) ) + #error Invalid ipconfigIGNORE_UNKNOWN_PACKETS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_HANG_PROTECTION + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_HANG_PROTECTION + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables automatic closure of a TCP socket after a timeout of no status + * changes. It can help reduce the impact of SYN floods. + * When a SYN packet comes in, it will first be checked if there is a listening + * socket for that port number. If not, it will be replied to with a RESET packet. + * If there is a listing socket for that port number, a new socket will be created. + * This socket will be owned temporarily by the IP-task. Only when the SYN/ACK + * handshake is finished, the new socket will be passed to the application, + * resulting in a successful call to FreeRTOS_accept(). + * The option 'ipconfigTCP_HANG_PROTECTION' will make sure that the socket will be + * deleted in case the SYN-handshake doesn't come to a good end. + * + * See ipconfigTCP_HANG_PROTECTION_TIME + */ + +#ifndef ipconfigTCP_HANG_PROTECTION + #define ipconfigTCP_HANG_PROTECTION ipconfigENABLE +#endif + +#if ( ( ipconfigTCP_HANG_PROTECTION != ipconfigDISABLE ) && ( ipconfigTCP_HANG_PROTECTION != ipconfigENABLE ) ) + #error Invalid ipconfigTCP_HANG_PROTECTION configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_HANG_PROTECTION_TIME + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_HANG_PROTECTION_TIME + * + * Type: TickType_t + * Unit: seconds + * Minimum: 0 + * Maximum: portMAX_DELAY / configTICK_RATE_HZ + * + * If ipconfigTCP_HANG_PROTECTION is set to 1 then + * ipconfigTCP_HANG_PROTECTION_TIME sets the interval in seconds + * between the status of a socket last changing and the anti-hang + * mechanism marking the socket as closed. It is the maximum time that a socket + * stays in one of these "in-between" states: eCONNECT_SYN, eSYN_FIRST, + * eSYN_RECEIVED, eFIN_WAIT_1, eFIN_WAIT_2, eCLOSING, eLAST_ACK, or eTIME_WAIT. + */ + +#ifndef ipconfigTCP_HANG_PROTECTION_TIME + #define ipconfigTCP_HANG_PROTECTION_TIME ( 30 ) +#endif + +#if ( ipconfigTCP_HANG_PROTECTION_TIME < 0 ) + #error ipconfigTCP_HANG_PROTECTION_TIME must be at least 0 +#endif + +#if ( ipconfigTCP_HANG_PROTECTION_TIME > SIZE_MAX ) + #error ipconfigTCP_HANG_PROTECTION_TIME must be at most portMAX_DELAY / configTICK_RATE_HZ +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_KEEP_ALIVE + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_KEEP_ALIVE + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Sockets that are connected but do not transmit any data for an extended + * period can be disconnected by routers or firewalls that time out. This + * can be avoided at the application level by ensuring the application + * periodically sends a packet. Alternatively FreeRTOS-Plus-TCP can be + * configured to automatically send keep alive messages when it detects + * that a connection is dormant. Note that, while having FreeRTOS-Plus-TCP + * automatically send keep alive messages is the more convenient method, it + * is also the least reliable method because some routers will discard keep + * alive messages. + * + * Set ipconfigTCP_KEEP_ALIVE to 1 to have FreeRTOS-Plus-TCP periodically + * send keep alive messages on connected but dormant sockets. Set + * ipconfigTCP_KEEP_ALIVE to 0 to prevent the automatic transmission of + * keep alive messages. + * + * If FreeRTOS-Plus-TCP does not receive a reply to a keep alive message + * then the connection will be broken and the socket will be marked as + * closed. Subsequent FreeRTOS_recv() calls on the socket will return + * -pdFREERTOS_ERRNO_ENOTCONN. + */ + +#ifndef ipconfigTCP_KEEP_ALIVE + #define ipconfigTCP_KEEP_ALIVE ipconfigDISABLE +#endif + +#if ( ( ipconfigTCP_KEEP_ALIVE != ipconfigDISABLE ) && ( ipconfigTCP_KEEP_ALIVE != ipconfigENABLE ) ) + #error Invalid ipconfigTCP_KEEP_ALIVE configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_KEEP_ALIVE_INTERVAL + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_KEEP_ALIVE_INTERVAL + * + * Type: TickType_t + * Unit: Seconds + * Minimum: 0 + * Maximum: portMAX_DELAY / configTICK_RATE_HZ + * + * If ipconfigTCP_KEEP_ALIVE is set to 1 then + * ipconfigTCP_KEEP_ALIVE_INTERVAL sets the interval in seconds between + * successive keep alive messages. Keep alive messages are not sent at + * all unless ipconfigTCP_KEEP_ALIVE_INTERVAL seconds have passed since + * the last packet was sent or received. + */ + +#ifndef ipconfigTCP_KEEP_ALIVE_INTERVAL + #define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) +#endif + +#if ( ipconfigTCP_KEEP_ALIVE_INTERVAL < 0 ) + #error ipconfigTCP_KEEP_ALIVE_INTERVAL must be at least 0 +#endif + +#if ( ipconfigTCP_KEEP_ALIVE_INTERVAL > SIZE_MAX ) + #error ipconfigTCP_KEEP_ALIVE_INTERVAL must be at most portMAX_DELAY / configTICK_RATE_HZ +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_MSS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_MSS + * + * Type: size_t + * Unit: bytes + * Minimum: 536 ( tcpMINIMUM_SEGMENT_LENGTH ) + * + * Sets the MSS value (in bytes) for all TCP packets. + * + * Note that FreeRTOS-Plus-TCP contains checks that the defined + * ipconfigNETWORK_MTU and ipconfigTCP_MSS values are consistent with each + * other. + * + * The default definition of 'ipconfigTCP_MSS' works well for most projects. + * Note that IPv6 headers are larger than IPv4 headers, leaving less space for + * the TCP payload. In prvSocketSetMSS_IPV6(), 20 bytes will be subtracted from + * 'ipconfigTCP_MSS'. + * + * The default is derived from MTU - ( ipconfigNETWORK_MTU + ipSIZE_OF_TCP_HEADER ) + * Where ipconfigNETWORK_MTU + ipSIZE_OF_TCP_HEADER is 40 bytes. + */ + +#ifndef ipconfigTCP_MSS + #define ipconfigTCP_MSS ( ipconfigNETWORK_MTU - 40 ) +#endif + +#if ( ipconfigTCP_MSS < 536 ) + #error ipconfigTCP_MSS must be at least 536 ( tcpMINIMUM_SEGMENT_LENGTH ) +#endif + +#if ( ipconfigTCP_MSS > SIZE_MAX ) + #error ipconfigTCP_MSS overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_RX_BUFFER_LENGTH + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_RX_BUFFER_LENGTH + * + * Type: size_t + * Unit: size of StreamBuffer_t in bytes + * Minimum: 0 + * + * Each TCP socket has a circular stream buffer for reception and a separate + * buffer for transmission. + * + * FreeRTOS_setsockopt() can be used with the FREERTOS_SO_RCVBUF and + * FREERTOS_SO_SNDBUF parameters to set the receive and send buffer sizes + * respectively - but this must be done between the time that the socket is + * created and the buffers used by the socket are created. The receive + * buffer is not created until data is actually received, and the transmit + * buffer is not created until data is actually sent to the socket for + * transmission. Once the buffers have been created their sizes cannot be + * changed. + * + * If a listening socket creates a new socket in response to an incoming + * connect request then the new socket will inherit the buffers sizes of + * the listening socket. + * + * The buffer length defaults to 5840 bytes. + */ + +#ifndef ipconfigTCP_RX_BUFFER_LENGTH + #define ipconfigTCP_RX_BUFFER_LENGTH ( 4 * ipconfigTCP_MSS ) +#endif + +#if ( ipconfigTCP_RX_BUFFER_LENGTH < 0 ) + #error ipconfigTCP_RX_BUFFER_LENGTH must be at least 0 +#endif + +#if ( ipconfigTCP_RX_BUFFER_LENGTH > SIZE_MAX ) + #error ipconfigTCP_RX_BUFFER_LENGTH overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_TX_BUFFER_LENGTH + * + * Type: size_t + * Unit: size of StreamBuffer_t in bytes + * Minimum: 0 + * + * Define the size of Tx stream buffer for TCP sockets. + * See ipconfigTCP_RX_BUFFER_LENGTH + */ + +#ifndef ipconfigTCP_TX_BUFFER_LENGTH + #define ipconfigTCP_TX_BUFFER_LENGTH ( 4 * ipconfigTCP_MSS ) +#endif + +#if ( ipconfigTCP_TX_BUFFER_LENGTH < 0 ) + #error ipconfigTCP_TX_BUFFER_LENGTH must be at least 0 +#endif + +#if ( ipconfigTCP_TX_BUFFER_LENGTH > SIZE_MAX ) + #error ipconfigTCP_TX_BUFFER_LENGTH overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_TIME_TO_LIVE + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_TIME_TO_LIVE + * + * Type: uint8_t + * Unit: 'hops' + * Minimum: 0 + * + * Defines the Time To Live (TTL) values used in outgoing TCP packets. + */ + +#ifndef ipconfigTCP_TIME_TO_LIVE + #define ipconfigTCP_TIME_TO_LIVE ( 128 ) +#endif + +#if ( ipconfigTCP_TIME_TO_LIVE < 0 ) + #error ipconfigTCP_TIME_TO_LIVE must be at least 0 +#endif + +#if ( ipconfigTCP_TIME_TO_LIVE > UINT8_MAX ) + #error ipconfigTCP_TIME_TO_LIVE overflows a uint8_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_TCP_WIN + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_TCP_WIN + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Sliding Windows allows messages to arrive out-of-order. + * + * Set ipconfigUSE_TCP_WIN to 1 to include sliding window behaviour in TCP + * sockets. Set ipconfigUSE_TCP_WIN to 0 to exclude sliding window + * behaviour in TCP sockets. + * + * Sliding windows can increase throughput while minimizing network traffic + * at the expense of consuming more RAM. + * + * The size of the sliding window can be changed from its default using the + * FREERTOS_SO_WIN_PROPERTIES parameter to FreeRTOS_setsockopt(). The + * sliding window size is specified in units of MSS (so if the MSS is set + * to 200 bytes then a sliding window size of 2 is equal to 400 bytes) and + * must always be smaller than or equal to the size of the internal buffers + * in both directions. + * + * If a listening socket creates a new socket in response to an incoming + * connect request then the new socket will inherit the sliding window + * sizes of the listening socket. + */ + +#ifndef ipconfigUSE_TCP_WIN + #define ipconfigUSE_TCP_WIN ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_TCP_WIN != ipconfigDISABLE ) && ( ipconfigUSE_TCP_WIN != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_TCP_WIN configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_SRTT_MINIMUM_VALUE_MS + * + * Type: int32_t + * Unit: milliseconds + * Minimum: 0 + * + * When measuring the Smoothed Round Trip Time (SRTT), + * the result will be rounded up to a minimum value. + * The default has always been 50, but a value of 1000 + * is recommended ( see RFC6298 ) because hosts often delay the + * sending of ACK packets with 200 ms. + */ + +#ifndef ipconfigTCP_SRTT_MINIMUM_VALUE_MS + #define ipconfigTCP_SRTT_MINIMUM_VALUE_MS ( 50 ) +#endif + +#if ( ipconfigTCP_SRTT_MINIMUM_VALUE_MS < 0 ) + #error ipconfigTCP_SRTT_MINIMUM_VALUE_MS must be at least 0 +#endif + +#if ( ipconfigTCP_SRTT_MINIMUM_VALUE_MS > UINT32_MAX ) + #error ipconfigTCP_SRTT_MINIMUM_VALUE_MS overflows a uint32_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_WIN_SEG_COUNT + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_WIN_SEG_COUNT + * + * Type: size_t + * Unit: count of sliding windows + * Minimum: 1 + * + * If ipconfigUSE_TCP_WIN is set to 1 then each socket will use a + * sliding window. Sliding windows allow messages to arrive out-of + * order, and FreeRTOS-Plus-TCP uses window descriptors to track + * information about the packets in a window. + * + * A pool of descriptors is allocated when the first TCP connection is + * made. The descriptors are shared between all the sockets. + * ipconfigTCP_WIN_SEG_COUNT sets the number of descriptors in the + * pool, and each descriptor is approximately 64 bytes. + * + * As an example: If a system will have at most 16 simultaneous TCP + * connections, and each connection will have an Rx and Tx window of at + * most 8 segments, then the worst case maximum number of descriptors + * that will be required is 256 ( 16 * 2 * 8 ). However, the practical + * worst case is normally much lower than this as most packets will + * arrive in order. + */ + +#ifndef ipconfigTCP_WIN_SEG_COUNT + #define ipconfigTCP_WIN_SEG_COUNT ( 256 ) +#endif + +#if ( ipconfigTCP_WIN_SEG_COUNT < 1 ) + #error ipconfigTCP_WIN_SEG_COUNT must be at least 1 +#endif + +#if ( ipconfigTCP_WIN_SEG_COUNT > SIZE_MAX ) + #error ipconfigTCP_WIN_SEG_COUNT overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * pvPortMallocLarge / vPortFreeLarge + * + * Malloc functions specific to large TCP buffers for Rx/Tx. + */ + +#ifndef pvPortMallocLarge + #define pvPortMallocLarge( size ) pvPortMalloc( size ) +#endif + +#ifndef vPortFreeLarge + #define vPortFreeLarge( ptr ) vPortFree( ptr ) +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* TCP CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* UDP CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUDP_MAX_RX_PACKETS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUDP_MAX_RX_PACKETS + * + * Type: UBaseType_t + * Unit: rx packets + * Minimum: 0 + * + * ipconfigUDP_MAX_RX_PACKETS defines the maximum number of packets that can + * exist in the Rx queue of a UDP socket. For example, if + * ipconfigUDP_MAX_RX_PACKETS is set to 5 and there are already 5 packets + * queued on the UDP socket then subsequent packets received on that socket + * will be dropped until the queue length is less than 5 again. + * Can be overridden with the socket option 'FREERTOS_SO_UDP_MAX_RX_PACKETS'. + */ + +#ifndef ipconfigUDP_MAX_RX_PACKETS + #define ipconfigUDP_MAX_RX_PACKETS ( 0 ) +#endif + +#if ( ipconfigUDP_MAX_RX_PACKETS < 0 ) + #error ipconfigUDP_MAX_RX_PACKETS must be at least 0 +#endif + +#if ( ipconfigUDP_MAX_RX_PACKETS > UINT_FAST8_MAX ) + #error ipconfigUDP_MAX_RX_PACKETS overflows a UBaseType_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * Sockets have a send block time attribute. If FreeRTOS_sendto() is called but + * a network buffer cannot be obtained, then the calling RTOS task is held in + * the Blocked state (so other tasks can continue to executed) until either a + * network buffer becomes available or the send block time expires. If the send + * block time expires then the send operation is aborted. + * + * The maximum allowable send block time is capped to the value set by + * ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS. Capping the maximum allowable send + * block time prevents prevents a deadlock occurring when all the network + * buffers are in use and the tasks that process (and subsequently free) the + * network buffers are themselves blocked waiting for a network buffer. + * + * ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in + * milliseconds can be converted to a time in ticks by dividing the time in + * milliseconds by portTICK_PERIOD_MS. + */ + +#ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS + #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 20 ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * If enabled then UDP packets that have their checksum value set to 0 will be + * accepted, which is in compliance with the UDP specification. Otherwise they + * will be dropped, which deviates from the UDP specification, but is safer. + */ + +#ifndef ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS + #define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS ipconfigDISABLE +#endif + +#if ( ( ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS != ipconfigDISABLE ) && ( ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS != ipconfigENABLE ) ) + #error Invalid ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUDP_TIME_TO_LIVE + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUDP_TIME_TO_LIVE + * + * Type: uint8_t + * Units: 'hops' + * Minimum: 0 + * + * Defines the Time To Live (TTL) values used in outgoing UDP packets. + */ + +#ifndef ipconfigUDP_TIME_TO_LIVE + #define ipconfigUDP_TIME_TO_LIVE ( 128 ) +#endif + +#if ( ipconfigUDP_TIME_TO_LIVE < 0 ) + #error ipconfigUDP_TIME_TO_LIVE must be at least 0 +#endif + +#if ( ipconfigUDP_TIME_TO_LIVE > UINT8_MAX ) + #error ipconfigUDP_TIME_TO_LIVE overflows a uint8_t +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* UDP CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* SOCKET CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * The address of a socket is the combination of its IP address and its port + * number. FreeRTOS_bind() is used to manually allocate a port number to a + * socket (to 'bind' the socket to a port), but manual binding is not normally + * necessary for client sockets (those sockets that initiate outgoing + * connections rather than wait for incoming connections on a known port + * number). If ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling + * FreeRTOS_sendto() on a socket that has not yet been bound will result in the + * IP stack automatically binding the socket to a port number from the range + * socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If + * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling + * FreeRTOS_sendto() on a socket that has not yet been bound will result + * in the send operation being aborted. + */ + +#ifndef ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND + #define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND ipconfigENABLE +#endif + +#if ( ( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND != ipconfigDISABLE ) && ( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND != ipconfigENABLE ) ) + #error Invalid ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSUPPORT_SELECT_FUNCTION + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSUPPORT_SELECT_FUNCTION + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for FreeRTOS_select() and associated API functions. + */ + +#ifndef ipconfigSUPPORT_SELECT_FUNCTION + #define ipconfigSUPPORT_SELECT_FUNCTION ipconfigDISABLE +#endif + +#if ( ( ipconfigSUPPORT_SELECT_FUNCTION != ipconfigDISABLE ) && ( ipconfigSUPPORT_SELECT_FUNCTION != ipconfigENABLE ) ) + #error Invalid ipconfigSUPPORT_SELECT_FUNCTION configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSELECT_USES_NOTIFY + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSELECT_USES_NOTIFY + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * This option is only used in case the socket-select functions are + * activated (when ipconfigSUPPORT_SELECT_FUNCTION is non-zero). When + * calling select() for a given socket from the same task, this macro is + * not required. Only when there are multiple tasks using select on the + * same sockets, this option may prevent a dead-lock. The problem is that + * the event bit eSELECT_CALL_IP is waited for and cleared by multiple + * tasks. + */ + +#ifndef ipconfigSELECT_USES_NOTIFY + #define ipconfigSELECT_USES_NOTIFY ipconfigDISABLE +#endif + +#if ( ( ipconfigSELECT_USES_NOTIFY != ipconfigDISABLE ) && ( ipconfigSELECT_USES_NOTIFY != ipconfigENABLE ) ) + #error Invalid ipconfigSELECT_USES_NOTIFY configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * API functions used to read data from a socket can block to wait for data to + * become available. ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME sets the default + * block time defined in RTOS ticks. If ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME + * is not defined then the default block time will be set to portMAX_DELAY - + * meaning an RTOS task that is blocked on a socket read will not leave the + * Blocked state until data is available. Note that tasks in the Blocked state + * do not consume any CPU time. + * + * ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME is specified in ticks. The macros + * pdMS_TO_TICKS() and portTICK_PERIOD_MS can both be used to convert a time + * specified in milliseconds to a time specified in ticks, e.g. 2000 ms: + * + * #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME pdMS_TO_TICKS( 2000U ) + * + * The timeout time can be changed at any time using the FREERTOS_SO_RCVTIMEO + * parameter with FreeRTOS_setsockopt(). Note: Infinite block times should be + * used with extreme care in order to avoid a situation where all tasks are + * blocked indefinitely to wait for another RTOS task (which is also blocked + * indefinitely) to free a network buffer. + * + * A socket can be set to non-blocking mode by setting both the send and + * receive block time to 0. This might be desirable when an RTOS task is using + * more than one socket - in which case blocking can instead by performed on + * all the sockets at once using FreeRTOS_select(), or the RTOS task can + * set ipconfigSOCKET_HAS_USER_SEMAPHORE to one, then block on its own + * semaphore. + */ + +#ifndef ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME + #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME portMAX_DELAY +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * When writing to a socket, the write may not be able to proceed immediately. + * For example, depending on the configuration, a write might have to wait for + * a network buffer to become available. + * It determines the number of clock ticks that FreeRTOS_send() must wait + * for space in the transmission buffer. For FreeRTOS_sendto(), it limits + * how long the application should wait for a network buffer to become available. + * + * See ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME + */ + +#ifndef ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME + #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME portMAX_DELAY +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSOCKET_HAS_USER_SEMAPHORE + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSOCKET_HAS_USER_SEMAPHORE + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Allows a semaphore to be provided that will be given after important events + * to wake up the user. + * + * Set by calling FreeRTOS_setsockopt() with the FREERTOS_SO_SET_SEMAPHORE + * option and a pointer to a semaphore. Once set, the semaphore will be signalled + * after every important socket event: READ, WRITE, EXCEPTION. + * Note that a READ event is also generated for a TCP socket in listen mode, + * and a WRITE event is generated when a call to connect() has succeeded. + * Beside that, READ and WRITE are the normal events that occur when + * data has been received or delivered. + * + * Can be used with non-blocking sockets as an alternative to + * FreeRTOS_select in order to handle multiple sockets at once. + */ + +#ifndef ipconfigSOCKET_HAS_USER_SEMAPHORE + #define ipconfigSOCKET_HAS_USER_SEMAPHORE ipconfigDISABLE +#endif + +#if ( ( ipconfigSOCKET_HAS_USER_SEMAPHORE != ipconfigDISABLE ) && ( ipconfigSOCKET_HAS_USER_SEMAPHORE != ipconfigENABLE ) ) + #error Invalid ipconfigSOCKET_HAS_USER_SEMAPHORE configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSOCKET_HAS_USER_WAKE_CALLBACK + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSOCKET_HAS_USER_WAKE_CALLBACK + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables usage of an application defined hook that will be called after + * one of the following events: + * + * eSOCKET_RECEIVE = 0x0001, * Reception of new data. * + * eSOCKET_SEND = 0x0002, * Some data has been sent. * + * eSOCKET_ACCEPT = 0x0004, * A new TCP client was detected, please call accept(). * + * eSOCKET_CONNECT = 0x0008, * A TCP connect has succeeded or timed-out. * + * eSOCKET_BOUND = 0x0010, * A socket got bound. * + * eSOCKET_CLOSED = 0x0020, * A TCP connection got closed. * + * eSOCKET_INTR = 0x0040, * A blocking API call got interrupted, because + * * the function FreeRTOS_SignalSocket() was called. * + * + * It is not a good idea to do a lot of processing in any of the application + * hooks. Normally the hook will only notify the task that owns the socket so + * that the socket gets immediate attention. + * + * Function prototype: + * + * typedef void (* SocketWakeupCallback_t)( Socket_t pxSocket ) + */ + +#ifndef ipconfigSOCKET_HAS_USER_WAKE_CALLBACK + #define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ipconfigDISABLE +#endif + +#if ( ( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK != ipconfigDISABLE ) && ( ipconfigSOCKET_HAS_USER_WAKE_CALLBACK != ipconfigENABLE ) ) + #error Invalid ipconfigSOCKET_HAS_USER_WAKE_CALLBACK configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigSUPPORT_SIGNALS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSUPPORT_SIGNALS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * Include support for FreeRTOS_SignalSocket(). + * + * Used to interrupt a socket during a blocked read allowing the task proceed. + * A signal interruption can be distinguished from a read through the return + * value -pdFREERTOS_ERRNO_EINTR. + */ + +#ifndef ipconfigSUPPORT_SIGNALS + #define ipconfigSUPPORT_SIGNALS ipconfigDISABLE +#endif + +#if ( ( ipconfigSUPPORT_SIGNALS != ipconfigDISABLE ) && ( ipconfigSUPPORT_SIGNALS != ipconfigENABLE ) ) + #error Invalid ipconfigSUPPORT_SIGNALS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_CALLBACKS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_CALLBACKS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * Allows usage of application defined hooks for socket events. + * + * Can be set by calling FreeRTOS_setsockopt() with any of the following + * options and a pointer to a F_TCP_UDP_Handler_t. + * + * FREERTOS_SO_TCP_CONN_HANDLER * Callback for (dis)connection events. * + * FREERTOS_SO_TCP_RECV_HANDLER * Callback for receiving TCP data. * + * FREERTOS_SO_TCP_SENT_HANDLER * Callback for sending TCP data. * + * FREERTOS_SO_UDP_RECV_HANDLER * Callback for receiving UDP data. * + * FREERTOS_SO_UDP_SENT_HANDLER * Callback for sending UDP data. * + * + * typedef struct xTCP_UDP_HANDLER + * { + * FOnConnected_t pxOnTCPConnected; * FREERTOS_SO_TCP_CONN_HANDLER * + * FOnTCPReceive_t pxOnTCPReceive; * FREERTOS_SO_TCP_RECV_HANDLER * + * FOnTCPSent_t pxOnTCPSent; * FREERTOS_SO_TCP_SENT_HANDLER * + * FOnUDPReceive_t pxOnUDPReceive; * FREERTOS_SO_UDP_RECV_HANDLER * + * FOnUDPSent_t pxOnUDPSent; * FREERTOS_SO_UDP_SENT_HANDLER * + * } F_TCP_UDP_Handler_t + * + * Function Prototypes: + * + * typedef void (* FOnConnected_t )( Socket_t xSocket, + * BaseType_t ulConnected ) + * + * typedef BaseType_t (* FOnTCPReceive_t )( Socket_t xSocket, + * void * pData, + * size_t xLength ) + * + * typedef void (* FOnTCPSent_t )( Socket_t xSocket, + * size_t xLength ) + * + * typedef BaseType_t (* FOnUDPReceive_t ) ( Socket_t xSocket, + * void * pData, + * size_t xLength, + * const struct freertos_sockaddr * pxFrom, + * const struct freertos_sockaddr * pxDest ) + * + * typedef void (* FOnUDPSent_t )( Socket_t xSocket, + * size_t xLength ); + */ + +#ifndef ipconfigUSE_CALLBACKS + #define ipconfigUSE_CALLBACKS ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_CALLBACKS != ipconfigDISABLE ) && ( ipconfigUSE_CALLBACKS != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_CALLBACKS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigIS_VALID_PROG_ADDRESS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigIS_VALID_PROG_ADDRESS + * + * Type: Macro Function + * Value: BaseType_t ( pdTRUE | pdFALSE ) + * + * Verifies that a given address refers to valid (instruction) memory. + * + * Used to check if application defined hooks are valid. + * + * Example: + * if( ipconfigIS_VALID_PROG_ADDRESS( pxSocket->u.xTCP.pxHandleSent ) ) + * { + * pxSocket->u.xTCP.pxHandleSent( pxSocket, ulCount ); + * } + */ + +#ifndef ipconfigIS_VALID_PROG_ADDRESS + #define ipconfigIS_VALID_PROG_ADDRESS( pxAddress ) ( ( pxAddress ) != NULL ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * pvPortMallocSocket/vPortFreeSocket + * + * Malloc functions specific to sockets. + */ + +#ifndef pvPortMallocSocket + #define pvPortMallocSocket( size ) pvPortMalloc( size ) +#endif + +#ifndef vPortFreeSocket + #define vPortFreeSocket( ptr ) vPortFree( ptr ) +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* SOCKET CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DHCP CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_DHCP + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Allows DHCP to be enabled by setting by setting `endpoint->bits.bWantDHCP`. + * + * When successful, DHCP will assign an IP-address, a netmask, a gateway + * address, and one or more DNS addresses to the endpoint. DHCP must be able to + * receive an options field of 312 bytes, the fixed part of the DHCP packet is + * 240 bytes, and the IP/UDP headers take 28 bytes. + */ + +#ifndef ipconfigUSE_DHCP + #define ipconfigUSE_DHCP ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_DHCP != ipconfigDISABLE ) && ( ipconfigUSE_DHCP != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_DHCP configuration +#endif + +#if ( ( ipconfigUSE_DHCP != ipconfigDISABLE ) && ( ipconfigNETWORK_MTU < 586 ) ) + + #error ipconfigNETWORK_MTU needs to be at least 586 to use DHCP +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_DHCPv6 + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for DHCPv6. + * + * The use of DHCP can be enabled per endpoint by setting + * `endpoint->bits.bWantDHCP`. + * + * An alternative way of obtaining an IP-address is Router Advertisement ("RA"). + * As RA is generally preferred above DHCP, ipconfigUSE_RA is enabled and + * ipconfigUSE_DHCPv6 is disabled by default. + */ + +#ifndef ipconfigUSE_DHCPv6 + #define ipconfigUSE_DHCPv6 ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_DHCPv6 != ipconfigDISABLE ) && ( ipconfigUSE_DHCPv6 != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_DHCPv6 configuration +#endif + +#if ( ipconfigIS_ENABLED( ipconfigUSE_DHCPv6 ) && ipconfigIS_DISABLED( ipconfigUSE_IPv6 ) ) + #error DHCPv6 Cannot be enabled without IPv6 +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDHCP_REGISTER_HOSTNAME + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDHCP_REGISTER_HOSTNAME + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables usage of an application defined hook to provide a hostname to a DHCP + * server. + * + * Function prototype: + * + * const char *pcApplicationHostnameHook( void ) + */ + +#ifndef ipconfigDHCP_REGISTER_HOSTNAME + #define ipconfigDHCP_REGISTER_HOSTNAME ipconfigDISABLE +#endif + +#if ( ( ipconfigDHCP_REGISTER_HOSTNAME != ipconfigDISABLE ) && ( ipconfigDHCP_REGISTER_HOSTNAME != ipconfigENABLE ) ) + #error Invalid ipconfigDHCP_REGISTER_HOSTNAME configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_DHCP_HOOK + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DHCP_HOOK + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables usage of an application defined hook during the DHCP process before + * the initial discovery packet is sent, and after a DHCP offer has been + * received. + * + * Function Prototype: + * + * Function prototype if ipconfigIPv4_BACKWARD_COMPATIBLE is enabled: + * + * eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, + * uint32_t ulIPAddress ) + * + * Function prototype by default: + * + * eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase, + * struct xNetworkEndPoint * pxEndPoint, + * IP_Address_t * pxIPAddress ); + */ + +#ifndef ipconfigUSE_DHCP_HOOK + #define ipconfigUSE_DHCP_HOOK ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_DHCP_HOOK != ipconfigDISABLE ) && ( ipconfigUSE_DHCP_HOOK != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_DHCP_HOOK configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDHCP_FALL_BACK_AUTO_IP + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * If no DHCP server responds, allocate a random LinkLayer IP address. + * + * Requires ipconfigARP_USE_CLASH_DETECTION to be enabled as well in order to + * test if it is still available. + * + * An alternative is to resort to a static IP address. + */ + +#ifndef ipconfigDHCP_FALL_BACK_AUTO_IP + #define ipconfigDHCP_FALL_BACK_AUTO_IP ipconfigDISABLE +#endif + +#if ( ( ipconfigDHCP_FALL_BACK_AUTO_IP != ipconfigDISABLE ) && ( ipconfigDHCP_FALL_BACK_AUTO_IP != ipconfigENABLE ) ) + #error Invalid ipconfigDHCP_FALL_BACK_AUTO_IP configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigMAXIMUM_DISCOVER_TX_PERIOD + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigMAXIMUM_DISCOVER_TX_PERIOD + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * Sets the max interval allowed between transmissions of DHCP requests before + * the default IP address will be used. + * + * When 'endpoint->bits.bWantDHCP' is set, DHCP requests will be sent out at + * increasing time intervals until either a reply is received from a DHCP + * server and accepted, or the interval between transmissions reaches + * ipconfigMAXIMUM_DISCOVER_TX_PERIOD. If no reply is received, the TCP/IP + * stack will revert to using the default IP address of the endpoint + * 'endpoint->ipv4_defaults.ulIPAddress' for IPv4 address or + * 'endpoint->ipv6_defaults.xIPAddress' for IPv6 address. + */ + +#ifndef ipconfigMAXIMUM_DISCOVER_TX_PERIOD + #ifdef _WINDOWS_ + #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD pdMS_TO_TICKS( 999 ) + #else + #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD pdMS_TO_TICKS( 30000 ) + #endif +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* DHCP CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DNS CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_DNS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DNS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enable ipconfigUSE_DNS to include a basic DNS client/resolver. DNS is used + * through functions like FreeRTOS_getaddrinfo() and FreeRTOS_gethostbyname(). + * + * Allows name discovery protocols like mDNS, LLMNR and NBNS to be enabled as + * well. + * + * See: ipconfigUSE_MDNS, ipconfigUSE_LLMNR, ipconfigUSE_NBNS + */ + +#ifndef ipconfigUSE_DNS + #define ipconfigUSE_DNS ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_DNS != ipconfigDISABLE ) && ( ipconfigUSE_DNS != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_DNS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_DNS_CACHE + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_DNS_CACHE + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables usage of the DNS cache. + */ + +#ifndef ipconfigUSE_DNS_CACHE + #define ipconfigUSE_DNS_CACHE ipconfigENABLE +#endif + +#if ( ( ipconfigUSE_DNS_CACHE != ipconfigDISABLE ) && ( ipconfigUSE_DNS_CACHE != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_DNS_CACHE configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_CACHE_ENTRIES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDNS_CACHE_ENTRIES + * + * Type: size_t + * Unit: count of DNS cache entries + * Minimum: 1 + * + * Defines the number of entries in the DNS cache. + */ + +#ifndef ipconfigDNS_CACHE_ENTRIES + #define ipconfigDNS_CACHE_ENTRIES ( 1 ) +#endif + +#if ( ipconfigDNS_CACHE_ENTRIES < 1 ) + #error ipconfigDNS_CACHE_ENTRIES must be at least 1 +#endif + +#if ( ipconfigDNS_CACHE_ENTRIES > SIZE_MAX ) + #error ipconfigDNS_CACHE_ENTRIES overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_CACHE_NAME_LENGTH + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDNS_CACHE_NAME_LENGTH + * + * Type: size_t + * Unit: count of hostname chars + * Minimum: 1 + * + * The maximum number of characters a DNS host name can take, including + * the NULL terminator. + * + * Stack warning: the function DNS_ParseDNSReply() declares a local object + * of type 'ParseSet_t', which contains a copy of an URL: + * + * char pcName[ ipconfigDNS_CACHE_NAME_LENGTH ]; + * + * plus another 52 bytes. + */ + +#ifndef ipconfigDNS_CACHE_NAME_LENGTH + #define ipconfigDNS_CACHE_NAME_LENGTH ( 254 ) +#endif + +#if ( ipconfigDNS_CACHE_NAME_LENGTH < 1 ) + #error ipconfigDNS_CACHE_NAME_LENGTH must be at least 1 +#endif + +#if ( ipconfigDNS_CACHE_NAME_LENGTH > SIZE_MAX ) + #error ipconfigDNS_CACHE_NAME_LENGTH overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY + * + * Type: size_t + * Unit: count of IP addresses + * Minimum: 1 + * + * Sets how many IP addresses can be stored when looking up a URL. + */ + +#ifndef ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY + #define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 1 ) +#endif + +#if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY < 1 ) + #error ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY must be at least 1 +#endif + +#if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY > SIZE_MAX ) + #error ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_REQUEST_ATTEMPTS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDNS_REQUEST_ATTEMPTS + * + * Type: size_t + * Unit: count of request attempts + * Minimum: 1 + * + * Sets the most amount of times the library can send a DNS result and wait for + * a result when looking up a host. + * + * See ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS & ipconfigDNS_SEND_BLOCK_TIME_TICKS + */ + +#ifndef ipconfigDNS_REQUEST_ATTEMPTS + #define ipconfigDNS_REQUEST_ATTEMPTS ( 5 ) +#endif + +#if ( ipconfigDNS_REQUEST_ATTEMPTS < 1 ) + #error ipconfigDNS_REQUEST_ATTEMPTS must be at least 1 +#endif + +#if ( ipconfigDNS_REQUEST_ATTEMPTS > SIZE_MAX ) + #error ipconfigDNS_REQUEST_ATTEMPTS overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * When looking up a host with DNS, this macro determines how long the + * call to FreeRTOS_sendto() will wait for a reply. When there is no + * reply, the request will be repeated up to 'ipconfigDNS_REQUEST_ATTEMPTS' + * attempts. + * See ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME + * + * Applies to DNS socket only. + */ + +#ifndef ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS + #define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000 ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_SEND_BLOCK_TIME_TICKS + * + * Type: TickType_t + * Unit: Ticks + * Minimum: 0 + * Maximum: portMAX_DELAY + * + * When looking up a host with DNS, this macro determines how long the + * call to FreeRTOS_sendto() will block to wait for a free buffer. + * See ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME + * + * Applies to DNS socket only. + */ + +#ifndef ipconfigDNS_SEND_BLOCK_TIME_TICKS + #define ipconfigDNS_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500 ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigDNS_USE_CALLBACKS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigDNS_USE_CALLBACKS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables callback functionality in the DNS process. + * + * Application defined callbacks can be provided as parameters in calls + * to FreeRTOS_gethostbyname_a() & FreeRTOS_getaddrinfo_a(). These functions + * will start a DNS-lookup and call the callback when either the URL has been + * found, or when a time-out has been reached. These functions are + * non-blocking, the suffix "_a" stands for asynchronous. The callback can be + * canceled by using FreeRTOS_gethostbyname_cancel(). + * + * Function Prototype: + * + * void (* FOnDNSEvent ) ( const char * pcName, void * pvSearchID, struct freertos_addrinfo * pxAddressInfo ) + */ + +#ifndef ipconfigDNS_USE_CALLBACKS + #define ipconfigDNS_USE_CALLBACKS ipconfigDISABLE +#endif + +#if ( ( ipconfigDNS_USE_CALLBACKS != ipconfigDISABLE ) && ( ipconfigDNS_USE_CALLBACKS != ipconfigENABLE ) ) + #error Invalid ipconfigDNS_USE_CALLBACKS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_LLMNR + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_LLMNR + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for Link Local Multicast Name Resolution (LLMNR). + */ + +#ifndef ipconfigUSE_LLMNR + #define ipconfigUSE_LLMNR ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_LLMNR != ipconfigDISABLE ) && ( ipconfigUSE_LLMNR != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_LLMNR configuration +#endif + +#if ( ipconfigIS_ENABLED( ipconfigUSE_LLMNR ) && ipconfigIS_DISABLED( ipconfigUSE_DNS ) ) + #error When LLMNR is enabled, ipconfigUSE_DNS must also be enabled +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_NBNS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_NBNS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for NetBIOS Name Service (NBNS). + */ + +#ifndef ipconfigUSE_NBNS + #define ipconfigUSE_NBNS ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_NBNS != ipconfigDISABLE ) && ( ipconfigUSE_NBNS != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_NBNS configuration +#endif + +#if ( ipconfigIS_ENABLED( ipconfigUSE_NBNS ) && ipconfigIS_DISABLED( ipconfigUSE_DNS ) ) + #error When NBNS is enabled, ipconfigUSE_DNS must also be enabled +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_MDNS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for Multicast DNS (MDNS). + */ + +#ifndef ipconfigUSE_MDNS + #define ipconfigUSE_MDNS ipconfigDISABLE +#endif + +#if ( ( ipconfigUSE_MDNS != ipconfigDISABLE ) && ( ipconfigUSE_MDNS != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_MDNS configuration +#endif + +#if ( ipconfigIS_ENABLED( ipconfigUSE_MDNS ) && ipconfigIS_DISABLED( ipconfigUSE_DNS ) ) + #error When MDNS is enabled, ipconfigUSE_DNS must also be enabled +#endif + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* DNS CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* ARP CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigARP_CACHE_ENTRIES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigARP_CACHE_ENTRIES + * + * Type: size_t + * Unit: count of arp cache entries + * Minimum: 1 + * + * Defines the maximum number of entries that can exist in the ARP table at any + * one time. + * + * The ARP cache is a table that maps IP addresses to MAC addresses. The IP + * stack can only send a UDP message to a remove IP address if it knowns + * the MAC address associated with the IP address, or the MAC address of the + * router used to contact the remote IP address. When a UDP message is received + * from a remote IP address, the MAC address and IP address are added to the + * ARP cache. When a UDP message is sent to a remote IP address that does not + * already appear in the ARP cache, then the UDP message is replaced by a ARP + * message that solicits the required MAC address information. + */ + +#ifndef ipconfigARP_CACHE_ENTRIES + #define ipconfigARP_CACHE_ENTRIES ( 10 ) +#endif + +#if ( ipconfigARP_CACHE_ENTRIES < 1 ) + #error ipconfigARP_CACHE_ENTRIES must be at least 1 +#endif + +#if ( ipconfigARP_CACHE_ENTRIES > SIZE_MAX ) + #error ipconfigARP_CACHE_ENTRIES overflows a size_t +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigARP_STORES_REMOTE_ADDRESSES + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigARP_STORES_REMOTE_ADDRESSES + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * Normally, the ARP table will only store IP-addresses that are located + * in the local subnet. This macro enables the storage of remote addresses + * in the ARP table along with the associated MAC address from which the + * message was received. + * + * Provided for the case when a message that requires a reply arrives from the + * Internet, but from a computer attached to a LAN rather than via the defined + * gateway. Before replying to the message, the TCP/IP stack RTOS task will + * loop up the message's IP address in the ARP table. If disabled then ARP will + * return the MAC address of the defined gateway because the destination + * address is outside of the netmask, which might prevent the reply reaching + * its intended destination. This macro can allow the message in this scenario + * to be routed and delivered correctly. + */ + +#ifndef ipconfigARP_STORES_REMOTE_ADDRESSES + #define ipconfigARP_STORES_REMOTE_ADDRESSES ipconfigDISABLE +#endif + +#if ( ( ipconfigARP_STORES_REMOTE_ADDRESSES != ipconfigDISABLE ) && ( ipconfigARP_STORES_REMOTE_ADDRESSES != ipconfigENABLE ) ) + #error Invalid ipconfigARP_STORES_REMOTE_ADDRESSES configuration +#endif + +/*---------------------------------------------------------------------------*/ + +#if ( ipconfigIS_ENABLED( ipconfigUSE_DHCP ) && ipconfigIS_ENABLED( ipconfigDHCP_FALL_BACK_AUTO_IP ) ) + +/*-----------------------------------------------------------------------*/ + +/* + * ipconfigARP_USE_CLASH_DETECTION + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigARP_USE_CLASH_DETECTION + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables the driver to test if an assigned link-layer address is already + * taken by another device by sending ARP requests. + * + * ipconfigDHCP_FALL_BACK_AUTO_IP requires this feature to be enabled. + */ + + #ifndef ipconfigARP_USE_CLASH_DETECTION + #define ipconfigARP_USE_CLASH_DETECTION ipconfigENABLE + #endif + + #if ( ( ipconfigARP_USE_CLASH_DETECTION != ipconfigDISABLE ) && ( ipconfigARP_USE_CLASH_DETECTION != ipconfigENABLE ) ) + #error Invalid ipconfigARP_USE_CLASH_DETECTION configuration + #endif + + #if ( ipconfigIS_DISABLED( ipconfigARP_USE_CLASH_DETECTION ) ) + #error When ipconfigDHCP_FALL_BACK_AUTO_IP is enabled, ipconfigARP_USE_CLASH_DETECTION must also be enabled + #endif + +/*-----------------------------------------------------------------------*/ + +#else /* ( ( ipconfigIS_ENABLED( ipconfigUSE_DHCP ) && ipconfigIS_ENABLED( ipconfigDHCP_FALL_BACK_AUTO_IP ) ) */ + +/*-----------------------------------------------------------------------*/ + + #ifndef ipconfigARP_USE_CLASH_DETECTION + #define ipconfigARP_USE_CLASH_DETECTION ipconfigDISABLE + #endif + + #if ( ipconfigIS_ENABLED( ipconfigARP_USE_CLASH_DETECTION ) ) + #error ipconfigARP_USE_CLASH_DETECTION is unused when ipconfigDHCP_FALL_BACK_AUTO_IP is disabled + #endif + +/*-----------------------------------------------------------------------*/ + +#endif /* ( ipconfigIS_ENABLED( ipconfigUSE_DHCP ) && ipconfigIS_ENABLED( ipconfigDHCP_FALL_BACK_AUTO_IP ) ) */ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigMAX_ARP_AGE + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigMAX_ARP_AGE + * + * Type: uint8_t + * Unit: decaseconds + * Minimum: 0 + * + * Defines the maximum time between an entry in the ARP table being created or + * refreshed and the entry being removed because it is stale. New ARP requests + * are sent for ARP cache entries that are nearing their maximum age. + * The maximum age of an entry in the ARP cache table can be + * calculated as 'ipARP_TIMER_PERIOD_MS' x 'ipconfigMAX_ARP_AGE'. + * + * Units are derived from ipARP_TIMER_PERIOD_MS, which is 10000 ms or 10 sec. + * So, a value of 150 is equal to 1500 seconds. + */ + +#ifndef ipconfigMAX_ARP_AGE + #define ipconfigMAX_ARP_AGE ( 150 ) #endif -/* When looking up a host with DNS, this macro determines how long the - * call to FreeRTOS_recvfrom() will wait for a reply. - * When there is no reply, the request will be repeated up to - * 'ipconfigDNS_REQUEST_ATTEMPTS' attempts. */ -#ifndef ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS - #define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U ) +#if ( ipconfigMAX_ARP_AGE < 0 ) + #error ipconfigMAX_ARP_AGE must be at least 0 #endif -/* When looking up a host with DNS, this macro determines how long the - * call to FreeRTOS_sendto() will block to wait for a free buffer. */ -#ifndef ipconfigDNS_SEND_BLOCK_TIME_TICKS - #define ipconfigDNS_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500U ) +#if ( ipconfigMAX_ARP_AGE > UINT8_MAX ) + #error ipconfigMAX_ARP_AGE overflows a uint8_t #endif -/* The number of times a DNS request will be send before giving up. */ -#ifndef ipconfigDNS_REQUEST_ATTEMPTS - #define ipconfigDNS_REQUEST_ATTEMPTS 5 +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigMAX_ARP_RETRANSMISSIONS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigMAX_ARP_RETRANSMISSIONS + * + * Type: uint8_t + * Unit: count of retransmissions + * Minimum: 0 + * + * Sets the number of times an ARP request is sent when looking up an + * IP-address. Also referred as the maximum amount of retransmissions + * of ARP requests that do not result in an ARP response before the ARP + * request is aborted. + */ + +#ifndef ipconfigMAX_ARP_RETRANSMISSIONS + #define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) #endif -/* The results of DNS lookup's can be stored in a cache table. */ -#ifndef ipconfigUSE_DNS_CACHE - #define ipconfigUSE_DNS_CACHE 1 +#if ( ipconfigMAX_ARP_RETRANSMISSIONS < 0 ) + #error ipconfigMAX_ARP_RETRANSMISSIONS must be at least 0 #endif -#if ( ipconfigUSE_DNS_CACHE != 0 ) +#if ( ipconfigMAX_ARP_RETRANSMISSIONS > UINT8_MAX ) + #error ipconfigMAX_ARP_RETRANSMISSIONS overflows a uint8_t +#endif -/* Per https://tools.ietf.org/html/rfc1035 253 is the maximum string length - * of a DNS name. The following default accounts for a null terminator. */ - #ifndef ipconfigDNS_CACHE_NAME_LENGTH - #define ipconfigDNS_CACHE_NAME_LENGTH 254U - #endif +/*---------------------------------------------------------------------------*/ -/* The number of entries in the DNS cache table. - * The default of 1 is maybe too economic. */ - #ifndef ipconfigDNS_CACHE_ENTRIES - #define ipconfigDNS_CACHE_ENTRIES 1U - #endif +/* + * ipconfigUSE_ARP_REMOVE_ENTRY + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_ARP_REMOVE_ENTRY + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * Include support for ulARPRemoveCacheEntryByMac() which uses a MAC address to + * look up and remove an entry from the ARP cache. If the MAC address is found + * in the ARP cache, then the IP address associated with the MAC address is + * returned, otherwise 0 is returned. + */ -#endif /* ipconfigUSE_DNS_CACHE != 0 */ +#ifndef ipconfigUSE_ARP_REMOVE_ENTRY + #define ipconfigUSE_ARP_REMOVE_ENTRY ipconfigDISABLE +#endif -/* When accessing services which have multiple IP addresses, setting this - * greater than 1 can improve reliability by returning different IP address - * answers on successive calls to FreeRTOS_gethostbyname(). */ -#ifndef ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY - #define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY 1 +#if ( ( ipconfigUSE_ARP_REMOVE_ENTRY != ipconfigDISABLE ) && ( ipconfigUSE_ARP_REMOVE_ENTRY != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_ARP_REMOVE_ENTRY configuration #endif -/* When 'ipconfigDNS_USE_CALLBACKS' is defined, a function 'FreeRTOS_gethostbyname_a()' - * will become available. - * It is used for asynchronous DNS lookups. - * This function will start a DNS-lookup and set an application hook. - * This hook will be called when either the URL has been found, or when - * a time-out has been reached. - * Note that the function 'FreeRTOS_gethostbyname_a()' will not make use of the - * macros 'ipconfigDNS_SEND_BLOCK_TIME_TICKS', 'ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS' - * or 'ipconfigDNS_REQUEST_ATTEMPTS'. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_ARP_REVERSED_LOOKUP + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigUSE_ARP_REVERSED_LOOKUP + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Advanced users only. + * + * Include support for eARPGetCacheEntryByMac() which looks up a MAC address + * from an IP address. + * + * ARP normally does the reverse by looking up an IP address from a MAC + * address. */ -#ifndef ipconfigDNS_USE_CALLBACKS - #define ipconfigDNS_USE_CALLBACKS 0 -#endif -/* Include support for LLMNR: Link-local Multicast Name Resolution. */ -#ifndef ipconfigUSE_LLMNR - #define ipconfigUSE_LLMNR ( 0 ) +#ifndef ipconfigUSE_ARP_REVERSED_LOOKUP + #define ipconfigUSE_ARP_REVERSED_LOOKUP ipconfigDISABLE #endif -/* Include support for NBNS: NetBIOS Name Server. */ -#ifndef ipconfigUSE_NBNS - #define ipconfigUSE_NBNS 0 +#if ( ( ipconfigUSE_ARP_REVERSED_LOOKUP != ipconfigDISABLE ) && ( ipconfigUSE_ARP_REVERSED_LOOKUP != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_ARP_REVERSED_LOOKUP configuration #endif -/* Include support for MDNS: Multicast DNS. */ -#ifndef ipconfigUSE_MDNS - #define ipconfigUSE_MDNS 0 -#endif +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* ARP CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* ICMP CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigREPLY_TO_INCOMING_PINGS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigREPLY_TO_INCOMING_PINGS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables generation of replies to incoming ICMP echo (ping) requests. + * + * Normally it is quite desirable when embedded devices respond to a ping + * request. Endpoints of the type IPv6 will reply to a ping request + * unconditionally. + */ -/* It is recommended to let the application respond to incoming ping - * requests. */ #ifndef ipconfigREPLY_TO_INCOMING_PINGS - #define ipconfigREPLY_TO_INCOMING_PINGS 1 + #define ipconfigREPLY_TO_INCOMING_PINGS ipconfigENABLE #endif -/* Add code for outgoing pings as well. */ -#ifndef ipconfigSUPPORT_OUTGOING_PINGS - #define ipconfigSUPPORT_OUTGOING_PINGS 0 +#if ( ( ipconfigREPLY_TO_INCOMING_PINGS != ipconfigDISABLE ) && ( ipconfigREPLY_TO_INCOMING_PINGS != ipconfigENABLE ) ) + #error Invalid ipconfigREPLY_TO_INCOMING_PINGS configuration #endif -/* A MISRA note: The macros 'ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES' - * and 'ipconfigETHERNET_DRIVER_FILTERS_PACKETS' are too long: - * the first 32 bytes are equal, which might cause problems - * for some compilers. */ +/*---------------------------------------------------------------------------*/ -/* Beside that, there is some overlap between the following 3 macros. Here is - * a summary: +/* + * ipconfigICMP_TIME_TO_LIVE * - * 1) ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES - * When disabled, the IP-task will call 'eConsiderFrameForProcessing()' - * to check incoming packets. - * 2) ipconfigETHERNET_DRIVER_FILTERS_PACKETS - * When disabled, the IP-task will perform sanity checks on the IP-header, - * also checking the target IP address. - * Also when disabled, xPortHasUDPSocket() won't be included. That means - * that the IP-task can access the 'xBoundUDPSocketsList' without locking. - * 3) ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES - * When enabled, the function 'eConsiderFrameForProcessing()' will also - * check if the Ethernet frame type is acceptable. - */ - -/* The following macro determines if the network interface will - * do checks on the incoming packets. When false, the IP-task will - * perform these checks in the function eConsiderFrameForProcessing(). + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigICMP_TIME_TO_LIVE + * + * Type: uint8_t + * Unit: 'hops' + * Minimum: 0 * - * It should be noted that it is most efficient to drop unwanted packets - * as early as possible. + * Sets the value of the TTL field when replying to an ICMP packet. + * + * Only used when replying to an ICMP IPv4 ping request. The default of 64 is + * recommended by RFC 1700. */ -#ifndef ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES - #define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1 +#ifndef ipconfigICMP_TIME_TO_LIVE + #define ipconfigICMP_TIME_TO_LIVE ( 64 ) #endif -/* When ipconfigETHERNET_DRIVER_FILTERS_PACKETS is enabled, the network - * interface will inspect the incoming packets to see if they can be - * accepted. - * When enabled, the function 'xPortHasUDPSocket()' will become available. - * That function checks if there is a UDP socket listening to a - * given port number. - */ -#ifndef ipconfigETHERNET_DRIVER_FILTERS_PACKETS - #define ipconfigETHERNET_DRIVER_FILTERS_PACKETS ( 0 ) +#if ( ipconfigICMP_TIME_TO_LIVE < 0 ) + #error ipconfigICMP_TIME_TO_LIVE must be at least 0 #endif -/* When defined as 1, the driver will drop all packets with an unknown - * frame type. - * This macro is only looked at when 'ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES' - * is disabled. - */ -#ifndef ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES - #define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1 +#if ( ipconfigICMP_TIME_TO_LIVE > UINT8_MAX ) + #error ipconfigICMP_TIME_TO_LIVE overflows a uint8_t #endif +/*---------------------------------------------------------------------------*/ -/* The macro 'ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS' was - * introduced to enable a tracing system. - * Currently it is only used in BufferAllocation_2.c. +/* + * ipconfigSUPPORT_OUTGOING_PINGS + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigSUPPORT_OUTGOING_PINGS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Include support for FreeRTOS_SendPingRequest() and + * FreeRTOS_SendPingRequestIPv6() */ -#ifndef configINCLUDE_TRACE_RELATED_CLI_COMMANDS - #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0 -#else - #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS configINCLUDE_TRACE_RELATED_CLI_COMMANDS + +#ifndef ipconfigSUPPORT_OUTGOING_PINGS + #define ipconfigSUPPORT_OUTGOING_PINGS ipconfigDISABLE #endif -/* This macro will be called in every loop the IP-task makes. It may be - * replaced by user-code that triggers a watchdog */ -#ifndef ipconfigWATCHDOG_TIMER - #define ipconfigWATCHDOG_TIMER() +#if ( ( ipconfigSUPPORT_OUTGOING_PINGS != ipconfigDISABLE ) && ( ipconfigSUPPORT_OUTGOING_PINGS != ipconfigENABLE ) ) + #error Invalid ipconfigSUPPORT_OUTGOING_PINGS configuration #endif -/* The option 'ipconfigUSE_CALLBACKS' allows to assign specific application - * hooks to a socket. Each hook will be set with a specific socket option: +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* ICMP CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* ROUTING CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigCOMPATIBLE_WITH_SINGLE * - * FREERTOS_SO_TCP_CONN_HANDLER * Callback for (dis) connection events. - * * Supply pointer to 'F_TCP_UDP_Handler_t' - * FREERTOS_SO_TCP_RECV_HANDLER * Callback for receiving TCP data. - * * Supply pointer to 'F_TCP_UDP_Handler_t' - * FREERTOS_SO_TCP_SENT_HANDLER * Callback for sending TCP data. - * * Supply pointer to 'F_TCP_UDP_Handler_t' - * FREERTOS_SO_UDP_RECV_HANDLER * Callback for receiving UDP data. - * * Supply pointer to 'F_TCP_UDP_Handler_t' - * FREERTOS_SO_UDP_SENT_HANDLER * Callback for sending UDP data. - * * Supply pointer to 'F_TCP_UDP_Handler_t' + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) * - * Note that the call-back functions will run in the IP-task, so very little - * things can be done. Better not to call any networking API, because that - * could easily lead to a deadlock situation. + * Retains compatibility with V3.x.x and older versions that only + * supported one interface. */ -#ifndef ipconfigUSE_CALLBACKS - #define ipconfigUSE_CALLBACKS ( 0 ) -#endif -/* Replace this macro with a test returning non-zero if the memory pointer to by - * pxAddress is valid memory which can contain executable code. - * In fact this is an extra safety measure: if a handler points to invalid memory, - * it will not be called. - * The parameter 'pxAddress' is in fact a pointer to a function. - */ -#if ( ipconfigUSE_CALLBACKS != 0 ) - #ifndef ipconfigIS_VALID_PROG_ADDRESS - #define ipconfigIS_VALID_PROG_ADDRESS( pxAddress ) ( ( pxAddress ) != NULL ) - #endif +#ifndef ipconfigCOMPATIBLE_WITH_SINGLE + #define ipconfigCOMPATIBLE_WITH_SINGLE ipconfigDISABLE #endif -/* The macro 'ipconfigHAS_INLINE_FUNCTIONS' is now deprecated. */ -#ifndef ipconfigHAS_INLINE_FUNCTIONS - #define ipconfigHAS_INLINE_FUNCTIONS ( 1 ) +#if ( ( ipconfigCOMPATIBLE_WITH_SINGLE != ipconfigDISABLE ) && ( ipconfigCOMPATIBLE_WITH_SINGLE != ipconfigENABLE ) ) + #error Invalid ipconfigCOMPATIBLE_WITH_SINGLE configuration #endif -/* Since all code is made compatible with the MISRA rules, the inline functions - * disappear. 'portINLINE' should normally be defined in FreeRTOSCOnfig.h +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigHAS_ROUTING_STATISTICS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) */ -#ifndef portINLINE - #define portINLINE inline -#endif -/* When non-zero, the buffers passed to xNetworkInterfaceOutput() will be passed - * directly to DMA. As soon as sending is ready, the buffers must be released by - * calling vReleaseNetworkBufferAndDescriptor(). */ -#ifndef ipconfigZERO_COPY_TX_DRIVER - #define ipconfigZERO_COPY_TX_DRIVER ( 0 ) +#ifndef ipconfigHAS_ROUTING_STATISTICS + #define ipconfigHAS_ROUTING_STATISTICS ipconfigENABLE #endif -/* When enabled, the network interface will pass the network buffers directly to - * the DMA descriptors. When a packet has been received, the function - * pxPacketBuffer_to_NetworkBuffer() will translate a buffer address to a - * network packet, so it can be passed to the IP-task. */ -#ifndef ipconfigZERO_COPY_RX_DRIVER - #define ipconfigZERO_COPY_RX_DRIVER ( 0 ) +#if ( ( ipconfigHAS_ROUTING_STATISTICS != ipconfigDISABLE ) && ( ipconfigHAS_ROUTING_STATISTICS != ipconfigENABLE ) ) + #error Invalid ipconfigHAS_ROUTING_STATISTICS configuration #endif -/* When ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM is defined as non-zero, - * the network interface is responsible for setting the checksums - * of the outgoing packets. - * This can be either done in hardware, or by calling the checksum - * routines from 'xNetworkInterfaceOutput()'. - */ -#ifndef ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM - #define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM 0 -#endif +/*---------------------------------------------------------------------------*/ -/* When ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM is enabled, - * the network interface is responsible for checking the checksums - * of the incoming packets. If hardware supports checking TCP checksum only, - * the network interface layer should handle the same for other protocols, - * such as IP/UDP/ICMP/etc, and give the checksum verified packets to the - * FreeRTOS-plus-TCP stack. +/* + * ipconfigMULTI_INTERFACE * - * This can be either done in hardware, or by calling the checksum - * functions. + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Used to let applications know that multiple interfaces are supported by + * this version of the TCP/IP stack. + * + * Must be enabled for demo applications to work. */ -#ifndef ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM - #define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 0 + +#ifndef ipconfigMULTI_INTERFACE + #define ipconfigMULTI_INTERFACE ipconfigENABLE +#endif + +#if ( ( ipconfigMULTI_INTERFACE != ipconfigDISABLE ) && ( ipconfigMULTI_INTERFACE != ipconfigENABLE ) ) + #error Invalid ipconfigMULTI_INTERFACE configuration #endif -/* The macro 'ipconfigSOCKET_HAS_USER_SEMAPHORE' is rarely used, yet it - * can be very useful. IT applies to both TCP and UDP sockets. +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* ROUTING CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DEBUG/TRACE/LOGGING CONFIG */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigCHECK_IP_QUEUE_SPACE * - * The application can register a semaphore ( of type 'SemaphoreHandle_t' ) - * in a socket with the option 'FREERTOS_SO_SET_SEMAPHORE'. - * Once set, the semaphore will be signalled after every important socket event: - * READ, WRITE, EXCEPTION. - * Note that a READ event is also generated for a TCP socket in listen mode, - * and a WRITE event is generated when a call to connect() has succeeded. - * Beside that, READ and WRITE are the normal events that occur when - * data has been received or delivered. + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigCHECK_IP_QUEUE_SPACE + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables the IP-Task to track the run-time minimum free space that has + * existed in the event queue (uxQueueMinimumSpace). This value can be + * retrieved using the function uxGetMinimumIPQueueSpace(). + * + * Enables vPrintResourceStats() to log warnings about shrinking queue space. + * + * See ipconfigEVENT_QUEUE_LENGTH for setting the length of the event queue. */ -#ifndef ipconfigSOCKET_HAS_USER_SEMAPHORE - #define ipconfigSOCKET_HAS_USER_SEMAPHORE 0 + +#ifndef ipconfigCHECK_IP_QUEUE_SPACE + #define ipconfigCHECK_IP_QUEUE_SPACE ipconfigDISABLE #endif -/* The macro 'ipconfigSOCKET_HAS_USER_WAKE_CALLBACK' allows to use a call-back - * function that will be called at the moment one of the above events occurs. - * Use the socket option 'FREERTOS_SO_WAKEUP_CALLBACK' to install a function - * of the type 'void callback( Socket_t pxSocket )'. - * Note that the call-back function runs in the IP-task, so very little things - * can be done. Better not to call any networking API, because that could - * easily lead to a deadlock situation. - */ -#ifndef ipconfigSOCKET_HAS_USER_WAKE_CALLBACK - #define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK 0 +#if ( ( ipconfigCHECK_IP_QUEUE_SPACE != ipconfigDISABLE ) && ( ipconfigCHECK_IP_QUEUE_SPACE != ipconfigENABLE ) ) + #error Invalid ipconfigCHECK_IP_QUEUE_SPACE configuration #endif -/* Yet another possibility that makes it easy to handle multiple socket in - * a single task FreeRTOS_select(). The code for this functionality will - * be included when 'ipconfigSUPPORT_SELECT_FUNCTION' is defined as non-zero. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigHAS_DEBUG_PRINTF + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigHAS_DEBUG_PRINTF + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * ipconfigHAS_DEBUG_PRINTF enables usage of the macro FreeRTOS_debug_printf to + * generate output messages mostly from the TCP/IP stack. + * + * Requires a reentrant application defined macro function + * FreeRTOS_debug_printf with a return value that is ignored. + * + * The FreeRTOS_debug_printf() must be thread-safe but does not + * have to be interrupt-safe. + * + * Example: + * + * void vLoggingPrintf( const char *pcFormatString, ... ) + * + * #define ipconfigHAS_DEBUG_PRINTF ipconfigENABLE + * #define FreeRTOS_debug_printf( X ) if( ipconfigIS_ENABLED( ipconfigHAS_DEBUG_PRINTF ) vLoggingPrintf X + * + * FreeRTOS_debug_printf( ( "FunctionName: Failed with error code: %u\n", xErrorCode ) ) */ -#ifndef ipconfigSUPPORT_SELECT_FUNCTION - #define ipconfigSUPPORT_SELECT_FUNCTION 0 + +#ifndef ipconfigHAS_DEBUG_PRINTF + #define ipconfigHAS_DEBUG_PRINTF ipconfigDISABLE #endif -/* If the select function will be called simultaneously from more that one task - * e.g. one for 'eSELECT_READ', and the other for the other flags, it is strongly - * recommended to define 'ipconfigSELECT_USES_NOTIFY'. - * The problem is 'eSELECT_CALL_IP': 2 tasks would be waiting for the same bit - * in the event group, and both will try to reset this bit. - * When ipconfigSELECT_USES_NOTIFY is used, the IP-task will wakeup the calling - * task by notifying it. - */ -#ifndef ipconfigSELECT_USES_NOTIFY - #define ipconfigSELECT_USES_NOTIFY 0 +#if ( ( ipconfigHAS_DEBUG_PRINTF != ipconfigDISABLE ) && ( ipconfigHAS_DEBUG_PRINTF != ipconfigENABLE ) ) + #error Invalid ipconfigHAS_DEBUG_PRINTF configuration #endif -/* TCP only: if the 'ipconfigTCP_KEEP_ALIVE' macro is defined as 1, - * sockets in state "ESTABLISHED" can be protected using keep-alive packets. - * These packets will be sent as soon as there hasn't been any activity - * for a while. - * The macro 'ipconfigTCP_KEEP_ALIVE_INTERVAL' determines the interval at - * which keep-alive packets are sent. - */ -#ifndef ipconfigTCP_KEEP_ALIVE - #define ipconfigTCP_KEEP_ALIVE 0 +#ifndef FreeRTOS_debug_printf + #ifdef configPRINTF + #define FreeRTOS_debug_printf( MSG ) if( ipconfigHAS_DEBUG_PRINTF ) configPRINTF( MSG ) + #else + #define FreeRTOS_debug_printf( MSG ) do {} while( ipFALSE_BOOL ) + #endif #endif -/* The period of non-activity ( in seconds ) after which the driver will - * start sending a keep-alive packet to the TCP peer. The default is 20 seconds. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigHAS_PRINTF + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigHAS_PRINTF + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * ipconfigHAS_PRINTF enables usage of the macro FreeRTOS_printf to + * generate output messages mostly from TCP/IP stack demo applications. + * + * Requires a reentrant application defined macro function FreeRTOS_printf with + * a return value that is ignored. + * + * The FreeRTOS_printf() must be thread-safe but does not have to be interrupt-safe. + * + * See ipconfigHAS_DEBUG_PRINTF */ -#ifndef ipconfigTCP_KEEP_ALIVE_INTERVAL - #define ipconfigTCP_KEEP_ALIVE_INTERVAL 20U + +#ifndef ipconfigHAS_PRINTF + #define ipconfigHAS_PRINTF ipconfigDISABLE #endif -/* Another less used option: signals. This macro makes it possible to interrupt - * a blocking call to one of the API's by calling either FreeRTOS_SignalSocket() or - * FreeRTOS_SignalSocketFromISR() for that socket. - * When an API got interrupted, it will return the error value -pdFREERTOS_ERRNO_EINTR. - */ -#ifndef ipconfigSUPPORT_SIGNALS - #define ipconfigSUPPORT_SIGNALS 0 +#if ( ( ipconfigHAS_PRINTF != ipconfigDISABLE ) && ( ipconfigHAS_PRINTF != ipconfigENABLE ) ) + #error Invalid ipconfigHAS_PRINTF configuration #endif -/* Hang protection can help reduce the impact of SYN floods. - * When a SYN packet comes in, it will first be checked if there is a listening - * socket for the port number. If not, it will be replied to with a RESET packet. - * If there is a listing socket for that port number, a new socket will be created. - * This socket will be owned temporarily by the IP-task. Only when the SYN/ACK - * handshake is finished, the new socket will be passed to the application, - * resulting in a successful call to FreeRTOS_accept(). - * The option 'ipconfigTCP_HANG_PROTECTION' will make sure that the socket will be - * deleted in case the SYN-handshake doesn't come to a good end. - * See also ipconfigTCP_HANG_PROTECTION_TIME time. - */ -#ifndef ipconfigTCP_HANG_PROTECTION - #define ipconfigTCP_HANG_PROTECTION 1 +#ifndef FreeRTOS_printf + #ifdef configPRINTF + #define FreeRTOS_printf( MSG ) if( ipconfigHAS_PRINTF ) configPRINTF( MSG ) + #else + #define FreeRTOS_printf( MSG ) do {} while( ipFALSE_BOOL ) + #endif #endif -/* ipconfigTCP_HANG_PROTECTION_TIME defines the maximum time that a socket stays - * in one of these "in-between" states: +/*---------------------------------------------------------------------------*/ + +/* + * FreeRTOS_flush_logging + * + * Type: Macro Function + * + * Macro that is called in cases where a lot of logging is produced. * - * eCONNECT_SYN, eSYN_FIRST, eSYN_RECEIVED, eFIN_WAIT_1, eFIN_WAIT_2, eCLOSING, - * eLAST_ACK, or eTIME_WAIT. + * This gives the logging module a chance to flush the data. */ -#ifndef ipconfigTCP_HANG_PROTECTION_TIME - #define ipconfigTCP_HANG_PROTECTION_TIME 30U + +#ifndef FreeRTOS_flush_logging + #define FreeRTOS_flush_logging() if( ipconfigHAS_PRINTF || ipconfigHAS_DEBUG_PRINTF ) do {} while( ipFALSE_BOOL ) #endif -/* Initially, 'ipconfigTCP_IP_SANITY' was introduced to include all code that checks - * the correctness of the algorithms. However, it is only used in BufferAllocation_1.c - * When defined as non-zero, some extra code will check the validity of network buffers. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_IP_SANITY + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_IP_SANITY + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * Enables warnings when irregularities are detected when using + * BufferAllocation_1.c. */ + #ifndef ipconfigTCP_IP_SANITY - #define ipconfigTCP_IP_SANITY 0 + #define ipconfigTCP_IP_SANITY ipconfigDISABLE #endif -/* Expert option: define a value for 'ipBUFFER_PADDING'. - * When 'ipconfigBUFFER_PADDING' equals 0, - * 'ipBUFFER_PADDING' will get a default value of 8 + 2 bytes. */ -#ifndef ipconfigBUFFER_PADDING - #define ipconfigBUFFER_PADDING 0U +#if ( ( ipconfigTCP_IP_SANITY != ipconfigDISABLE ) && ( ipconfigTCP_IP_SANITY != ipconfigENABLE ) ) + #error Invalid ipconfigTCP_IP_SANITY configuration #endif -/* This library treats the network packets as structs, containing 16- and 32-bit - * variables. However, due to the size of the Ethernet header, the 32-byte - * variables are badly aligned. - * This is corrected with the macro 'ipconfigPACKET_FILLER_SIZE' which has a default - * of two. Thanks to this offset, ( almost ) all 32-bit numbers can be read and - * written in a single assembler instruction. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_MAY_LOG_PORT + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigTCP_MAY_LOG_PORT + * + * Type: Macro Function + * + * Specifies which port numbers should be logged by FreeRTOS_debug_printf(). + * The return value should be a BaseType_t ( pdFALSE | pdTRUE ) + * For example, the following definition will not generate log messages for + * ports 23 or 2402: + * + * #define ipconfigTCP_MAY_LOG_PORT( xPort ) ( ( ( xPort ) != 23 ) && ( ( xPort ) != 2402 ) ) */ -#ifndef ipconfigPACKET_FILLER_SIZE - #define ipconfigPACKET_FILLER_SIZE 2U + +#ifndef ipconfigTCP_MAY_LOG_PORT + #define ipconfigTCP_MAY_LOG_PORT( xPort ) ( ( xPort ) != 23 ) #endif -/* Set to 1 if you plan on processing custom Ethernet protocols or protocols - * that are not yet supported by the FreeRTOS+TCP stack. If set to 1, - * the user must define eFrameProcessingResult_t eApplicationProcessCustomFrameHook( NetworkBufferDescriptor_t * const pxNetworkBuffer ) - * which will be called by the stack for any frame with an unsupported EtherType. */ -#ifndef ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES - #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 0 +#if ( ( ipconfigTCP_MAY_LOG_PORT( 0 ) != 0 ) && ( ipconfigTCP_MAY_LOG_PORT( 0 ) != 1 ) ) + #error ipconfigTCP_MAY_LOG_PORT() should equate to pdFALSE or pdTRUE #endif -/* Set to 1 if you want to receive eNetworkDown notification via vApplicationIPNetworkEventHook() callback. - * Not all drivers support this feature. */ -#ifndef ipconfigSUPPORT_NETWORK_DOWN_EVENT - #define ipconfigSUPPORT_NETWORK_DOWN_EVENT 0 +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigWATCHDOG_TIMER + * + * https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html#ipconfigWATCHDOG_TIMER + * + * Type: Macro Function + * + * Macro that is called on each iteration of the IP task. + * + * May be useful if the application includes watchdog type functionality that + * needs to know that the IP task is still cycling (although the fact that the + * IP task is cycling does not necessarily indicate it is functioning + * correctly). The return value is ignored. + */ + +#ifndef ipconfigWATCHDOG_TIMER + #define ipconfigWATCHDOG_TIMER() do {} while( ipFALSE_BOOL ) #endif -#ifndef ipconfigND_CACHE_ENTRIES - #define ipconfigND_CACHE_ENTRIES 24 +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_DUMP_PACKETS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * See this utility: tools/tcp_utilities/tcp_dump_packets.md + * + * Allow inclusion of a utility that writes of network packets to files. + * + * Useful for testing and development. Assumes the presence of full stdio + * disk access. + */ + +#ifndef ipconfigUSE_DUMP_PACKETS + #define ipconfigUSE_DUMP_PACKETS ipconfigDISABLE #endif -#ifndef ipconfigHAS_ROUTING_STATISTICS - #define ipconfigHAS_ROUTING_STATISTICS 1 +#if ( ( ipconfigUSE_DUMP_PACKETS != ipconfigDISABLE ) && ( ipconfigUSE_DUMP_PACKETS != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_DUMP_PACKETS configuration #endif -#ifndef ipconfigUSE_RA - #define ipconfigUSE_RA 1 +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigUSE_TCP_MEM_STATS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * See this utility: tools/tcp_utilities/tcp_mem_stats.md + * + * Allow inclusion of a utility that monitors all allocation and releases of + * network-related resources. + * + * After running for a while, it will print all data + * in a CSV format, which can be analysed in a spreadsheet program. + */ + +#ifndef ipconfigUSE_TCP_MEM_STATS + #define ipconfigUSE_TCP_MEM_STATS ipconfigDISABLE #endif -/* RA or Router Advertisement/SLAAC: see end-point flag 'bWantRA'. - * An Router Solicitation will be sent. It will wait for ipconfigRA_SEARCH_TIME_OUT_MSEC ms. - * When there is no response, it will be repeated ipconfigRA_SEARCH_COUNT times. - * Then it will be checked if the chosen IP-address already exists, repeating this - * ipconfigRA_IP_TEST_COUNT times, each time with a timeout of ipconfigRA_IP_TEST_TIME_OUT_MSEC ms. - * Finally the end-point will go in the UP state. +#if ( ( ipconfigUSE_TCP_MEM_STATS != ipconfigDISABLE ) && ( ipconfigUSE_TCP_MEM_STATS != ipconfigENABLE ) ) + #error Invalid ipconfigUSE_TCP_MEM_STATS configuration +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigTCP_MEM_STATS_MAX_ALLOCATION + * + * Type: size_t + * Unit: count of TCP_ALLOCATION_t + * Minimum: 1 + * + * Defines the maximum number of allocations that can be stored/monitored. */ -#ifndef ipconfigRA_SEARCH_COUNT - #define ipconfigRA_SEARCH_COUNT ( 3U ) + +#ifndef ipconfigTCP_MEM_STATS_MAX_ALLOCATION + #define ipconfigTCP_MEM_STATS_MAX_ALLOCATION ( 128 ) #endif -#ifndef ipconfigRA_SEARCH_TIME_OUT_MSEC - #define ipconfigRA_SEARCH_TIME_OUT_MSEC ( 10000U ) +#if ( ipconfigTCP_MEM_STATS_MAX_ALLOCATION < 1 ) + #error ipconfigTCP_MEM_STATS_MAX_ALLOCATION must be at least 1 #endif -#ifndef ipconfigRA_IP_TEST_COUNT - #define ipconfigRA_IP_TEST_COUNT ( 3 ) +#if ( ipconfigTCP_MEM_STATS_MAX_ALLOCATION > SIZE_MAX ) + #error ipconfigTCP_MEM_STATS_MAX_ALLOCATION overflows a size_t #endif -#ifndef ipconfigRA_IP_TEST_TIME_OUT_MSEC - #define ipconfigRA_IP_TEST_TIME_OUT_MSEC ( 1500U ) +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigENABLE_BACKWARD_COMPATIBILITY + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * For backward compatibility define old structure names to the newer equivalent + * structure name. + */ + +#ifndef ipconfigENABLE_BACKWARD_COMPATIBILITY + #define ipconfigENABLE_BACKWARD_COMPATIBILITY ipconfigENABLE #endif -/* For some use cases, users set the configurations that issues warning messages. - * This configuration is used to suppress warning in portable layers to make compilation clean. +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigPORT_SUPPRESS_WARNING + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * For some use cases, users set configurations that issue warning messages. + * This suppresses warnings in portable layers to make compilation clean. */ + #ifndef ipconfigPORT_SUPPRESS_WARNING - #define ipconfigPORT_SUPPRESS_WARNING ( 0 ) + #define ipconfigPORT_SUPPRESS_WARNING ipconfigDISABLE +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS + * + * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) + * + * The macro 'ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS' was + * introduced to enable a tracing system. Currently it is only used in + * BufferAllocation_2.c. + */ + +#ifndef ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS + #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS ipconfigDISABLE #endif -#endif /* FREERTOS_DEFAULT_IP_CONFIG_H */ +/*---------------------------------------------------------------------------*/ + +/* Should only be included here, ensures trace config is set first. */ +#include "IPTraceMacroDefaults.h" + +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* DEBUG/TRACE/LOGGING CONFIG */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ + +#endif /* FREERTOS_IP_CONFIG_DEFAULTS_H */ diff --git a/source/include/FreeRTOSIPDeprecatedDefinitions.h b/source/include/FreeRTOSIPDeprecatedDefinitions.h new file mode 100644 index 000000000..48c71407f --- /dev/null +++ b/source/include/FreeRTOSIPDeprecatedDefinitions.h @@ -0,0 +1,140 @@ +/* + * FreeRTOS+TCP + * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://aws.amazon.com/freertos + * http://www.FreeRTOS.org + */ + +/** + * @file FreeRTOSIPDeprecatedDefinitions.h + * @brief File that ensures defined configuration constants are using the most up to date naming. + */ + +#ifndef FREERTOS_IP_DEPRECATED_DEFINITIONS_H +#define FREERTOS_IP_DEPRECATED_DEFINITIONS_H + +#ifndef FREERTOS_IP_CONFIG_DEFAULTS_H + #error FreeRTOSIPConfigDefaults.h has not been included yet +#endif + +#ifdef dnsMAX_REQUEST_ATTEMPTS + #error dnsMAX_REQUEST_ATTEMPTS is now called ipconfigDNS_REQUEST_ATTEMPTS +#endif + +#ifdef FreeRTOS_lprintf + #error FreeRTOS_lprintf is now called FreeRTOS_debug_printf/FreeRTOS_printf +#endif + +#ifdef HAS_TX_CRC_OFFLOADING + #error HAS_TX_CRC_OFFLOADING is deprecated +#endif + +#ifdef HAS_RX_CRC_OFFLOADING + #error HAS_RX_CRC_OFFLOADING is deprecated +#endif + +#ifdef ipconfigBUFFER_ALLOC_FIXED_SIZE + #error ipconfigBUFFER_ALLOC_FIXED_SIZE is deprecated +#endif + +#ifdef ipconfigDHCP_USES_USER_HOOK + #error ipconfigDHCP_USES_USER_HOOK has been replaced by ipconfigUSE_DHCP_HOOK +#endif + +#ifdef ipconfigDRIVER_INCLUDED_RX_IP_FILTERING + #error ipconfigDRIVER_INCLUDED_RX_IP_FILTERING is now called ipconfigETHERNET_DRIVER_FILTERS_PACKETS +#endif + +#ifdef ipconfigHAS_INLINE_FUNCTIONS + #error ipconfigHAS_INLINE_FUNCTIONS is deprecated +#endif + +#ifdef ipconfigMAX_SEND_BLOCK_TIME_TICKS + #error ipconfigMAX_SEND_BLOCK_TIME_TICKS is now called ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS +#endif + +#ifdef ipconfigNIC_SEND_PASSES_DMA + #error ipconfigNIC_SEND_PASSES_DMA is now called ipconfigZERO_COPY_TX_DRIVER +#endif + +#ifdef ipconfigNUM_NETWORK_BUFFERS + #error ipconfigNUM_NETWORK_BUFFERS is now now called ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS +#endif + +#ifdef ipconfigRAND32 + #error ipconfigRAND32 has been replaced by xApplicationGetRandomNumber( uint32_t *pulValue ) +#endif + +#ifdef ipconfigTCP_HANG_PROT + #error ipconfigTCP_HANG_PROT is now called ipconfigTCP_HANG_PROTECTION +#endif + +#ifdef ipconfigTCP_HANG_PROT_TIME + #error ipconfigTCP_HANG_PROT_TIME is now called ipconfigTCP_HANG_PROTECTION_TIME +#endif + +#ifdef ipconfigTCP_RX_BUF_LEN + #error ipconfigTCP_RX_BUF_LEN is now called ipconfigTCP_RX_BUFFER_LENGTH +#endif + +#ifdef ipconfigTCP_TX_BUF_LEN + #error ipconfigTCP_TX_BUF_LEN is now called ipconfigTCP_TX_BUFFER_LENGTH +#endif + +#ifdef ipconfigUDP_TASK_PRIORITY + #error ipconfigUDP_TASK_PRIORITY is now called ipconfigIP_TASK_PRIORITY +#endif + +#ifdef ipconfigUDP_TASK_STACK_SIZE_WORDS + #error ipconfigUDP_TASK_STACK_SIZE_WORDS is now called ipconfigIP_TASK_STACK_SIZE_WORDS +#endif + +#ifdef ipconfigUSE_RECEIVE_CONNECT_CALLBACKS + #error ipconfigUSE_RECEIVE_CONNECT_CALLBACKS is now called ipconfigUSE_CALLBACKS +#endif + +#ifdef ipconfigUSE_TCP_TIMESTAMPS + #error ipconfigUSE_TCP_TIMESTAMPS is deprecated +#endif + +#ifdef ipFILLER_SIZE + #error ipFILLER_SIZE is now called ipconfigPACKET_FILLER_SIZE +#endif + +#ifdef tcpconfigIP_TIME_TO_LIVE + #error tcpconfigIP_TIME_TO_LIVE is now called ipconfigTCP_TIME_TO_LIVE +#endif + +#ifdef updconfigIP_TIME_TO_LIVE + #error updconfigIP_TIME_TO_LIVE is now called ipconfigUDP_TIME_TO_LIVE +#endif + +#ifdef PHY_LS_HIGH_CHECK_TIME_MS + #error PHY_LS_HIGH_CHECK_TIME_MS is now called ipconfigPHY_LS_HIGH_CHECK_TIME_MS +#endif + +#ifdef PHY_LS_LOW_CHECK_TIME_MS + #error PHY_LS_LOW_CHECK_TIME_MS is now called ipconfigPHY_LS_LOW_CHECK_TIME_MS +#endif + +#endif /* FREERTOS_IP_DEPRECATED_DEFINITIONS_H */ diff --git a/source/include/FreeRTOS_ARP.h b/source/include/FreeRTOS_ARP.h index 56946d4d0..84db85105 100644 --- a/source/include/FreeRTOS_ARP.h +++ b/source/include/FreeRTOS_ARP.h @@ -31,7 +31,6 @@ /* Application level configuration options. */ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_IP.h" diff --git a/source/include/FreeRTOS_DHCP.h b/source/include/FreeRTOS_DHCP.h index 4dc21daff..b7502bb0e 100644 --- a/source/include/FreeRTOS_DHCP.h +++ b/source/include/FreeRTOS_DHCP.h @@ -32,7 +32,6 @@ /* Application level configuration options. */ #include "FreeRTOSIPConfig.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_Sockets.h" diff --git a/source/include/FreeRTOS_DHCPv6.h b/source/include/FreeRTOS_DHCPv6.h index b591e8d3f..0e2792c86 100644 --- a/source/include/FreeRTOS_DHCPv6.h +++ b/source/include/FreeRTOS_DHCPv6.h @@ -29,7 +29,6 @@ /* Application level configuration options. */ #include "FreeRTOS_DHCP.h" #include "FreeRTOSIPConfig.h" - #include "IPTraceMacroDefaults.h" #ifdef __cplusplus extern "C" { diff --git a/source/include/FreeRTOS_DNS_Globals.h b/source/include/FreeRTOS_DNS_Globals.h index fe4f75945..74ccb7daa 100644 --- a/source/include/FreeRTOS_DNS_Globals.h +++ b/source/include/FreeRTOS_DNS_Globals.h @@ -32,7 +32,6 @@ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_Sockets.h" @@ -101,15 +100,6 @@ #define dnsNBNS_QUERY_RESPONSE_FLAGS ( 0x8500U ) #endif /* ( ipconfigUSE_NBNS != 0 ) */ - - #ifndef _lint - #if ( ipconfigUSE_DNS_CACHE == 0 ) - #if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY != 1 ) - #error When DNS caching is disabled, please make ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY equal to 1. - #endif - #endif - #endif - /** @brief Define the ASCII value of '.' (Period/Full-stop). */ #define ASCII_BASELINE_DOT 46U diff --git a/source/include/FreeRTOS_IP.h b/source/include/FreeRTOS_IP.h index 98f123761..1995b9ffe 100644 --- a/source/include/FreeRTOS_IP.h +++ b/source/include/FreeRTOS_IP.h @@ -35,7 +35,6 @@ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" #include "FreeRTOS_IP_Common.h" -#include "IPTraceMacroDefaults.h" /* *INDENT-OFF* */ #ifdef __cplusplus @@ -247,6 +246,11 @@ typedef struct xIP_TIMER #define FreeRTOS_ntohs( x ) FreeRTOS_htons( x ) #define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x ) +/* Translate a pdFREERTOS_ERRNO code to a human readable string. */ +const char * FreeRTOS_strerror_r( BaseType_t xErrnum, + char * pcBuffer, + size_t uxLength ); + /* Some simple helper functions. */ int32_t FreeRTOS_max_int32( int32_t a, int32_t b ); @@ -313,7 +317,7 @@ BaseType_t FreeRTOS_IPInit_Multi( void ); struct xNetworkInterface; -#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) +#if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) /* Do not call the following function directly. It is there for downward compatibility. * The function FreeRTOS_IPInit() will call it to initialise the interface and end-point @@ -345,7 +349,7 @@ struct xNetworkInterface; void * FreeRTOS_GetUDPPayloadBuffer( size_t uxRequestedSizeBytes, TickType_t uxBlockTimeTicks ); -#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ +#endif /* if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ /* * Returns the addresses stored in an end-point structure. @@ -381,7 +385,7 @@ const uint8_t * FreeRTOS_GetMACAddress( void ); void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] ); #if ( ipconfigUSE_NETWORK_EVENT_HOOK == 1 ) /* This function shall be defined by the application. */ - #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) + #if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ); #else void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent, @@ -446,12 +450,6 @@ BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber ); * This pointer is for internal use only. */ extern NetworkBufferDescriptor_t * pxARPWaitingNetworkBuffer; -/* For backward compatibility define old structure names to the newer equivalent - * structure name. */ -#ifndef ipconfigENABLE_BACKWARD_COMPATIBILITY - #define ipconfigENABLE_BACKWARD_COMPATIBILITY 1 -#endif - #if ( ipconfigENABLE_BACKWARD_COMPATIBILITY == 1 ) #define xIPStackEvent_t IPStackEvent_t #define xNetworkBufferDescriptor_t NetworkBufferDescriptor_t diff --git a/source/include/FreeRTOS_IP_Private.h b/source/include/FreeRTOS_IP_Private.h index 3d4ee932d..c69232e9b 100644 --- a/source/include/FreeRTOS_IP_Private.h +++ b/source/include/FreeRTOS_IP_Private.h @@ -32,7 +32,6 @@ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" #include "FreeRTOS_Sockets.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_Stream_Buffer.h" #include "FreeRTOS_Routing.h" diff --git a/source/include/FreeRTOS_IPv4.h b/source/include/FreeRTOS_IPv4.h index 318ce5c05..3244a2895 100644 --- a/source/include/FreeRTOS_IPv4.h +++ b/source/include/FreeRTOS_IPv4.h @@ -34,7 +34,6 @@ /* Application level configuration options. */ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" -#include "IPTraceMacroDefaults.h" /* *INDENT-OFF* */ #ifdef __cplusplus diff --git a/source/include/FreeRTOS_IPv6_Private.h b/source/include/FreeRTOS_IPv6_Private.h index 5d48f186e..1e5ad5d07 100644 --- a/source/include/FreeRTOS_IPv6_Private.h +++ b/source/include/FreeRTOS_IPv6_Private.h @@ -33,7 +33,6 @@ #include "FreeRTOSIPConfigDefaults.h" #include "FreeRTOS_IP_Common.h" #include "FreeRTOS_Sockets.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_Stream_Buffer.h" #if ( ipconfigUSE_TCP == 1 ) #include "FreeRTOS_TCP_WIN.h" diff --git a/source/include/FreeRTOS_ND.h b/source/include/FreeRTOS_ND.h index e1419f511..bdbabdec7 100644 --- a/source/include/FreeRTOS_ND.h +++ b/source/include/FreeRTOS_ND.h @@ -31,7 +31,6 @@ /* Application level configuration options. */ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_ARP.h" diff --git a/source/include/FreeRTOS_UDP_IP.h b/source/include/FreeRTOS_UDP_IP.h index adf9412f8..0285aaebb 100644 --- a/source/include/FreeRTOS_UDP_IP.h +++ b/source/include/FreeRTOS_UDP_IP.h @@ -31,7 +31,6 @@ /* Application level configuration options. */ #include "FreeRTOSIPConfig.h" #include "FreeRTOSIPConfigDefaults.h" -#include "IPTraceMacroDefaults.h" #include "FreeRTOS_IP.h" /* *INDENT-OFF* */ diff --git a/source/include/FreeRTOS_errno_TCP.h b/source/include/FreeRTOS_errno_TCP.h deleted file mode 100644 index 5658cff9d..000000000 --- a/source/include/FreeRTOS_errno_TCP.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - -#ifndef FREERTOS_ERRNO_TCP -#define FREERTOS_ERRNO_TCP - -/* *INDENT-OFF* */ -#ifdef __cplusplus - extern "C" { -#endif -/* *INDENT-ON* */ - -/* The following definitions will be included in the core FreeRTOS code in - * future versions of FreeRTOS - hence the 'pd' (ProjDefs) prefix - at which time - * this file will be removed. */ - -/* The following errno values are used by FreeRTOS+ components, not FreeRTOS - * itself. */ - -/* For future compatibility (see comment above), check the definitions have not - * already been made. */ -#ifndef pdFREERTOS_ERRNO_NONE - #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ - #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ - #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ - #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ - #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ - #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ - #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ - #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ - #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ - #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ - #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ - #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ - #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ - #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ - #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ - #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ - #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ - #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ - #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ - #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ - #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ - #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ - #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ - #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ - #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ - #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ - #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ - #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ - #define pdFREERTOS_ERRNO_EAFNOSUPPORT 97 /* Address family not supported by protocol */ - #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ - #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ - #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ - #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ - #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ - #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ - #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ - #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ - #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ - #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ - #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ - #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ - -/* The following endian values are used by FreeRTOS+ components, not FreeRTOS - * itself. */ - #define pdFREERTOS_LITTLE_ENDIAN 0 - #define pdFREERTOS_BIG_ENDIAN 1 -#else /* ifndef pdFREERTOS_ERRNO_NONE */ - #ifndef pdFREERTOS_ERRNO_EAFNOSUPPORT - #define pdFREERTOS_ERRNO_EAFNOSUPPORT 97 /* Address family not supported by protocol */ - #endif /* pdFREERTOS_ERRNO_EAFNOSUPPORT */ -#endif /* pdFREERTOS_ERRNO_NONE */ - -/* Translate a pdFREERTOS_ERRNO code to a human readable string. */ -const char * FreeRTOS_strerror_r( BaseType_t xErrnum, - char * pcBuffer, - size_t uxLength ); - -/* *INDENT-OFF* */ -#ifdef __cplusplus - } /* extern "C" */ -#endif -/* *INDENT-ON* */ - -#endif /* FREERTOS_ERRNO_TCP */ diff --git a/source/include/IPTraceMacroDefaults.h b/source/include/IPTraceMacroDefaults.h index 08282e196..3c3872f15 100644 --- a/source/include/IPTraceMacroDefaults.h +++ b/source/include/IPTraceMacroDefaults.h @@ -25,273 +25,831 @@ * http://www.FreeRTOS.org */ -/* This file provides default (empty) implementations for any IP trace macros - * that are not defined by the user. See - * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Trace.html */ +/** + * @file IPTraceMacroDefaults.h + * @brief This file provides default (empty) implementations for any IP trace + * macros that are not defined by the user. See + * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Trace.html + */ -#ifndef UDP_TRACE_MACRO_DEFAULTS_H -#define UDP_TRACE_MACRO_DEFAULTS_H +#ifndef IP_TRACE_MACRO_DEFAULTS_H +#define IP_TRACE_MACRO_DEFAULTS_H -#ifndef iptraceNETWORK_DOWN - #define iptraceNETWORK_DOWN() +#ifndef FREERTOS_IP_CONFIG_DEFAULTS_H + #error FreeRTOSIPConfigDefaults.h has not been included yet #endif -#ifndef iptraceNETWORK_BUFFER_RELEASED - #define iptraceNETWORK_BUFFER_RELEASED( pxBufferAddress ) +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* NETWORK TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER + * + * Called when a task attempts to obtain a network buffer, but a buffer was + * not available even after any defined block period. + */ +#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER + #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER() +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR + * + * Called when an interrupt service routine attempts to obtain a network + * buffer, but a buffer was not available. + */ +#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR + #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR() #endif +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_BUFFER_OBTAINED + * + * Called when the network buffer at address pxBufferAddress is obtained from + * the TCP/IP stack by an RTOS task. + */ #ifndef iptraceNETWORK_BUFFER_OBTAINED #define iptraceNETWORK_BUFFER_OBTAINED( pxBufferAddress ) #endif +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR + * + * Called when the network buffer at address pxBufferAddress is obtained from + * the TCP/IP stack by an interrupt service routine. + */ #ifndef iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR #define iptraceNETWORK_BUFFER_OBTAINED_FROM_ISR( pxBufferAddress ) #endif +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_BUFFER_RELEASED + * + * Called when the network buffer at address pxBufferAddress is released back + * to the TCP/IP stack. + */ +#ifndef iptraceNETWORK_BUFFER_RELEASED + #define iptraceNETWORK_BUFFER_RELEASED( pxBufferAddress ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_DOWN + * + * Called when the network driver indicates that the network connection has + * been lost (not implemented by all network drivers). + */ +#ifndef iptraceNETWORK_DOWN + #define iptraceNETWORK_DOWN() +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_EVENT_RECEIVED + * + * Called when the TCP/IP stack processes an event previously posted to the + * network event queue. eEvent will be one of the following values: + * + * eNetworkDownEvent - The network interface has been lost and/or needs + * [re]connecting. + * eNetworkRxEvent - The network interface has queued a received Ethernet + * frame. + * eARPTimerEvent - The ARP timer expired. + * eStackTxEvent - The software stack has queued a packet to transmit. + * eDHCPEvent - Process the DHCP state machine. + * + * Note the events are defined by the private eIPEvent_t type which is not + * generally accessible. + */ +#ifndef iptraceNETWORK_EVENT_RECEIVED + #define iptraceNETWORK_EVENT_RECEIVED( eEvent ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_INTERFACE_INPUT + * + * Called when a packet of length uxDataLength and with the contents at + * address pucEthernetBuffer has been received. + */ #ifndef iptraceNETWORK_INTERFACE_INPUT - /* An Ethernet packet has been received. */ #define iptraceNETWORK_INTERFACE_INPUT( uxDataLength, pucEthernetBuffer ) #endif +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_INTERFACE_OUTPUT + * + * Called when a packet of length uxDataLength and with the contents at + * address pucEthernetBuffer has been sent. + */ #ifndef iptraceNETWORK_INTERFACE_OUTPUT - /* An Ethernet packet will be sent. */ #define iptraceNETWORK_INTERFACE_OUTPUT( uxDataLength, pucEthernetBuffer ) #endif -#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER - #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER() -#endif +/*---------------------------------------------------------------------------*/ -#ifndef iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR - #define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER_FROM_ISR() +/* + * iptraceNETWORK_INTERFACE_RECEIVE + * + * Called when a packet is received from the network by the network driver. + * Note this macro is called by the network driver rather than the TCP/IP stack + * and may not be called at all by drivers provided by third parties. + */ +#ifndef iptraceNETWORK_INTERFACE_RECEIVE + #define iptraceNETWORK_INTERFACE_RECEIVE() #endif -#ifndef iptraceDROPPED_INVALID_ARP_PACKET - #define iptraceDROPPED_INVALID_ARP_PACKET( pxARPHeader ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceNETWORK_INTERFACE_TRANSMIT + * + * Called when a packet is sent to the network by the network driver. Note this + * macro is called by the network driver rather than the TCP/IP stack and may + * not be called at all by drivers provided by third parties. + */ +#ifndef iptraceNETWORK_INTERFACE_TRANSMIT + #define iptraceNETWORK_INTERFACE_TRANSMIT() #endif -#ifndef iptraceCREATING_ARP_REQUEST - #define iptraceCREATING_ARP_REQUEST( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceSTACK_TX_EVENT_LOST + * + * Called when a packet generated by the TCP/IP stack is dropped because there + * is insufficient space in the network event queue (see the + * ipconfigEVENT_QUEUE_LENGTH setting in FreeRTOSIPConfig.h). + */ +#ifndef iptraceSTACK_TX_EVENT_LOST + #define iptraceSTACK_TX_EVENT_LOST( xEvent ) #endif -/* A packet came in from an unknown IPv4 address. - * An ARP request has been sent and the network - * buffer is stored for processing later.*/ -#ifndef iptraceDELAYED_ARP_REQUEST_STARTED - #define iptraceDELAYED_ARP_REQUEST_STARTED() +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* NETWORK TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DRIVER TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceETHERNET_RX_EVENT_LOST + * + * Called when a packet received by the network driver is dropped for one of + * the following reasons: There is insufficient space in the network event + * queue (see the ipconfigEVENT_QUEUE_LENGTH setting in FreeRTOSIPConfig.h), + * the received packet has an invalid data length, or there are no network + * buffers available (see the ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS setting + * in FreeRTOSIPConfig.h). Note this macro is called by the network driver + * rather than the TCP/IP stack and may not be called at all by drivers + * provided by third parties. + */ +#ifndef iptraceETHERNET_RX_EVENT_LOST + #define iptraceETHERNET_RX_EVENT_LOST() #endif -/* A packet has come in from an unknown IPv4 address. - * An ARP request has been sent, but the queue is - * still filled with a different packet. */ -#ifndef iptraceDELAYED_ARP_BUFFER_FULL - #define iptraceDELAYED_ARP_BUFFER_FULL() +/*---------------------------------------------------------------------------*/ + +/* + * iptraceWAITING_FOR_TX_DMA_DESCRIPTOR + * + * Called when a transmission at the network driver level cannot complete + * immediately because the driver is having to wait for a DMA descriptor to + * become free. Try increasing the configNUM_TX_ETHERNET_DMA_DESCRIPTORS + * setting in FreeRTOSConfig.h (if it exists for the network driver being + * used). + */ +#ifndef iptraceWAITING_FOR_TX_DMA_DESCRIPTOR + #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR() #endif -/* An ARP request has been sent, and a matching - * reply is received. Now the original - * packet will be processed by the IP-task. */ -#ifndef iptrace_DELAYED_ARP_REQUEST_REPLIED - #define iptrace_DELAYED_ARP_REQUEST_REPLIED() +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* DRIVER TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* UDP TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceSENDING_UDP_PACKET + * + * Called when a UDP packet is sent to the IP address ulIPAddress. ulIPAddress + * is expressed as a 32-bit number in network byte order. + */ +#ifndef iptraceSENDING_UDP_PACKET + #define iptraceSENDING_UDP_PACKET( ulIPAddress ) #endif -/* A packet was stored for delayed processing, but - * there is no ARP reply. The network buffer will - * be released without being processed. */ -#ifndef iptraceDELAYED_ARP_TIMER_EXPIRED - #define iptraceDELAYED_ARP_TIMER_EXPIRED() +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* UDP TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* SOCKET TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceBIND_FAILED + * + * A call to FreeRTOS_bind() failed. usPort is the port number the socket + * xSocket was to be bound to. + */ +#ifndef iptraceBIND_FAILED + #define iptraceBIND_FAILED( xSocket, usPort ) #endif -#ifndef iptraceARP_TABLE_ENTRY_WILL_EXPIRE - #define iptraceARP_TABLE_ENTRY_WILL_EXPIRE( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceFAILED_TO_CREATE_EVENT_GROUP + * + * Called when an event group could not be created, possibly due to + * insufficient heap space, during new socket creation. + */ +#ifndef iptraceFAILED_TO_CREATE_EVENT_GROUP + #define iptraceFAILED_TO_CREATE_EVENT_GROUP() #endif -#ifndef iptraceARP_TABLE_ENTRY_EXPIRED - #define iptraceARP_TABLE_ENTRY_EXPIRED( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceFAILED_TO_CREATE_SOCKET + * + * A call to FreeRTOS_socket() failed because there was insufficient FreeRTOS + * heap memory available for the socket structure to be created. + */ +#ifndef iptraceFAILED_TO_CREATE_SOCKET + #define iptraceFAILED_TO_CREATE_SOCKET() #endif -#ifndef iptraceARP_TABLE_ENTRY_CREATED - #define iptraceARP_TABLE_ENTRY_CREATED( ulIPAddress, ucMACAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceFAILED_TO_NOTIFY_SELECT_GROUP + */ +#ifndef iptraceFAILED_TO_NOTIFY_SELECT_GROUP + #define iptraceFAILED_TO_NOTIFY_SELECT_GROUP( xSocket ) #endif -#ifndef iptraceND_TABLE_ENTRY_WILL_EXPIRE - #define iptraceND_TABLE_ENTRY_WILL_EXPIRE( pxIPAddress ) +/*-----------------------------------------------------------------------*/ + +/* + * iptraceNO_BUFFER_FOR_SENDTO + * + * Called when a call to FreeRTOS_sendto() tries to allocate a buffer, but a + * buffer was not available even after any defined block period. + */ +#ifndef iptraceNO_BUFFER_FOR_SENDTO + #define iptraceNO_BUFFER_FOR_SENDTO() #endif -#ifndef iptraceND_TABLE_ENTRY_EXPIRED - #define iptraceND_TABLE_ENTRY_EXPIRED( pxIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceRECVFROM_DISCARDING_BYTES + * + * FreeRTOS_recvfrom() is discarding xNumberOfBytesDiscarded bytes because the + * number of bytes received is greater than the number of bytes that will fit + * in the user supplied buffer (the buffer passed in as a FreeRTOS_recvfrom() + * function parameter). + */ +#ifndef iptraceRECVFROM_DISCARDING_BYTES + #define iptraceRECVFROM_DISCARDING_BYTES( xNumberOfBytesDiscarded ) #endif -#ifndef iptraceSENDING_UDP_PACKET - #define iptraceSENDING_UDP_PACKET( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceRECVFROM_INTERRUPTED + * + * Called when a blocking call to FreeRTOS_recvfrom() is interrupted through a + * call to FreeRTOS_SignalSocket(). + */ +#ifndef iptraceRECVFROM_INTERRUPTED + #define iptraceRECVFROM_INTERRUPTED() #endif -#ifndef iptracePACKET_DROPPED_TO_GENERATE_ARP - #define iptracePACKET_DROPPED_TO_GENERATE_ARP( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceRECVFROM_TIMEOUT + * + * Called when FreeRTOS_recvfrom() gets no data on the given socket even after + * any defined block period. + */ +#ifndef iptraceRECVFROM_TIMEOUT + #define iptraceRECVFROM_TIMEOUT() #endif -#ifndef iptraceICMP_PACKET_RECEIVED - #define iptraceICMP_PACKET_RECEIVED() +/*---------------------------------------------------------------------------*/ + +/* + * iptraceSENDTO_DATA_TOO_LONG + * + * Called when the data requested to be sent using a call to FreeRTOS_sendto() + * is too long and could not be sent. + */ +#ifndef iptraceSENDTO_DATA_TOO_LONG + #define iptraceSENDTO_DATA_TOO_LONG() #endif -#ifndef iptraceSENDING_PING_REPLY - #define iptraceSENDING_PING_REPLY( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceSENDTO_SOCKET_NOT_BOUND + * + * Called when the socket used in the call to FreeRTOS_sendto() is not already + * bound to a port. + */ +#ifndef iptraceSENDTO_SOCKET_NOT_BOUND + #define iptraceSENDTO_SOCKET_NOT_BOUND() #endif +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* SOCKET TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* ARP TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * traceARP_PACKET_RECEIVED + * + * Called when an ARP packet is received, even if the local network node is not + * involved in the ARP transaction. + */ #ifndef traceARP_PACKET_RECEIVED #define traceARP_PACKET_RECEIVED() #endif -#ifndef iptracePROCESSING_RECEIVED_ARP_REPLY - #define iptracePROCESSING_RECEIVED_ARP_REPLY( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceARP_TABLE_ENTRY_CREATED + * + * Called when a new entry in the ARP table is created to map the IP address + * ulIPAddress to the MAC address ucMACAddress. ulIPAddress is expressed as a + * 32-bit number in network byte order. ucMACAddress is a pointer to an + * MACAddress_t structure. + */ +#ifndef iptraceARP_TABLE_ENTRY_CREATED + #define iptraceARP_TABLE_ENTRY_CREATED( ulIPAddress, ucMACAddress ) #endif -#ifndef iptraceSENDING_ARP_REPLY - #define iptraceSENDING_ARP_REPLY( ulIPAddress ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceARP_TABLE_ENTRY_EXPIRED + * + * Called when the entry for the IP address ulIPAddress in the ARP cache is + * removed. ulIPAddress is expressed as a 32-bit number in network byte order. + */ +#ifndef iptraceARP_TABLE_ENTRY_EXPIRED + #define iptraceARP_TABLE_ENTRY_EXPIRED( ulIPAddress ) #endif -#ifndef iptraceFAILED_TO_CREATE_SOCKET - #define iptraceFAILED_TO_CREATE_SOCKET() +/*---------------------------------------------------------------------------*/ + +/* + * iptraceARP_TABLE_ENTRY_WILL_EXPIRE + * + * Called when an ARP request is about to be sent because the entry for the IP + * address ulIPAddress in the ARP cache has become stale. ulIPAddress is + * expressed as a 32-bit number in network byte order. + */ +#ifndef iptraceARP_TABLE_ENTRY_WILL_EXPIRE + #define iptraceARP_TABLE_ENTRY_WILL_EXPIRE( ulIPAddress ) #endif -#ifndef iptraceFAILED_TO_CREATE_EVENT_GROUP - #define iptraceFAILED_TO_CREATE_EVENT_GROUP() +/*---------------------------------------------------------------------------*/ + +/* + * iptraceCREATING_ARP_REQUEST + * + * Called when the IP generates an ARP request packet. + */ +#ifndef iptraceCREATING_ARP_REQUEST + #define iptraceCREATING_ARP_REQUEST( ulIPAddress ) #endif -#ifndef iptraceRECVFROM_DISCARDING_BYTES - #define iptraceRECVFROM_DISCARDING_BYTES( xNumberOfBytesDiscarded ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceDELAYED_ARP_BUFFER_FULL + * + * A packet has come in from an unknown IPv4 address. An ARP request has been + * sent, but the queue is still filled with a different packet. + */ +#ifndef iptraceDELAYED_ARP_BUFFER_FULL + #define iptraceDELAYED_ARP_BUFFER_FULL() #endif -#ifndef iptraceETHERNET_RX_EVENT_LOST - #define iptraceETHERNET_RX_EVENT_LOST() +/*---------------------------------------------------------------------------*/ + +/* + * iptrace_DELAYED_ARP_REQUEST_REPLIED + * + * An ARP request has been sent, and a matching reply is received. Now the + * original packet will be processed by the IP-task. + */ +#ifndef iptrace_DELAYED_ARP_REQUEST_REPLIED + #define iptrace_DELAYED_ARP_REQUEST_REPLIED() #endif -#ifndef iptraceSTACK_TX_EVENT_LOST - #define iptraceSTACK_TX_EVENT_LOST( xEvent ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceDELAYED_ARP_REQUEST_STARTED + * + * A packet came in from an unknown IPv4 address. An ARP request has been sent + * and the network buffer is stored for processing later. + */ +#ifndef iptraceDELAYED_ARP_REQUEST_STARTED + #define iptraceDELAYED_ARP_REQUEST_STARTED() #endif -#ifndef iptraceNETWORK_EVENT_RECEIVED - #define iptraceNETWORK_EVENT_RECEIVED( eEvent ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceDELAYED_ARP_TIMER_EXPIRED + * + * A packet was stored for delayed processing, but there is no ARP reply. The + * network buffer will be released without being processed. + */ +#ifndef iptraceDELAYED_ARP_TIMER_EXPIRED + #define iptraceDELAYED_ARP_TIMER_EXPIRED() #endif -#ifndef iptraceBIND_FAILED - #define iptraceBIND_FAILED( xSocket, usPort ) +/*---------------------------------------------------------------------------*/ + +/* + * iptraceDROPPED_INVALID_ARP_PACKET + * + * Called when an ARP packet is dropped due to invalid protocol and hardware + * fields in the header at address pxARPHeader. + */ +#ifndef iptraceDROPPED_INVALID_ARP_PACKET + #define iptraceDROPPED_INVALID_ARP_PACKET( pxARPHeader ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptracePACKET_DROPPED_TO_GENERATE_ARP + * + * Called when a packet destined for the IP address ulIPAddress is dropped + * because the ARP cache does not contain an entry for the IP address. The + * packet is automatically replaced by an ARP packet. ulIPAddress is expressed + * as a 32-bit number in network byte order. + */ +#ifndef iptracePACKET_DROPPED_TO_GENERATE_ARP + #define iptracePACKET_DROPPED_TO_GENERATE_ARP( ulIPAddress ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptracePROCESSING_RECEIVED_ARP_REPLY + * + * Called when the ARP cache is about to be updated in response to the + * reception of an ARP reply. ulIPAddress holds the ARP message's target IP + * address (as a 32-bit number in network byte order), which may not be the + * local network node (depending on the FreeRTOSIPConfig.h settings). + */ +#ifndef iptracePROCESSING_RECEIVED_ARP_REPLY + #define iptracePROCESSING_RECEIVED_ARP_REPLY( ulIPAddress ) +#endif + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceSENDING_ARP_REPLY + * + * An ARP reply is being sent in response to an ARP request from the IP address + * ulIPAddress. ulIPAddress is expressed as a 32-bit number in network byte + * order. + */ +#ifndef iptraceSENDING_ARP_REPLY + #define iptraceSENDING_ARP_REPLY( ulIPAddress ) #endif +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* ARP TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DHCP TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS + * + * Called when the default IP address is used because an IP address could not + * be obtained from a DHCP. ulIPAddress is expressed as a 32-bit number in + * network byte order. + */ #ifndef iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS #define iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ulIPAddress ) #endif +/*-----------------------------------------------------------------------*/ + +/* + * iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IPv6_ADDRESS + */ #ifndef iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IPv6_ADDRESS #define iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IPv6_ADDRESS( xIPAddress ) #endif +/*-----------------------------------------------------------------------*/ + +/* + * iptraceDHCP_SUCCEEDED + * + * Called when DHCP negotiation is complete and the IP address in + * ulOfferedIPAddress is offered to the device. + */ +#ifndef iptraceDHCP_SUCCEEDED + #define iptraceDHCP_SUCCEEDED( ulOfferedIPAddress ) +#endif + +/*-----------------------------------------------------------------------*/ + +/* + * iptraceSENDING_DHCP_DISCOVER + * + * Called when a DHCP discover packet is sent. + */ #ifndef iptraceSENDING_DHCP_DISCOVER #define iptraceSENDING_DHCP_DISCOVER() #endif +/*-----------------------------------------------------------------------*/ + +/* + * iptraceSENDING_DHCP_REQUEST + * + * Called when a DHCP request packet is sent. + */ #ifndef iptraceSENDING_DHCP_REQUEST #define iptraceSENDING_DHCP_REQUEST() #endif -#ifndef iptraceDHCP_SUCCEEDED - #define iptraceDHCP_SUCCEEDED( address ) -#endif - -#ifndef iptraceRA_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS - #define iptraceRA_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ipv6_address ) -#endif +/*-----------------------------------------------------------------------*/ -#ifndef iptraceRA_SUCCEEDED - #define iptraceRA_SUCCEEDED( ipv6_address ) -#endif +/*===========================================================================*/ +/* DHCP TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* DNS TRACE MACROS */ +/*===========================================================================*/ -#ifndef iptraceNETWORK_INTERFACE_TRANSMIT - #define iptraceNETWORK_INTERFACE_TRANSMIT() -#endif - -#ifndef iptraceNETWORK_INTERFACE_RECEIVE - #define iptraceNETWORK_INTERFACE_RECEIVE() -#endif +/*---------------------------------------------------------------------------*/ +/* + * iptraceSENDING_DNS_REQUEST + * + * Called when a DNS request is sent. + */ #ifndef iptraceSENDING_DNS_REQUEST #define iptraceSENDING_DNS_REQUEST() #endif -#ifndef iptraceWAITING_FOR_TX_DMA_DESCRIPTOR - #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR() -#endif +/*---------------------------------------------------------------------------*/ -#ifndef ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS - #define ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS 0 -#endif +/*===========================================================================*/ +/* DNS TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* ICMP TRACE MACROS */ +/*===========================================================================*/ -#ifndef iptraceFAILED_TO_NOTIFY_SELECT_GROUP - #define iptraceFAILED_TO_NOTIFY_SELECT_GROUP( xSocket ) -#endif +/*---------------------------------------------------------------------------*/ -#ifndef pvPortMallocSocket - #define pvPortMallocSocket( xSize ) pvPortMalloc( ( xSize ) ) +/* + * iptraceICMP_PACKET_RECEIVED + * + * Called when an ICMP packet is received. + */ +#ifndef iptraceICMP_PACKET_RECEIVED + #define iptraceICMP_PACKET_RECEIVED() #endif -#ifndef iptraceRECVFROM_TIMEOUT - #define iptraceRECVFROM_TIMEOUT() -#endif +/*-----------------------------------------------------------------------*/ -#ifndef iptraceRECVFROM_INTERRUPTED - #define iptraceRECVFROM_INTERRUPTED() +/* + * iptraceSENDING_PING_REPLY + * + * Called when an ICMP echo reply (ping reply) is sent to the IP address + * ulIPAddress in response to an ICMP echo request (ping request) originating + * from the same address. ulIPAddress is expressed as a 32-bit number in + * network byte order. + */ +#ifndef iptraceSENDING_PING_REPLY + #define iptraceSENDING_PING_REPLY( ulIPAddress ) #endif -#ifndef iptraceNO_BUFFER_FOR_SENDTO - #define iptraceNO_BUFFER_FOR_SENDTO() +/*-----------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* ICMP TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* NDP TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceND_TABLE_ENTRY_EXPIRED + */ +#ifndef iptraceND_TABLE_ENTRY_EXPIRED + #define iptraceND_TABLE_ENTRY_EXPIRED( pxIPAddress ) #endif -#ifndef iptraceSENDTO_SOCKET_NOT_BOUND - #define iptraceSENDTO_SOCKET_NOT_BOUND() +/*---------------------------------------------------------------------------*/ + +/* + * iptraceND_TABLE_ENTRY_WILL_EXPIRE + */ +#ifndef iptraceND_TABLE_ENTRY_WILL_EXPIRE + #define iptraceND_TABLE_ENTRY_WILL_EXPIRE( pxIPAddress ) #endif -#ifndef iptraceSENDTO_DATA_TOO_LONG - #define iptraceSENDTO_DATA_TOO_LONG() +/*---------------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* NDP TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* ROUTER ADVERTISEMENT TRACE MACROS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + +/* + * iptraceRA_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS + */ +#ifndef iptraceRA_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS + #define iptraceRA_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ipv6_address ) #endif -#ifndef ipconfigUSE_TCP_MEM_STATS - #define ipconfigUSE_TCP_MEM_STATS 0 +/*---------------------------------------------------------------------------*/ + +/* + * iptraceRA_SUCCEEDED + */ +#ifndef iptraceRA_SUCCEEDED + #define iptraceRA_SUCCEEDED( ipv6_address ) #endif -#if ( ipconfigUSE_TCP_MEM_STATS == 0 ) +/*---------------------------------------------------------------------------*/ -/* See tools/tcp_mem_stat.c */ +/*===========================================================================*/ +/* ROUTER ADVERTISEMENT TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* MEM STATS MACROS */ +/*===========================================================================*/ - #ifndef iptraceMEM_STATS_CREATE - #define iptraceMEM_STATS_CREATE( xMemType, pxObject, uxSize ) - #endif +/*-----------------------------------------------------------------------*/ - #ifndef iptraceMEM_STATS_DELETE - #define iptraceMEM_STATS_DELETE( pxObject ) - #endif +/* + * iptraceMEM_STATS_CLOSE + * + * Should be called by the application when the collection of memory + * statistics should be stopped. + */ +#ifndef iptraceMEM_STATS_CLOSE + #define iptraceMEM_STATS_CLOSE() +#endif + +/*-----------------------------------------------------------------------*/ - #ifndef iptraceMEM_STATS_CLOSE - #define iptraceMEM_STATS_CLOSE() - #endif +/* + * iptraceMEM_STATS_CREATE + * + * Called when an object at address pxObject of type xMemType and size + * uxSize has been allocated from the heap. + */ +#ifndef iptraceMEM_STATS_CREATE + #define iptraceMEM_STATS_CREATE( xMemType, pxObject, uxSize ) +#endif -#endif /* ( ipconfigUSE_TCP_MEM_STATS != 0 ) */ +/*-----------------------------------------------------------------------*/ -#ifndef ipconfigUSE_DUMP_PACKETS - #define ipconfigUSE_DUMP_PACKETS 0 +/* + * iptraceMEM_STATS_DELETE + * + * Called when an object at address pxObject has been deallocated and the + * memory has been returned to the heap. + */ +#ifndef iptraceMEM_STATS_DELETE + #define iptraceMEM_STATS_DELETE( pxObject ) #endif -#if ( ipconfigUSE_DUMP_PACKETS == 0 ) +/*-----------------------------------------------------------------------*/ + +/*===========================================================================*/ +/* MEM STATS MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* TCP DUMP TRACE MACROS */ +/*===========================================================================*/ + +/*-----------------------------------------------------------------------*/ + +/* + * iptraceDUMP_INIT + */ +#ifndef iptraceDUMP_INIT + #define iptraceDUMP_INIT( pcFileName, pxEntries ) +#endif -/* See tools/tcp_dump_packets.c */ +/*-----------------------------------------------------------------------*/ - #ifndef iptraceDUMP_INIT - #define iptraceDUMP_INIT( pcFileName, pxEntries ) - #endif +/* + * iptraceDUMP_PACKET + */ +#ifndef iptraceDUMP_PACKET + #define iptraceDUMP_PACKET( pucBuffer, uxLength, xIncoming ) +#endif - #ifndef iptraceDUMP_PACKET - #define iptraceDUMP_PACKET( pucBuffer, uxLength, xIncoming ) - #endif +/*-----------------------------------------------------------------------*/ -#endif /* ( ipconfigUSE_DUMP_PACKETS != 0 ) */ +/*===========================================================================*/ +/* TCP DUMP TRACE MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ -#endif /* UDP_TRACE_MACRO_DEFAULTS_H */ +#endif /* IP_TRACE_MACRO_DEFAULTS_H */ diff --git a/test/Coverity/ConfigFiles/FreeRTOSIPConfig.h b/test/Coverity/ConfigFiles/FreeRTOSIPConfig.h index 962a3ee1b..6d3da4df7 100644 --- a/test/Coverity/ConfigFiles/FreeRTOSIPConfig.h +++ b/test/Coverity/ConfigFiles/FreeRTOSIPConfig.h @@ -100,20 +100,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5U ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand( void ); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -127,7 +119,7 @@ extern uint32_t ulRand( void ); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -136,14 +128,14 @@ extern uint32_t ulRand( void ); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/AllDisable/FreeRTOSIPConfig.h b/test/build-combination/AllDisable/FreeRTOSIPConfig.h index 09bb6b6c5..4fa5a6225 100644 --- a/test/build-combination/AllDisable/FreeRTOSIPConfig.h +++ b/test/build-combination/AllDisable/FreeRTOSIPConfig.h @@ -96,20 +96,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 0 +#define ipconfigUSE_NETWORK_EVENT_HOOK 0 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -123,7 +115,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -132,14 +124,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 0 -#define ipconfigDHCP_REGISTER_HOSTNAME 0 -#define ipconfigDHCP_USES_UNICAST 0 +#define ipconfigUSE_DHCP 0 +#define ipconfigDHCP_REGISTER_HOSTNAME 0 +#define ipconfigDHCP_USES_UNICAST 0 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 0 +#define ipconfigUSE_DHCP_HOOK 0 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/AllEnable/FreeRTOSIPConfig.h b/test/build-combination/AllEnable/FreeRTOSIPConfig.h index a6fbdde0e..2a2dbf1d4 100644 --- a/test/build-combination/AllEnable/FreeRTOSIPConfig.h +++ b/test/build-combination/AllEnable/FreeRTOSIPConfig.h @@ -127,20 +127,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -154,7 +146,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -163,14 +155,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h index a60a44a3e..269a6fd20 100644 --- a/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h @@ -130,20 +130,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -157,7 +149,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -166,14 +158,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h index 0beab5729..1ddfcc14c 100644 --- a/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h @@ -130,20 +130,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -157,7 +149,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -166,14 +158,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h index cbec621ff..28fbf765d 100644 --- a/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv4_TCP/FreeRTOSIPConfig.h @@ -130,20 +130,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -157,7 +149,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -166,14 +158,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h index 663a02950..aa37a341e 100644 --- a/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv6/FreeRTOSIPConfig.h @@ -130,20 +130,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -157,7 +149,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -166,14 +158,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h b/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h index f2050ce1d..e269767d2 100644 --- a/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h +++ b/test/build-combination/Enable_IPv6_TCP/FreeRTOSIPConfig.h @@ -130,20 +130,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -157,7 +149,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -166,14 +158,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/cbmc/patches/FreeRTOSIPConfig.h b/test/cbmc/patches/FreeRTOSIPConfig.h index 004922bcb..03d9164d6 100644 --- a/test/cbmc/patches/FreeRTOSIPConfig.h +++ b/test/cbmc/patches/FreeRTOSIPConfig.h @@ -76,9 +76,9 @@ * call to FreeRTOS_gethostbyname() will return immediately, without even creating * a socket. */ #ifndef ipconfigUSE_DNS_CACHE - #define ipconfigUSE_DNS_CACHE ( 1 ) + #define ipconfigUSE_DNS_CACHE ( 1 ) #endif -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) +#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) /* The IP stack executes it its own task (although any application task can make * use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY @@ -89,22 +89,14 @@ * FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to * the priority assigned to the task executing the IP stack relative to the * priority assigned to tasks that use the IP stack. */ -#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) +#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) /* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP * task. This setting is less important when the FreeRTOS Win32 simulator is used * as the Win32 simulator only stores a fixed amount of information on the task * stack. FreeRTOS includes optional stack overflow detection, see: * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ -#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) - -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() +#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK diff --git a/test/cbmc/proofs/CheckOptionsInner/Makefile.json b/test/cbmc/proofs/CheckOptionsInner/Makefile.json index ada3510b2..f318ae1cd 100644 --- a/test/cbmc/proofs/CheckOptionsInner/Makefile.json +++ b/test/cbmc/proofs/CheckOptionsInner/Makefile.json @@ -2,8 +2,8 @@ "ENTRY": "CheckOptionsInner", "CBMCFLAGS": [ "--unwind 1", - "--unwindset __CPROVER_file_local_FreeRTOS_TCP_WIN_c_prvTCPWindowTxCheckAck.1:2", - "--unwindset __CPROVER_file_local_FreeRTOS_TCP_WIN_c_prvTCPWindowFastRetransmit.2:2" + "--unwindset __CPROVER_file_local_FreeRTOS_TCP_WIN_c_prvTCPWindowTxCheckAck.0:2", + "--unwindset __CPROVER_file_local_FreeRTOS_TCP_WIN_c_prvTCPWindowFastRetransmit.1:2" ], "OPT": [ diff --git a/test/cbmc/proofs/CheckOptionsOuter/Makefile.json b/test/cbmc/proofs/CheckOptionsOuter/Makefile.json index 722068709..d97be23e6 100644 --- a/test/cbmc/proofs/CheckOptionsOuter/Makefile.json +++ b/test/cbmc/proofs/CheckOptionsOuter/Makefile.json @@ -3,7 +3,7 @@ "CBMCFLAGS": [ "--unwind 1", - "--unwindset __CPROVER_file_local_FreeRTOS_TCP_Reception_c_prvSingleStepTCPHeaderOptions.2:32" + "--unwindset __CPROVER_file_local_FreeRTOS_TCP_Reception_c_prvSingleStepTCPHeaderOptions.0:32" ], "OPT": [ diff --git a/test/cbmc/proofs/IPUtils/usGenerateProtocolChecksum_IPv6/Makefile.json b/test/cbmc/proofs/IPUtils/usGenerateProtocolChecksum_IPv6/Makefile.json index b64116cb3..ddf4febda 100644 --- a/test/cbmc/proofs/IPUtils/usGenerateProtocolChecksum_IPv6/Makefile.json +++ b/test/cbmc/proofs/IPUtils/usGenerateProtocolChecksum_IPv6/Makefile.json @@ -24,6 +24,7 @@ "FREERTOS_TCP_ENABLE_VERIFICATION", "ipconfigUSE_TCP=1", "ipconfigNETWORK_MTU=200", + "ipconfigTCP_MSS=586", "ipconfigUSE_DHCP=0" ], "INC": diff --git a/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/eHandleIPv6ExtensionHeaders/Makefile.json b/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/eHandleIPv6ExtensionHeaders/Makefile.json index 66c0cd84d..d9b7588db 100644 --- a/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/eHandleIPv6ExtensionHeaders/Makefile.json +++ b/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/eHandleIPv6ExtensionHeaders/Makefile.json @@ -4,7 +4,7 @@ "CBMCFLAGS": [ "--unwind 1", - "--unwindset usGetExtensionHeaderLength.3:{MAX_EXT_HEADER_NUM}", + "--unwindset usGetExtensionHeaderLength.0:{MAX_EXT_HEADER_NUM}", "--nondet-static" ], "OPT": @@ -21,6 +21,7 @@ "DEF": [ "ipconfigNETWORK_MTU=200", + "ipconfigTCP_MSS=586", "ipconfigUSE_DHCP=0" ], "INC": diff --git a/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/prvAllowIPPacketIPv6/Configurations.json b/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/prvAllowIPPacketIPv6/Configurations.json index 368da7d17..150e6879a 100644 --- a/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/prvAllowIPPacketIPv6/Configurations.json +++ b/test/cbmc/proofs/parsing/ProcessIPPacket_IPv6/prvAllowIPPacketIPv6/Configurations.json @@ -29,6 +29,7 @@ "ipconfigETHERNET_DRIVER_FILTERS_PACKE,TS=1", "FREERTOS_TCP_ENABLE_VERIFICATION", "ipconfigNETWORK_MTU=200", + "ipconfigTCP_MSS=586", "ipconfigUSE_DHCP=0" ] }, @@ -39,6 +40,7 @@ "ipconfigETHERNET_DRIVER_FILTERS_PACKETS=0", "FREERTOS_TCP_ENABLE_VERIFICATION", "ipconfigNETWORK_MTU=200", + "ipconfigTCP_MSS=586", "ipconfigUSE_DHCP=0" ] } diff --git a/test/cbmc/proofs/prvChecksumIPv6Checks/Makefile.json b/test/cbmc/proofs/prvChecksumIPv6Checks/Makefile.json index 51d7c2153..9645ee00a 100644 --- a/test/cbmc/proofs/prvChecksumIPv6Checks/Makefile.json +++ b/test/cbmc/proofs/prvChecksumIPv6Checks/Makefile.json @@ -5,7 +5,7 @@ [ "--unwind 1", "--nondet-static", - "--unwindset usGetExtensionHeaderLength.3:{MAX_EXT_HEADER_NUM}", + "--unwindset usGetExtensionHeaderLength.0:{MAX_EXT_HEADER_NUM}", "--unwindset prvPrepareExtensionHeaders.0:{MAX_EXT_HEADER_NUM}", "--flush" ], @@ -26,6 +26,7 @@ [ "FREERTOS_TCP_ENABLE_VERIFICATION", "ipconfigNETWORK_MTU=200", + "ipconfigTCP_MSS=586", "ipconfigUSE_DHCP=0" ], "INC": diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt index 79e538bcc..0e271c11b 100644 --- a/test/unit-test/CMakeLists.txt +++ b/test/unit-test/CMakeLists.txt @@ -135,10 +135,6 @@ foreach( file ${TCP_INCLUDES} ) # Use this tool to process all conditional declarations. if(${MODIFIED_FILE} STREQUAL "FreeRTOS_Routing" OR ${MODIFIED_FILE} STREQUAL "FreeRTOS_IP_Private" ) execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT - -UpdTRUE_SIGNED - -UpdFALSE_SIGNED - -UpdTRUE_UNSIGNED - -UpdFALSE_UNSIGNED -UipTRUE_BOOL -UipFALSE_BOOL -UFreeRTOS_htonl @@ -158,10 +154,6 @@ foreach( file ${TCP_INCLUDES} ) ERROR_QUIET ) else() execute_process( COMMAND unifdefall -U${Guard} -USEND_REPEATED_COUNT - -UpdTRUE_SIGNED - -UpdFALSE_SIGNED - -UpdTRUE_UNSIGNED - -UpdFALSE_UNSIGNED -UipTRUE_BOOL -UipFALSE_BOOL -UFreeRTOS_htonl @@ -291,7 +283,6 @@ include( ${UNIT_TEST_DIR}/FreeRTOS_IP_Timers/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_ND/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_Sockets/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_Sockets_DiffConfig/ut.cmake ) -include( ${UNIT_TEST_DIR}/FreeRTOS_Sockets_DiffConfig1/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_Sockets_DiffConfig2/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_Stream_Buffer/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_RA/ut.cmake ) @@ -308,7 +299,6 @@ include( ${UNIT_TEST_DIR}/FreeRTOS_TCP_Transmission/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_TCP_Transmission_IPv6/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_TCP_Utils/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_TCP_Utils_IPv6/ut.cmake ) -include( ${UNIT_TEST_DIR}/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_IPv6/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_IPv6_ConfigDriverCheckChecksum/ut.cmake ) include( ${UNIT_TEST_DIR}/FreeRTOS_Sockets_IPv6/ut.cmake ) @@ -355,14 +345,11 @@ add_custom_target( coverage FreeRTOS_TCP_IP FreeRTOS_TCP_Utils FreeRTOS_TCP_Utils_IPv6_utest - FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS_utest FreeRTOS_Sockets_GenericAPI_utest FreeRTOS_Sockets_privates_utest FreeRTOS_Sockets_TCP_API_utest FreeRTOS_Sockets_UDP_API_utest FreeRTOS_Sockets_DiffConfig_privates_utest - FreeRTOS_Sockets_DiffConfig1_GenericAPI_utest - FreeRTOS_Sockets_DiffConfig1_privates_utest FreeRTOS_Sockets_DiffConfig2_GenericAPI_utest FreeRTOS_Sockets_DiffConfig2_privates_utest FreeRTOS_Sockets_DiffConfig2_TCP_API_utest diff --git a/test/unit-test/ConfigFiles/FreeRTOSIPConfig.h b/test/unit-test/ConfigFiles/FreeRTOSIPConfig.h index 3f6473a7c..81d820289 100644 --- a/test/unit-test/ConfigFiles/FreeRTOSIPConfig.h +++ b/test/unit-test/ConfigFiles/FreeRTOSIPConfig.h @@ -107,20 +107,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -134,7 +126,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -143,16 +135,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/ConfigFiles/FreeRTOS_errno_TCP.h b/test/unit-test/ConfigFiles/FreeRTOS_errno_TCP.h deleted file mode 100644 index 1fcbd8ab0..000000000 --- a/test/unit-test/ConfigFiles/FreeRTOS_errno_TCP.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - -#ifndef FREERTOS_ERRNO_TCP -#define FREERTOS_ERRNO_TCP - -/* The following definitions will be included in the core FreeRTOS code in - * future versions of FreeRTOS - hence the 'pd' (ProjDefs) prefix - at which time - * this file will be removed. */ - -/* The following errno values are used by FreeRTOS+ components, not FreeRTOS - * itself. */ - -/* For future compatibility (see comment above), check the definitions have not - * already been made. */ -#ifndef pdFREERTOS_ERRNO_NONE - #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ - #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ - #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ - #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ - #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ - #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ - #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ - #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ - #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ - #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ - #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ - #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ - #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ - #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ - #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ - #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ - #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ - #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ - #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ - #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ - #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ - #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ - #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ - #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ - #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ - #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ - #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ - #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ - #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ - #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ - #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ - #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ - #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ - #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ - #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ - #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ - #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ - #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ - #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ - #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ - -/* The following endian values are used by FreeRTOS+ components, not FreeRTOS - * itself. */ - #define pdFREERTOS_LITTLE_ENDIAN 0 - #define pdFREERTOS_BIG_ENDIAN 1 - -#endif /* pdFREERTOS_ERRNO_NONE */ - -#endif /* FREERTOS_ERRNO_TCP */ diff --git a/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/FreeRTOSIPConfig.h index ed07f90ef..e8f5d6755 100644 --- a/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_ARP_DataLenLessThanMinPacket/FreeRTOSIPConfig.h @@ -100,20 +100,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -127,7 +119,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -136,16 +128,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_DHCPv6/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_DHCPv6/FreeRTOSIPConfig.h index fb1b85e4c..aed379466 100644 --- a/test/unit-test/FreeRTOS_DHCPv6/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_DHCPv6/FreeRTOSIPConfig.h @@ -106,20 +106,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -133,7 +125,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -142,16 +134,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server @@ -160,7 +152,7 @@ extern uint32_t ulRand(); * static IP address passed as a parameter to FreeRTOS_IPInit() if the * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) +#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP * stack can only send a UDP message to a remove IP address if it knowns the MAC @@ -171,19 +163,19 @@ extern uint32_t ulRand(); * cache then the UDP message is replaced by a ARP message that solicits the * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 +#define ipconfigARP_CACHE_ENTRIES 6 /* ARP requests that do not result in an ARP response will be re-transmitted a * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) +#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP * table being created or refreshed and the entry being removed because it is stale. * New ARP requests are sent for ARP cache entries that are nearing their maximum * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 +#define ipconfigMAX_ARP_AGE 150 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling * routines, which are relatively large. To save code space the full @@ -195,13 +187,13 @@ extern uint32_t ulRand(); * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 +#define ipconfigINCLUDE_FULL_INET_ADDR 1 /* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that * are available to the IP stack. The total number of network buffers is limited * to ensure the total amount of RAM that can be consumed by the IP stack is capped * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 +#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 /* A FreeRTOS queue is used to send events from application tasks to the IP * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can diff --git a/test/unit-test/FreeRTOS_DNS/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_DNS/FreeRTOSIPConfig.h index eee2e487e..6574ae4cc 100644 --- a/test/unit-test/FreeRTOS_DNS/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_DNS/FreeRTOSIPConfig.h @@ -107,20 +107,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -134,7 +126,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -143,16 +135,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server @@ -161,7 +153,7 @@ extern uint32_t ulRand(); * static IP address passed as a parameter to FreeRTOS_IPInit() if the * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) +#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP * stack can only send a UDP message to a remove IP address if it knowns the MAC @@ -172,19 +164,19 @@ extern uint32_t ulRand(); * cache then the UDP message is replaced by a ARP message that solicits the * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 +#define ipconfigARP_CACHE_ENTRIES 6 /* ARP requests that do not result in an ARP response will be re-transmitted a * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) +#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP * table being created or refreshed and the entry being removed because it is stale. * New ARP requests are sent for ARP cache entries that are nearing their maximum * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 +#define ipconfigMAX_ARP_AGE 150 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling * routines, which are relatively large. To save code space the full @@ -196,13 +188,13 @@ extern uint32_t ulRand(); * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 +#define ipconfigINCLUDE_FULL_INET_ADDR 1 /* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that * are available to the IP stack. The total number of network buffers is limited * to ensure the total amount of RAM that can be consumed by the IP stack is capped * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 +#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 /* A FreeRTOS queue is used to send events from application tasks to the IP * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can diff --git a/test/unit-test/FreeRTOS_DNS_ConfigNoCallback/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_DNS_ConfigNoCallback/FreeRTOSIPConfig.h index d9deab1dc..78a695c9e 100644 --- a/test/unit-test/FreeRTOS_DNS_ConfigNoCallback/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_DNS_ConfigNoCallback/FreeRTOSIPConfig.h @@ -107,20 +107,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -134,7 +126,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -143,16 +135,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server @@ -161,7 +153,7 @@ extern uint32_t ulRand(); * static IP address passed as a parameter to FreeRTOS_IPInit() if the * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) +#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP * stack can only send a UDP message to a remove IP address if it knowns the MAC @@ -172,19 +164,19 @@ extern uint32_t ulRand(); * cache then the UDP message is replaced by a ARP message that solicits the * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 +#define ipconfigARP_CACHE_ENTRIES 6 /* ARP requests that do not result in an ARP response will be re-transmitted a * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) +#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP * table being created or refreshed and the entry being removed because it is stale. * New ARP requests are sent for ARP cache entries that are nearing their maximum * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 +#define ipconfigMAX_ARP_AGE 150 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling * routines, which are relatively large. To save code space the full @@ -196,13 +188,13 @@ extern uint32_t ulRand(); * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 +#define ipconfigINCLUDE_FULL_INET_ADDR 1 /* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that * are available to the IP stack. The total number of network buffers is limited * to ensure the total amount of RAM that can be consumed by the IP stack is capped * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 +#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 /* A FreeRTOS queue is used to send events from application tasks to the IP * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can diff --git a/test/unit-test/FreeRTOS_DNS_Parser/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_DNS_Parser/FreeRTOSIPConfig.h index 32adf4497..18b5be367 100644 --- a/test/unit-test/FreeRTOS_DNS_Parser/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_DNS_Parser/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_DiffConfig/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IP_DiffConfig/FreeRTOSIPConfig.h index f86a2816b..4cc1a6ad6 100644 --- a/test/unit-test/FreeRTOS_IP_DiffConfig/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IP_DiffConfig/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOSIPConfig.h index 54cc01dac..bd7b02199 100644 --- a/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IP_DiffConfig1/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_DiffConfig2/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IP_DiffConfig2/FreeRTOSIPConfig.h index a4b4420b2..d9e12ec24 100644 --- a/test/unit-test/FreeRTOS_IP_DiffConfig2/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IP_DiffConfig2/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_DiffConfig3/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IP_DiffConfig3/FreeRTOSIPConfig.h index 59a2ee392..bf235883c 100644 --- a/test/unit-test/FreeRTOS_IP_DiffConfig3/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IP_DiffConfig3/FreeRTOSIPConfig.h @@ -106,20 +106,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -133,7 +125,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -142,16 +134,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_Utils/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IP_Utils/FreeRTOSIPConfig.h index 2e1bb6655..c224522bb 100644 --- a/test/unit-test/FreeRTOS_IP_Utils/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IP_Utils/FreeRTOSIPConfig.h @@ -106,20 +106,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -133,7 +125,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -142,17 +134,17 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigUSE_DHCPv6 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigUSE_DHCPv6 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOSIPConfig.h index 9133238cd..3333de487 100644 --- a/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOS_IP_Utils_DiffConfig_utest.c b/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOS_IP_Utils_DiffConfig_utest.c index 8a19cad36..8d2ff7080 100644 --- a/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOS_IP_Utils_DiffConfig_utest.c +++ b/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/FreeRTOS_IP_Utils_DiffConfig_utest.c @@ -45,6 +45,7 @@ #include "FreeRTOSIPConfig.h" +#include "mock_FreeRTOS_IP.h" #include "mock_FreeRTOS_IP_Private.h" #include "mock_FreeRTOS_IP_Timers.h" #include "mock_FreeRTOS_ARP.h" diff --git a/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/IP_Utils_DiffConfig_list_macros.h b/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/IP_Utils_DiffConfig_list_macros.h index 163d50012..cdfb1e722 100644 --- a/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/IP_Utils_DiffConfig_list_macros.h +++ b/test/unit-test/FreeRTOS_IP_Utils_DiffConfig/IP_Utils_DiffConfig_list_macros.h @@ -74,8 +74,6 @@ void * listGET_LIST_ITEM_OWNER( const ListItem_t * listItem ); size_t xPortGetMinimumEverFreeHeapSize( void ); -UBaseType_t uxGetMinimumIPQueueSpace( void ); - void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ); #endif /* ifndef LIST_MACRO_H */ diff --git a/test/unit-test/FreeRTOS_IPv4_DiffConfig/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IPv4_DiffConfig/FreeRTOSIPConfig.h index a19e99b3e..f4a4b5474 100644 --- a/test/unit-test/FreeRTOS_IPv4_DiffConfig/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IPv4_DiffConfig/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IPv4_DiffConfig1/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IPv4_DiffConfig1/FreeRTOSIPConfig.h index 754635509..7e58cb2d3 100644 --- a/test/unit-test/FreeRTOS_IPv4_DiffConfig1/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IPv4_DiffConfig1/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IPv6/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IPv6/FreeRTOSIPConfig.h index ca776333e..de397158a 100644 --- a/test/unit-test/FreeRTOS_IPv6/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IPv6/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IPv6_ConfigDriverCheckChecksum/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IPv6_ConfigDriverCheckChecksum/FreeRTOSIPConfig.h index eccdaf572..7f304dfda 100644 --- a/test/unit-test/FreeRTOS_IPv6_ConfigDriverCheckChecksum/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IPv6_ConfigDriverCheckChecksum/FreeRTOSIPConfig.h @@ -104,20 +104,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -131,7 +123,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -140,16 +132,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_IPv6_Utils/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_IPv6_Utils/FreeRTOSIPConfig.h index 3d64170c4..95b087a47 100644 --- a/test/unit-test/FreeRTOS_IPv6_Utils/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_IPv6_Utils/FreeRTOSIPConfig.h @@ -102,20 +102,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -129,7 +121,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -138,16 +130,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_Routing/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Routing/FreeRTOSIPConfig.h index 217e9e7c5..317cc58ab 100644 --- a/test/unit-test/FreeRTOS_Routing/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_Routing/FreeRTOSIPConfig.h @@ -108,20 +108,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -135,7 +127,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -144,16 +136,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_Routing_ConfigCompatibleWithSingle/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Routing_ConfigCompatibleWithSingle/FreeRTOSIPConfig.h index e7275a487..9d550f5d2 100644 --- a/test/unit-test/FreeRTOS_Routing_ConfigCompatibleWithSingle/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_Routing_ConfigCompatibleWithSingle/FreeRTOSIPConfig.h @@ -112,20 +112,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -139,7 +131,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -148,16 +140,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_Routing_ConfigV4Only/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Routing_ConfigV4Only/FreeRTOSIPConfig.h index 53fde60a2..132206dd2 100644 --- a/test/unit-test/FreeRTOS_Routing_ConfigV4Only/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_Routing_ConfigV4Only/FreeRTOSIPConfig.h @@ -42,7 +42,7 @@ #define ipconfigUSE_RA ( 1 ) -#define ipconfigUSE_DHCPv6 ( 1 ) +#define ipconfigUSE_DHCPv6 ( 0 ) #define ipconfigCOMPATIBLE_WITH_SINGLE ( 0 ) @@ -116,20 +116,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -143,7 +135,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -152,16 +144,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Sockets_DiffConfig/FreeRTOSIPConfig.h index 7554f8464..b86e87136 100644 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_Sockets_DiffConfig/FreeRTOSIPConfig.h @@ -100,20 +100,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -127,7 +119,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -136,16 +128,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOSConfig.h b/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOSConfig.h deleted file mode 100644 index b0ba377db..000000000 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOSConfig.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS - * - */ - - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -#include - -/*----------------------------------------------------------- -* Application specific definitions. -* -* These definitions should be adjusted for your particular hardware and -* application requirements. -* -* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE -* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. See -* http://www.freertos.org/a00110.html -*----------------------------------------------------------*/ - -#define configUSE_PREEMPTION 1 -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 1 -#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 -#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */ -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) ) -#define configMAX_TASK_NAME_LEN ( 12 ) -#define configUSE_TRACE_FACILITY 1 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 1 -#define configCHECK_FOR_STACK_OVERFLOW 0 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 20 -#define configUSE_MALLOC_FAILED_HOOK 1 -#define configUSE_APPLICATION_TASK_TAG 1 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_ALTERNATIVE_API 0 -#define configUSE_QUEUE_SETS 1 -#define configUSE_TASK_NOTIFICATIONS 1 -#define configSUPPORT_STATIC_ALLOCATION 1 -#define configINITIAL_TICK_COUNT ( ( TickType_t ) 0 ) /* For test. */ -#define configSTREAM_BUFFER_TRIGGER_LEVEL_TEST_MARGIN 1 /* As there are a lot of tasks running. */ - -/* Software timer related configuration options. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) -#define configTIMER_QUEUE_LENGTH 20 -#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) - -#define configMAX_PRIORITIES ( 7 ) -#define configENABLE_MPU 0 - -/* Run time stats gathering configuration options. */ - -#define configGENERATE_RUN_TIME_STATS 1 - -/* This demo makes use of one or more example stats formatting functions. These - * format the raw data provided by the uxTaskGetSystemState() function in to human - * readable ASCII form. See the notes in the implementation of vTaskList() within - * FreeRTOS/Source/tasks.c for limitations. */ -#define configUSE_STATS_FORMATTING_FUNCTIONS 1 - -/* Set the following definitions to 1 to include the API function, or zero - * to exclude the API function. In most cases the linker will remove unused - * functions anyway. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 -#define INCLUDE_xTaskGetIdleTaskHandle 1 -#define INCLUDE_xTaskGetHandle 1 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_xTaskAbortDelay 1 - -/* It is a good idea to define configASSERT() while developing. configASSERT() - * uses the same semantics as the standard C assert() macro. */ -extern void vAssertCalled( unsigned long ulLine, - const char * const pcFileName ); -#define configASSERT( x ) assert( x ) - -#define configINCLUDE_MESSAGE_BUFFER_AMP_DEMO 0 -#if ( configINCLUDE_MESSAGE_BUFFER_AMP_DEMO == 1 ) - extern void vGenerateCoreBInterrupt( void * xUpdatedMessageBuffer ); - #define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer ) -#endif /* configINCLUDE_MESSAGE_BUFFER_AMP_DEMO */ - -/* Include the FreeRTOS+Trace FreeRTOS trace macro definitions. */ -/* #include "trcRecorder.h" */ - -#endif /* FREERTOS_CONFIG_H */ diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOSIPConfig.h deleted file mode 100644 index 0936cb2e1..000000000 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOSIPConfig.h +++ /dev/null @@ -1,341 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - - -/***************************************************************************** -* -* See the following URL for configuration information. -* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html -* -*****************************************************************************/ - -#ifndef FREERTOS_IP_CONFIG_H -#define FREERTOS_IP_CONFIG_H - -#define _static - -#define TEST 1 - -#define ipconfigUSE_IPv4 ( 1 ) -#define ipconfigUSE_IPv6 ( 1 ) -#define ipconfigTCP_MSS ( ipSIZE_OF_IPv6_HEADER - ipSIZE_OF_IPv4_HEADER - 1 ) - -/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to - * 1 then FreeRTOS_debug_printf should be defined to the function used to print - * out the debugging messages. */ -#define ipconfigHAS_DEBUG_PRINTF 1 -#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) - #define FreeRTOS_debug_printf( X ) configPRINTF( X ) -#endif - -/* Set to 1 to print out non debugging messages, for example the output of the - * FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 - * then FreeRTOS_printf should be set to the function used to print out the - * messages. */ -#define ipconfigHAS_PRINTF 1 -#if ( ipconfigHAS_PRINTF == 1 ) - #define FreeRTOS_printf( X ) configPRINTF( X ) -#endif - -/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing - * on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ -#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN - -/* If the network card/driver includes checksum offloading then set - * ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software - * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 0 - -/* Several API's will block until the result is known, or the action has been - * performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be - * set per socket, using setsockopt(). If not set, the times below will be - * used as defaults. */ -#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) -#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) - -/* Include support for DNS caching. For TCP, having a small DNS cache is very - * useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low - * and also DNS may use small timeouts. If a DNS reply comes in after the DNS - * socket has been destroyed, the result will be stored into the cache. The next - * call to FreeRTOS_gethostbyname() will return immediately, without even creating - * a socket. - */ -#define ipconfigUSE_DNS_CACHE ( 1 ) -#define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 1 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) - -#define ipconfigDNS_CACHE_NAME_LENGTH ( 254 ) - -/* The IP stack executes it its own task (although any application task can make - * use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY - * sets the priority of the task that executes the IP stack. The priority is a - * standard FreeRTOS task priority so can take any value from 0 (the lowest - * priority) to (configMAX_PRIORITIES - 1) (the highest priority). - * configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in - * FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to - * the priority assigned to the task executing the IP stack relative to the - * priority assigned to tasks that use the IP stack. */ -#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) - -/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP - * task. This setting is less important when the FreeRTOS Win32 simulator is used - * as the Win32 simulator only stores a fixed amount of information on the task - * stack. FreeRTOS includes optional stack overflow detection, see: - * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ -#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) - -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - -/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the - * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK - * is not set to 1 then the network event hook will never be called. See: - * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. - */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 - -/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but - * a network buffer cannot be obtained then the calling task is held in the Blocked - * state (so other tasks can continue to executed) until either a network buffer - * becomes available or the send block time expires. If the send block time expires - * then the send operation is aborted. The maximum allowable send block time is - * capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the - * maximum allowable send block time prevents prevents a deadlock occurring when - * all the network buffers are in use and the tasks that process (and subsequently - * free) the network buffers are themselves blocked waiting for a network buffer. - * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in - * milliseconds can be converted to a time in ticks by dividing the time in - * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) - -/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP - * address, netmask, DNS server address and gateway address from a DHCP server. If - * ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The - * stack will revert to using the static IP address even when ipconfigUSE_DHCP is - * set to 1 if a valid configuration cannot be obtained from a DHCP server for any - * reason. The static configuration used is that passed into the stack by the - * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 - -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 - -/* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must - * provide an implementation of the DHCP callback function, - * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 - -/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at - * increasing time intervals until either a reply is received from a DHCP server - * and accepted, or the interval between transmissions reaches - * ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the - * static IP address passed as a parameter to FreeRTOS_IPInit() if the - * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without - * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ - ( 120000U / portTICK_PERIOD_MS ) - -/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP - * stack can only send a UDP message to a remove IP address if it knowns the MAC - * address associated with the IP address, or the MAC address of the router used to - * contact the remote IP address. When a UDP message is received from a remote IP - * address the MAC address and IP address are added to the ARP cache. When a UDP - * message is sent to a remote IP address that does not already appear in the ARP - * cache then the UDP message is replaced by a ARP message that solicits the - * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum - * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 - -/* ARP requests that do not result in an ARP response will be re-transmitted a - * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is - * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) - -/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP - * table being created or refreshed and the entry being removed because it is stale. - * New ARP requests are sent for ARP cache entries that are nearing their maximum - * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is - * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 - -/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling - * routines, which are relatively large. To save code space the full - * FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster - * alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr() - * takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter. - * FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets - * (for example, 192, 168, 0, 1) as its parameters. If - * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and - * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is - * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 - -/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that - * are available to the IP stack. The total number of network buffers is limited - * to ensure the total amount of RAM that can be consumed by the IP stack is capped - * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 - -/* A FreeRTOS queue is used to send events from application tasks to the IP - * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can - * be queued for processing at any one time. The event queue must be a minimum of - * 5 greater than the total number of network buffers. */ -#define ipconfigEVENT_QUEUE_LENGTH \ - ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) - -/* The address of a socket is the combination of its IP address and its port - * number. FreeRTOS_bind() is used to manually allocate a port number to a socket - * (to 'bind' the socket to a port), but manual binding is not normally necessary - * for client sockets (those sockets that initiate outgoing connections rather than - * wait for incoming connections on a known port number). If - * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling - * FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP - * stack automatically binding the socket to a port number from the range - * socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If - * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto() - * on a socket that has not yet been bound will result in the send operation being - * aborted. */ -#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 0 - -/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */ -#define ipconfigUDP_TIME_TO_LIVE 128 -/* Also defined in FreeRTOSIPConfigDefaults.h. */ -#define ipconfigTCP_TIME_TO_LIVE 128 - -/* USE_TCP: Use TCP and all its features. */ -#define ipconfigUSE_TCP ( 1 ) - -/* USE_WIN: Let TCP use windowing mechanism. */ -#define ipconfigUSE_TCP_WIN ( 1 ) - -/* The MTU is the maximum number of bytes the payload of a network frame can - * contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a - * lower value can save RAM, depending on the buffer management scheme used. If - * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must - * be divisible by 8. */ -#define ipconfigNETWORK_MTU 1500U - -/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used - * through the FreeRTOS_gethostbyname() API function. */ -#define ipconfigUSE_DNS 1 - -/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will - * generate replies to incoming ICMP echo (ping) requests. */ -#define ipconfigREPLY_TO_INCOMING_PINGS 1 - -/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the - * FreeRTOS_SendPingRequest() API function is available. */ -#define ipconfigSUPPORT_OUTGOING_PINGS 1 - -/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select() - * (and associated) API function is available. */ -#define ipconfigSUPPORT_SELECT_FUNCTION 1 - -/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames - * that are not in Ethernet II format will be dropped. This option is included for - * potential future IP stack developments. */ -#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1 - -/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the - * responsibility of the Ethernet interface to filter out packets that are of no - * interest. If the Ethernet interface does not implement this functionality, then - * set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack - * perform the filtering instead (it is much less efficient for the stack to do it - * because the packet will already have been passed into the stack). If the - * Ethernet driver does all the necessary filtering in hardware then software - * filtering can be removed by using a value other than 1 or 0. */ -#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1 - -/* The windows simulator cannot really simulate MAC interrupts, and needs to - * block occasionally to allow other tasks to run. */ -#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS ) - -/* Advanced only: in order to access 32-bit fields in the IP packets with - * 32-bit memory instructions, all packets will be stored 32-bit-aligned, - * plus 16-bits. This has to do with the contents of the IP-packets: all - * 32-bit fields are 32-bit-aligned, plus 16-bit. */ -#define ipconfigPACKET_FILLER_SIZE 2U - -/* Define the size of the pool of TCP window descriptors. On the average, each - * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 - * outstanding packets (for Rx and Tx). When using up to 10 TP sockets - * simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */ -#define ipconfigTCP_WIN_SEG_COUNT 2 - -/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed - * maximum size. Define the size of Rx buffer for TCP sockets. */ -#define ipconfigTCP_RX_BUFFER_LENGTH ( 10000 ) - -/* Define the size of Tx buffer for TCP sockets. */ -#define ipconfigTCP_TX_BUFFER_LENGTH ( 10000 ) - -/* When using call-back handlers, the driver may check if the handler points to - * real program memory (RAM or flash) or just has a random non-zero value. */ -#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL ) - -/* Include support for TCP keep-alive messages. */ -#define ipconfigTCP_KEEP_ALIVE ( 1 ) -#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* Seconds. */ - -/* The socket semaphore is used to unblock the MQTT task. */ -#define ipconfigSOCKET_HAS_USER_SEMAPHORE ( 1 ) - -#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ( 1 ) -#define ipconfigUSE_CALLBACKS ( 1 ) - -#define ipconfigUSE_NBNS ( 1 ) - -#define ipconfigUSE_LLMNR ( 1 ) - -#define ipconfigDNS_USE_CALLBACKS 1 -#define ipconfigUSE_ARP_REMOVE_ENTRY 1 -#define ipconfigUSE_ARP_REVERSED_LOOKUP 1 - -#define ipconfigETHERNET_MINIMUM_PACKET_BYTES ( 200 ) - -#define ipconfigARP_STORES_REMOTE_ADDRESSES ( 1 ) - -#define ipconfigARP_USE_CLASH_DETECTION ( 1 ) - -#define ipconfigDHCP_FALL_BACK_AUTO_IP ( 1 ) - -#define ipconfigUDP_MAX_RX_PACKETS ( 1 ) - -#define ipconfigSUPPORT_SIGNALS ( 1 ) - -#define ipconfigDNS_CACHE_ENTRIES ( 2 ) - -#define ipconfigBUFFER_PADDING ( 14 ) -#define ipconfigTCP_SRTT_MINIMUM_VALUE_MS ( 34 ) - -#define ipconfigTCP_HANG_PROTECTION ( 1 ) - -#define portINLINE - -#define ipconfigTCP_MAY_LOG_PORT( xPort ) ( ( xPort ) != 23U ) - -#endif /* FREERTOS_IP_CONFIG_H */ diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOS_Sockets_DiffConfig1_GenericAPI_utest.c b/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOS_Sockets_DiffConfig1_GenericAPI_utest.c deleted file mode 100644 index e4f60cc2a..000000000 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOS_Sockets_DiffConfig1_GenericAPI_utest.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - - -/* Include Unity header */ -#include "unity.h" - -/* Include standard libraries */ -#include -#include -#include - -#include "mock_task.h" -#include "mock_list.h" - -/* This must come after list.h is included (in this case, indirectly - * by mock_list.h). */ -#include "mock_Sockets_DiffConfig1_list_macros.h" -#include "mock_event_groups.h" -#include "mock_portable.h" - -#include "mock_FreeRTOS_IP.h" - -#include "FreeRTOS_Sockets.h" - -#include "FreeRTOS_Sockets_stubs.c" -#include "catch_assert.h" - -#include "FreeRTOSIPConfig.h" - -/* ============================== Test Cases ============================== */ - -/** - * @brief Creation of socket when the protocol is TCPv6 with MSS less than - * the difference of IPv6 & IPv4 header length. - */ -void test_FreeRTOS_socket_TCPv6SocketLowMSS( void ) -{ - Socket_t xSocket; - FreeRTOS_Socket_t * pxSocket; - BaseType_t xDomain = FREERTOS_AF_INET6, xType = FREERTOS_SOCK_STREAM, xProtocol = FREERTOS_IPPROTO_TCP; - uint8_t ucSocket[ ( sizeof( *pxSocket ) - sizeof( pxSocket->u ) ) + sizeof( pxSocket->u.xTCP ) ]; - uint8_t xEventGroup[ sizeof( uintptr_t ) ]; - - pxSocket = ( FreeRTOS_Socket_t * ) ucSocket; - - xIPIsNetworkTaskReady_ExpectAndReturn( pdTRUE ); - - listLIST_IS_INITIALISED_ExpectAndReturn( &xBoundUDPSocketsList, pdTRUE ); - listLIST_IS_INITIALISED_ExpectAndReturn( &xBoundTCPSocketsList, pdTRUE ); - - pvPortMalloc_ExpectAndReturn( ( sizeof( *pxSocket ) - sizeof( pxSocket->u ) ) + sizeof( pxSocket->u.xTCP ), ( void * ) ucSocket ); - - xEventGroupCreate_ExpectAndReturn( ( EventGroupHandle_t ) xEventGroup ); - - FreeRTOS_round_up_ExpectAndReturn( ipconfigTCP_TX_BUFFER_LENGTH, ipconfigTCP_MSS, 0xAABB ); - FreeRTOS_max_size_t_ExpectAndReturn( 1U, ( uint32_t ) ( ipconfigTCP_RX_BUFFER_LENGTH / 2U ) / ipconfigTCP_MSS, 0x1234 ); - FreeRTOS_max_size_t_ExpectAndReturn( 1U, ( uint32_t ) ( 0xAABB / 2U ) / ipconfigTCP_MSS, 0x3456 ); - - vListInitialiseItem_Expect( &( pxSocket->xBoundSocketListItem ) ); - - listSET_LIST_ITEM_OWNER_Expect( &( pxSocket->xBoundSocketListItem ), pxSocket ); - - xSocket = FreeRTOS_socket( xDomain, xType, xProtocol ); - - TEST_ASSERT_EQUAL( ucSocket, xSocket ); - TEST_ASSERT_EQUAL( xSocket->xEventGroup, xEventGroup ); - TEST_ASSERT_EQUAL( xSocket->xReceiveBlockTime, ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ); - TEST_ASSERT_EQUAL( xSocket->xSendBlockTime, ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ); - TEST_ASSERT_EQUAL( xSocket->ucSocketOptions, ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT ); - TEST_ASSERT_EQUAL( xSocket->ucProtocol, ( uint8_t ) xProtocol ); - TEST_ASSERT_EQUAL( xSocket->u.xTCP.usMSS, ( uint16_t ) ipconfigTCP_MSS ); - TEST_ASSERT_EQUAL( xSocket->u.xTCP.uxRxStreamSize, ( size_t ) ipconfigTCP_RX_BUFFER_LENGTH ); - TEST_ASSERT_EQUAL( xSocket->u.xTCP.uxTxStreamSize, 0xAABB ); - TEST_ASSERT_EQUAL( 0x1234, pxSocket->u.xTCP.uxRxWinSize ); - TEST_ASSERT_EQUAL( 0x3456, pxSocket->u.xTCP.uxTxWinSize ); -} diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOS_Sockets_DiffConfig1_privates_utest.c b/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOS_Sockets_DiffConfig1_privates_utest.c deleted file mode 100644 index b53ff0e85..000000000 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/FreeRTOS_Sockets_DiffConfig1_privates_utest.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - - -/* Include Unity header */ -#include "unity.h" - -/* Include standard libraries */ -#include -#include -#include - -#include "mock_task.h" -#include "mock_list.h" - -#include "FreeRTOSIPConfig.h" - -#include "FreeRTOS_Sockets.h" -#include "FreeRTOS_IP_Private.h" - -#include "catch_assert.h" - -/* ============================== Test Cases ============================== */ - -/* - * @brief Binding successful. - */ -void test_vSocketBind_TCP( void ) -{ - BaseType_t xReturn; - FreeRTOS_Socket_t xSocket; - struct freertos_sockaddr xBindAddress; - size_t uxAddressLength; - BaseType_t xInternal = pdFALSE; - NetworkEndPoint_t xEndPoint = { 0 }; - - memset( &xBindAddress, 0xFC, sizeof( xBindAddress ) ); - memset( &xSocket, 0, sizeof( xSocket ) ); - - xSocket.ucProtocol = ( uint8_t ) FREERTOS_IPPROTO_TCP; - - catch_assert( vSocketBind( &xSocket, NULL, uxAddressLength, xInternal ) ); -} diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/Sockets_DiffConfig1_list_macros.h b/test/unit-test/FreeRTOS_Sockets_DiffConfig1/Sockets_DiffConfig1_list_macros.h deleted file mode 100644 index 4c1d99e8e..000000000 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig1/Sockets_DiffConfig1_list_macros.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - -#ifndef LIST_MACRO_H -#define LIST_MACRO_H - -#include "FreeRTOS.h" -#include "portmacro.h" -#include "list.h" - -#undef listSET_LIST_ITEM_OWNER -void listSET_LIST_ITEM_OWNER( ListItem_t * pxListItem, - void * owner ); - -#undef listGET_HEAD_ENTRY -ListItem_t * listGET_HEAD_ENTRY( List_t * pxList ); - -#undef listGET_END_MARKER -ListItem_t * listGET_END_MARKER( List_t * pxList ); - -#undef listGET_NEXT -ListItem_t * listGET_NEXT( const ListItem_t * pxListItem ); - -#undef listLIST_IS_EMPTY -BaseType_t listLIST_IS_EMPTY( const List_t * pxList ); - -#undef listGET_OWNER_OF_HEAD_ENTRY -void * listGET_OWNER_OF_HEAD_ENTRY( const List_t * pxList ); - -#undef listIS_CONTAINED_WITHIN -BaseType_t listIS_CONTAINED_WITHIN( List_t * list, - const ListItem_t * listItem ); - -#undef listGET_LIST_ITEM_VALUE -TickType_t listGET_LIST_ITEM_VALUE( const ListItem_t * listItem ); - -#undef listSET_LIST_ITEM_VALUE -void listSET_LIST_ITEM_VALUE( ListItem_t * listItem, - TickType_t itemValue ); - - -#undef listLIST_ITEM_CONTAINER -List_t * listLIST_ITEM_CONTAINER( const ListItem_t * listItem ); - -#undef listCURRENT_LIST_LENGTH -UBaseType_t listCURRENT_LIST_LENGTH( List_t * list ); - -#undef listGET_ITEM_VALUE_OF_HEAD_ENTRY -TickType_t listGET_ITEM_VALUE_OF_HEAD_ENTRY( List_t * list ); - -#undef listGET_LIST_ITEM_OWNER -void * listGET_LIST_ITEM_OWNER( const ListItem_t * listItem ); - -#undef listLIST_IS_INITIALISED -BaseType_t listLIST_IS_INITIALISED( List_t * pxList ); - -/* - * Returns pdTRUE if the IP task has been created and is initialised. Otherwise - * returns pdFALSE. - */ -BaseType_t xIPIsNetworkTaskReady( void ); - -/* - * The same as above, but a struct as a parameter, containing: - * eIPEvent_t eEventType; - * void *pvData; - */ -BaseType_t xSendEventStructToIPTask( const IPStackEvent_t * pxEvent, - TickType_t uxTimeout ); - -/* Returns pdTRUE is this function is called from the IP-task */ -BaseType_t xIsCallingFromIPTask( void ); - -/* Get the size of the IP-header. - * 'usFrameType' must be filled in if IPv6is to be recognised. */ -size_t uxIPHeaderSizePacket( const NetworkBufferDescriptor_t * pxNetworkBuffer ); - -/* - * Returns a pointer to the original NetworkBuffer from a pointer to a UDP - * payload buffer. - */ -NetworkBufferDescriptor_t * pxUDPPayloadBuffer_to_NetworkBuffer( const void * pvBuffer ); - -/* - * Send the event eEvent to the IP task event queue, using a block time of - * zero. Return pdPASS if the message was sent successfully, otherwise return - * pdFALSE. - */ -BaseType_t xSendEventToIPTask( eIPEvent_t eEvent ); - -/* - * Internal: Sets a new state for a TCP socket and performs the necessary - * actions like calling a OnConnected handler to notify the socket owner. - */ -#if ( ipconfigUSE_TCP == 1 ) - void vTCPStateChange( FreeRTOS_Socket_t * pxSocket, - enum eTCP_STATE eTCPState ); -#endif /* ipconfigUSE_TCP */ - -/* Check a single socket for retransmissions and timeouts */ -BaseType_t xTCPSocketCheck( FreeRTOS_Socket_t * pxSocket ); - -/* Get the size of the IP-header. - * The socket is checked for its type: IPv4 or IPv6. */ -size_t uxIPHeaderSizeSocket( const FreeRTOS_Socket_t * pxSocket ); - -#endif /* ifndef LIST_MACRO_H */ diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOSIPConfig.h index 42e7a66f5..0f60a4da2 100644 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOSIPConfig.h @@ -102,20 +102,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -129,7 +121,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -138,16 +130,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOS_Sockets_DiffConfig2_privates_utest.c b/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOS_Sockets_DiffConfig2_privates_utest.c index b823fadeb..2d4a14da7 100644 --- a/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOS_Sockets_DiffConfig2_privates_utest.c +++ b/test/unit-test/FreeRTOS_Sockets_DiffConfig2/FreeRTOS_Sockets_DiffConfig2_privates_utest.c @@ -91,3 +91,18 @@ void test_prvDetermineSocketSize_TCPv6Socket( void ) catch_assert( prvDetermineSocketSize( xDomain, xType, xProtocol, &xSocketSize ) ); } + +/** + * @brief Trying to bind an NULL bind address. + */ +void test_vSocketBind_CatchAssert( void ) +{ + BaseType_t xReturn; + FreeRTOS_Socket_t xSocket; + size_t uxAddressLength; + BaseType_t xInternal; + + memset( &xSocket, 0, sizeof( xSocket ) ); + + catch_assert( vSocketBind( &xSocket, NULL, uxAddressLength, xInternal ) ); +} diff --git a/test/unit-test/FreeRTOS_TCP_IP_DiffConfig/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_TCP_IP_DiffConfig/FreeRTOSIPConfig.h index 30ea5521f..dbd4141e2 100644 --- a/test/unit-test/FreeRTOS_TCP_IP_DiffConfig/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_TCP_IP_DiffConfig/FreeRTOSIPConfig.h @@ -100,20 +100,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -127,7 +119,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -136,16 +128,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/FreeRTOSIPConfig.h deleted file mode 100644 index 3fa50b426..000000000 --- a/test/unit-test/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/FreeRTOSIPConfig.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - - -/***************************************************************************** -* -* See the following URL for configuration information. -* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html -* -*****************************************************************************/ - -#ifndef FREERTOS_IP_CONFIG_H -#define FREERTOS_IP_CONFIG_H - -#define _static - -#define TEST 1 - -#define ipconfigUSE_IPv4 ( 1 ) -#define ipconfigUSE_IPv6 ( 1 ) - -#define ipconfigTCP_MSS ( 535U ) /* tcpMINIMUM_SEGMENT_LENGTH is set to 536U in FreeRTOS_TCP_IP.h */ - -/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to - * 1 then FreeRTOS_debug_printf should be defined to the function used to print - * out the debugging messages. */ -#define ipconfigHAS_DEBUG_PRINTF 1 -#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) - #define FreeRTOS_debug_printf( X ) configPRINTF( X ) -#endif - -/* Set to 1 to print out non debugging messages, for example the output of the - * FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 - * then FreeRTOS_printf should be set to the function used to print out the - * messages. */ -#define ipconfigHAS_PRINTF 1 -#if ( ipconfigHAS_PRINTF == 1 ) - #define FreeRTOS_printf( X ) configPRINTF( X ) -#endif - -/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing - * on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ -#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN - -/* If the network card/driver includes checksum offloading then set - * ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software - * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 0 - -/* Several API's will block until the result is known, or the action has been - * performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be - * set per socket, using setsockopt(). If not set, the times below will be - * used as defaults. */ -#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) -#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) - -/* Include support for DNS caching. For TCP, having a small DNS cache is very - * useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low - * and also DNS may use small timeouts. If a DNS reply comes in after the DNS - * socket has been destroyed, the result will be stored into the cache. The next - * call to FreeRTOS_gethostbyname() will return immediately, without even creating - * a socket. - */ -#define ipconfigUSE_DNS_CACHE ( 1 ) -#define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 1 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) - -#define ipconfigDNS_CACHE_NAME_LENGTH ( 254 ) - -/* The IP stack executes it its own task (although any application task can make - * use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY - * sets the priority of the task that executes the IP stack. The priority is a - * standard FreeRTOS task priority so can take any value from 0 (the lowest - * priority) to (configMAX_PRIORITIES - 1) (the highest priority). - * configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in - * FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to - * the priority assigned to the task executing the IP stack relative to the - * priority assigned to tasks that use the IP stack. */ -#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) - -/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP - * task. This setting is less important when the FreeRTOS Win32 simulator is used - * as the Win32 simulator only stores a fixed amount of information on the task - * stack. FreeRTOS includes optional stack overflow detection, see: - * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ -#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) - -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - -/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the - * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK - * is not set to 1 then the network event hook will never be called. See: - * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. - */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 - -/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but - * a network buffer cannot be obtained then the calling task is held in the Blocked - * state (so other tasks can continue to executed) until either a network buffer - * becomes available or the send block time expires. If the send block time expires - * then the send operation is aborted. The maximum allowable send block time is - * capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the - * maximum allowable send block time prevents prevents a deadlock occurring when - * all the network buffers are in use and the tasks that process (and subsequently - * free) the network buffers are themselves blocked waiting for a network buffer. - * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in - * milliseconds can be converted to a time in ticks by dividing the time in - * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) - -/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP - * address, netmask, DNS server address and gateway address from a DHCP server. If - * ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The - * stack will revert to using the static IP address even when ipconfigUSE_DHCP is - * set to 1 if a valid configuration cannot be obtained from a DHCP server for any - * reason. The static configuration used is that passed into the stack by the - * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 - -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 5 - -/* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must - * provide an implementation of the DHCP callback function, - * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 - -/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at - * increasing time intervals until either a reply is received from a DHCP server - * and accepted, or the interval between transmissions reaches - * ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the - * static IP address passed as a parameter to FreeRTOS_IPInit() if the - * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without - * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ - ( 120000U / portTICK_PERIOD_MS ) - -/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP - * stack can only send a UDP message to a remove IP address if it knowns the MAC - * address associated with the IP address, or the MAC address of the router used to - * contact the remote IP address. When a UDP message is received from a remote IP - * address the MAC address and IP address are added to the ARP cache. When a UDP - * message is sent to a remote IP address that does not already appear in the ARP - * cache then the UDP message is replaced by a ARP message that solicits the - * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum - * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 - -/* ARP requests that do not result in an ARP response will be re-transmitted a - * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is - * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) - -/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP - * table being created or refreshed and the entry being removed because it is stale. - * New ARP requests are sent for ARP cache entries that are nearing their maximum - * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is - * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 - -/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling - * routines, which are relatively large. To save code space the full - * FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster - * alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr() - * takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter. - * FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets - * (for example, 192, 168, 0, 1) as its parameters. If - * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and - * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is - * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 - -/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that - * are available to the IP stack. The total number of network buffers is limited - * to ensure the total amount of RAM that can be consumed by the IP stack is capped - * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 - -/* A FreeRTOS queue is used to send events from application tasks to the IP - * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can - * be queued for processing at any one time. The event queue must be a minimum of - * 5 greater than the total number of network buffers. */ -#define ipconfigEVENT_QUEUE_LENGTH \ - ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) - -/* The address of a socket is the combination of its IP address and its port - * number. FreeRTOS_bind() is used to manually allocate a port number to a socket - * (to 'bind' the socket to a port), but manual binding is not normally necessary - * for client sockets (those sockets that initiate outgoing connections rather than - * wait for incoming connections on a known port number). If - * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling - * FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP - * stack automatically binding the socket to a port number from the range - * socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If - * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto() - * on a socket that has not yet been bound will result in the send operation being - * aborted. */ -#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 0 - -/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */ -#define ipconfigUDP_TIME_TO_LIVE 128 -/* Also defined in FreeRTOSIPConfigDefaults.h. */ -#define ipconfigTCP_TIME_TO_LIVE 128 - -/* USE_TCP: Use TCP and all its features. */ -#define ipconfigUSE_TCP ( 1 ) - -/* USE_WIN: Let TCP use windowing mechanism. */ -#define ipconfigUSE_TCP_WIN ( 1 ) - -/* The MTU is the maximum number of bytes the payload of a network frame can - * contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a - * lower value can save RAM, depending on the buffer management scheme used. If - * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must - * be divisible by 8. */ -#define ipconfigNETWORK_MTU 1500U - -/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used - * through the FreeRTOS_gethostbyname() API function. */ -#define ipconfigUSE_DNS 1 - -/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will - * generate replies to incoming ICMP echo (ping) requests. */ -#define ipconfigREPLY_TO_INCOMING_PINGS 1 - -/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the - * FreeRTOS_SendPingRequest() API function is available. */ -#define ipconfigSUPPORT_OUTGOING_PINGS 1 - -/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select() - * (and associated) API function is available. */ -#define ipconfigSUPPORT_SELECT_FUNCTION 1 - -/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames - * that are not in Ethernet II format will be dropped. This option is included for - * potential future IP stack developments. */ -#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1 - -/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the - * responsibility of the Ethernet interface to filter out packets that are of no - * interest. If the Ethernet interface does not implement this functionality, then - * set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack - * perform the filtering instead (it is much less efficient for the stack to do it - * because the packet will already have been passed into the stack). If the - * Ethernet driver does all the necessary filtering in hardware then software - * filtering can be removed by using a value other than 1 or 0. */ -#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1 - -/* The windows simulator cannot really simulate MAC interrupts, and needs to - * block occasionally to allow other tasks to run. */ -#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS ) - -/* Advanced only: in order to access 32-bit fields in the IP packets with - * 32-bit memory instructions, all packets will be stored 32-bit-aligned, - * plus 16-bits. This has to do with the contents of the IP-packets: all - * 32-bit fields are 32-bit-aligned, plus 16-bit. */ -#define ipconfigPACKET_FILLER_SIZE 2U - -/* Define the size of the pool of TCP window descriptors. On the average, each - * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 - * outstanding packets (for Rx and Tx). When using up to 10 TP sockets - * simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */ -#define ipconfigTCP_WIN_SEG_COUNT 2 - -/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed - * maximum size. Define the size of Rx buffer for TCP sockets. */ -#define ipconfigTCP_RX_BUFFER_LENGTH ( 10000 ) - -/* Define the size of Tx buffer for TCP sockets. */ -#define ipconfigTCP_TX_BUFFER_LENGTH ( 10000 ) - -/* When using call-back handlers, the driver may check if the handler points to - * real program memory (RAM or flash) or just has a random non-zero value. */ -#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL ) - -/* Include support for TCP keep-alive messages. */ -#define ipconfigTCP_KEEP_ALIVE ( 1 ) -#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* Seconds. */ - -/* The socket semaphore is used to unblock the MQTT task. */ -#define ipconfigSOCKET_HAS_USER_SEMAPHORE ( 1 ) - -#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ( 1 ) -#define ipconfigUSE_CALLBACKS ( 1 ) - -#define ipconfigUSE_NBNS ( 1 ) - -#define ipconfigUSE_LLMNR ( 1 ) - -#define ipconfigDNS_USE_CALLBACKS 1 -#define ipconfigUSE_ARP_REMOVE_ENTRY 1 -#define ipconfigUSE_ARP_REVERSED_LOOKUP 1 - -#define ipconfigETHERNET_MINIMUM_PACKET_BYTES ( 200 ) - -#define ipconfigARP_STORES_REMOTE_ADDRESSES ( 1 ) - -#define ipconfigARP_USE_CLASH_DETECTION ( 1 ) - -#define ipconfigDHCP_FALL_BACK_AUTO_IP ( 1 ) - -#define ipconfigUDP_MAX_RX_PACKETS ( 1 ) - -#define ipconfigSUPPORT_SIGNALS ( 1 ) - -#define ipconfigDNS_CACHE_ENTRIES ( 2 ) - -#define ipconfigBUFFER_PADDING ( 14 ) -#define ipconfigTCP_SRTT_MINIMUM_VALUE_MS ( 34 ) - -#define ipconfigTCP_HANG_PROTECTION ( 1 ) - -#define portINLINE - -#define ipconfigTCP_MAY_LOG_PORT( xPort ) ( ( xPort ) != 23U ) - -#endif /* FREERTOS_IP_CONFIG_H */ diff --git a/test/unit-test/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS_utest.c b/test/unit-test/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS_utest.c deleted file mode 100644 index 93a7f08f1..000000000 --- a/test/unit-test/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS_utest.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * FreeRTOS+TCP - * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://aws.amazon.com/freertos - * http://www.FreeRTOS.org - */ - - -/* Include Unity header */ -#include "unity.h" - -/* Include standard libraries */ -#include -#include -#include - -#include "FreeRTOSIPConfig.h" - -#include "mock_FreeRTOS_IP.h" -#include "mock_FreeRTOS_Sockets.h" -#include "mock_FreeRTOS_Routing.h" - -#include "catch_assert.h" - -#include "FreeRTOS_TCP_IP.h" -#include "FreeRTOS_TCP_Utils.h" - -/* =========================== EXTERN VARIABLES =========================== */ - -FreeRTOS_Socket_t xSocket, * pxSocket; -NetworkEndPoint_t xEndPoint, * pxEndPoint; - -/* =========================== Unity Fixtures =========================== */ - -/*! called before each test case */ -void setUp( void ) -{ - memset( &xSocket, 0, sizeof( xSocket ) ); - memset( &xEndPoint, 0, sizeof( xEndPoint ) ); - - pxSocket = NULL; - pxEndPoint = NULL; -} - -/* ============================== Test Cases ============================== */ - -/** - * @brief Due to low TCP MSS configuration, the MSS is set to minimum segment length. - */ -void test_prvSocketSetMSS_IPV6_LowMSS( void ) -{ - uint32_t ulDiffSizeIPHeader = ( ipSIZE_OF_IPv6_HEADER - ipSIZE_OF_IPv4_HEADER ); - - pxSocket = &xSocket; - pxEndPoint = &xEndPoint; - pxSocket->pxEndPoint = pxEndPoint; - - xIPv6_GetIPType_ExpectAndReturn( &( pxSocket->u.xTCP.xRemoteIP.xIP_IPv6 ), eIPv6_Global + 1 ); - - FreeRTOS_inet_ntop_ExpectAnyArgsAndReturn( NULL ); - - prvSocketSetMSS_IPV6( pxSocket ); - - TEST_ASSERT_EQUAL( tcpMINIMUM_SEGMENT_LENGTH - ulDiffSizeIPHeader, pxSocket->u.xTCP.usMSS ); -} diff --git a/test/unit-test/FreeRTOS_Tiny_TCP/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_Tiny_TCP/FreeRTOSIPConfig.h index 50d80f5b7..b40021826 100644 --- a/test/unit-test/FreeRTOS_Tiny_TCP/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_Tiny_TCP/FreeRTOSIPConfig.h @@ -102,20 +102,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -129,7 +121,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -138,14 +130,14 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server diff --git a/test/unit-test/FreeRTOS_UDP_IPv4/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_UDP_IPv4/FreeRTOSIPConfig.h index eee2e487e..6574ae4cc 100644 --- a/test/unit-test/FreeRTOS_UDP_IPv4/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_UDP_IPv4/FreeRTOSIPConfig.h @@ -107,20 +107,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -134,7 +126,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -143,16 +135,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server @@ -161,7 +153,7 @@ extern uint32_t ulRand(); * static IP address passed as a parameter to FreeRTOS_IPInit() if the * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) +#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP * stack can only send a UDP message to a remove IP address if it knowns the MAC @@ -172,19 +164,19 @@ extern uint32_t ulRand(); * cache then the UDP message is replaced by a ARP message that solicits the * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 +#define ipconfigARP_CACHE_ENTRIES 6 /* ARP requests that do not result in an ARP response will be re-transmitted a * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) +#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP * table being created or refreshed and the entry being removed because it is stale. * New ARP requests are sent for ARP cache entries that are nearing their maximum * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 +#define ipconfigMAX_ARP_AGE 150 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling * routines, which are relatively large. To save code space the full @@ -196,13 +188,13 @@ extern uint32_t ulRand(); * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 +#define ipconfigINCLUDE_FULL_INET_ADDR 1 /* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that * are available to the IP stack. The total number of network buffers is limited * to ensure the total amount of RAM that can be consumed by the IP stack is capped * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 +#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 /* A FreeRTOS queue is used to send events from application tasks to the IP * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can diff --git a/test/unit-test/FreeRTOS_UDP_IPv6/FreeRTOSIPConfig.h b/test/unit-test/FreeRTOS_UDP_IPv6/FreeRTOSIPConfig.h index 85969a9b3..e824c7e05 100644 --- a/test/unit-test/FreeRTOS_UDP_IPv6/FreeRTOSIPConfig.h +++ b/test/unit-test/FreeRTOS_UDP_IPv6/FreeRTOSIPConfig.h @@ -106,20 +106,12 @@ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html. */ #define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) -/* ipconfigRAND32() is called by the IP stack to generate random numbers for - * things such as a DHCP transaction number or initial sequence number. Random - * number generation is performed via this macro to allow applications to use their - * own random number generation method. For example, it might be possible to - * generate a random number by sampling noise on an analogue input. */ -extern uint32_t ulRand(); -#define ipconfigRAND32() ulRand() - /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK * is not set to 1 then the network event hook will never be called. See: * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml. */ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but * a network buffer cannot be obtained then the calling task is held in the Blocked @@ -133,7 +125,7 @@ extern uint32_t ulRand(); * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * milliseconds can be converted to a time in ticks by dividing the time in * milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP * address, netmask, DNS server address and gateway address from a DHCP server. If @@ -142,16 +134,16 @@ extern uint32_t ulRand(); * set to 1 if a valid configuration cannot be obtained from a DHCP server for any * reason. The static configuration used is that passed into the stack by the * FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 -#define ipconfigDHCP_REGISTER_HOSTNAME 1 -#define ipconfigDHCP_USES_UNICAST 1 +#define ipconfigUSE_DHCP 1 +#define ipconfigDHCP_REGISTER_HOSTNAME 1 +#define ipconfigDHCP_USES_UNICAST 1 -#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 +#define ipconfigENDPOINT_DNS_ADDRESS_COUNT 2 /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must * provide an implementation of the DHCP callback function, * xApplicationDHCPUserHook(). */ -#define ipconfigUSE_DHCP_HOOK 1 +#define ipconfigUSE_DHCP_HOOK 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at * increasing time intervals until either a reply is received from a DHCP server @@ -160,7 +152,7 @@ extern uint32_t ulRand(); * static IP address passed as a parameter to FreeRTOS_IPInit() if the * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) +#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 30000U / portTICK_PERIOD_MS ) /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP * stack can only send a UDP message to a remove IP address if it knowns the MAC @@ -171,19 +163,19 @@ extern uint32_t ulRand(); * cache then the UDP message is replaced by a ARP message that solicits the * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum * number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 +#define ipconfigARP_CACHE_ENTRIES 6 /* ARP requests that do not result in an ARP response will be re-transmitted a * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is * aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) +#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP * table being created or refreshed and the entry being removed because it is stale. * New ARP requests are sent for ARP cache entries that are nearing their maximum * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is * equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 +#define ipconfigMAX_ARP_AGE 150 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling * routines, which are relatively large. To save code space the full @@ -195,13 +187,13 @@ extern uint32_t ulRand(); * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 +#define ipconfigINCLUDE_FULL_INET_ADDR 1 /* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that * are available to the IP stack. The total number of network buffers is limited * to ensure the total amount of RAM that can be consumed by the IP stack is capped * to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 +#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60 /* A FreeRTOS queue is used to send events from application tasks to the IP * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can