Changes in FreeRTOS+TCP demo application files to add compatibility for running EndPoint changes in the IPv4 stack. (#907)

* Update main.c

* Update main.c

* Update main.c

* Update main.c

* TCP/IP Demo Changes for Sock Addr Changes

* Update SimpleClientAndServer.c

* Update TwoEchoClients.c

* Update SimpleUDPClientAndServer.c

* Update main.c

* Update main_networking.c

* Update TwoEchoClients.c

* Update SimpleClientAndServer.c

* Update TwoEchoClients.c

* Update SimpleUDPClientAndServer.c

* Update main_networking.c

* Update main_networking.c

* Update main_networking.c

* Update main.c

* Update main_networking.c

* Update main_networking.c

* Update main.c

* Update main.c

* Update main.c

* Update main_networking.c

* Update main_networking.c

* Update plus_tcp_hooks_winsim.c

* Update plus_tcp_hooks_winsim.c

* Update main.c

* Update main.c

* Update main_networking.c

* Update main_networking.c

* Update plus_tcp_hooks_winsim.c

* Update lexicon.txt

* Update lexicon.txt

* Update lexicon.txt

* Fix core header check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Update main_networking.c

* Update CLI-commands.c

* Update plus_tcp_hooks_winsim.c

* Code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Remove incorrect spelling from lexicon

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Fix Build issues in QEMU and UDP demo

* Lexicon spell check issue fix

* WinPcap Network Interface update

* Update Network_winPCap.c

* Adding declaration for pxMyInterface for EndPoint changed function in WinPCap.c

* Revert changes for WinPCap.c

* Update NetworkInterface_WinPCap.c

* Minor code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
kar-rahul-aws 2023-02-22 12:58:17 +05:30 committed by GitHub
parent cf603c60fa
commit 38d5e421eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 661 additions and 127 deletions

View file

@ -118,6 +118,19 @@ const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_
/* Use by the pseudo random number generator. */
static UBaseType_t ulNextRand;
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
/* In case multiple interfaces are used, define them statically. */
/* There is only 1 physical interface. */
static NetworkInterface_t xInterfaces[ 1 ];
/* It will have several end-points. */
static NetworkEndPoint_t xEndPoints[ 4 ];
#endif /* if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */
/*-----------------------------------------------------------*/
void main_tcp_echo_client_tasks( void )
@ -140,12 +153,29 @@ void main_tcp_echo_client_tasks( void )
* vApplicationIPNetworkEventHook() below). The address values passed in here
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
* but a DHCP server cannot be contacted. */
FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\n" ) );
FreeRTOS_IPInit( ucIPAddress,
ucNetMask,
ucGatewayAddress,
ucDNSServerAddress,
ucMACAddress );
/* Initialise the network interface.*/
FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\r\n" ) );
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
/* Initialise the interface descriptor for WinPCap. */
pxFillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
/* === End-point 0 === */
FreeRTOS_FillEndPoint( &( xInterfaces[ 0 ] ), &( xEndPoints [ 0 ] ), ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
#if ( ipconfigUSE_DHCP != 0 )
{
/* End-point 0 wants to use DHCPv4. */
xEndPoints[ 0 ].bits.bWantDHCP = pdTRUE;
}
#endif /* ( ipconfigUSE_DHCP != 0 ) */
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
FreeRTOS_IPStart();
#else
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
#endif /* if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */
/* Start the RTOS scheduler. */
FreeRTOS_debug_printf( ( "vTaskStartScheduler\n" ) );
@ -195,7 +225,11 @@ void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
/* Print out the network configuration, which may have come from a DHCP
* server. */
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
#endif
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );