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 <action@github.com>
pull/1111/head
Monika Singh 1 year ago committed by GitHub
parent b1cadcc6fc
commit f60dd88609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,26 +74,26 @@ extern void vLoggingPrintf( const char * pcFormatString,
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing /* 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. */ * 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) /* 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 * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */ * 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 /* 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 * 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 * set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */ * used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution /* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */ * (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 1 ) #define ipconfigUSE_LLMNR ( 1 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */ /* 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 /* 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 * 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 * socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating * call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */ * a socket. */
#define ipconfigUSE_DNS_CACHE ( 1 ) #define ipconfigUSE_DNS_CACHE ( 1 )
#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 ) #define ipconfigDNS_CACHE_NAME_LENGTH ( 16 )
#define ipconfigDNS_CACHE_ENTRIES ( 4 ) #define ipconfigDNS_CACHE_ENTRIES ( 4 )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) #define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
/* The IP stack executes it its own task (although any application task can make /* 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 * 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 * 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 * the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */ * 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 /* 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 * 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 * as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see: * stack. FreeRTOS includes optional stack overflow detection, see:
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* 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 * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK

@ -288,6 +288,7 @@ static void prvMiscInitialisation( void )
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] ); ( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n", FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n",
ulRandomNumbers[ 0 ], ulRandomNumbers[ 0 ],
ulRandomNumbers[ 1 ], ulRandomNumbers[ 1 ],

@ -79,26 +79,26 @@ extern void vLoggingPrintf( const char * pcFormatString,
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing /* 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. */ * 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) /* 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 * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */ * 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 /* 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 * 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 * set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */ * used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution /* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */ * (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 1 ) #define ipconfigUSE_LLMNR ( 1 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */ /* 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 /* 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 * 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 * socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating * call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */ * a socket. */
#define ipconfigUSE_DNS_CACHE ( 1 ) #define ipconfigUSE_DNS_CACHE ( 1 )
#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 ) #define ipconfigDNS_CACHE_NAME_LENGTH ( 16 )
#define ipconfigDNS_CACHE_ENTRIES ( 4 ) #define ipconfigDNS_CACHE_ENTRIES ( 4 )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) #define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
/* The IP stack executes it its own task (although any application task can make /* 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 * 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 * 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 * the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */ * 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 /* 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 * 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 * as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see: * stack. FreeRTOS includes optional stack overflow detection, see:
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* 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 * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK

@ -60,26 +60,26 @@ extern void vLoggingPrintf( const char * pcFormatString,
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing /* 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. */ * 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) /* 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 * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */ * 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 /* 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 * 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 * set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */ * used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution /* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */ * (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 1 ) #define ipconfigUSE_LLMNR ( 1 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */ /* 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 /* 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 * 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 * socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating * call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */ * a socket. */
#define ipconfigUSE_DNS_CACHE ( 1 ) #define ipconfigUSE_DNS_CACHE ( 1 )
#define ipconfigDNS_CACHE_NAME_LENGTH ( 33 ) #define ipconfigDNS_CACHE_NAME_LENGTH ( 33 )
#define ipconfigDNS_CACHE_ENTRIES ( 4 ) #define ipconfigDNS_CACHE_ENTRIES ( 4 )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) #define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
/* Let DNS wait for 3 seconds for an answer. */ /* 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 /* 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 * 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 * 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 * the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */ * 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 /* 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 * 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 * as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see: * stack. FreeRTOS includes optional stack overflow detection, see:
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* 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 * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK

@ -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 ) static void prvSRand( UBaseType_t ulSeed )
{ {
/* Utility function to seed the pseudo random number generator. */ /* Utility function to seed the pseudo random number generator. */
@ -483,6 +474,7 @@ static void prvSRand( UBaseType_t ulSeed )
static void prvMiscInitialisation( void ) static void prvMiscInitialisation( void )
{ {
time_t xTimeNow; time_t xTimeNow;
uint32_t ulRandomNumbers[ 4 ];
uint32_t ulLoggingIPAddress; uint32_t ulLoggingIPAddress;
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 ); 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 ); time( &xTimeNow );
FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\r\n", xTimeNow ) ); FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\r\n", xTimeNow ) );
prvSRand( ( uint32_t ) 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, uint32_t ulDestinationAddress,
uint16_t usDestinationPort ) uint16_t usDestinationPort )
{ {
uint32_t ulRandomNumber;
( void ) ulSourceAddress; ( void ) ulSourceAddress;
( void ) usSourcePort; ( void ) usSourcePort;
( void ) ulDestinationAddress; ( void ) ulDestinationAddress;
( void ) usDestinationPort; ( 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 ) static void dns_test( const char * pcHostName )
{ {
uint32_t ulID = uxRand32(); uint32_t ulID;
BaseType_t rc; BaseType_t rc;
FreeRTOS_dnsclear(); if( xApplicationGetRandomNumber( &( ulID ) ) != pdFALSE )
{
struct freertos_addrinfo xHints; FreeRTOS_dnsclear();
struct freertos_addrinfo * pxResult = NULL;
struct freertos_addrinfo xHints;
memset( &xHints, 0, sizeof xHints ); struct freertos_addrinfo * pxResult = NULL;
xHints.ai_family = FREERTOS_AF_INET6;
memset( &xHints, 0, sizeof xHints );
rc = FreeRTOS_getaddrinfo( pcHostName, NULL, &xHints, &pxResult ); xHints.ai_family = FREERTOS_AF_INET6;
FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); rc = FreeRTOS_getaddrinfo( pcHostName, NULL, &xHints, &pxResult );
FreeRTOS_dnsclear(); FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) );
xDNSResult = -2;
rc = FreeRTOS_getaddrinfo_a( pcHostName, FreeRTOS_dnsclear();
NULL, xDNSResult = -2;
&xHints, rc = FreeRTOS_getaddrinfo_a( pcHostName,
&pxResult, /* An allocated struct, containing the results. */ NULL,
vDNSEvent, &xHints,
( void * ) ulID, &pxResult, /* An allocated struct, containing the results. */
pdMS_TO_TICKS( 1000U ) ); vDNSEvent,
vTaskDelay( pdMS_TO_TICKS( 1000U ) ); ( void * ) ulID,
rc = xDNSResult; pdMS_TO_TICKS( 1000U ) );
FreeRTOS_printf( ( "Lookup '%s': %d\n", pcHostName, rc ) ); vTaskDelay( pdMS_TO_TICKS( 1000U ) );
/* FreeRTOS_gethostbyname( pcHostName ); */ 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 ) void showAddressInfo( struct freertos_addrinfo * pxAddrInfo )

@ -60,26 +60,26 @@ extern void vLoggingPrintf( const char * pcFormatString,
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing /* 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. */ * 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) /* 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 * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */ * 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 /* 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 * 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 * set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */ * used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 2000 ) #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 2000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution /* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */ * (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 0 ) #define ipconfigUSE_LLMNR ( 0 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */ /* 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 /* 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 * 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 * socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating * call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */ * a socket. */
#define ipconfigUSE_DNS_CACHE ( 1 ) #define ipconfigUSE_DNS_CACHE ( 1 )
#define ipconfigDNS_CACHE_NAME_LENGTH ( 64 ) #define ipconfigDNS_CACHE_NAME_LENGTH ( 64 )
#define ipconfigDNS_CACHE_ENTRIES ( 4 ) #define ipconfigDNS_CACHE_ENTRIES ( 4 )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) #define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
/* The IP stack executes it its own task (although any application task can make /* 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 * 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 * 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 * the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */ * 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 /* 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 * 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 * as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see: * stack. FreeRTOS includes optional stack overflow detection, see:
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* 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 * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK

@ -62,26 +62,26 @@ extern void vLoggingPrintf( const char * pcFormatString,
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing /* 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. */ * 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) /* 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 * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */ * 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 /* 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 * 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 * set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */ * used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution /* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */ * (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 0 ) #define ipconfigUSE_LLMNR ( 0 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */ /* 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 /* 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 * 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 * socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating * call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */ * a socket. */
#define ipconfigUSE_DNS_CACHE ( 1 ) #define ipconfigUSE_DNS_CACHE ( 1 )
#define ipconfigDNS_CACHE_NAME_LENGTH ( 254 ) #define ipconfigDNS_CACHE_NAME_LENGTH ( 254 )
#define ipconfigDNS_CACHE_ENTRIES ( 4 ) #define ipconfigDNS_CACHE_ENTRIES ( 4 )
#define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 6 ) #define ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY ( 6 )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) #define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
/* The IP stack executes it its own task (although any application task can make /* 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 * 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 * 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 * the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */ * 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 /* 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 * 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 * as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see: * stack. FreeRTOS includes optional stack overflow detection, see:
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* 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 * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK

@ -97,20 +97,12 @@
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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 /* 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 * 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: * 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. * 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 /* 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 * 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 * 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 can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * 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 /* 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 * 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 * 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 * reason. The static configuration used is that passed into the stack by the
* FreeRTOS_IPInit() function call. */ * FreeRTOS_IPInit() function call. */
#define ipconfigUSE_DHCP 1 #define ipconfigUSE_DHCP 1
#define ipconfigDHCP_REGISTER_HOSTNAME 1 #define ipconfigDHCP_REGISTER_HOSTNAME 1
#define ipconfigDHCP_USES_UNICAST 1 #define ipconfigDHCP_USES_UNICAST 1
/* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must
* provide an implementation of the DHCP callback function, * provide an implementation of the DHCP callback function,
* xApplicationDHCPUserHook(). */ * 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 /* 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 * increasing time intervals until either a reply is received from a DHCP server

@ -63,26 +63,26 @@ extern void vLoggingPrintf( const char * pcFormatString,
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing /* 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. */ * 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) /* 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 * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */ * 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 /* 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 * 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 * set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */ * used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution /* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */ * (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 0 ) #define ipconfigUSE_LLMNR ( 0 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */ /* 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 /* 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 * 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 * socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating * call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */ * a socket. */
#define ipconfigUSE_DNS_CACHE 1 #define ipconfigUSE_DNS_CACHE 1
#define ipconfigDNS_CACHE_NAME_LENGTH ( 64U ) #define ipconfigDNS_CACHE_NAME_LENGTH ( 64U )
#define ipconfigDNS_CACHE_ENTRIES ( 4U ) #define ipconfigDNS_CACHE_ENTRIES ( 4U )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2U ) #define ipconfigDNS_REQUEST_ATTEMPTS ( 2U )
/* The IP stack executes it its own task (although any application task can make /* 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 * 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 * 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 * the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */ * 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 /* 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 * 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 * as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see: * stack. FreeRTOS includes optional stack overflow detection, see:
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5U ) #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()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the /* 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 * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK

@ -93,20 +93,12 @@
* https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */ * https://www.FreeRTOS.org/Stacks-and-stack-overflow-checking.html. */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) #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 /* 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 * 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: * 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. * 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 /* 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 * 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 * 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 can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * 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 /* 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 * 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 * 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 * reason. The static configuration used is that passed into the stack by the
* FreeRTOS_IPInit() function call. */ * FreeRTOS_IPInit() function call. */
#define ipconfigUSE_DHCP 1 #define ipconfigUSE_DHCP 1
#define ipconfigDHCP_REGISTER_HOSTNAME 1 #define ipconfigDHCP_REGISTER_HOSTNAME 1
#define ipconfigDHCP_USES_UNICAST 1 #define ipconfigDHCP_USES_UNICAST 1
/* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must /* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must
* provide an implementation of the DHCP callback function, * provide an implementation of the DHCP callback function,
* xApplicationDHCPUserHook(). */ * 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 /* 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 * increasing time intervals until either a reply is received from a DHCP server

Loading…
Cancel
Save