From f60dd886098058580ec3fdd9e6d57798b49171b3 Mon Sep 17 00:00:00 2001 From: Monika Singh Date: Wed, 1 Nov 2023 12:33:25 +0530 Subject: [PATCH] Remove deprecated ipconfigRAND32 (#1108) * Remove deprecated ipconfigRAND32 * Uncrustify: triggered by comment. * Update * Check for return value * Uncrustify: triggered by comment. * Update --------- Co-authored-by: GitHub Action --- .../FreeRTOSIPConfig.h | 32 +++---- .../main_networking.c | 1 + .../FreeRTOSIPConfig.h | 32 +++---- .../IPv6_Multi_WinSim_demo/FreeRTOSIPConfig.h | 34 +++----- .../IPv6_Multi_WinSim_demo/main.c | 86 +++++++++++-------- .../Integration/Config/FreeRTOSIPConfig.h | 32 +++---- .../Config/FreeRTOSIPConfig.h | 34 +++----- .../Full-TCP-Suite/Config/FreeRTOSIPConfig.h | 20 ++--- .../FreeRTOS+TCP/FreeRTOSIPConfig.h | 32 +++---- FreeRTOS/Test/CBMC/patches/FreeRTOSIPConfig.h | 20 ++--- 10 files changed, 136 insertions(+), 187 deletions(-) diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSIPConfig.h index 070ee6cc1db..24bd5d70ce2 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSIPConfig.h @@ -74,26 +74,26 @@ extern void vLoggingPrintf( const char * pcFormatString, /* 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 +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* 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 ) +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution * (non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 1 ) +#define ipconfigUSE_LLMNR ( 1 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 1 ) +#define ipconfigUSE_NBNS ( 1 ) /* 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 @@ -101,10 +101,10 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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_NAME_LENGTH ( 16 ) -#define ipconfigDNS_CACHE_ENTRIES ( 4 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) +#define ipconfigUSE_DNS_CACHE ( 1 ) +#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 ) +#define ipconfigDNS_CACHE_ENTRIES ( 4 ) +#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 @@ -115,22 +115,14 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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 UBaseType_t uxRand(); -#define ipconfigRAND32() uxRand() +#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/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main_networking.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main_networking.c index 085f2950958..8fde5343f51 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main_networking.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main_networking.c @@ -288,6 +288,7 @@ static void prvMiscInitialisation( void ) ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] ); + FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n", ulRandomNumbers[ 0 ], ulRandomNumbers[ 1 ], diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/FreeRTOSIPConfig.h index a30f9a522c5..539dcc18037 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/FreeRTOSIPConfig.h @@ -79,26 +79,26 @@ extern void vLoggingPrintf( const char * pcFormatString, /* 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 +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* 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 ) +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution * (non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 1 ) +#define ipconfigUSE_LLMNR ( 1 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 1 ) +#define ipconfigUSE_NBNS ( 1 ) /* 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 @@ -106,10 +106,10 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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_NAME_LENGTH ( 16 ) -#define ipconfigDNS_CACHE_ENTRIES ( 4 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) +#define ipconfigUSE_DNS_CACHE ( 1 ) +#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 ) +#define ipconfigDNS_CACHE_ENTRIES ( 4 ) +#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 @@ -120,22 +120,14 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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 UBaseType_t uxRand(); -#define ipconfigRAND32() uxRand() +#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/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/FreeRTOSIPConfig.h index d8aa1a7b4c5..acf4df5c185 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/FreeRTOSIPConfig.h @@ -60,26 +60,26 @@ extern void vLoggingPrintf( const char * pcFormatString, /* 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 +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* 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 ) +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution * (non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 1 ) +#define ipconfigUSE_LLMNR ( 1 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 1 ) +#define ipconfigUSE_NBNS ( 1 ) /* 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 @@ -87,13 +87,13 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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_NAME_LENGTH ( 33 ) -#define ipconfigDNS_CACHE_ENTRIES ( 4 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) +#define ipconfigUSE_DNS_CACHE ( 1 ) +#define ipconfigDNS_CACHE_NAME_LENGTH ( 33 ) +#define ipconfigDNS_CACHE_ENTRIES ( 4 ) +#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) /* Let DNS wait for 3 seconds for an answer. */ -#define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 3000U ) +#define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 3000U ) /* 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 @@ -104,22 +104,14 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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 UBaseType_t uxRand(); -#define ipconfigRAND32() uxRand() +#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/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/main.c index b2fe91edc1c..eeeb0a88e6b 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/main.c @@ -464,15 +464,6 @@ UBaseType_t uxRand( void ) } /*-----------------------------------------------------------*/ -uint32_t uxRand32( void ) -{ - /* uxRand only returns 15 random bits. Call it 3 times. */ - uint32_t ul[ 3 ] = { uxRand(), uxRand(), uxRand() }; - uint32_t uxReturn = ul[ 0 ] | ( ul[ 1 ] << 15 ) | ( ul[ 2 ] << 30 ); - - return uxReturn; -} - static void prvSRand( UBaseType_t ulSeed ) { /* Utility function to seed the pseudo random number generator. */ @@ -483,6 +474,7 @@ static void prvSRand( UBaseType_t ulSeed ) static void prvMiscInitialisation( void ) { time_t xTimeNow; + uint32_t ulRandomNumbers[ 4 ]; uint32_t ulLoggingIPAddress; ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 ); @@ -492,7 +484,16 @@ static void prvMiscInitialisation( void ) time( &xTimeNow ); FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\r\n", xTimeNow ) ); prvSRand( ( uint32_t ) xTimeNow ); - FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\r\n", ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32(), ipconfigRAND32() ) ); + + ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] ); + ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] ); + ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] ); + ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] ); + FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n", + ulRandomNumbers[ 0 ], + ulRandomNumbers[ 1 ], + ulRandomNumbers[ 2 ], + ulRandomNumbers[ 3 ] ) ); } /*-----------------------------------------------------------*/ @@ -637,12 +638,16 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, uint32_t ulDestinationAddress, uint16_t usDestinationPort ) { + uint32_t ulRandomNumber; + ( void ) ulSourceAddress; ( void ) usSourcePort; ( void ) ulDestinationAddress; ( void ) usDestinationPort; - return uxRand32(); + ( void ) xApplicationGetRandomNumber( &ulRandomNumber ); + + return ulRandomNumber; } /*-----------------------------------------------------------*/ @@ -930,34 +935,41 @@ static void vDNSEvent( const char * pcName, static void dns_test( const char * pcHostName ) { - uint32_t ulID = uxRand32(); + uint32_t ulID; BaseType_t rc; - FreeRTOS_dnsclear(); - - struct freertos_addrinfo xHints; - struct freertos_addrinfo * pxResult = NULL; - - memset( &xHints, 0, sizeof xHints ); - xHints.ai_family = FREERTOS_AF_INET6; - - rc = FreeRTOS_getaddrinfo( pcHostName, NULL, &xHints, &pxResult ); - - FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); - - FreeRTOS_dnsclear(); - xDNSResult = -2; - rc = FreeRTOS_getaddrinfo_a( pcHostName, - NULL, - &xHints, - &pxResult, /* An allocated struct, containing the results. */ - vDNSEvent, - ( void * ) ulID, - pdMS_TO_TICKS( 1000U ) ); - vTaskDelay( pdMS_TO_TICKS( 1000U ) ); - rc = xDNSResult; - FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); - /* FreeRTOS_gethostbyname( pcHostName ); */ + if( xApplicationGetRandomNumber( &( ulID ) ) != pdFALSE ) + { + FreeRTOS_dnsclear(); + + struct freertos_addrinfo xHints; + struct freertos_addrinfo * pxResult = NULL; + + memset( &xHints, 0, sizeof xHints ); + xHints.ai_family = FREERTOS_AF_INET6; + + rc = FreeRTOS_getaddrinfo( pcHostName, NULL, &xHints, &pxResult ); + + FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); + + FreeRTOS_dnsclear(); + xDNSResult = -2; + rc = FreeRTOS_getaddrinfo_a( pcHostName, + NULL, + &xHints, + &pxResult, /* An allocated struct, containing the results. */ + vDNSEvent, + ( void * ) ulID, + pdMS_TO_TICKS( 1000U ) ); + vTaskDelay( pdMS_TO_TICKS( 1000U ) ); + rc = xDNSResult; + FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); + /* FreeRTOS_gethostbyname( pcHostName ); */ + } + else + { + FreeRTOS_printf( ( "dns_test: Failed to generate a random SearchID\n" ) ); + } } void showAddressInfo( struct freertos_addrinfo * pxAddrInfo ) diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h index 86573f18eb8..f9a9982a3ec 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/Config/FreeRTOSIPConfig.h @@ -60,26 +60,26 @@ extern void vLoggingPrintf( const char * pcFormatString, /* 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 +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* 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 ( 2000 ) -#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 2000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution * (non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 0 ) +#define ipconfigUSE_LLMNR ( 0 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 0 ) +#define ipconfigUSE_NBNS ( 0 ) /* 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 @@ -87,10 +87,10 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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_NAME_LENGTH ( 64 ) -#define ipconfigDNS_CACHE_ENTRIES ( 4 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) +#define ipconfigUSE_DNS_CACHE ( 1 ) +#define ipconfigDNS_CACHE_NAME_LENGTH ( 64 ) +#define ipconfigDNS_CACHE_ENTRIES ( 4 ) +#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 @@ -101,22 +101,14 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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: * https://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 UBaseType_t uxRand(); -#define ipconfigRAND32() uxRand() +#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/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/Config/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/Config/FreeRTOSIPConfig.h index 71eafde4ece..a6d1283a011 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/Config/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/Config/FreeRTOSIPConfig.h @@ -62,26 +62,26 @@ extern void vLoggingPrintf( const char * pcFormatString, /* 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 +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* 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 ) +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution * (non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 0 ) +#define ipconfigUSE_LLMNR ( 0 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 1 ) +#define ipconfigUSE_NBNS ( 1 ) /* 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 @@ -89,11 +89,11 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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_NAME_LENGTH ( 254 ) -#define ipconfigDNS_CACHE_ENTRIES ( 4 ) -#define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 6 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) +#define ipconfigUSE_DNS_CACHE ( 1 ) +#define ipconfigDNS_CACHE_NAME_LENGTH ( 254 ) +#define ipconfigDNS_CACHE_ENTRIES ( 4 ) +#define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 6 ) +#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 @@ -104,22 +104,14 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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 UBaseType_t rand(); */ -#define ipconfigRAND32() rand() +#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/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Config/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Config/FreeRTOSIPConfig.h index f3758c65967..2ce3b83167a 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Config/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Config/FreeRTOSIPConfig.h @@ -97,20 +97,12 @@ * https://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: * https://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 @@ -124,7 +116,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 @@ -133,14 +125,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 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/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/FreeRTOSIPConfig.h b/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/FreeRTOSIPConfig.h index bb372e016ed..c49e2e2b605 100644 --- a/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/FreeRTOSIPConfig.h +++ b/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/FreeRTOSIPConfig.h @@ -63,26 +63,26 @@ extern void vLoggingPrintf( const char * pcFormatString, /* 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 +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software * stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* 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 ) +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution * (non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 0 ) +#define ipconfigUSE_LLMNR ( 0 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 0 ) +#define ipconfigUSE_NBNS ( 0 ) /* 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 @@ -90,10 +90,10 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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_NAME_LENGTH ( 64U ) -#define ipconfigDNS_CACHE_ENTRIES ( 4U ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2U ) +#define ipconfigUSE_DNS_CACHE 1 +#define ipconfigDNS_CACHE_NAME_LENGTH ( 64U ) +#define ipconfigDNS_CACHE_ENTRIES ( 4U ) +#define ipconfigDNS_REQUEST_ATTEMPTS ( 2U ) /* 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 @@ -104,22 +104,14 @@ extern void vLoggingPrintf( const char * pcFormatString, * 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 - 2U ) +#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2U ) /* 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: * https://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 UBaseType_t uxRand(); -#define ipconfigRAND32() uxRand() +#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5U ) /* 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/FreeRTOS/Test/CBMC/patches/FreeRTOSIPConfig.h b/FreeRTOS/Test/CBMC/patches/FreeRTOSIPConfig.h index 9ad479b694e..0a637da5211 100644 --- a/FreeRTOS/Test/CBMC/patches/FreeRTOSIPConfig.h +++ b/FreeRTOS/Test/CBMC/patches/FreeRTOSIPConfig.h @@ -93,20 +93,12 @@ * https://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: * https://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 @@ -120,7 +112,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 @@ -129,14 +121,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 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