From f1472b138f1b29e940de99ad9bb5fce9d92c00ee Mon Sep 17 00:00:00 2001 From: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:25:32 +0530 Subject: [PATCH] Fix build issue in FreeRTOS+TCP QEMU demo when DHCP enabled (#1092) * Fix build issue in QEMU demo when DHCP enabled --- .../TCPEchoClient_SingleTasks.c | 32 +++++++++---------- .../TCPEchoClient_SingleTasks.c | 18 +++++++++++ .../main_networking.c | 2 ++ 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/TCPEchoClient_SingleTasks.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/TCPEchoClient_SingleTasks.c index 6c11240f71a..b354ad9bdc4 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/TCPEchoClient_SingleTasks.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/TCPEchoClient_SingleTasks.c @@ -399,22 +399,22 @@ return xReturn; } -#endif /* ipconfigUSE_TCP */ + #if ( ipconfigUSE_DHCP_HOOK != 0 ) + + #if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) + eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, + uint32_t ulIPAddress ) + #else /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ + eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase, + struct xNetworkEndPoint * pxEndPoint, + IP_Address_t * pxIPAddress ) + #endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ + { + /* Provide a stub for this function. */ + return eDHCPContinue; + } -#if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) ) + #endif /* if ( ipconfigUSE_DHCP_HOOK != 0 ) */ - #if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) - eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, - uint32_t ulIPAddress ) - #else /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ - eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase, - struct xNetworkEndPoint * pxEndPoint, - IP_Address_t * pxIPAddress ) - #endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ - { - /* Provide a stub for this function. */ - return eDHCPContinue; - } - -#endif /* if ( ( ipconfigUSE_TCP == 1 ) && ( ipconfigUSE_DHCP_HOOK != 0 ) ) */ +#endif /* ipconfigUSE_TCP */ /*-----------------------------------------------------------*/ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/TCPEchoClient_SingleTasks.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/TCPEchoClient_SingleTasks.c index b80d3de09dc..968e044e36e 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/TCPEchoClient_SingleTasks.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/TCPEchoClient_SingleTasks.c @@ -395,4 +395,22 @@ return xReturn; } + + #if ( ipconfigUSE_DHCP_HOOK != 0 ) + + #if ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) + eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase, + uint32_t ulIPAddress ) + #else /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ + eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase, + struct xNetworkEndPoint * pxEndPoint, + IP_Address_t * pxIPAddress ) + #endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 ) */ + { + /* Provide a stub for this function. */ + return eDHCPContinue; + } + + #endif /* if ( ipconfigUSE_DHCP_HOOK != 0 )*/ + #endif /* ipconfigUSE_TCP */ diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/main_networking.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/main_networking.c index 2936325395e..2c6ab1d853c 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/main_networking.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/main_networking.c @@ -164,6 +164,8 @@ void main_tcp_echo_client_tasks( void ) #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) /* Initialise the interface descriptor for WinPCap. */ + extern NetworkInterface_t * pxMPS2_FillInterfaceDescriptor( BaseType_t xEMACIndex, + NetworkInterface_t * pxInterface ); pxMPS2_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) ); /* === End-point 0 === */