diff options
author | Tony Josi <tonyjosi@amazon.com> | 2023-04-12 07:03:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 12:33:59 +0530 |
commit | cf11e34d02d2bc1f16704062b55f48495982dfed (patch) | |
tree | f51f1a7268817c56634b6eaab770db51d305c471 | |
parent | 920af3b290230f8c1a7d9d3559646cbe65177fa1 (diff) | |
download | freertos-git-cf11e34d02d2bc1f16704062b55f48495982dfed.tar.gz |
Update demo to latest +TCP dev/IPv6_integration (#978)
* remove macro namings
* rename sin_addr to sin_address.ulIP_IPv4 for ipv6 demo
* replace in6addr_any with FreeRTOS_in6addr_any
* replace mainCREATE_UDP_ECHO_SERVER_TASK with mainCREATE_UDP_ECHO_TASKS_SINGLE
* handle removal of sin_addr macro to sin_address.ulIP_IPv4
* updating +TCP repo to latest dev/IPv6_integration
* minor update to more clear code
* more sin_addr to sin_address.ulIP_IPv4 replacements
* fix makefiles for qemu and posix demos
* review feedback changes
37 files changed, 400 insertions, 165 deletions
diff --git a/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/Common/FreeRTOS_TCP_server.c b/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/Common/FreeRTOS_TCP_server.c index 19ba83155..ec75c77af 100644 --- a/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/Common/FreeRTOS_TCP_server.c +++ b/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/Common/FreeRTOS_TCP_server.c @@ -91,7 +91,16 @@ SocketSet_t xSocketSet; if( xSocket != FREERTOS_INVALID_SOCKET )
{
- xAddress.sin_addr = FreeRTOS_GetIPAddress(); // Single NIC, currently not used
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xAddress.sin_address.ulIP_IPv4 = FreeRTOS_GetIPAddress(); /* Single NIC, currently not used */
+ }
+ #else
+ {
+ xAddress.sin_addr = FreeRTOS_GetIPAddress(); /* Single NIC, currently not used */
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
xAddress.sin_port = FreeRTOS_htons( xPortNumber );
FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );
@@ -209,7 +218,15 @@ const char *pcType = "Unknown"; {
struct freertos_sockaddr xRemoteAddress;
FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );
- FreeRTOS_printf( ( "TPC-server: new %s client %xip\n", pcType, (unsigned)FreeRTOS_ntohl( xRemoteAddress.sin_addr ) ) );
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ FreeRTOS_printf( ( "TPC-server: new %s client %xip\n", pcType, (unsigned)FreeRTOS_ntohl( xRemoteAddress.sin_address.ulIP_IPv4 ) ) );
+ }
+ #else
+ {
+ FreeRTOS_printf( ( "TPC-server: new %s client %xip\n", pcType, (unsigned)FreeRTOS_ntohl( xRemoteAddress.sin_addr ) ) );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
}
/* Remove compiler warnings in case FreeRTOS_printf() is not used. */
diff --git a/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/FTP/FreeRTOS_FTP_server.c b/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/FTP/FreeRTOS_FTP_server.c index 3e0ba0c0a..59e21b7e5 100644 --- a/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/FTP/FreeRTOS_FTP_server.c +++ b/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/FTP/FreeRTOS_FTP_server.c @@ -585,8 +585,18 @@ BaseType_t xResult = 0; FreeRTOS_GetLocalAddress( pxClient->xTransferSocket, &xLocalAddress );
FreeRTOS_GetRemoteAddress( pxClient->xSocket, &xRemoteAddress );
- ulIP = FreeRTOS_ntohl( xLocalAddress.sin_addr );
- pxClient->ulClientIP = FreeRTOS_ntohl( xRemoteAddress.sin_addr );
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ ulIP = FreeRTOS_ntohl( xLocalAddress.sin_address.ulIP_IPv4 );
+ pxClient->ulClientIP = FreeRTOS_ntohl( xRemoteAddress.sin_address.ulIP_IPv4 );
+ }
+ #else
+ {
+ ulIP = FreeRTOS_ntohl( xLocalAddress.sin_addr );
+ pxClient->ulClientIP = FreeRTOS_ntohl( xRemoteAddress.sin_addr );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
ulPort = FreeRTOS_ntohs( xLocalAddress.sin_port );
pxClient->usClientPort = FreeRTOS_ntohs( xRemoteAddress.sin_port );
@@ -852,7 +862,17 @@ BaseType_t xResult; #if( ipconfigFTP_TX_BUFSIZE > 0 )
WinProperties_t xWinProps;
#endif
- xAddress.sin_addr = FreeRTOS_GetIPAddress( ); /* Single NIC, currently not used */
+
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xAddress.sin_address.ulIP_IPv4 = FreeRTOS_GetIPAddress( ); /* Single NIC, currently not used */
+ }
+ #else
+ {
+ xAddress.sin_addr = FreeRTOS_GetIPAddress( ); /* Single NIC, currently not used */
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
xAddress.sin_port = FreeRTOS_htons( 0 ); /* Bind to any available port number */
BaseType_t xBindResult;
@@ -929,9 +949,19 @@ BaseType_t xResult; }
else
{
- struct freertos_sockaddr xAddress;
+ struct freertos_sockaddr xAddress;
+
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xAddress.sin_address.ulIP_IPv4 = FreeRTOS_htonl( pxClient->ulClientIP );
+ }
+ #else
+ {
+ xAddress.sin_addr = FreeRTOS_htonl( pxClient->ulClientIP );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
- xAddress.sin_addr = FreeRTOS_htonl( pxClient->ulClientIP );
+
xAddress.sin_port = FreeRTOS_htons( pxClient->usClientPort );
/* Start an active connection for this data socket */
xResult = FreeRTOS_connect( pxClient->xTransferSocket, &xAddress, sizeof( xAddress ) );
diff --git a/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/NTP/NTPDemo.c b/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/NTP/NTPDemo.c index 62f46620b..1bf86697e 100644 --- a/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/NTP/NTPDemo.c +++ b/FreeRTOS-Plus/Demo/Common/Demo_IP_Protocols/NTP/NTPDemo.c @@ -149,7 +149,16 @@ void vStartNTPTask( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority ) BaseType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );
#endif
- xAddress.sin_addr = 0ul;
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xAddress.sin_address.ulIP_IPv4 = 0ul;
+ }
+ #else
+ {
+ xAddress.sin_addr = 0ul;
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
xAddress.sin_port = FreeRTOS_htons( NTP_PORT );
FreeRTOS_bind( xUDPSocket, &xAddress, sizeof( xAddress ) );
@@ -386,10 +395,21 @@ struct freertos_sockaddr xAddress; char pcBuf[16];
prvNTPPacketInit( );
- xAddress.sin_addr = ulIPAddressFound;
- xAddress.sin_port = FreeRTOS_htons( NTP_PORT );
- FreeRTOS_inet_ntoa( xAddress.sin_addr, pcBuf );
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xAddress.sin_address.ulIP_IPv4 = ulIPAddressFound;
+ xAddress.sin_port = FreeRTOS_htons( NTP_PORT );
+ FreeRTOS_inet_ntoa( xAddress.sin_address.ulIP_IPv4, pcBuf );
+ }
+ #else
+ {
+ xAddress.sin_addr = ulIPAddressFound;
+ xAddress.sin_port = FreeRTOS_htons( NTP_PORT );
+ FreeRTOS_inet_ntoa( xAddress.sin_addr, pcBuf );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
FreeRTOS_printf( ( "Sending UDP message to %s:%u\n",
pcBuf,
FreeRTOS_ntohs( xAddress.sin_port ) ) );
diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c index 11c46aaf6..02d4eeadf 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UDP-Related-CLI-commands.c @@ -270,7 +270,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( &ulAddress, NULL, NULL, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nIP address " );
xReturn = pdTRUE;
xIndex++;
@@ -281,7 +281,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, &ulAddress, NULL, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nNet mask " );
xReturn = pdTRUE;
xIndex++;
@@ -292,7 +292,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, NULL, &ulAddress, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nGateway address " );
xReturn = pdTRUE;
xIndex++;
@@ -303,7 +303,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, NULL, NULL, &ulAddress, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nDNS server address " );
xReturn = pdTRUE;
xIndex++;
diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c index f08c5bc39..293baab26 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/CLICommands/CLI-commands.c @@ -569,7 +569,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( &ulAddress, NULL, NULL, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nIP address " );
xReturn = pdTRUE;
xIndex++;
@@ -580,7 +580,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, &ulAddress, NULL, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nNet mask " );
xReturn = pdTRUE;
xIndex++;
@@ -591,7 +591,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, NULL, &ulAddress, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nGateway address " );
xReturn = pdTRUE;
xIndex++;
@@ -602,7 +602,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, NULL, NULL, &ulAddress, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
sprintf( pcWriteBuffer, "\r\nDNS server address " );
xReturn = pdTRUE;
xIndex++;
diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c index 57bb31506..6cba51074 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_UDP_Demos/EchoClients/TwoEchoClients.c @@ -130,10 +130,22 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress ); server is configured by the constants configECHO_SERVER_ADDR0 to
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
- xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
- configECHO_SERVER_ADDR1,
- configECHO_SERVER_ADDR2,
- configECHO_SERVER_ADDR3 );
+
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
+ configECHO_SERVER_ADDR1,
+ configECHO_SERVER_ADDR2,
+ configECHO_SERVER_ADDR3 );
+ }
+ #else
+ {
+ xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
+ configECHO_SERVER_ADDR1,
+ configECHO_SERVER_ADDR2,
+ configECHO_SERVER_ADDR3 );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
for( ;; )
{
@@ -238,10 +250,22 @@ const size_t xBufferLength = strlen( pcStringToSend ) + 15; server is configured by the constants configECHO_SERVER_ADDR0 to
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
- xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
- configECHO_SERVER_ADDR1,
- configECHO_SERVER_ADDR2,
- configECHO_SERVER_ADDR3 );
+
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
+ configECHO_SERVER_ADDR1,
+ configECHO_SERVER_ADDR2,
+ configECHO_SERVER_ADDR3 );
+ }
+ #else
+ {
+ xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
+ configECHO_SERVER_ADDR1,
+ configECHO_SERVER_ADDR2,
+ configECHO_SERVER_ADDR3 );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
for( ;; )
{
diff --git a/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c b/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c index 38fdfb8ce..f9122e3d9 100644 --- a/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c +++ b/FreeRTOS-Plus/Demo/Common/Logging/windows/Logging_WinSim.c @@ -181,7 +181,17 @@ void vLoggingInit( BaseType_t xLogToStdout, { /* Set the address to which the print messages are sent. */ xPrintUDPAddress.sin_port = FreeRTOS_htons( usRemotePort ); - xPrintUDPAddress.sin_addr = ulRemoteIPAddress; + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xPrintUDPAddress.sin_address.ulIP_IPv4 = ulRemoteIPAddress; + } + #else + { + xPrintUDPAddress.sin_addr = ulRemoteIPAddress; + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + } /* If a disk file or stdout are to be used then Win32 system calls will diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/Makefile b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/Makefile index 387c84b29..cb171799e 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/Makefile +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/Makefile @@ -52,31 +52,10 @@ SOURCE_FILES += ${FREERTOS_DIR}/Source/portable/MemMang/heap_3.c # FreeRTOS TCP -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_ARP.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_DHCP.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_DNS.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_DNS_Cache.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_DNS_Callback.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_DNS_Networking.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_DNS_Parser.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_ICMP.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_IP.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_IP_Timers.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_IP_Utils.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_Sockets.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_Stream_Buffer.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_IP.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_Reception.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_State_Handling.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_Transmission.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_Utils.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_TCP_WIN.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_Tiny_TCP.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/FreeRTOS_UDP_IP.c +SOURCE_FILES += $(wildcard ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/*.c ) SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/portable/BufferManagement/BufferAllocation_2.c SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/linux/NetworkInterface.c - CFLAGS := -ggdb3 LDFLAGS := -ggdb3 -pthread -lpcap CPPFLAGS := $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\" 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 e846c0679..55dc8e883 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 @@ -158,10 +158,22 @@ * server is configured by the constants configECHO_SERVER_ADDR0 to * configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */ xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT ); - xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, - configECHO_SERVER_ADDR1, - configECHO_SERVER_ADDR2, - configECHO_SERVER_ADDR3 ); + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #else + { + xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ for( ; ; ) { 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 2f302c4af..5dbc82c14 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 @@ -202,7 +202,7 @@ void main_tcp_echo_client_tasks( void ) struct xNetworkEndPoint * pxEndPoint ) #else void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) -#endif +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress; char cBuffer[ 16 ]; @@ -234,7 +234,7 @@ void main_tcp_echo_client_tasks( void ) FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ FreeRTOS_inet_ntoa( ulIPAddress, cBuffer ); FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) ); @@ -313,7 +313,7 @@ static void prvMiscInitialisation( void ) const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/Makefile b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/Makefile index cde316760..fdfe7c741 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/Makefile +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/Makefile @@ -41,27 +41,7 @@ SOURCE_FILES += ${KERNEL_DIR}/portable/MemMang/heap_3.c # FreeRTOS+TCP INCLUDE_DIRS += -I${FREERTOS_TCP}/source/include/ -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_ARP.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_DHCP.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_DNS.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_DNS_Cache.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_DNS_Callback.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_DNS_Networking.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_DNS_Parser.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_ICMP.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_IP.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_IP_Timers.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_IP_Utils.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_Sockets.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_Stream_Buffer.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_TCP_IP.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_TCP_Reception.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_TCP_State_Handling.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_TCP_Transmission.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_TCP_Utils.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_TCP_WIN.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_Tiny_TCP.c -SOURCE_FILES += ${FREERTOS_TCP}/source/FreeRTOS_UDP_IP.c +SOURCE_FILES += $(wildcard ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/*.c ) # FreeRTOS+TCP Port for ARM MPS2 SoC INCLUDE_DIRS += -I${FREERTOS_TCP}/source/portable/NetworkInterface/MPS2_AN385/ether_lan9118 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 457d6fcb7..c99dc5e50 100755 --- 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 @@ -159,10 +159,22 @@ * server is configured by the constants configECHO_SERVER_ADDR0 to * configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */ xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT ); - xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, - configECHO_SERVER_ADDR1, - configECHO_SERVER_ADDR2, - configECHO_SERVER_ADDR3 ); + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #else + { + xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ for( ; ; ) { 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 51e43ef4f..22f7b6042 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 @@ -134,7 +134,7 @@ static UBaseType_t ulNextRand; /* It will have several end-points. */ static NetworkEndPoint_t xEndPoints[ 4 ]; -#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /*-----------------------------------------------------------*/ @@ -181,7 +181,7 @@ void main_tcp_echo_client_tasks( void ) #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( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /* Start the RTOS scheduler. */ @@ -211,7 +211,7 @@ BaseType_t xTasksAlreadyCreated = pdFALSE; struct xNetworkEndPoint * pxEndPoint ) #else void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) -#endif +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { uint32_t ulIPAddress; uint32_t ulNetMask; @@ -246,7 +246,7 @@ BaseType_t xTasksAlreadyCreated = pdFALSE; FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ FreeRTOS_inet_ntoa( ulIPAddress, cBuffer ); FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) ); @@ -326,7 +326,7 @@ static void prvMiscInitialisation( void ) const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/Logging_WinSim.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/Logging_WinSim.c index 742c77d1c..f1af8e153 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/Logging_WinSim.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/Logging_WinSim.c @@ -181,7 +181,7 @@ void vLoggingInit( BaseType_t xLogToStdout, {
/* Set the address to which the print messages are sent. */
xPrintUDPAddress.sin_port = FreeRTOS_htons( usRemotePort );
- xPrintUDPAddress.sin_addr = ulRemoteIPAddress;
+ xPrintUDPAddress.sin_address.ulIP_IPv4 = ulRemoteIPAddress;
}
/* If a disk file or stdout are to be used then Win32 system calls will
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/ReadMe.md b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/ReadMe.md index e08171cc5..61020507b 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/ReadMe.md +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/ReadMe.md @@ -97,7 +97,7 @@ an asynchronous DNS lookup, and “c” to clear all caches before starting the ## Using the UDP Echo Client The demo also demonstrates a IPv4/IPv6 UDP echo client which can be enabled by -setting the `mainCREATE_UDP_ECHO_SERVER_TASK` macro to 1 in the main file. +setting the `mainCREATE_UDP_ECHO_TASKS_SINGLE` macro to 1 in the main file. The UDP Echo Client creates a task and sends messages to the IP address and port defined as `configECHO_SERVER_ADDR_STRING` (either v4 or v6 address) diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c index 81eee31f7..e3780ce09 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c @@ -215,7 +215,7 @@ }
#else /* ifdef configECHO_SERVER_ADDR_STRING */
{
- xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 );
+ xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3 );
}
#endif /* ifdef configECHO_SERVER_ADDR_STRING */
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/UDPEchoClient_SingleTasks.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/UDPEchoClient_SingleTasks.c index 3089e3848..93b089d86 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/UDPEchoClient_SingleTasks.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/UDPEchoClient_SingleTasks.c @@ -140,7 +140,7 @@ static void prvUDPEchoClientTask(void* pvParameters) } else { - rc = FreeRTOS_inet_pton(FREERTOS_AF_INET4, configECHO_SERVER_ADDR_STRING, (void*)xEchoServerAddress.sin_address.xIP_IPv6.ucBytes); + rc = FreeRTOS_inet_pton(FREERTOS_AF_INET4, configECHO_SERVER_ADDR_STRING, (void*) &(xEchoServerAddress.sin_address.ulIP_IPv4)); configASSERT(rc == pdPASS); xFamily = FREERTOS_AF_INET4; ucIPType = ipTYPE_IPv4; @@ -148,7 +148,7 @@ static void prvUDPEchoClientTask(void* pvParameters) } #else { - xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick(configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3); + xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick(configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3); } #endif 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 7adc3257a..1f6a21cb5 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 @@ -91,14 +91,14 @@ * connections on the standard echo port (port 7), then echos back any data * received on that connection. * - * mainCREATE_UDP_ECHO_SERVER_TASK: When set to 1 a task is created that sends data + * mainCREATE_UDP_ECHO_TASKS_SINGLE: When set to 1 a task is created that sends data * to the address configECHO_SERVER_ADDR_STRING (IPv4/Ipv6) where it is * expected to echo back the data, which, the created tasks receives. * */ #define mainCREATE_TCP_ECHO_TASKS_SINGLE 1 /* 1 */ #define mainCREATE_TCP_ECHO_SERVER_TASK 0 -#define mainCREATE_UDP_ECHO_SERVER_TASK 0 +#define mainCREATE_UDP_ECHO_TASKS_SINGLE 0 /*-----------------------------------------------------------*/ /* Define a task that is used to start and monitor several tests. */ @@ -412,7 +412,7 @@ void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent, } #endif - #if ( mainCREATE_UDP_ECHO_SERVER_TASK == 1 ) + #if ( mainCREATE_UDP_ECHO_TASKS_SINGLE == 1 ) { vStartUDPEchoClientTasks_SingleTasks( mainECHO_SERVER_TASK_STACK_SIZE, mainECHO_SERVER_TASK_PRIORITY ); } @@ -934,12 +934,12 @@ void show_single_addressinfo( const char * pcFormat, { struct freertos_sockaddr * sockaddr6 = ( ( struct freertos_sockaddr * ) pxAddress->ai_addr ); - pucAddress = ( const uint8_t * ) &( sockaddr6->sin_addr6 ); + pucAddress = ( const uint8_t * ) &( sockaddr6->sin_address.xIP_IPv6 ); } else #endif /* ( ipconfigUSE_IPv6 != 0 ) */ { - pucAddress = ( const uint8_t * ) &( pxAddress->ai_addr->sin_addr ); + pucAddress = ( const uint8_t * ) &( pxAddress->ai_addr->sin_address.ulIP_IPv4 ); } ( void ) FreeRTOS_inet_ntop( pxAddress->ai_family, ( const void * ) pucAddress, cBuffer, sizeof( cBuffer ) ); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/Logging/windows/Logging_WinSim.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/Logging/windows/Logging_WinSim.c index 120c99dd0..9c5e44338 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/Logging/windows/Logging_WinSim.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/Logging/windows/Logging_WinSim.c @@ -181,7 +181,7 @@ void vLoggingInit( BaseType_t xLogToStdout, {
/* Set the address to which the print messages are sent. */
xPrintUDPAddress.sin_port = FreeRTOS_htons( usRemotePort );
- xPrintUDPAddress.sin_addr = ulRemoteIPAddress;
+ xPrintUDPAddress.sin_address.ulIP_IPv4 = ulRemoteIPAddress;
}
/* If a disk file or stdout are to be used then Win32 system calls will
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/NTP/NTPDemo.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/NTP/NTPDemo.c index 06c9c37c0..04ad081a1 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/NTP/NTPDemo.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/NTP/NTPDemo.c @@ -109,7 +109,7 @@ static SemaphoreHandle_t xNTPWakeupSem = NULL; static uint32_t ulIPAddressFound; #if ( ipconfigUSE_IPv6 != 0 ) - static struct freertos_sockaddr6 xIPAddressFound; + static struct freertos_sockaddr xIPAddressFound; #endif static BaseType_t xHasIPAddress = pdFALSE; @@ -218,7 +218,7 @@ void vStartNTPTask( uint16_t usTaskStackSize, BaseType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 ); #endif - xAddress.sin_addr = 0ul; + xAddress.sin_address.ulIP_IPv4 = 0ul; xAddress.sin_port = FreeRTOS_htons( NTP_PORT ); FreeRTOS_bind( xUDPSocket, &xAddress, sizeof( xAddress ) ); @@ -259,7 +259,7 @@ void vStartNTPTask( uint16_t usTaskStackSize, uint32_t ulIPAddress; /* The DNS lookup has a result, or it has reached the time-out. */ - ulIPAddress = pxAddress->ai_addr->sin_addr; + ulIPAddress = pxAddress->ai_addr->sin_address.ulIP_IPv4; FreeRTOS_inet_ntoa( ulIPAddress, pcBuf ); FreeRTOS_printf( ( "vDNS_callback: IP address of %s found: %s\n", pcName, pcBuf ) ); @@ -269,22 +269,22 @@ void vStartNTPTask( uint16_t usTaskStackSize, /* } */ if( ulIPAddressFound != 0U ) { - memset( xIPAddressFound.sin_addrv6.ucBytes, 0, ipSIZE_OF_IPv6_ADDRESS ); + memset( xIPAddressFound.sin_address.xIP_IPv6.ucBytes, 0, ipSIZE_OF_IPv6_ADDRESS ); xHasIPAddress = pdTRUE; } } else if( pxAddress->ai_family == FREERTOS_AF_INET6 ) { /* struct freertos_sockaddr * ai_addr */ - struct freertos_sockaddr6 * sockaddr6 = ( struct freertos_sockaddr6 * ) pxAddress->ai_addr; + struct freertos_sockaddr * sockaddr6 = ( struct freertos_sockaddr * ) pxAddress->ai_addr; xIPAddressFound.sin_len = sizeof( xIPAddressFound ); /* Ignored, still present for backward compatibility. */ xIPAddressFound.sin_family = FREERTOS_AF_INET6; /* Set to FREERTOS_AF_INET6. */ xIPAddressFound.sin_port = FreeRTOS_htons( NTP_PORT ); xIPAddressFound.sin_flowinfo = 0; /* IPv6 flow information. */ - memcpy( xIPAddressFound.sin_addrv6.ucBytes, sockaddr6->sin_addrv6.ucBytes, ipSIZE_OF_IPv6_ADDRESS ); + memcpy( xIPAddressFound.sin_address.xIP_IPv6.ucBytes, sockaddr6->sin_address.xIP_IPv6.ucBytes, ipSIZE_OF_IPv6_ADDRESS ); - FreeRTOS_printf( ( "vDNS_callback: using address %pip\n", xIPAddressFound.sin_addrv6.ucBytes ) ); + FreeRTOS_printf( ( "vDNS_callback: using address %pip\n", xIPAddressFound.sin_address.xIP_IPv6.ucBytes ) ); ulIPAddressFound = 0U; xHasIPAddress = pdTRUE; } @@ -590,10 +590,10 @@ static void prvNTPTask( void * pvParameters ) prvNTPPacketInit(); uxSendTime = xTaskGetTickCount(); #if ( ipconfigUSE_IPv6 != 0 ) - if( memcmp( xIPAddressFound.sin_addrv6.ucBytes, in6addr_any.ucBytes, ipSIZE_OF_IPv6_ADDRESS ) != 0 ) + if( memcmp( xIPAddressFound.sin_address.xIP_IPv6.ucBytes, FreeRTOS_in6addr_any.ucBytes, ipSIZE_OF_IPv6_ADDRESS ) != 0 ) { FreeRTOS_printf( ( "Sending UDP message to %pip:%u\n", - xIPAddressFound.sin_addrv6.ucBytes, + xIPAddressFound.sin_address.xIP_IPv6.ucBytes, FreeRTOS_ntohs( xIPAddressFound.sin_port ) ) ); FreeRTOS_sendto( xUDPSocket, @@ -605,7 +605,7 @@ static void prvNTPTask( void * pvParameters ) else #endif /* ( ipconfigUSE_IPv6 != 0 ) */ { - xAddress.sin_addr = ulIPAddressFound; + xAddress.sin_address.ulIP_IPv4 = ulIPAddressFound; xAddress.sin_port = FreeRTOS_htons( NTP_PORT ); FreeRTOS_printf( ( "Sending UDP message to %lxip:%u\n", diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/SimpleUDPClientAndServer.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/SimpleUDPClientAndServer.c index 448337631..08958605f 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/SimpleUDPClientAndServer.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/SimpleUDPClientAndServer.c @@ -108,12 +108,21 @@ const TickType_t x150ms = 150UL / portTICK_PERIOD_MS; FreeRTOS_GetEndPointConfiguration( &ulIPAddress, NULL, NULL, NULL, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL );
-#endif
+#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/* This test sends to itself, so data sent from here is received by a server
socket on the same IP address. Setup the freertos_sockaddr structure with
this nodes IP address, and the port number being sent to. The strange
- casting is to try and remove compiler warnings on 32 bit machines. */
- xDestinationAddress.sin_addr = ulIPAddress;
+ casting is to try and remove compiler warnings on 32 bit machines. */
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xDestinationAddress.sin_address.ulIP_IPv4 = ulIPAddress;
+ }
+ #else
+ {
+ xDestinationAddress.sin_addr = ulIPAddress;
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
xDestinationAddress.sin_port = ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL;
xDestinationAddress.sin_port = FreeRTOS_htons( xDestinationAddress.sin_port );
@@ -219,14 +228,20 @@ const size_t xStringLength = strlen( pcStringToSend ) + 15; port on the same IP address. */
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, NULL, NULL, NULL, pxNetworkEndPoints );
+ /* This test sends to itself, so data sent from here is received by a server
+ socket on the same IP address. Setup the freertos_sockaddr structure with
+ this nodes IP address, and the port number being sent to. The strange
+ casting is to try and remove compiler warnings on 32 bit machines. */
+ xDestinationAddress.sin_address.ulIP_IPv4 = ulIPAddress;
#else
FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL );
-#endif
/* This test sends to itself, so data sent from here is received by a server
socket on the same IP address. Setup the freertos_sockaddr structure with
this nodes IP address, and the port number being sent to. The strange
casting is to try and remove compiler warnings on 32 bit machines. */
xDestinationAddress.sin_addr = ulIPAddress;
+#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
xDestinationAddress.sin_port = ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL;
xDestinationAddress.sin_port = FreeRTOS_htons( xDestinationAddress.sin_port );
@@ -257,7 +272,7 @@ const size_t xStringLength = strlen( pcStringToSend ) + 15; } while( ( pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer_Multi( xStringLength, portMAX_DELAY, ipTYPE_IPv4 ) ) == NULL );
#else
} while( ( pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer( xStringLength, portMAX_DELAY ) ) == NULL );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/* A buffer was successfully obtained. Create the string that is
sent to the server. First the string is filled with zeros as this will
@@ -329,10 +344,12 @@ Socket_t xListeningSocket; after the network is up, so the IP address is valid here. */
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, NULL, NULL, NULL, pxNetworkEndPoints );
+ xBindAddress.sin_address.ulIP_IPv4 = ulIPAddress;
#else
FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL );
-#endif
xBindAddress.sin_addr = ulIPAddress;
+#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+
xBindAddress.sin_port = ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL;
xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/TCPEchoClient_SingleTasks.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/TCPEchoClient_SingleTasks.c index 9b8e827af..7b1bd8773 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/TCPEchoClient_SingleTasks.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/DemoTasks/TCPEchoClient_SingleTasks.c @@ -153,7 +153,16 @@ TickType_t xTimeOnEntering; server is configured by the constants configECHO_SERVER_ADDR0 to
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
- xEchoServerAddress.sin_addr = FreeRTOS_inet_addr( configECHO_SERVER_ADDR );
+
+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
+ {
+ xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr( configECHO_SERVER_ADDR );
+ }
+ #else
+ {
+ xEchoServerAddress.sin_addr = FreeRTOS_inet_addr( configECHO_SERVER_ADDR );
+ }
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
for( ;; )
{
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c index fd63c09a1..cda76b6de 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c @@ -139,7 +139,7 @@ static UBaseType_t ulNextRand; /* It will have several end-points. */
static NetworkEndPoint_t xEndPoints[ 4 ];
-#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/*-----------------------------------------------------------*/
@@ -186,7 +186,7 @@ int main( void ) #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( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/* Start the RTOS scheduler. */
FreeRTOS_debug_printf( ( "vTaskStartScheduler\r\n" ) );
@@ -225,7 +225,7 @@ void vApplicationIdleHook( void ) struct xNetworkEndPoint * pxEndPoint )
#else
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
-#endif
+#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
{
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
char cBuffer[ 16 ];
@@ -272,7 +272,7 @@ void vApplicationIdleHook( void ) FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints );
#else
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
- #endif
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
@@ -351,7 +351,7 @@ static void prvMiscInitialisation( void ) const char * pcName )
#else
BaseType_t xApplicationDNSQueryHook( const char * pcName )
- #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
+ #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
{
BaseType_t xReturn;
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/CLI-commands.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/CLI-commands.c index 42856d3b8..36f5c894c 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/CLI-commands.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/CLI-commands.c @@ -536,7 +536,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( &ulAddress, NULL, NULL, NULL, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( &ulAddress, NULL, NULL, NULL ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ sprintf( ( char * ) pcWriteBuffer, "\r\nIP address " ); xReturn = pdTRUE; xIndex++; @@ -547,7 +547,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, &ulAddress, NULL, NULL, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( NULL, &ulAddress, NULL, NULL ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ sprintf( ( char * ) pcWriteBuffer, "\r\nNet mask " ); xReturn = pdTRUE; xIndex++; @@ -558,7 +558,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, NULL, &ulAddress, NULL, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( NULL, NULL, &ulAddress, NULL ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ sprintf( ( char * ) pcWriteBuffer, "\r\nGateway address " ); xReturn = pdTRUE; xIndex++; @@ -569,7 +569,7 @@ uint32_t ulAddress; FreeRTOS_GetEndPointConfiguration( NULL, NULL, NULL, &ulAddress, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulAddress ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ sprintf( ( char * ) pcWriteBuffer, "\r\nDNS server address " ); xReturn = pdTRUE; xIndex++; diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c index 7ea1f4a68..2c65a264b 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/SimpleClientAndServer.c @@ -96,15 +96,20 @@ const portTickType x150ms = 150UL / portTICK_RATE_MS; port on the same IP address. */ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) FreeRTOS_GetEndPointConfiguration( &ulIPAddress, NULL, NULL, NULL, pxNetworkEndPoints ); + /* This test sends to itself, so data sent from here is received by a server + socket on the same IP address. Setup the freertos_sockaddr structure with + this nodes IP address, and the port number being sent to. The strange + casting is to try and remove compiler warnings on 32 bit machines. */ + xDestinationAddress.sin_address.ulIP_IPv4 = ulIPAddress; #else FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL ); -#endif - /* This test sends to itself, so data sent from here is received by a server socket on the same IP address. Setup the freertos_sockaddr structure with this nodes IP address, and the port number being sent to. The strange casting is to try and remove compiler warnings on 32 bit machines. */ xDestinationAddress.sin_addr = ulIPAddress; +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + xDestinationAddress.sin_port = ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL; xDestinationAddress.sin_port = FreeRTOS_htons( xDestinationAddress.sin_port ); @@ -216,14 +221,20 @@ const size_t xStringLength = strlen( ( char * ) pucStringToSend ) + 15; port on the same IP address. */ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) FreeRTOS_GetEndPointConfiguration( &ulIPAddress, NULL, NULL, NULL, pxNetworkEndPoints ); + /* This test sends to itself, so data sent from here is received by a server + socket on the same IP address. Setup the freertos_sockaddr structure with + this nodes IP address, and the port number being sent to. The strange + casting is to try and remove compiler warnings on 32 bit machines. */ + xDestinationAddress.sin_address.ulIP_IPv4 = ulIPAddress; #else FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL ); -#endif /* This test sends to itself, so data sent from here is received by a server socket on the same IP address. Setup the freertos_sockaddr structure with this nodes IP address, and the port number being sent to. The strange casting is to try and remove compiler warnings on 32 bit machines. */ xDestinationAddress.sin_addr = ulIPAddress; +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + xDestinationAddress.sin_port = ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL; xDestinationAddress.sin_port = FreeRTOS_htons( xDestinationAddress.sin_port ); @@ -254,7 +265,7 @@ const size_t xStringLength = strlen( ( char * ) pucStringToSend ) + 15; } while( ( pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer_Multi( xStringLength, portMAX_DELAY, ipTYPE_IPv4 ) ) == NULL ); #else } while( ( pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer( xStringLength, portMAX_DELAY ) ) == NULL ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /* A buffer was successfully obtained. Create the string that is sent to the server. First the string is filled with zeros as this will @@ -326,10 +337,12 @@ Socket_t xListeningSocket; after the network is up, so the IP address is valid here. */ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) FreeRTOS_GetEndPointConfiguration( &ulIPAddress, NULL, NULL, NULL, pxNetworkEndPoints ); + xBindAddress.sin_address.ulIP_IPv4 = ulIPAddress; #else FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL ); -#endif xBindAddress.sin_addr = ulIPAddress; +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + xBindAddress.sin_port = ( uint16_t ) ( ( uint32_t ) pvParameters ) & 0xffffUL; xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port ); diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/TwoEchoClients.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/TwoEchoClients.c index 23e58649f..d78b99e01 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/TwoEchoClients.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/DemoTasks/TwoEchoClients.c @@ -139,10 +139,22 @@ uint32_t xAddressLength = sizeof( xEchoServerAddress ); server is configured by the constants configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */ xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT ); - xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, - configECHO_SERVER_ADDR1, - configECHO_SERVER_ADDR2, - configECHO_SERVER_ADDR3 ); + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #else + { + xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ for( ;; ) { @@ -270,10 +282,22 @@ const size_t xBufferLength = strlen( ( char * ) pucStringToSend ) + 15; server is configured by the constants configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */ xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT ); - xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, - configECHO_SERVER_ADDR1, - configECHO_SERVER_ADDR2, - configECHO_SERVER_ADDR3 ); + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #else + { + xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0, + configECHO_SERVER_ADDR1, + configECHO_SERVER_ADDR2, + configECHO_SERVER_ADDR3 ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ for( ;; ) { @@ -300,7 +324,7 @@ const size_t xBufferLength = strlen( ( char * ) pucStringToSend ) + 15; pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer_Multi( xBufferLength, portMAX_DELAY, ipTYPE_IPv4 ); #else pucUDPPayloadBuffer = ( uint8_t * ) FreeRTOS_GetUDPPayloadBuffer( xBufferLength, portMAX_DELAY ); - #endif + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ if( pucUDPPayloadBuffer != NULL ) { diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/main.c index 8a14a6563..eea3e0d92 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/main.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/main.c @@ -118,7 +118,7 @@ static UBaseType_t ulNextRand; /* It will have several end-points. */ static NetworkEndPoint_t xEndPoints[ 4 ]; -#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /****************************************************************************** * @@ -162,7 +162,7 @@ const uint32_t ulLongTime_ms = 250UL; #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( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /* Initialise the logging. */ uint32_t ulLoggingIPAddress; @@ -276,7 +276,7 @@ void vApplicationMallocFailedHook( void ) const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c index fa8b7c52c..addeee382 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/DemoTasks/SerializerMQTTExample.c @@ -604,7 +604,16 @@ static Socket_t prvCreateTCPConnectionToBroker( void ) if( ulBrokerIPAddress != 0 ) { xBrokerAddress.sin_port = FreeRTOS_htons( democonfigMQTT_BROKER_PORT ); - xBrokerAddress.sin_addr = ulBrokerIPAddress; + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xBrokerAddress.sin_address.ulIP_IPv4 = ulBrokerIPAddress; + } + #else + { + xBrokerAddress.sin_addr = ulBrokerIPAddress; + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ if( FreeRTOS_connect( xMQTTSocket, &xBrokerAddress, sizeof( xBrokerAddress ) ) == 0 ) { diff --git a/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/SNTPClientTask.c b/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/SNTPClientTask.c index 97e585ed9..4bb5627fc 100644 --- a/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/SNTPClientTask.c +++ b/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator/SNTPClientTask.c @@ -733,7 +733,16 @@ int32_t UdpTransport_Send( NetworkContext_t * pNetworkContext, struct freertos_sockaddr destinationAddress; int32_t bytesSent; - destinationAddress.sin_addr = FreeRTOS_htonl( serverAddr ); + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + destinationAddress.sin_address.ulIP_IPv4 = FreeRTOS_htonl( serverAddr ); + } + #else + { + destinationAddress.sin_addr = FreeRTOS_htonl( serverAddr ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + destinationAddress.sin_port = FreeRTOS_htons( serverPort ); /* Send the buffer with ulFlags set to 0, so the FREERTOS_ZERO_COPY bit @@ -787,15 +796,29 @@ static int32_t UdpTransport_Recv( NetworkContext_t * pNetworkContext, /* If data is received from the network, discard the data if received from a different source than * the server. */ - if( ( bytesReceived > 0 ) && ( ( FreeRTOS_ntohl( sourceAddress.sin_addr ) != serverAddr ) || - ( FreeRTOS_ntohs( sourceAddress.sin_port ) != serverPort ) ) ) + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + if( ( bytesReceived > 0 ) && ( ( FreeRTOS_ntohl( sourceAddress.sin_address.ulIP_IPv4 ) != serverAddr ) || + ( FreeRTOS_ntohs( sourceAddress.sin_port ) != serverPort ) ) ) + #else + if( ( bytesReceived > 0 ) && ( ( FreeRTOS_ntohl( sourceAddress.sin_addr ) != serverAddr ) || + ( FreeRTOS_ntohs( sourceAddress.sin_port ) != serverPort ) ) ) + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { bytesReceived = 0; #if defined( LIBRARY_LOG_LEVEL ) && ( LIBRARY_LOG_LEVEL != LOG_NONE ) /* Convert the IP address of the sender's address to string for logging. */ char stringAddr[ 16 ]; - FreeRTOS_inet_ntoa( sourceAddress.sin_addr, stringAddr ); + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + FreeRTOS_inet_ntoa( sourceAddress.sin_address.ulIP_IPv4, stringAddr ); + } + #else + { + FreeRTOS_inet_ntoa( sourceAddress.sin_addr, stringAddr ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /* Log about reception of packet from unexpected sender. */ LogWarn( ( "Received UDP packet from unexpected source: Addr=%s Port=%u", diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/sockets_wrapper.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/sockets_wrapper.c index 87be1f9fc..e387d7312 100644 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/sockets_wrapper.c +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/sockets_wrapper.c @@ -91,11 +91,18 @@ BaseType_t Sockets_Connect( Socket_t * pTcpSocket, /* Connection parameters. */ serverAddress.sin_family = FREERTOS_AF_INET; serverAddress.sin_port = FreeRTOS_htons( port ); - serverAddress.sin_addr = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); serverAddress.sin_len = ( uint8_t ) sizeof( serverAddress ); + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + serverAddress.sin_address.ulIP_IPv4 = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); + /* Check for errors from DNS lookup. */ + if( serverAddress.sin_address.ulIP_IPv4 == 0U ) + #else + serverAddress.sin_addr = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); /* Check for errors from DNS lookup. */ if( serverAddress.sin_addr == 0U ) + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + { LogError( ( "Failed to connect to server: DNS resolution failed: Hostname=%s.", pHostName ) ); diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/tcp_sockets_wrapper.c b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/tcp_sockets_wrapper.c index 32191c82e..393ea2e2b 100644 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/tcp_sockets_wrapper.c +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/tcp_sockets_wrapper/ports/freertos_plus_tcp/tcp_sockets_wrapper.c @@ -115,11 +115,18 @@ BaseType_t TCP_Sockets_Connect( Socket_t * pTcpSocket, /* Connection parameters. */ serverAddress.sin_family = FREERTOS_AF_INET; serverAddress.sin_port = FreeRTOS_htons( port ); - serverAddress.sin_addr = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); serverAddress.sin_len = ( uint8_t ) sizeof( serverAddress ); +#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + serverAddress.sin_address.ulIP_IPv4 = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); + /* Check for errors from DNS lookup. */ + if( serverAddress.sin_address.ulIP_IPv4 == 0U ) +#else + serverAddress.sin_addr = ( uint32_t ) FreeRTOS_gethostbyname( pHostName ); /* Check for errors from DNS lookup. */ if( serverAddress.sin_addr == 0U ) +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + { LogError( ( "Failed to connect to server: DNS resolution failed: Hostname=%s.", pHostName ) ); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP -Subproject caea155ce071c12afe41441bfdc7c6a36b0282d +Subproject 89269454b9187e8693e94eb3f6cb0df5da9ee4c diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c index bd4a980ef..ee8a2d8aa 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c +++ b/FreeRTOS-Plus/Test/FreeRTOS-Cellular-Interface/Integration/main.c @@ -114,7 +114,7 @@ int main( void ) struct xNetworkEndPoint * pxEndPoint ) #else void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) -#endif +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { ( void ) eNetworkEvent; } @@ -207,7 +207,7 @@ void vApplicationIdleHook( void ) const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/main.c b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/main.c index c2db03a4e..1a4c57c54 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/main.c +++ b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Networkless/main.c @@ -165,7 +165,7 @@ int main( void ) struct xNetworkEndPoint * pxEndPoint ) #else void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) -#endif +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { static BaseType_t xTasksAlreadyCreated = pdFALSE; @@ -215,7 +215,7 @@ static LONG CALLBACK prvExceptionHandler( _In_ PEXCEPTION_POINTERS ExceptionInfo const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Test_Code/Test_Cases/test_tcp.c b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Test_Code/Test_Cases/test_tcp.c index f14b74b39..f6889888f 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Test_Code/Test_Cases/test_tcp.c +++ b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/Test_Code/Test_Cases/test_tcp.c @@ -515,10 +515,23 @@ static BaseType_t prvNonSecureConnectHelper( Socket_t xSocketLocal, /* Echo requests are sent to the echo server. The echo server is * listening to tcptestECHO_PORT on this computer's IP address. */ - pxHostAddress->sin_addr = FreeRTOS_inet_addr_quick( tcptestECHO_SERVER_ADDR0, - tcptestECHO_SERVER_ADDR1, - tcptestECHO_SERVER_ADDR2, - tcptestECHO_SERVER_ADDR3 ); + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + pxHostAddress->sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( tcptestECHO_SERVER_ADDR0, + tcptestECHO_SERVER_ADDR1, + tcptestECHO_SERVER_ADDR2, + tcptestECHO_SERVER_ADDR3 ); + } + #else + { + pxHostAddress->sin_addr = FreeRTOS_inet_addr_quick( tcptestECHO_SERVER_ADDR0, + tcptestECHO_SERVER_ADDR1, + tcptestECHO_SERVER_ADDR2, + tcptestECHO_SERVER_ADDR3 ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + pxHostAddress->sin_port = FreeRTOS_htons( tcptestECHO_PORT ); pxHostAddress->sin_len = sizeof( struct freertos_sockaddr ); pxHostAddress->sin_family = FREERTOS_AF_INET; @@ -1815,7 +1828,17 @@ static void prvFreeRTOS_connect_InvalidParams( void ) /* Echo requests are sent to the echo server. The echo server is * listening to tcptestECHO_PORT on this computer's IP address. */ xEchoServerAddress.sin_port = FreeRTOS_htons( tcptestECHO_PORT ); - xEchoServerAddress.sin_addr = ulEchoServerIP; + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = ulEchoServerIP; + } + #else + { + xEchoServerAddress.sin_addr = ulEchoServerIP; + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + /* Invalid socket. */ xResult = FreeRTOS_connect( FREERTOS_INVALID_SOCKET, @@ -1833,7 +1856,16 @@ static void prvFreeRTOS_connect_InvalidParams( void ) xSocket = prvTcpSocketHelper( &xSocketOpen ); TEST_ASSERT_NOT_EQUAL_MESSAGE( FREERTOS_INVALID_SOCKET, xSocket, "Socket creation failed" ); - xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( 0, 0, 0, 0 ); + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( 0, 0, 0, 0 ); + } + #else + { + xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( 0, 0, 0, 0 ); + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + xResult = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) ); @@ -1850,7 +1882,17 @@ static void prvFreeRTOS_connect_InvalidParams( void ) TEST_ASSERT_NOT_EQUAL_MESSAGE( FREERTOS_INVALID_SOCKET, xSocket, "Socket creation failed" ); xEchoServerAddress.sin_port = FreeRTOS_htons( 0 ); - xEchoServerAddress.sin_addr = ulEchoServerIP; + + #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) + { + xEchoServerAddress.sin_address.ulIP_IPv4 = ulEchoServerIP; + } + #else + { + xEchoServerAddress.sin_addr = ulEchoServerIP; + } + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + xResult = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) ); diff --git a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/main.c b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/main.c index 9015d194c..9930edad9 100644 --- a/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/main.c +++ b/FreeRTOS-Plus/Test/FreeRTOS-Plus-TCP/Integration/Full-TCP-Suite/main.c @@ -165,7 +165,7 @@ int main( void ) struct xNetworkEndPoint * pxEndPoint ) #else void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) -#endif +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { static BaseType_t xTasksAlreadyCreated = pdFALSE; @@ -217,7 +217,7 @@ static LONG CALLBACK prvExceptionHandler( _In_ PEXCEPTION_POINTERS ExceptionInfo const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; diff --git a/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/plus_tcp_hooks_winsim.c b/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/plus_tcp_hooks_winsim.c index 82e877931..c224b34eb 100644 --- a/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/plus_tcp_hooks_winsim.c +++ b/FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/plus_tcp_hooks_winsim.c @@ -47,7 +47,7 @@ /* It will have several end-points. */ static NetworkEndPoint_t xEndPoints[ 4 ]; -#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ +#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ /*-----------------------------------------------------------*/ @@ -72,7 +72,7 @@ const char * pcName ) #else BaseType_t xApplicationDNSQueryHook( const char * pcName ) - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ { BaseType_t xReturn; @@ -150,7 +150,7 @@ uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxNetworkEndPoints ); #else FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress ); - #endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ + #endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */ FreeRTOS_inet_ntoa( ulIPAddress, cBuffer ); FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) ); @@ -219,7 +219,7 @@ void vPlatformInitIpStack( void ) #else /* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */ xResult = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress ); -#endif /* if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */ +#endif /* defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */ configASSERT( xResult == pdTRUE ); } |