Merging IPv6 demo changes to main (#1028)

* Add IPv6 Demo (#937)

* Add demo changes

* Update kernel and library paths

* Update main.c

* Run uncrustify

* Fix spell checker

* CI check file headers update

* Add IPv6/v4 UDP echo server with zero copy/non-zero copy versions

* Add VS proj file changes to include the UDP echo sample code

* readme update

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.com>

* Update Backward Compatibility Flag (#954)

* Update Backward Compatibility Flag

* Update FreeRTOS_GetUDPPayloadBuffer_ByIPType

* Update FreeRTOS_IPStart to FreeRTOS_IPInit_Multi

* Update Application APIs

* Remove ipconfigCOMPATIBLE_WITH_SINGLE

* Update Static Lib files (#956)

* Update Static Lib files

* making vApplicationIPNetworkEventHook backward compatible in demos

* Update CI check file headers

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.com>

* Add WinPCap NetworkInterface Changes (#958)

* Update winpcap network interface

* Run uncrustify

* Update function to include NetworkInterface_t parameters

* Adding compatibility for xApplicationDNSQueryHook with latest dev branch for old demos (#957)

* adding compatibility for xApplicationDNSQueryHook with latest dev branch

* adding tcp echo server source

* removing unused sub demos

* fix build issues (#969)

* 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

* Update FreeRTOS-Plus-TCP for RC2

* Change from PR (#994)

* Update FreeRTOS-Plus-TCP for RC2

* Update copyright

* Ignore WinPCap for files header check failure.

* Update checker

* Update manifest

* Point manifest to latest commit

* Fix Spell-checker

* Update doxygen

* Update xApplicationDHCPHook for backward compatibility  (#999)

* Update xApplicationDHCPHook for backward compatability

* Update IPv6

* Update VisualStudio Static Project files

* Update pxEndPoint error (#1002)

* Update IPv6 demo ReadMe (#1004)

* Update ReadMe

* Update setup requirement

* Update UDP demo info

* Update comment

* TCP demo changes post build separation (#1011)

* adding sin_family to dest adddr for FreeRTOS_sendto

* updating FreeRTOS_bind to input sin_family post build separation changes

* updating FreeRTOS_connect to input sin_family post build separation changes

* minor fix

* updating copyright year

* updating file headers

* updating +TCP submodule

* updating file headers

* updating file headers

* updating manifest file to have latest +TCP submodule hash

* Fix issue with posix demo while running with ipconfigIPv4_BACKWARD_COMPATIBLE enabled for +TCP stack (#1027)

* Update the submodule pointer to IPv6 main

* Update manifest with latest TCP commit

* Update file checker exception

* Ignore Visual studio project file from file header checker

---------

Co-authored-by: Tony Josi <tonyjosi@amazon.com>
This commit is contained in:
Monika Singh
2023-07-06 12:22:11 +05:30
committed by GitHub
co-authored by Tony Josi
parent 8f3233e0a0
commit 301ed5881b
83 changed files with 12126 additions and 1074 deletions
+3
View File
@@ -278,6 +278,9 @@ FREERTOS_IGNORED_PATTERNS = [
r'FreeRTOS\-Plus/Demo/Common/WinPCap/.*',
r'FreeRTOS\-Plus/Source/FreeRTOS-Plus-Trace/.*',
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/.*',
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/WinPCap/.*',
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/WinPCap/pcap/.*',
r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/FreeRTOS_Plus_TCP_IPv6_Multi.props',
r'FreeRTOS/Demo/lwIP_AVR32_UC3/.*',
r'FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.*',
r'FreeRTOS/Demo/CORTEX_LM3S102_GCC/makedefs',
@@ -1,6 +1,6 @@
/*
* FreeRTOS+TCP V2.0.3
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -19,8 +19,9 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://aws.amazon.com/freertos
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
@@ -91,8 +92,18 @@ 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 );
xAddress.sin_family = FREERTOS_AF_INET;
FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );
FreeRTOS_listen( xSocket, pxConfigs[ xIndex ].xBackLog );
@@ -209,7 +220,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. */
@@ -1,11 +1,6 @@
/*
*!
*! The protocols implemented in this file are intended to be demo quality only,
*! and not for production devices.
*!
*
* FreeRTOS+TCP V2.0.3
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -24,8 +19,16 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://aws.amazon.com/freertos
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/*
*!
*! The protocols implemented in this file are intended to be demo quality only,
*! and not for production devices.
*!
*/
/* Standard includes. */
@@ -585,8 +588,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,8 +865,19 @@ 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 */
xAddress.sin_family = FREERTOS_AF_INET;
BaseType_t xBindResult;
xBindResult = FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );
@@ -929,10 +953,22 @@ BaseType_t xResult;
}
else
{
struct freertos_sockaddr xAddress;
struct freertos_sockaddr xAddress;
xAddress.sin_addr = FreeRTOS_htonl( pxClient->ulClientIP );
#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_port = FreeRTOS_htons( pxClient->usClientPort );
xAddress.sin_family = FREERTOS_AF_INET;
/* Start an active connection for this data socket */
xResult = FreeRTOS_connect( pxClient->xTransferSocket, &xAddress, sizeof( xAddress ) );
}
@@ -1,11 +1,6 @@
/*
*!
*! The protocols implemented in this file are intended to be demo quality only,
*! and not for production devices.
*!
*
* FreeRTOS+TCP V2.0.3
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -24,11 +19,17 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://aws.amazon.com/freertos
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/*
*!
*! The protocols implemented in this file are intended to be demo quality only,
*! and not for production devices.
*!
*
* NTPDemo.c
*
* An example of how to lookup a domain using DNS
@@ -149,8 +150,18 @@ 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 );
xAddress.sin_family = FREERTOS_AF_INET;
FreeRTOS_bind( xUDPSocket, &xAddress, sizeof( xAddress ) );
FreeRTOS_setsockopt( xUDPSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
@@ -386,10 +397,23 @@ 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 ) */
xAddress.sin_family = FREERTOS_AF_INET;
FreeRTOS_printf( ( "Sending UDP message to %s:%u\n",
pcBuf,
FreeRTOS_ntohs( xAddress.sin_port ) ) );
@@ -266,44 +266,44 @@ uint32_t ulAddress;
switch( xIndex )
{
case 0 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
break;
case 1 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
break;
case 2 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
break;
case 3 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
@@ -565,44 +565,44 @@ uint32_t ulAddress;
switch( xIndex )
{
case 0 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
break;
case 1 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
break;
case 2 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
break;
case 3 :
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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++;
@@ -1,6 +1,6 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -20,7 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
@@ -190,6 +190,7 @@ xSocket_t xSocket = FREERTOS_INVALID_SOCKET;
/* Set family and port. */
xServer.sin_port = FreeRTOS_htons( usPort );
xServer.sin_family = FREERTOS_AF_INET;
/* Bind the address to the socket. */
if( FreeRTOS_bind( xSocket, &xServer, sizeof( xServer ) ) == -1 )
@@ -1,6 +1,6 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -20,7 +20,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://aws.amazon.com/freertos
* https://github.com/FreeRTOS
*
*/
@@ -130,10 +130,24 @@ 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 ) */
xEchoServerAddress.sin_family = FREERTOS_AF_INET;
for( ;; )
{
@@ -238,10 +252,24 @@ 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 ) */
xEchoServerAddress.sin_family = FREERTOS_AF_INET;
for( ;; )
{
@@ -181,7 +181,19 @@ 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 ) */
xPrintUDPAddress.sin_family = FREERTOS_AF_INET;
}
/* If a disk file or stdout are to be used then Win32 system calls will
@@ -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)\"
@@ -192,6 +192,7 @@
* listen for incoming connections. */
xBindAddress.sin_port = tcpechoPORT_NUMBER;
xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
xBindAddress.sin_family = FREERTOS_AF_INET;
FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
FreeRTOS_listen( xListeningSocket, xBacklog );
@@ -158,10 +158,24 @@
* 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 ) */
xEchoServerAddress.sin_family = FREERTOS_AF_INET;
for( ; ; )
{
@@ -118,7 +118,7 @@ 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 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
/* In case multiple interfaces are used, define them statically. */
@@ -128,7 +128,7 @@ static UBaseType_t ulNextRand;
/* It will have several end-points. */
static NetworkEndPoint_t xEndPoints[ 4 ];
#endif /* if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */
#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/*-----------------------------------------------------------*/
@@ -157,7 +157,9 @@ void main_tcp_echo_client_tasks( void )
/* Initialise the network interface.*/
FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\r\n" ) );
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
/* Initialise the interface descriptor for WinPCap. */
pxFillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
@@ -170,12 +172,11 @@ void main_tcp_echo_client_tasks( void )
}
#endif /* ( ipconfigUSE_DHCP != 0 ) */
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
FreeRTOS_IPStart();
FreeRTOS_IPInit_Multi();
#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 ) */
#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/* Start the RTOS scheduler. */
FreeRTOS_debug_printf( ( "vTaskStartScheduler\n" ) );
@@ -197,7 +198,12 @@ void main_tcp_echo_client_tasks( void )
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
* events are only received if implemented in the MAC driver. */
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
struct xNetworkEndPoint * pxEndPoint )
#else
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
{
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
char cBuffer[ 16 ];
@@ -225,11 +231,11 @@ void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
/* Print out the network configuration, which may have come from a DHCP
* server. */
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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 ) );
@@ -303,7 +309,12 @@ static void prvMiscInitialisation( void )
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
BaseType_t xApplicationDNSQueryHook( const char * pcName )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
BaseType_t xApplicationDNSQueryHook_Multi( struct xNetworkEndPoint * pxEndPoint,
const char * pcName )
#else
BaseType_t xApplicationDNSQueryHook( const char * pcName )
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
{
BaseType_t xReturn;
@@ -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
@@ -159,10 +159,24 @@
* 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 ) */
xEchoServerAddress.sin_family = FREERTOS_AF_INET;
for( ; ; )
{
@@ -124,7 +124,7 @@ const uint8_t ucMACAddress[ 6 ] =
/* Use by the pseudo random number generator. */
static UBaseType_t ulNextRand;
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
/* In case multiple interfaces are used, define them statically. */
@@ -134,7 +134,7 @@ static UBaseType_t ulNextRand;
/* It will have several end-points. */
static NetworkEndPoint_t xEndPoints[ 4 ];
#endif /* if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 ) */
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/*-----------------------------------------------------------*/
@@ -162,7 +162,7 @@ void main_tcp_echo_client_tasks( void )
/* Initialise the network interface.*/
FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\r\n" ) );
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
/* Initialise the interface descriptor for WinPCap. */
pxMPS2_FillInterfaceDescriptor( 0, &( xInterfaces[ 0 ] ) );
@@ -177,11 +177,11 @@ void main_tcp_echo_client_tasks( void )
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
FreeRTOS_IPStart();
FreeRTOS_IPInit_Multi();
#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 ) */
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
/* Start the RTOS scheduler. */
@@ -206,7 +206,12 @@ BaseType_t xTasksAlreadyCreated = pdFALSE;
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
* events are only received if implemented in the MAC driver. */
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
struct xNetworkEndPoint * pxEndPoint )
#else
void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
{
uint32_t ulIPAddress;
uint32_t ulNetMask;
@@ -237,11 +242,11 @@ void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
/* Print out the network configuration, which may have come from a DHCP
* server. */
#if defined( FREERTOS_PLUS_TCP_VERSION ) && ( FREERTOS_PLUS_TCP_VERSION >= 10 )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
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 ) );
@@ -316,7 +321,12 @@ static void prvMiscInitialisation( void )
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
BaseType_t xApplicationDNSQueryHook( const char * pcName )
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
BaseType_t xApplicationDNSQueryHook_Multi( struct xNetworkEndPoint * pxEndPoint,
const char * pcName )
#else
BaseType_t xApplicationDNSQueryHook( const char * pcName )
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
{
BaseType_t xReturn;
@@ -0,0 +1,228 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* http://www.freertos.org/a00110.html
*
* The bottom of this file contains some constants specific to running the UDP
* stack in this demo. Constants specific to FreeRTOS+TCP itself (rather than
* the demo) are contained in FreeRTOSIPConfig.h.
*----------------------------------------------------------*/
/* Used for IPv6 validation */
#define configECHO_SERVER_ADDR_STRING "fe80::a53b:3371:d92f:970b"
/* Used for IPv4 validation */
/* #define configECHO_SERVER_ADDR_STRING "192.168.1.3" */
#define configECHO_SERVER_PORT 7
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configMAX_PRIORITIES ( 7 )
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 2048U * 1024U ) )
#define configMAX_TASK_NAME_LEN ( 15 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 3 /* FreeRTOS+FAT requires 2 pointers if a CWD is supported. */
/* Hook function related definitions. */
#define configUSE_TICK_HOOK 0
#define configUSE_IDLE_HOOK 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configCHECK_FOR_STACK_OVERFLOW 0 /* Not applicable to the Win32 port. */
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
/* Event group related definitions. */
#define configUSE_EVENT_GROUPS 1
/* Run time stats gathering definitions. */
#define configGENERATE_RUN_TIME_STATS 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the API function, or zero
* to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTimerGetTimerTaskHandle 0
#define INCLUDE_xTaskGetIdleTaskHandle 0
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xEventGroupSetBitsFromISR 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_pcTaskGetTaskName 1
/* This demo makes use of one or more example stats formatting functions. These
* format the raw data provided by the uxTaskGetSystemState() function in to human
* readable ASCII form. See the notes in the implementation of vTaskList() within
* FreeRTOS/Source/tasks.c for limitations. configUSE_STATS_FORMATTING_FUNCTIONS
* is set to 2 so the formatting functions are included without the stdio.h being
* included in tasks.c. That is because this project defines its own sprintf()
* functions. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Assert call defined for debug builds. */
#ifdef _DEBUG
extern void vAssertCalled( const char * pcFile,
uint32_t ulLine );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
#endif /* _DEBUG */
/* Application specific definitions follow. **********************************/
/* If configINCLUDE_DEMO_DEBUG_STATS is set to one, then a few basic IP trace
* macros are defined to gather some UDP stack statistics that can then be viewed
* through the CLI interface. */
#define configINCLUDE_DEMO_DEBUG_STATS 1
/* The size of the global output buffer that is available for use when there
* are multiple command interpreters running at once (for example, one on a UART
* and one on TCP/IP). This is done to prevent an output buffer being defined by
* each implementation - which would waste RAM. In this case, there is only one
* command interpreter running, and it has its own local output buffer, so the
* global buffer is just set to be one byte long as it is not used and should not
* take up unnecessary RAM. */
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1
/* Only used when running in the FreeRTOS Windows simulator. Defines the
* priority of the task used to simulate Ethernet interrupts. */
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
/* This demo creates a virtual network connection by accessing the raw Ethernet
* or WiFi data to and from a real network connection. Many computers have more
* than one real network port, and configNETWORK_INTERFACE_TO_USE is used to tell
* the demo which real port should be used to create the virtual port. The ports
* available are displayed on the console when the application is executed. For
* example, on my development laptop setting configNETWORK_INTERFACE_TO_USE to 4
* results in the wired network being used, while setting
* configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
* used. */
#define configNETWORK_INTERFACE_TO_USE 1L
#define configNETWORK_INTERFACE_TYPE_TO_USE "Realtek"
/* The address of an echo server that will be used by the two demo echo client
* tasks.
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html */
#define configECHO_SERVER_ADDR0 192
#define configECHO_SERVER_ADDR1 168
#define configECHO_SERVER_ADDR2 2
#define configECHO_SERVER_ADDR3 5
/* Default MAC address configuration. The demo creates a virtual network
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data
* to and from a real network connection on the host PC. See the
* configNETWORK_INTERFACE_TO_USE definition above for information on how to
* configure the real network connection to use. */
#define configMAC_ADDR0 0x00
#define configMAC_ADDR1 0x11
#define configMAC_ADDR2 0x22
#define configMAC_ADDR3 0x33
#define configMAC_ADDR4 0x44
#define configMAC_ADDR5 0x41
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
#define configIP_ADDR0 192
#define configIP_ADDR1 168
#define configIP_ADDR2 2
#define configIP_ADDR3 114
/* Default gateway IP address configuration. Used in ipconfigUSE_DNS is set to
* 0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
#define configGATEWAY_ADDR0 192
#define configGATEWAY_ADDR1 168
#define configGATEWAY_ADDR2 2
#define configGATEWAY_ADDR3 1
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and
* 208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set
* to 1 but a DNS server cannot be contacted.*/
#define configDNS_SERVER_ADDR0 180
#define configDNS_SERVER_ADDR1 250
#define configDNS_SERVER_ADDR2 245
#define configDNS_SERVER_ADDR3 182
/* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */
#define configNET_MASK0 255
#define configNET_MASK1 255
#define configNET_MASK2 255
#define configNET_MASK3 0
/* The UDP port to which print messages are sent. */
#define configPRINT_PORT ( 15000 )
#if ( defined( _MSC_VER ) && ( _MSC_VER <= 1600 ) && !defined( snprintf ) )
/* Map to Windows names. */
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
/* Visual studio does not have an implementation of strcasecmp(). */
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strcmpi _strcmpi
#endif /* FREERTOS_CONFIG_H */
@@ -0,0 +1,321 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/*****************************************************************************
*
* See the following URL for configuration information.
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
*
*****************************************************************************/
#ifndef FREERTOS_IP_CONFIG_H
#define FREERTOS_IP_CONFIG_H
/* Prototype for the function used to print out. In this case it prints to the
* console before the network is connected then a UDP port after the network has
* connected. */
extern void vLoggingPrintf( const char * pcFormatString,
... );
/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
* 1 then FreeRTOS_debug_printf should be defined to the function used to print
* out the debugging messages. */
#define ipconfigHAS_DEBUG_PRINTF 1
#if ( ipconfigHAS_DEBUG_PRINTF == 1 )
#define FreeRTOS_debug_printf( X ) vLoggingPrintf X
#endif
/* Set to 1 to print out non debugging messages, for example the output of the
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
* then FreeRTOS_printf should be set to the function used to print out the
* messages. */
#define ipconfigHAS_PRINTF 1
#if ( ipconfigHAS_PRINTF == 1 )
#define FreeRTOS_printf( X ) vLoggingPrintf X
#endif
/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
* on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums)
* then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
* stack repeating the checksum calculations. */
#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
/* Several API's will block until the result is known, or the action has been
* performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
* set per socket, using setsockopt(). If not set, the times below will be
* used as defaults. */
#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
/* Include support for LLMNR: Link-local Multicast Name Resolution
* (non-Microsoft) */
#define ipconfigUSE_LLMNR ( 1 )
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
#define ipconfigUSE_NBNS ( 1 )
/* Include support for DNS caching. For TCP, having a small DNS cache is very
* useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
* and also DNS may use small timeouts. If a DNS reply comes in after the DNS
* socket has been destroyed, the result will be stored into the cache. The next
* call to FreeRTOS_gethostbyname() will return immediately, without even creating
* a socket. */
#define ipconfigUSE_DNS_CACHE ( 1 )
#define ipconfigDNS_CACHE_NAME_LENGTH ( 33 )
#define ipconfigDNS_CACHE_ENTRIES ( 4 )
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
/* Let DNS wait for 3 seconds for an answer. */
#define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 3000U )
/* The IP stack executes it its own task (although any application task can make
* use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
* sets the priority of the task that executes the IP stack. The priority is a
* standard FreeRTOS task priority so can take any value from 0 (the lowest
* priority) to (configMAX_PRIORITIES - 1) (the highest priority).
* configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
* FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
* the priority assigned to the task executing the IP stack relative to the
* priority assigned to tasks that use the IP stack. */
#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
* task. This setting is less important when the FreeRTOS Win32 simulator is used
* as the Win32 simulator only stores a fixed amount of information on the task
* stack. FreeRTOS includes optional stack overflow detection, see:
* http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
/* ipconfigRAND32() is called by the IP stack to generate random numbers for
* things such as a DHCP transaction number or initial sequence number. Random
* number generation is performed via this macro to allow applications to use their
* own random number generation method. For example, it might be possible to
* generate a random number by sampling noise on an analogue input. */
extern UBaseType_t uxRand();
#define ipconfigRAND32() uxRand()
/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
* network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
* is not set to 1 then the network event hook will never be called. See
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
*/
#define ipconfigUSE_NETWORK_EVENT_HOOK 1
/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
* a network buffer cannot be obtained then the calling task is held in the Blocked
* state (so other tasks can continue to executed) until either a network buffer
* becomes available or the send block time expires. If the send block time expires
* then the send operation is aborted. The maximum allowable send block time is
* capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
* maximum allowable send block time prevents prevents a deadlock occurring when
* all the network buffers are in use and the tasks that process (and subsequently
* free) the network buffers are themselves blocked waiting for a network buffer.
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* 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
* ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
* stack will revert to using the static IP address even when ipconfigUSE_DHCP is
* set to 1 if a valid configuration cannot be obtained from a DHCP server for any
* reason. The static configuration used is that passed into the stack by the
* FreeRTOS_IPInit() function call. */
#define ipconfigUSE_DHCP 1
/* 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
* and accepted, or the interval between transmissions reaches
* ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC
* address associated with the IP address, or the MAC address of the router used to
* contact the remote IP address. When a UDP message is received from a remote IP
* address the MAC address and IP address are added to the ARP cache. When a UDP
* message is sent to a remote IP address that does not already appear in the ARP
* cache then the UDP message is replaced by a ARP message that solicits the
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
* number of entries that can exist in the ARP table at any one time. */
#define ipconfigARP_CACHE_ENTRIES 6
/* ARP requests that do not result in an ARP response will be re-transmitted a
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
* aborted. */
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
* table being created or refreshed and the entry being removed because it is stale.
* New ARP requests are sent for ARP cache entries that are nearing their maximum
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
* equal to 1500 seconds (or 25 minutes). */
#define ipconfigMAX_ARP_AGE 150
/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
* routines, which are relatively large. To save code space the full
* FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
* alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
* takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
* FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
* (for example, 192, 168, 0, 1) as its parameters. If
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
#define ipconfigINCLUDE_FULL_INET_ADDR 1
/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
* are available to the IP stack. The total number of network buffers is limited
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
* to a pre-determinable value. */
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
/* A FreeRTOS queue is used to send events from application tasks to the IP
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
* be queued for processing at any one time. The event queue must be a minimum of
* 5 greater than the total number of network buffers. */
#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
/* The address of a socket is the combination of its IP address and its port
* number. FreeRTOS_bind() is used to manually allocate a port number to a socket
* (to 'bind' the socket to a port), but manual binding is not normally necessary
* for client sockets (those sockets that initiate outgoing connections rather than
* wait for incoming connections on a known port number). If
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
* FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
* stack automatically binding the socket to a port number from the range
* socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
* ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
* on a socket that has not yet been bound will result in the send operation being
* aborted. */
#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
#define ipconfigUDP_TIME_TO_LIVE 128
#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
/* USE_TCP: Use TCP and all its features */
#define ipconfigUSE_TCP ( 1 )
/* USE_WIN: Let TCP use windowing mechanism. */
#define ipconfigUSE_TCP_WIN ( 1 )
/* The MTU is the maximum number of bytes the payload of a network frame can
* contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
* lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */
#define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */
#define ipconfigUSE_DNS 1
#define ipconfigUSE_MDNS 1
/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
* generate replies to incoming ICMP echo (ping) requests. */
#define ipconfigREPLY_TO_INCOMING_PINGS 1
/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
* FreeRTOS_SendPingRequest() API function is available. */
#define ipconfigSUPPORT_OUTGOING_PINGS 1
/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
* (and associated) API function is available. */
#define ipconfigSUPPORT_SELECT_FUNCTION 1
/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
* that are not in Ethernet II format will be dropped. This option is included for
* potential future IP stack developments. */
#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
* responsibility of the Ethernet interface to filter out packets that are of no
* interest. If the Ethernet interface does not implement this functionality, then
* set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
* perform the filtering instead (it is much less efficient for the stack to do it
* because the packet will already have been passed into the stack). If the
* Ethernet driver does all the necessary filtering in hardware then software
* filtering can be removed by using a value other than 1 or 0. */
#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
/* The windows simulator cannot really simulate MAC interrupts, and needs to
* block occasionally to allow other tasks to run. */
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
/* Advanced only: in order to access 32-bit fields in the IP packets with
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
* This has to do with the contents of the IP-packets: all 32-bit fields are
* 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
* outstanding packets (for Rx and Tx). When using up to 10 TP sockets
* simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
#define ipconfigTCP_WIN_SEG_COUNT 240
/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
* maximum size. Define the size of Rx buffer for TCP sockets. */
#define ipconfigTCP_RX_BUFFER_LENGTH ( 1000 )
/* Define the size of Tx buffer for TCP sockets. */
#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 )
/* When using call-back handlers, the driver may check if the handler points to
* real program memory (RAM or flash) or just has a random non-zero value. */
#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL )
/* Include support for TCP hang protection. All sockets in a connecting or
* disconnecting stage will timeout after a period of non-activity. */
#define ipconfigTCP_HANG_PROTECTION ( 1 )
#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
/* Include support for TCP keep-alive messages. */
#define ipconfigTCP_KEEP_ALIVE ( 1 )
#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */
#define portINLINE __inline
#define ipconfigMULTI_INTERFACE 1
#define ipconfigUSE_NTP_DEMO 1
#define ipconfigDNS_USE_CALLBACKS 1
#define ipconfigSUPPORT_SIGNALS 1
#define ipconfigUSE_IPv6 1
#define ipconfigUSE_IPv6 1
#define ipconfigUSE_RA 0
#define ipconfigSUPPORT_OUTGOING_PINGS 1
#endif /* FREERTOS_IP_CONFIG_H */
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<COMMENT>
The following macros define the locations where the FreeRTOS kernel and
other libraries can be found. Note that an absolut path may also used.
Please try to avoid paths that contain whitespace.
</COMMENT>
<FREERTOS_SOURCE_DIR>..\..\..\Source\FreeRTOS-Plus-TCP\test\FreeRTOS-Kernel</FREERTOS_SOURCE_DIR>
<FREERTOS_INCLUDE_DIR>..\..\..\Source\FreeRTOS-Plus-TCP\test\FreeRTOS-Kernel\include</FREERTOS_INCLUDE_DIR>
<DEMO_COMMON_SOURCE_DIR>..\common</DEMO_COMMON_SOURCE_DIR>
<PLUS_TCP_SOURCE_DIR>..\..\..\Source\FreeRTOS-Plus-TCP\source</PLUS_TCP_SOURCE_DIR>
<PLUS_TCP_INCLUDE_DIR>..\..\..\Source\FreeRTOS-Plus-TCP\source\include</PLUS_TCP_INCLUDE_DIR>
<UTILITIES_SOURCE_DIR>..\..\..\Source\FreeRTOS-Plus-TCP\tools\tcp_utilities</UTILITIES_SOURCE_DIR>
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup>
<BuildMacro Include="PLUS_TCP_SOURCE_DIR">
<Value>$(PLUS_TCP_SOURCE_DIR)</Value>
</BuildMacro>
<BuildMacro Include="PLUS_TCP_INCLUDE_DIR">
<Value>$(PLUS_TCP_INCLUDE_DIR)</Value>
</BuildMacro>
<BuildMacro Include="FREERTOS_SOURCE_DIR">
<Value>$(FREERTOS_SOURCE_DIR)</Value>
</BuildMacro>
<BuildMacro Include="FREERTOS_INCLUDE_DIR">
<Value>$(FREERTOS_INCLUDE_DIR)</Value>
</BuildMacro>
</ItemGroup>
</Project>
@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = FreeRTOS_Plus_TCP_IPv6_Multi.vsmdi
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.ActiveCfg = Debug|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|Win32.Build.0 = Debug|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.ActiveCfg = Release|Win32
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,209 @@
# FreeRTOS+TCP IPv6 Multi-Endpoint Demo
The IPv6_Multi_WinSim Visual studio demo showcases the Multiple Interfaces (or
rather the multiple endpoints) functionality of the FreeRTOS+TCP library.
The Windows Simulator environment doesn't actually have multiple
interfaces which can be used by FreeRTOS and thus, this demo shows
the use of different endpoints which will be resolved by the OS having multiple
interfaces. It shows that the library will use different endpoints (IP-addresses)
to connect to IP-addresses on different subnets (or using different netmasks).
## Setting up the workspace
Clone the submodules used in the FreeRTOS repo:
`git submodule update --init --recursive`
Make sure the FreeRTOS+TCP submodule is pointing to the [`dev/IPv6_integration`](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/dev/IPv6_integration) branch
by checking:
``` sh
cd FreeRTOS-Plus\Source\FreeRTOS-Plus-TCP
git status
```
If not checkout to `dev/IPv6_integration`:
`git checkout dev/IPv6_integration`
Update submodules:
``` sh
git submodule update --init --recursive
git submodule update --checkout
```
The FreeRTOS+TCP Multiple Interface Visual Studio project file is in the following
directory: `FreeRTOS-Plus\Demo\FreeRTOS_Plus_TCP_IPv6_Demo\IPv6_Multi_WinSim_demo`
In FreeRTOS_Plus_TCP_IPv6_Multi.props, you will find a couple of macros that indicate
the location of source files:
- FREERTOS_SOURCE_DIR The kernel sources
- FREERTOS_INCLUDE_DIR The kernel header files
- DEMO_COMMON_SOURCE_DIR The location of the "common" directory of the demos
- PLUS_TCP_SOURCE_DIR The FreeRTOS+TCP source files
- PLUS_TCP_INCLUDE_DIR> The FreeRTOS+TCP header files
- UTILITIES_SOURCE_DIR The location of the tcp_utilities directory
You can changes these directory to let the project work with a different
source tree.
## Prerequisites
[Optional] Running IPv4 demo [FreeRTOS_Plus_TCP_Minimal_Windows_Simulator](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator)
The instructions are provided on the following URL, see the ["Hardware Setup" and "Software Setup"](http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html).
This will give more hands on experience of running Echo server and client.
For this demo, FreeRTOS configuration file *FreeRTOSConfig.h* needs to be updated as shown below :
*Client Configuration* :
1. `configIP_ADDR0/3` : Setup with client IP address, when DHCP is disabled.
2. `configNET_MASK0/3` : Setup with the appropriate network mask.
3. `configGATEWAY_ADDR0/3 ` : Setup with Default Gateway address of Client IP.
4. `configDNS_SERVER_ADDR0/3` : Setup wit DNS Server address of Client IP.
*Server Configuration :*
1. `configECHO_SERVER_ADDR_STRING` as an IPv6 Server IP address for IPv6
validation, it can be updated to IPv4 address for IPv4 validations.
2. `configECHO_SERVER_PORT` Needs to be setup for the Server port number.
Note that, as delivered, configUSE_DHCPv6 is set to 0, so a static IP address is used.
## Selecting the Examples to Run
### The TCP client example:
This example can be enabled by setting the `mainCREATE_TCP_ECHO_TASKS_SINGLE`
macro to 1 at the top of the project's main.c source file.
The example creates two RTOS tasks that send TCP echo requests to an external
echo server using the echo port set in FreeRTOSConfig.h, then wait to receive
the echo reply within the same RTOS task.
The IP address of the echo server must be configured by updating the `configECHO_SERVER_ADDR_STRING`
as IPv4 or IPv6 address and server port number must be updated as `configECHO_SERVER_PORT` in FreeRTOSConfig.h.
The echo server must be enabled and not blocked by a firewall.
### The TCP server example:
This example can be enabled by setting the `mainCREATE_TCP_ECHO_SERVER_TASK`
macro to 1 at the top of the project's main.c source file.
This example creates an echo server that listens for echo requests on
the standard echo protocol port number 7. It then echos back any data
received on that connection.
### The UDP Echo Client example
The demo also demonstrates a IPv4/IPv6 UDP echo client which can be enabled by
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)
and configECHO_SERVER_PORT respectively in the FreeRTOSConfig.h file and expect to
get echo of the messages back. There should be a UDP echo server running in the
given IP and port.
These RTOS tasks are self checking and will trigger a configASSERT() failure if they
detect a difference in the data that is received from that which was sent. As these
RTOS tasks use UDP, which can legitimately loose packets, they can cause configASSERT()
failures when they are executed in a less than perfect networking environment.
#### *Note* Sample TCP and UDP echo server can be found at the last section of ReadME.
### The IPv6_Multi_WinSim_demo demo also performs some basic network activities:
- ARP address resolution for IPv4 addresses on the LAN
- Neighbour Discovery for IPv6 addresses on the LAN
- Looking up a IPv4 or IPv6 address using DNS, either asynchronous or synchronous.
- Looking up a local host ( IPv4/6 ) using LLMNR ( not considered safe anymore )
- Talk with an NTP server and fetch the time using UDP, with IPv4/6
- Download a file from any public server using TCP/HTTP
- Ping any server on the web or on the LAN, , with IPv4 or IPv6
The demo can be easily adapted to your own needs. It works like a command line
interface ( CLI ) that performs the above tasks. Although it is called a CLI,
the demo does not have a STDIN. The commands are hard-coded in main.c pcCommandList.
The pcCommandList options can be uncommented to run the commands. Here are some examples of
valid command lines, using the keywords “http”, “ping”, “dnsq”, and “ntp:
"http4 google.co.uk /index.html",
"http6 amazon.com /index.html",
"ping4 10.0.1.10",
"ping6 2001:470:ec54::",
"dnsq4 yahoo.com",
"ping6 aws.com",
"ntp6a 2.europe.pool.ntp.org",
The last line will first lookup the mentioned NTP server, send a request, and wait
for a reply. The time will be printed in the logging.
The keywords can have some single-letter suffices: 4 or 6 ( for IPv4/6 ), “a” to do
an asynchronous DNS lookup, and “c” to clear all caches before starting the task.
## Sample Echo server
##### Prerequisites : [Install go](https://go.dev/doc/install)
#### Sample UDP server in Go:
``` go
// Filename: echo_server.go
// Run: go run echo_server.go <ip_address>:<port>
// Example IPv4: go run echo_server.go 192.168.1.2:9000
// Example IPv6: go run echo_server.go [fe80::1b99:a6bd:a344:b09d]:9000
package main
import (
"fmt"
"net"
"os"
)
func main() {
if len(os.Args) == 1 {
fmt.Println("Please provide host:port")
os.Exit(1)
}
// Resolve the string address to a UDP address
udpAddr, err := net.ResolveUDPAddr("udp", os.Args[1])
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Start listening for UDP packages on the given address
conn, err := net.ListenUDP("udp", udpAddr)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Read from UDP listener
for {
var buf [1024]byte
_, addr, err := conn.ReadFromUDP(buf[0:])
if err != nil {
fmt.Println(err)
return
}
fmt.Print(string(buf[0:]))
// Write back the message over UDP
conn.WriteToUDP([]byte(buf[0:]), addr)
}
}
```
The UDP Echo Client demo also demonstrates the UDP zero copy for both IPv4 and IPv6
(based on the IP type), it can be enabled by setting `USE_ZERO_COPY` macro of the
UDPEchoClient_SingleTasks.c file to 1.
#### Sample TCP server in Go:
[TCP Echo Server](https://github.com/aws/amazon-freertos/tree/main/tools/echo_server)
@@ -0,0 +1,6 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
IDList=
HotKey=0
@@ -0,0 +1,478 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/*
* A set of tasks are created that send TCP echo requests to the standard echo
* port (port 7) on the IP address set by the configECHO_SERVER_ADDR0 to
* configECHO_SERVER_ADDR3 constants, then wait for and verify the reply
* (another demo is available that demonstrates the reception being performed in
* a task other than that from with the request was made).
*
* See the following web page for essential demo usage and configuration
* details:
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
*/
/* Standard includes. */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
/* FreeRTOS+TCP includes. */
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
/*#include "tcp_echo_config.h" */
/* Exclude the whole file if FreeRTOSIPConfig.h is configured to use UDP only. */
#if ( ipconfigUSE_TCP == 1 )
/* The echo tasks create a socket, send out a number of echo requests, listen
* for the echo reply, then close the socket again before starting over. This
* delay is used between each iteration to ensure the network does not get too
* congested. */
#define echoLOOP_DELAY pdMS_TO_TICKS( 2U )
/* The size of the buffers is a multiple of the MSS - the length of the data
* sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
#define echoBUFFER_SIZE_MULTIPLIER ( 3 )
#define echoBUFFER_SIZES ( ipconfigTCP_MSS * echoBUFFER_SIZE_MULTIPLIER )
/* The number of instances of the echo client task to create. */
#define echoNUM_ECHO_CLIENTS ( 1 )
/*-----------------------------------------------------------*/
/*
* Uses a socket to send data to, then receive data from, the standard echo
* port number 7.
*/
static void prvEchoClientTask( void * pvParameters );
/*
* Creates a pseudo random sized buffer of data to send to the echo server.
*/
static BaseType_t prvCreateTxData( char * ucBuffer,
uint32_t ulBufferLength );
/*-----------------------------------------------------------*/
/* Rx and Tx time outs are used to ensure the sockets do not wait too long for
* missing data. */
static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 4000 );
static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 4000 );
static BaseType_t xHasStarted = pdFALSE;
/* Counters for each created task - for inspection only. */
static uint32_t ulTxRxCycles[ echoNUM_ECHO_CLIENTS ] = { 0 },
ulTxRxFailures[ echoNUM_ECHO_CLIENTS ] = { 0 },
ulConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
/* Rx and Tx buffers for each created task. */
static char cTxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ],
cRxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ];
/*-----------------------------------------------------------*/
void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize,
UBaseType_t uxTaskPriority )
{
if( xHasStarted == pdFALSE )
{
BaseType_t xCount = 0;
BaseType_t x;
xHasStarted = pdTRUE;
/* Create the echo client tasks. */
for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
{
char ucName[ 16 ];
snprintf( ucName, sizeof ucName, "echo_%02d", ( int ) x );
BaseType_t rc = xTaskCreate( prvEchoClientTask, /* The function that implements the task. */
ucName, /* Just a text name for the task to aid debugging. */
usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */
( void * ) x, /* The task parameter, not used in this case. */
uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */
NULL ); /* The task handle is not used. */
if( rc == pdPASS )
{
xCount++;
}
}
FreeRTOS_printf( ( "Started %d / %d tasks\n", ( int ) xCount, ( int ) echoNUM_ECHO_CLIENTS ) );
}
else
{
FreeRTOS_printf( ( "vStartTCPEchoClientTasks_SingleTasks: already started\n" ) );
}
}
/*-----------------------------------------------------------*/
static BaseType_t xIsFatalError( BaseType_t xCode )
{
BaseType_t xReturn = pdFALSE;
if( ( xCode < 0 ) && ( xCode != -pdFREERTOS_ERRNO_EWOULDBLOCK ) )
{
xReturn = pdTRUE;
}
return xReturn;
}
/*-----------------------------------------------------------*/
static void prvEchoClientTask( void * pvParameters )
{
Socket_t xSocket;
struct freertos_sockaddr xEchoServerAddress;
int32_t lLoopCount = 0UL;
const int32_t lMaxLoopCount = 1;
volatile uint32_t ulTxCount = 0UL;
BaseType_t xReceivedBytes, xReturned, xInstance;
BaseType_t lTransmitted, lStringLength;
char * pcTransmittedString, * pcReceivedString;
WinProperties_t xWinProps;
TickType_t xTimeOnEntering;
TickType_t uxDuration = 0;
size_t xTotalSent = 0U;
size_t xTotalRecv = 0U;
BaseType_t xFamily = FREERTOS_AF_INET;
/* Fill in the buffer and window sizes that will be used by the socket. */
#ifdef _WINDOWS_
xWinProps.lTxBufSize = 8 * ipconfigTCP_MSS;
xWinProps.lTxWinSize = 5;
xWinProps.lRxBufSize = 8 * ipconfigTCP_MSS;
xWinProps.lRxWinSize = 5;
#else
xWinProps.lTxBufSize = 3 * ipconfigTCP_MSS;
xWinProps.lTxWinSize = 2;
xWinProps.lRxBufSize = 3 * ipconfigTCP_MSS;
xWinProps.lRxWinSize = 2;
#endif
/* This task can be created a number of times. Each instance is numbered
* to enable each instance to use a different Rx and Tx buffer. The number is
* passed in as the task's parameter. */
xInstance = ( BaseType_t ) pvParameters;
/* Point to the buffers to be used by this instance of this task. */
pcTransmittedString = &( cTxBuffers[ xInstance ][ 0 ] );
pcReceivedString = &( cRxBuffers[ xInstance ][ 0 ] );
memset( &xEchoServerAddress, 0, sizeof( xEchoServerAddress ) );
/* Echo requests are sent to the echo server. The address of the echo
* server is configured by the constants configECHO_SERVER_ADDR0 to
* configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
#ifdef configECHO_SERVER_ADDR_STRING
{
BaseType_t rc = FreeRTOS_inet_pton( FREERTOS_AF_INET6, configECHO_SERVER_ADDR_STRING, ( void * ) xEchoServerAddress.sin_address.xIP_IPv6.ucBytes );
if( rc == pdPASS )
{
xFamily = FREERTOS_AF_INET6;
}
else
{
rc = FreeRTOS_inet_pton( FREERTOS_AF_INET4, configECHO_SERVER_ADDR_STRING, ( void * ) xEchoServerAddress.sin_address.xIP_IPv6.ucBytes );
configASSERT( rc == pdPASS );
xFamily = FREERTOS_AF_INET4;
}
}
#else /* ifdef configECHO_SERVER_ADDR_STRING */
{
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 */
xEchoServerAddress.sin_len = sizeof( xEchoServerAddress );
xEchoServerAddress.sin_port = FreeRTOS_htons( configECHO_SERVER_PORT );
xEchoServerAddress.sin_family = xFamily;
for( ; ; )
{
BaseType_t xResult;
/* Create a TCP socket. */
xSocket = FreeRTOS_socket( xFamily, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
/* Set a time out so a missing reply does not cause the task to block
* indefinitely. */
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xSendTimeOut ) );
/* Set the window and buffer sizes. */
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
xTotalSent = 0U;
xTotalRecv = 0U;
/* Connect to the echo server. */
xResult = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) );
FreeRTOS_printf( ( "FreeRTOS_connect returns %d\n", ( int ) xResult ) );
if( xResult == 0 )
{
ulConnections[ xInstance ]++;
/* Send a number of echo requests. */
for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ )
{
/* Create the string that is sent to the echo server. */
lStringLength = prvCreateTxData( pcTransmittedString, echoBUFFER_SIZES );
/* Add in some unique text at the front of the string. */
sprintf( pcTransmittedString, "TxRx message number %u", ( unsigned ) ulTxCount );
ulTxCount++;
if( lLoopCount == ( lMaxLoopCount - 1 ) )
{
BaseType_t xTrue = pdTRUE;
/* FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_CLOSE_AFTER_SEND, &xTrue, sizeof( xTrue ) ); */
}
/* Send the string to the socket. */
lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */
( void * ) pcTransmittedString, /* The data being sent. */
lStringLength, /* The length of the data being sent. */
0 ); /* No flags. */
FreeRTOS_printf( ( "FreeRTOS_send: %u/%u\n", ( unsigned ) lTransmitted, ( unsigned ) lStringLength ) );
if( xIsFatalError( lTransmitted ) )
{
/* Error? */
break;
}
xTotalSent += lTransmitted;
/* Clear the buffer into which the echoed string will be
* placed. */
memset( ( void * ) pcReceivedString, 0x00, echoBUFFER_SIZES );
xReceivedBytes = 0;
/* Receive data echoed back to the socket. */
while( xReceivedBytes < lTransmitted )
{
xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
&( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */
0 ); /* No flags. */
if( xIsFatalError( xReturned ) )
{
/* Error occurred. Latch it so it can be detected
* below. */
break;
}
if( xReturned == 0 )
{
/* Timed out. */
FreeRTOS_printf( ( "recv returned %u\n", ( unsigned ) xReturned ) );
break;
}
/* Keep a count of the bytes received so far. */
xReceivedBytes += xReturned;
xTotalRecv += xReturned;
}
/* If an error occurred it will be latched in xReceivedBytes,
* otherwise xReceived bytes will be just that - the number of
* bytes received from the echo server. */
if( xReceivedBytes > 0 )
{
/* Compare the transmitted string to the received string. */
configASSERT( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 );
if( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 )
{
/* The echo reply was received without error. */
ulTxRxCycles[ xInstance ]++;
}
else
{
/* The received string did not match the transmitted
* string. */
ulTxRxFailures[ xInstance ]++;
break;
}
}
else if( xIsFatalError( xReturned ) )
{
/* FreeRTOS_recv() returned an error. */
break;
}
else
{
/* Timed out without receiving anything? */
break;
}
}
/* Finished using the connected socket, initiate a graceful close:
* FIN, FIN+ACK, ACK. */
FreeRTOS_shutdown( xSocket, FREERTOS_SHUT_RDWR );
/* Expect FreeRTOS_recv() to return an error once the shutdown is
* complete. */
xTimeOnEntering = xTaskGetTickCount();
do
{
xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
&( pcReceivedString[ 0 ] ), /* The buffer into which the received data will be written. */
echoBUFFER_SIZES, /* The size of the buffer provided to receive the data. */
0 );
uxDuration = ( xTaskGetTickCount() - xTimeOnEntering );
if( xReturned < 0 )
{
break;
}
} while( uxDuration < xReceiveTimeOut );
}
FreeRTOS_printf( ( "Instance[%u]: Good %u/%u shutdown %u\n",
( unsigned ) xInstance,
( unsigned ) ( ulTxRxCycles[ xInstance ] - ulTxRxFailures[ xInstance ] ),
( unsigned ) ( ulTxRxCycles[ xInstance ] ),
( unsigned ) uxDuration ) );
FreeRTOS_printf( ( "%u x %u = %u Exchange %u/%u\n",
( unsigned ) echoBUFFER_SIZE_MULTIPLIER,
( unsigned ) echoBUFFER_SIZES,
( unsigned ) ( echoBUFFER_SIZE_MULTIPLIER * echoBUFFER_SIZES ),
( unsigned ) xTotalSent,
( unsigned ) xTotalRecv ) );
/* Close this socket before looping back to create another. */
FreeRTOS_closesocket( xSocket );
/* Pause for a short while to ensure the network is not too
* congested. */
vTaskDelay( echoLOOP_DELAY );
}
}
/*-----------------------------------------------------------*/
static BaseType_t prvCreateTxData( char * cBuffer,
uint32_t ulBufferLength )
{
BaseType_t lCharactersToAdd, lCharacter;
char cChar = '0';
const BaseType_t lMinimumLength = 60;
uint32_t ulRandomNumber;
static uint32_t ulNextnumber = 1U;
/* Randomise the number of characters that will be sent in the echo
* request. */
do
{
( void ) xApplicationGetRandomNumber( &ulRandomNumber );
lCharactersToAdd = ulRandomNumber % ( ulBufferLength - 20UL );
} while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
/* Fill the buffer. */
for( lCharacter = 0; lCharacter < lCharactersToAdd; lCharacter++ )
{
cBuffer[ lCharacter ] = cChar;
cChar++;
if( cChar > '~' )
{
cChar = '0';
}
}
{
/* Replace the string "0123456789" with an increasing number. */
char pcBuf[ 16 ];
char * pcPtr = cBuffer;
const char * ucLast = &( cBuffer[ ulBufferLength ] );
for( ; ; )
{
char * next = strchr( pcPtr, '0' );
if( ( next == NULL ) || ( ( next + 10 ) >= ucLast ) )
{
break;
}
snprintf( pcBuf, sizeof pcBuf, "%010u", ulNextnumber );
memcpy( next, pcBuf, 10 );
ulNextnumber++;
pcPtr = next + 10;
}
}
return lCharactersToAdd;
}
/*-----------------------------------------------------------*/
BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void )
{
static uint32_t ulLastEchoSocketCount[ echoNUM_ECHO_CLIENTS ] = { 0 }, ulLastConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
BaseType_t xReturn = pdPASS, x;
/* Return fail is the number of cycles does not increment between
* consecutive calls. */
for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
{
if( ulTxRxCycles[ x ] == ulLastEchoSocketCount[ x ] )
{
xReturn = pdFAIL;
}
else
{
ulLastEchoSocketCount[ x ] = ulTxRxCycles[ x ];
}
if( ulConnections[ x ] == ulLastConnections[ x ] )
{
xReturn = pdFAIL;
}
else
{
ulConnections[ x ] = ulLastConnections[ x ];
}
}
return xReturn;
}
#endif /* ipconfigUSE_TCP */
@@ -0,0 +1,38 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef SINGLE_TASK_TCP_ECHO_CLIENTS_H
#define SINGLE_TASK_TCP_ECHO_CLIENTS_H
/*
* Create the TCP echo client tasks. This is the version where an echo request
* is made from the same task that listens for the echo reply.
*/
void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize,
UBaseType_t uxTaskPriority );
BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void );
#endif /* SINGLE_TASK_TCP_ECHO_CLIENTS_H */
@@ -0,0 +1,294 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/*
* A set of tasks are created that send UDP echo requests to the
* IP address set by the configECHO_SERVER_ADDR0 to
* configECHO_SERVER_ADDR_STRING constant, then wait for and verify the reply
*
* See the following web page for essential demo usage and configuration
* details:
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
*/
/* Standard includes. */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
/* FreeRTOS+TCP includes. */
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#define USE_ZERO_COPY ( 1 )
/* The echo tasks create a socket, send out a number of echo requests, listen
for the echo reply, then close the socket again before starting over. This
delay is used between each iteration to ensure the network does not get too
congested. */
#define echoLOOP_DELAY pdMS_TO_TICKS( 2U )
/* The number of instances of the echo client task to create. */
#define echoNUM_ECHO_CLIENTS ( 1 )
#define TX_RX_STR_SIZE ( 25 )
/* Rx and Tx time outs are used to ensure the sockets do not wait too long for
missing data. */
static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS(4000);
static const TickType_t xSendTimeOut = pdMS_TO_TICKS(4000);
static BaseType_t xHasStarted = pdFALSE;
/*
* UDP echo client task
*/
static void prvUDPEchoClientTask(void* pvParameters);
void vStartUDPEchoClientTasks_SingleTasks(uint16_t usTaskStackSize, UBaseType_t uxTaskPriority)
{
if (xHasStarted == pdFALSE)
{
BaseType_t xCount = 0;
BaseType_t x;
xHasStarted = pdTRUE;
/* Create the echo client tasks. */
for (x = 0; x < echoNUM_ECHO_CLIENTS; x++)
{
char ucName[16];
snprintf(ucName, sizeof ucName, "echo_%02d", (int)x);
BaseType_t rc = xTaskCreate(prvUDPEchoClientTask, /* The function that implements the task. */
ucName, /* Just a text name for the task to aid debugging. */
usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */
(void*)x, /* The task parameter, not used in this case. */
uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */
NULL); /* The task handle is not used. */
if (rc == pdPASS)
{
xCount++;
}
}
FreeRTOS_printf(("Started %d / %d tasks\n", (int)xCount, (int)echoNUM_ECHO_CLIENTS));
}
else
{
FreeRTOS_printf(("vStartUDPEchoClientTasks_SingleTasks: already started\n"));
}
}
/*-----------------------------------------------------------*/
static void prvUDPEchoClientTask(void* pvParameters)
{
Socket_t xSocket;
struct freertos_sockaddr xEchoServerAddress, xRxAddress;
int8_t cTxString[TX_RX_STR_SIZE], cRxString[TX_RX_STR_SIZE]; /* Make sure the stack is large enough to hold these. Turn on stack overflow checking during debug to be sure. */
int32_t lLoopCount = 0UL;
int32_t lReturned;
const int32_t lMaxLoopCount = 50;
volatile uint32_t ulRxCount = 0UL, ulTxCount = 0UL;
uint32_t xAddressLength = sizeof(xEchoServerAddress);
BaseType_t xFamily = FREERTOS_AF_INET;
uint8_t ucIPType = ipTYPE_IPv4;
/* Remove compiler warning about unused parameters. */
(void)pvParameters;
memset(&xEchoServerAddress, 0, sizeof(xEchoServerAddress));
memset(&xRxAddress, 0, sizeof(xRxAddress));
/* Echo requests are sent to the echo server. The address of the echo
server is configured by the constants configECHO_SERVER_ADDR0 to
configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
#ifdef configECHO_SERVER_ADDR_STRING
{
BaseType_t rc = FreeRTOS_inet_pton(FREERTOS_AF_INET6, configECHO_SERVER_ADDR_STRING, (void*)xEchoServerAddress.sin_address.xIP_IPv6.ucBytes);
if (rc == pdPASS)
{
xFamily = FREERTOS_AF_INET6;
ucIPType = ipTYPE_IPv6;
}
else
{
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;
}
}
#else
{
xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick(configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3);
}
#endif
xEchoServerAddress.sin_len = sizeof(xEchoServerAddress);
xEchoServerAddress.sin_port = FreeRTOS_htons(configECHO_SERVER_PORT);
xEchoServerAddress.sin_family = xFamily;
for (;; )
{
/* Create a socket. */
xSocket = FreeRTOS_socket(xFamily, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP);
configASSERT(xSocket != FREERTOS_INVALID_SOCKET);
/* Set a time out so a missing reply does not cause the task to block
indefinitely. */
FreeRTOS_setsockopt(xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof(xReceiveTimeOut));
/* Send a number of echo requests. */
for (lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++)
{
/* Create the string that is sent to the echo server. */
sprintf((char*)cTxString, "Message number %u\r\n", ulTxCount);
#if USE_ZERO_COPY
/*
* First obtain a buffer of adequate length from the TCP/IP stack into which
* the string will be written. */
uint8_t* pucBuffer = FreeRTOS_GetUDPPayloadBuffer_Multi(TX_RX_STR_SIZE, portMAX_DELAY, ucIPType);
configASSERT(pucBuffer != NULL);
memcpy(pucBuffer, &cTxString, strlen((const char*)cTxString) + 1);
/* Send the string to the socket. ulFlags is set to 0, so the zero
copy interface is not used. That means the data from cTxString is
copied into a network buffer inside FreeRTOS_sendto(), and cTxString
can be reused as soon as FreeRTOS_sendto() has returned. 1 is added
to ensure the NULL string terminator is sent as part of the message. */
lReturned = FreeRTOS_sendto(xSocket, /* The socket being sent to. */
(void*)pucBuffer, /* The data being sent. */
strlen((const char*)pucBuffer) + 1, /* The length of the data being sent. */
FREERTOS_ZERO_COPY, /* ulFlags with the FREERTOS_ZERO_COPY bit clear. */
&xEchoServerAddress, /* The destination address. */
sizeof(xEchoServerAddress));
#else
/* Send the string to the socket. ulFlags is set to 0, so the zero
copy interface is not used. That means the data from cTxString is
copied into a network buffer inside FreeRTOS_sendto(), and cTxString
can be reused as soon as FreeRTOS_sendto() has returned. 1 is added
to ensure the NULL string terminator is sent as part of the message. */
lReturned = FreeRTOS_sendto(xSocket, /* The socket being sent to. */
(void*)cTxString, /* The data being sent. */
strlen((const char*)cTxString) + 1, /* The length of the data being sent. */
0, /* ulFlags with the FREERTOS_ZERO_COPY bit clear. */
&xEchoServerAddress, /* The destination address. */
sizeof(xEchoServerAddress));
#endif
if (lReturned == 0)
{
/* The send operation failed. */
}
else
{
/* The send was successful. */
FreeRTOS_debug_printf(("[Echo Client] Data sent... \r\n"));
}
/* Keep a count of how many echo requests have been transmitted so
it can be compared to the number of echo replies received. It would
be expected to loose at least one to an ARP message the first time
the connection is created. */
ulTxCount++;
/* Receive data echoed back to the socket. ulFlags is zero, so the
zero copy option is not being used and the received data will be
copied into the buffer pointed to by cRxString. xAddressLength is
not actually used (at the time of writing this comment, anyway) by
FreeRTOS_recvfrom(), but is set appropriately in case future
versions do use it. */
memset((void*)cRxString, 0x00, sizeof(cRxString));
#if USE_ZERO_COPY
uint8_t* pucReceivedUDPPayload = NULL;
lReturned = FreeRTOS_recvfrom(xSocket,
&pucReceivedUDPPayload,
0,
FREERTOS_ZERO_COPY,
&xRxAddress,
&xAddressLength);
if (pucReceivedUDPPayload != NULL) {
memcpy((void*)(cRxString), pucReceivedUDPPayload, TX_RX_STR_SIZE);
FreeRTOS_ReleaseUDPPayloadBuffer((void*)pucReceivedUDPPayload);
}
#else
lReturned = FreeRTOS_recvfrom(xSocket, /* The socket being received from. */
cRxString, /* The buffer into which the received data will be written. */
sizeof(cRxString), /* The size of the buffer provided to receive the data. */
0, /* ulFlags with the FREERTOS_ZERO_COPY bit clear. */
&xRxAddress, /* The address from where the data was sent (the source address). */
&xAddressLength);
#endif /* USE_ZERO_COPY */
if (lReturned > 0)
{
/* Compare the transmitted string to the received string. */
if (strcmp((char*)cRxString, (char*)cTxString) == 0)
{
/* The echo reply was received without error. */
ulRxCount++;
FreeRTOS_debug_printf(("[Echo Client] Data was received correctly.\r\n"));
}
else
{
FreeRTOS_debug_printf(("[Echo Client] Data received was erreneous.\r\n"));
}
}
else
{
FreeRTOS_debug_printf(("[Echo Client] Data was not received\r\n"));
}
}
/* Pause for a short while to ensure the network is not too
congested. */
vTaskDelay(echoLOOP_DELAY);
/* Close this socket before looping back to create another. */
FreeRTOS_closesocket(xSocket);
}
}
@@ -0,0 +1,36 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef SINGLE_TASK_UDP_ECHO_CLIENTS_H
#define SINGLE_TASK_UDP_ECHO_CLIENTS_H
/*
* Create the UDP echo client tasks. This is the version where an echo request
* is made from the same task that listens for the echo reply.
*/
void vStartUDPEchoClientTasks_SingleTasks(uint16_t usTaskStackSize, UBaseType_t uxTaskPriority);
#endif /* SINGLE_TASK_UDP_ECHO_CLIENTS_H */
@@ -0,0 +1,281 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C686325E-3261-42F7-AEB1-DDE5280E1CEB}</ProjectGuid>
<ProjectName>RTOSDemo</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
<Import Project="FreeRTOS_Plus_TCP_IPv6_Multi.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
<Import Project="FreeRTOS_Plus_TCP_IPv6_Multi.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<TypeLibraryName>.\Debug/WIN32.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>
$(FREERTOS_INCLUDE_DIR);
$(FREERTOS_SOURCE_DIR)\portable\MSVC-MingW;
$(UTILITIES_SOURCE_DIR)\include;
$(PLUS_TCP_INCLUDE_DIR);
$(PLUS_TCP_SOURCE_DIR)\protocols\include;
$(PLUS_TCP_SOURCE_DIR)\portable\BufferManagement;
$(PLUS_TCP_SOURCE_DIR)\portable\Compiler\MSVC;
$(DEMO_COMMON_SOURCE_DIR)\WinPCap;
$(DEMO_COMMON_SOURCE_DIR)\logging\include;
..\common\NTP\include;
.;
..\common\Logging\windows
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;ipconfigUSE_PCAP=1;_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
<ObjectFileName>.\Debug/</ObjectFileName>
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalOptions>/wd4210 /wd4127 /wd4214 /wd4201 /wd4244 /wd4310 %(AdditionalOptions)</AdditionalOptions>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0c09</Culture>
</ResourceCompile>
<Link>
<OutputFile>.\Debug/RTOSDemo.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Debug/WIN32.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>wpcap.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(DEMO_COMMON_SOURCE_DIR)\WinPCap</AdditionalLibraryDirectories>
<Profile>false</Profile>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug/WIN32.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<TypeLibraryName>.\Release/WIN32.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_WINSOCKAPI_;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeaderOutputFile>.\Release/WIN32.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
<ObjectFileName>.\Release/</ObjectFileName>
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0c09</Culture>
</ResourceCompile>
<Link>
<OutputFile>.\Release/RTOSDemo.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ProgramDatabaseFile>.\Release/WIN32.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release/WIN32.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\date_and_time.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\http_client_test.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\plus_tcp_demo_cli.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\tcp_dump_packets.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_BitConfig.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv4.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv4_Sockets.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv4_Utils.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv6.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv6_Sockets.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv6_Utils.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_IP_IPV4.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_IP_IPV6.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_State_Handling_IPV4.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_State_Handling_IPV6.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Transmission_IPV4.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Transmission_IPV6.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Utils_IPV4.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Utils_IPV6.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_Tiny_TCP.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_UDP_IPv4.c" />
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_UDP_IPv6.c" />
<ClCompile Include="..\..\FreeRTOS_Plus_TCP_Minimal_Windows_Simulator\DemoTasks\SimpleTCPEchoServer.c" />
<ClCompile Include="Logging_WinSim.c" />
<ClCompile Include="printf-stdarg.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\event_groups.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\list.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\portable\MemMang\heap_4.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\portable\MSVC-MingW\port.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\queue.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\tasks.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\timers.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_ARP.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DHCP.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Cache.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Callback.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Networking.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Parser.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_ICMP.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_IP.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_IP_Timers.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_IP_Utils.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_Sockets.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_Stream_Buffer.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_IP.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_Reception.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_State_Handling.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_Transmission.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_Utils.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_WIN.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_UDP_IP.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_Routing.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\portable\BufferManagement\BufferAllocation_2.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\portable\NetworkInterface\WinPCap\NetworkInterface.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DHCPv6.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_ND.c" />
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_RA.c" />
<ClCompile Include="..\common\NTP\NTPDemo.c" />
<ClCompile Include="main.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="TCPEchoClient_SingleTasks.c" />
<ClCompile Include="UDPEchoClient_SingleTasks.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\event_groups.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\FreeRTOS.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\portable.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\projdefs.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\queue.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\semphr.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\task.h" />
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\timers.h" />
<ClInclude Include="$(FREERTOS_SOURCE_DIR)\portable\MSVC-MingW\portmacro.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOSIPConfigDefaults.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_ARP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DHCP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Cache.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Callback.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Globals.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Networking.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Parser.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_errno_TCP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_ICMP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP_Private.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP_Timers.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP_Utils.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_Sockets.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_Stream_Buffer.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_IP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_Reception.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_State_Handling.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_Transmission.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_Utils.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_WIN.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_UDP_IP.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_Routing.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_BitConfig.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DHCPv6.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_ND.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\IPTraceMacroDefaults.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\NetworkBufferManagement.h" />
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\NetworkInterface.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4_Private.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4_Sockets.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4_Utils.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6_Private.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6_Sockets.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6_Utils.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IP_Common.h" />
<ClInclude Include="FreeRTOSConfig.h" />
<ClInclude Include="FreeRTOSIPConfig.h" />
<ClInclude Include="TCPEchoClient_SingleTasks.h" />
<ClInclude Include="UDPEchoClient_SingleTasks.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,354 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{38712199-cebf-4124-bf15-398f7c3419ea}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
<Filter Include="FreeRTOS">
<UniqueIdentifier>{af3445a1-4908-4170-89ed-39345d90d30c}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS\Source">
<UniqueIdentifier>{f32be356-4763-4cae-9020-974a2638cb08}</UniqueIdentifier>
<Extensions>*.c</Extensions>
</Filter>
<Filter Include="FreeRTOS\Source\Portable">
<UniqueIdentifier>{88f409e6-d396-4ac5-94bd-7a99c914be46}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS+">
<UniqueIdentifier>{e5ad4ec7-23dc-4295-8add-2acaee488f5a}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS\Source\include">
<UniqueIdentifier>{d2dcd641-8d91-492b-852f-5563ffadaec6}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS+\FreeRTOS+TCP">
<UniqueIdentifier>{8672fa26-b119-481f-8b8d-086419c01a3e}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS+\FreeRTOS+TCP\portable">
<UniqueIdentifier>{4570be11-ec96-4b55-ac58-24b50ada980a}</UniqueIdentifier>
</Filter>
<Filter Include="FreeRTOS+\FreeRTOS+TCP\include">
<UniqueIdentifier>{5d93ed51-023a-41ad-9243-8d230165d34b}</UniqueIdentifier>
</Filter>
<Filter Include="DemoTasks">
<UniqueIdentifier>{b71e974a-9f28-4815-972b-d930ba8a34d0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_UDP_IP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DHCP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_Sockets.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\portable\BufferManagement\BufferAllocation_2.c">
<Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\portable\NetworkInterface\WinPCap\NetworkInterface.c">
<Filter>FreeRTOS+\FreeRTOS+TCP\portable</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_ARP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_IP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_IP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_WIN.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_Routing.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_Stream_Buffer.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DHCPv6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_ND.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_RA.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\common\NTP\NTPDemo.c" />
<ClCompile Include="main.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\tcp_dump_packets.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\plus_tcp_demo_cli.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\date_and_time.c" />
<ClCompile Include="$(UTILITIES_SOURCE_DIR)\http_client_test.c" />
<ClCompile Include="printf-stdarg.c" />
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\event_groups.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\list.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\portable\MemMang\heap_4.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\portable\MSVC-MingW\port.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\queue.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\timers.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(FREERTOS_SOURCE_DIR)\tasks.c">
<Filter>FreeRTOS\Source</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_ICMP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_IP_Timers.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_IP_Utils.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_Reception.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_State_Handling.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_Transmission.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_TCP_Utils.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Callback.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Networking.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Parser.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="$(PLUS_TCP_SOURCE_DIR)\FreeRTOS_DNS_Cache.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_BitConfig.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv4.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv4_Sockets.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv4_Utils.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv6_Sockets.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_IPv6_Utils.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_IP_IPV4.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_IP_IPV6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_State_Handling_IPV4.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_State_Handling_IPV6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Transmission_IPV4.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Transmission_IPV6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Utils_IPV4.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_TCP_Utils_IPV6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_Tiny_TCP.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_UDP_IPv4.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\FreeRTOS_UDP_IPv6.c">
<Filter>FreeRTOS+\FreeRTOS+TCP</Filter>
</ClCompile>
<ClCompile Include="TCPEchoClient_SingleTasks.c" />
<ClCompile Include="Logging_WinSim.c" />
<ClCompile Include="UDPEchoClient_SingleTasks.c" />
<ClCompile Include="..\..\FreeRTOS_Plus_TCP_Minimal_Windows_Simulator\DemoTasks\SimpleTCPEchoServer.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\timers.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\event_groups.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\FreeRTOS.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\queue.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\semphr.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\task.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\portable.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(FREERTOS_INCLUDE_DIR)\projdefs.h">
<Filter>FreeRTOS\Source\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\NetworkInterface.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_Sockets.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_UDP_IP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP_Private.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\NetworkBufferManagement.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_ARP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DHCP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Cache.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Callback.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Globals.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Networking.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DNS_Parser.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_errno_TCP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_ICMP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP_Timers.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_IP_Utils.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_IP.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_Reception.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_State_Handling.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_Transmission.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_Utils.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_TCP_WIN.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_Routing.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_BitConfig.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_DHCPv6.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_ND.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOSIPConfigDefaults.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\IPTraceMacroDefaults.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="$(PLUS_TCP_INCLUDE_DIR)\FreeRTOS_Stream_Buffer.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="FreeRTOSConfig.h" />
<ClInclude Include="FreeRTOSIPConfig.h" />
<ClInclude Include="$(FREERTOS_SOURCE_DIR)\portable\MSVC-MingW\portmacro.h" />
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IP_Common.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4_Private.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4_Sockets.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv4_Utils.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6_Private.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6_Sockets.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="..\..\..\Source\FreeRTOS-Plus-TCP\source\include\FreeRTOS_IPv6_Utils.h">
<Filter>FreeRTOS+\FreeRTOS+TCP\include</Filter>
</ClInclude>
<ClInclude Include="TCPEchoClient_SingleTasks.h" />
<ClInclude Include="UDPEchoClient_SingleTasks.h" />
</ItemGroup>
</Project>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.freertos.org/logging.html
@@ -0,0 +1,46 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef DEMO_LOGGING_H
#define DEMO_LOGGING_H
/*
* Initialize a logging system that can be used from FreeRTOS tasks and Win32
* threads. Do not call printf() directly while the scheduler is running.
*
* Set xLogToStdout, xLogToFile and xLogToUDP to either pdTRUE or pdFALSE to
* lot to stdout, a disk file and a UDP port respectively.
*
* If xLogToUDP is pdTRUE then ulRemoteIPAddress and usRemotePort must be set
* to the IP address and port number to which UDP log messages will be sent.
*/
void vLoggingInit( BaseType_t xLogToStdout,
BaseType_t xLogToFile,
BaseType_t xLogToUDP,
uint32_t ulRemoteIPAddress,
uint16_t usRemotePort );
#endif /* DEMO_LOGGING_H */
@@ -0,0 +1,113 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/**
* @file logging_levels.h
* @brief Defines the configuration constants for all logging verbosity levels.
*/
#ifndef LOGGING_LEVELS_H
#define LOGGING_LEVELS_H
/**
* @constantspage{logging,logging library}
*
* @section logging_constants_levels Log levels
* @brief Log levels for the libraries in this SDK.
*
* Each library should specify a log level by setting @ref LIBRARY_LOG_LEVEL.
* All log messages with a level at or below the specified level will be printed
* for that library.
*
* Currently, there are 4 log levels. In the order of lowest to highest, they are:
* - #LOG_NONE <br>
* @copybrief LOG_NONE
* - #LOG_ERROR <br>
* @copybrief LOG_ERROR
* - #LOG_WARN <br>
* @copybrief LOG_WARN
* - #LOG_INFO <br>
* @copybrief LOG_INFO
* - #LOG_DEBUG <br>
* @copybrief LOG_DEBUG
*/
/**
* @brief No log messages.
*
* When @ref LIBRARY_LOG_LEVEL is #LOG_NONE, logging is disabled and no
* logging messages are printed.
*/
#define LOG_NONE 0
/**
* @brief Represents erroneous application state or event.
*
* These messages describe the situations when a library encounters an error from
* which it cannot recover.
*
* These messages are printed when @ref LIBRARY_LOG_LEVEL is defined as either
* of #LOG_ERROR, #LOG_WARN, #LOG_INFO or #LOG_DEBUG.
*/
#define LOG_ERROR 1
/**
* @brief Message about an abnormal event.
*
* These messages describe the situations when a library encounters
* abnormal event that may be indicative of an error. Libraries continue
* execution after logging a warning.
*
* These messages are printed when @ref LIBRARY_LOG_LEVEL is defined as either
* of #LOG_WARN, #LOG_INFO or #LOG_DEBUG.
*/
#define LOG_WARN 2
/**
* @brief A helpful, informational message.
*
* These messages describe normal execution of a library. They provide
* the progress of the program at a coarse-grained level.
*
* These messages are printed when @ref LIBRARY_LOG_LEVEL is defined as either
* of #LOG_INFO or #LOG_DEBUG.
*/
#define LOG_INFO 3
/**
* @brief Detailed and excessive debug information.
*
* Debug log messages are used to provide the
* progress of the program at a fine-grained level. These are mostly used
* for debugging and may contain excessive information such as internal
* variables, buffers, or other specific information.
*
* These messages are only printed when @ref LIBRARY_LOG_LEVEL is defined as
* #LOG_DEBUG.
*/
#define LOG_DEBUG 4
#endif /* ifndef LOGGING_LEVELS_H */
@@ -0,0 +1,129 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/**
* @file logging_stack.h
* @brief Utility header file that exposes macros for configuring logging implementation of logging macros (LogError, LogWarn, LogInfo, LogDebug).
*/
#ifndef LOGGING_STACK_H
#define LOGGING_STACK_H
/* Include header for logging level macros. */
#include "logging_levels.h"
/* Standard Include. */
#include <stdio.h>
#include <stdint.h>
/**
* @brief The name of the library or demo to add as metadata in log messages
* from the library or demo.
*
* This metadata aids in identifying the module source of log messages.
* The metadata is logged in the format `[ <LIBRARY-NAME> ]` as a prefix to the
* log messages.
* Refer to #LOG_METADATA_FORMAT for the complete format of the metadata prefix in
* log messages.
*/
/* Check if LIBRARY_LOG_NAME macro has been defined. */
#if !defined( LIBRARY_LOG_NAME )
#error "Please define LIBRARY_LOG_NAME for the library."
#endif
/* Metadata information to prepend to every log message. */
#ifndef LOG_METADATA_FORMAT
#define LOG_METADATA_FORMAT "[%s:%d] " /**< @brief Format of metadata prefix in log messages. */
#endif
#ifndef LOG_METADATA_ARGS
#define LOG_METADATA_ARGS __FUNCTION__, __LINE__ /**< @brief Arguments into the metadata logging prefix format. */
#endif
/**
* @brief Common macro that maps all the logging interfaces,
* (#LogDebug, #LogInfo, #LogWarn, #LogError) to the platform-specific logging
* function.
*
* @note The default definition of the macro is an empty definition that does not
* generate any logging.
*/
#ifndef SdkLog
#define SdkLog( string )
#endif
/**
* Disable definition of logging interface macros when generating doxygen output,
* to avoid conflict with documentation of macros at the end of the file.
*/
/* Check that LIBRARY_LOG_LEVEL is defined and has a valid value. */
#if !defined( LIBRARY_LOG_LEVEL ) || \
( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && \
( LIBRARY_LOG_LEVEL != LOG_ERROR ) && \
( LIBRARY_LOG_LEVEL != LOG_WARN ) && \
( LIBRARY_LOG_LEVEL != LOG_INFO ) && \
( LIBRARY_LOG_LEVEL != LOG_DEBUG ) )
#error "Please define LIBRARY_LOG_LEVEL as either LOG_NONE, LOG_ERROR, LOG_WARN, LOG_INFO, or LOG_DEBUG."
#else
#if LIBRARY_LOG_LEVEL == LOG_DEBUG
/* All log level messages will logged. */
#define LogError( message ) SdkLog( ( "[ERROR] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogWarn( message ) SdkLog( ( "[WARN] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogInfo( message ) SdkLog( ( "[INFO] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogDebug( message ) SdkLog( ( "[DEBUG] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#elif LIBRARY_LOG_LEVEL == LOG_INFO
/* Only INFO, WARNING and ERROR messages will be logged. */
#define LogError( message ) SdkLog( ( "[ERROR] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogWarn( message ) SdkLog( ( "[WARN] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogInfo( message ) SdkLog( ( "[INFO] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogDebug( message )
#elif LIBRARY_LOG_LEVEL == LOG_WARN
/* Only WARNING and ERROR messages will be logged.*/
#define LogError( message ) SdkLog( ( "[ERROR] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogWarn( message ) SdkLog( ( "[WARN] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogInfo( message )
#define LogDebug( message )
#elif LIBRARY_LOG_LEVEL == LOG_ERROR
/* Only ERROR messages will be logged. */
#define LogError( message ) SdkLog( ( "[ERROR] [%s] "LOG_METADATA_FORMAT, LIBRARY_LOG_NAME, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) )
#define LogWarn( message )
#define LogInfo( message )
#define LogDebug( message )
#else /* if LIBRARY_LOG_LEVEL == LOG_ERROR */
#define LogError( message )
#define LogWarn( message )
#define LogInfo( message )
#define LogDebug( message )
#endif /* if LIBRARY_LOG_LEVEL == LOG_ERROR */
#endif /* if !defined( LIBRARY_LOG_LEVEL ) || ( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && ( LIBRARY_LOG_LEVEL != LOG_ERROR ) && ( LIBRARY_LOG_LEVEL != LOG_WARN ) && ( LIBRARY_LOG_LEVEL != LOG_INFO ) && ( LIBRARY_LOG_LEVEL != LOG_DEBUG ) ) */
#endif /* ifndef LOGGING_STACK_H */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,53 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/*
* A simple demo for NTP using FreeRTOS+TCP
*/
#ifndef NTPDEMO_H
#define NTPDEMO_H
void vStartNTPTask( uint16_t usTaskStackSize,
UBaseType_t uxTaskPriority );
/*
* xIPVersion = 4 or 6.
* xAsynchronous = true for asynchronous DNS lookups.
* xLogging = true to get more logging.
*/
void vNTPSetNTPType( BaseType_t aIPType,
BaseType_t xAsynchronous,
BaseType_t xLogging );
/* Delete the IP-addresses of the NTP server to force a DNS lookup. */
void vNTPClearCache( void );
extern BaseType_t xNTPHasTime;
extern uint32_t ulNTPTime;
#endif /* ifndef NTPDEMO_H */
@@ -0,0 +1,104 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* */
/* ntpClient.h */
/* */
#ifndef __NTPCLIENT_H__
#define __NTPCLIENT_H__
#define NTP_PORT 123
typedef uint32_t quint32;
typedef int32_t qint32;
typedef uint8_t quint8;
typedef int8_t qint8;
typedef union _SNtpFlags SNtpFlags;
#ifdef _MSC_VER
#define __attribute__( x )
#endif
/**
* 64-bit NTP timestamp.
*/
struct __attribute__( ( __packed__ ) ) _SNtpTimestamp
{
/** Number of seconds passed since Jan 1 1900, in big-endian format. */
quint32 seconds;
/** Fractional time part, in <tt>1/0xFFFFFFFF</tt>s of a second. */
quint32 fraction;
};
typedef struct _SNtpTimestamp SNtpTimestamp;
/**
* Mandatory part of an NTP packet
*/
struct SNtpPacket
{
/** Flags. */
unsigned char flags; /* value 0xDB : mode 3 (client), version 3, leap indicator unknown 3 */
/** Stratum of the clock. */
quint8 stratum; /* value 0 : unspecified */
/** Maximum interval between successive messages, in log2 seconds. Note that the value is signed. */
qint8 poll; /* 10 means 1 << 10 = 1024 seconds */
/** Precision of the clock, in log2 seconds. Note that the value is signed. */
qint8 precision; /* 0xFA = 250 = 0.015625 seconds */
/** Round trip time to the primary reference source, in NTP short format. */
qint32 rootDelay; /* 0x5D2E = 23854 or (23854/65535)= 0.3640 sec */
/** Nominal error relative to the primary reference source. */
qint32 rootDispersion; /* 0x0008 CAC8 = 8.7912 seconds */
/** Reference identifier (either a 4 character string or an IP address). */
qint8 referenceID[ 4 ]; /* or just 0000 */
/** The time at which the clock was last set or corrected. */
SNtpTimestamp referenceTimestamp; /* Current time */
/** The time at which the request departed the client for the server. */
SNtpTimestamp originateTimestamp; /* Keep 0 */
/** The time at which the request arrived at the server. */
SNtpTimestamp receiveTimestamp; /* Keep 0 */
/** The time at which the reply departed the server for client. */
SNtpTimestamp transmitTimestamp;
};
/* Add this number to get secs since 1-1-1900 */
#define TIME1970 2208988800UL
#endif /* __NTPCLIENT_H__ */
@@ -0,0 +1,398 @@
/*
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
* Copyright (c) 2005 - 2007 CACE Technologies, Davis (California)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/** @ingroup packetapi
* @{
*/
/** @defgroup packet32h Packet.dll definitions and data structures
* Packet32.h contains the data structures and the definitions used by packet.dll.
* The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included
* by the applications that use the functions of this library
* @{
*/
#ifndef __PACKET32
#define __PACKET32
#include <winsock2.h>
#ifdef HAVE_AIRPCAP_API
#include <airpcap.h>
#else
#if !defined( AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ )
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
typedef struct _AirpcapHandle * PAirpcapHandle;
#endif /* AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ */
#endif /* HAVE_AIRPCAP_API */
#ifdef HAVE_DAG_API
#include <dagc.h>
#endif /* HAVE_DAG_API */
/* Working modes */
#define PACKET_MODE_CAPT 0x0 /*/< Capture mode */
#define PACKET_MODE_STAT 0x1 /*/< Statistical mode */
#define PACKET_MODE_MON 0x2 /*/< Monitoring mode */
#define PACKET_MODE_DUMP 0x10 /*/< Dump mode */
#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT /*/< Statistical dump Mode */
/*/ Alignment macro. Defines the alignment size. */
#define Packet_ALIGNMENT sizeof( int )
/*/ Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. */
#define Packet_WORDALIGN( x ) ( ( ( x ) + ( Packet_ALIGNMENT - 1 ) ) & ~( Packet_ALIGNMENT - 1 ) )
#define NdisMediumNull -1 /*/< Custom linktype: NDIS doesn't provide an equivalent */
#define NdisMediumCHDLC -2 /*/< Custom linktype: NDIS doesn't provide an equivalent */
#define NdisMediumPPPSerial -3 /*/< Custom linktype: NDIS doesn't provide an equivalent */
#define NdisMediumBare80211 -4 /*/< Custom linktype: NDIS doesn't provide an equivalent */
#define NdisMediumRadio80211 -5 /*/< Custom linktype: NDIS doesn't provide an equivalent */
#define NdisMediumPpi -6 /*/< Custom linktype: NDIS doesn't provide an equivalent */
/* Loopback behaviour definitions */
#define NPF_DISABLE_LOOPBACK 1 /*/< Drop the packets sent by the NPF driver */
#define NPF_ENABLE_LOOPBACK 2 /*/< Capture the packets sent by the NPF driver */
/*!
* \brief Network type structure.
*
* This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed.
*/
typedef struct NetType
{
UINT LinkType; /*/< The MAC of the current network adapter (see function PacketGetNetType() for more information) */
ULONGLONG LinkSpeed; /*/< The speed of the network in bits per second */
} NetType;
/*some definitions stolen from libpcap */
#ifndef BPF_MAJOR_VERSION
/*!
* \brief A BPF pseudo-assembly program.
*
* The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet.
*/
struct bpf_program
{
UINT bf_len; /*/< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. */
struct bpf_insn * bf_insns; /*/< A pointer to the first instruction of the program. */
};
/*!
* \brief A single BPF pseudo-instruction.
*
* bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver.
*/
struct bpf_insn
{
USHORT code; /*/< Instruction type and addressing mode. */
UCHAR jt; /*/< Jump if true */
UCHAR jf; /*/< Jump if false */
int k; /*/< Generic field used for various purposes. */
};
/*!
* \brief Structure that contains a couple of statistics values on the current capture.
*
* It is used by packet.dll to return statistics about a capture session.
*/
struct bpf_stat
{
UINT bs_recv; /*/< Number of packets that the driver received from the network adapter */
/*/< from the beginning of the current capture. This value includes the packets */
/*/< lost by the driver. */
UINT bs_drop; /*/< number of packets that the driver lost from the beginning of a capture. */
/*/< Basically, a packet is lost when the the buffer of the driver is full. */
/*/< In this situation the packet cannot be stored and the driver rejects it. */
UINT ps_ifdrop; /*/< drops by interface. XXX not yet supported */
UINT bs_capt; /*/< number of packets that pass the filter, find place in the kernel buffer and */
/*/< thus reach the application. */
};
/*!
* \brief Packet header.
*
* This structure defines the header associated with every packet delivered to the application.
*/
struct bpf_hdr
{
struct timeval bh_tstamp; /*/< The timestamp associated with the captured packet. */
/*/< It is stored in a TimeVal structure. */
UINT bh_caplen; /*/< Length of captured portion. The captured portion <b>can be different</b> */
/*/< from the original packet, because it is possible (with a proper filter) */
/*/< to instruct the driver to capture only a portion of the packets. */
UINT bh_datalen; /*/< Original length of packet */
USHORT bh_hdrlen; /*/< Length of bpf header (this struct plus alignment padding). In some cases, */
/*/< a padding could be added between the end of this structure and the packet */
/*/< data for performance reasons. This filed can be used to retrieve the actual data */
/*/< of the packet. */
};
/*!
* \brief Dump packet header.
*
* This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets().
* It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a
* packet in a dump file. This makes straightforward sending WinPcap dump files to the network.
*/
struct dump_bpf_hdr
{
struct timeval ts; /*/< Time stamp of the packet */
UINT caplen; /*/< Length of captured portion. The captured portion can smaller than the */
/*/< the original packet, because it is possible (with a proper filter) to */
/*/< instruct the driver to capture only a portion of the packets. */
UINT len; /*/< Length of the original packet (off wire). */
};
#endif /* ifndef BPF_MAJOR_VERSION */
struct bpf_stat;
#define DOSNAMEPREFIX TEXT( "Packet_" ) /*/< Prefix added to the adapters device names to create the WinPcap devices */
#define MAX_LINK_NAME_LENGTH 64 /*< Maximum length of the devices symbolic links */
#define NMAX_PACKET 65535
/*!
* \brief Addresses of a network adapter.
*
* This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with
* an adapter.
*/
typedef struct npf_if_addr
{
struct sockaddr_storage IPAddress; /*/< IP address. */
struct sockaddr_storage SubnetMask; /*/< Netmask for that address. */
struct sockaddr_storage Broadcast; /*/< Broadcast address. */
} npf_if_addr;
#define ADAPTER_NAME_LENGTH 256 + 12 /*/< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. */
#define ADAPTER_DESC_LENGTH 128 /*/< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. */
#define MAX_MAC_ADDR_LENGTH 8 /*/< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. */
#define MAX_NETWORK_ADDRESSES 16 /*/< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. */
typedef struct WAN_ADAPTER_INT WAN_ADAPTER; /*/< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API */
typedef WAN_ADAPTER * PWAN_ADAPTER; /*/< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API */
#define INFO_FLAG_NDIS_ADAPTER 0 /*/< Flag for ADAPTER_INFO: this is a traditional ndis adapter */
#define INFO_FLAG_NDISWAN_ADAPTER 1 /*/< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET */
#define INFO_FLAG_DAG_CARD 2 /*/< Flag for ADAPTER_INFO: this is a DAG card */
#define INFO_FLAG_DAG_FILE 6 /*/< Flag for ADAPTER_INFO: this is a DAG file */
#define INFO_FLAG_DONT_EXPORT 8 /*/< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. */
#define INFO_FLAG_AIRPCAP_CARD 16 /*/< Flag for ADAPTER_INFO: this is an airpcap card */
#define INFO_FLAG_NPFIM_DEVICE 32
/*!
* \brief Describes an opened network adapter.
*
* This structure is the most important for the functioning of packet.dll, but the great part of its fields
* should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters
*/
typedef struct _ADAPTER
{
HANDLE hFile; /*/< \internal Handle to an open instance of the NPF driver. */
CHAR SymbolicLink[ MAX_LINK_NAME_LENGTH ]; /*/< \internal A string containing the name of the network adapter currently opened. */
int NumWrites; /*/< \internal Number of times a packets written on this adapter will be repeated */
/*/< on the wire. */
HANDLE ReadEvent; /*/< A notification event associated with the read calls on the adapter. */
/*/< It can be passed to standard Win32 functions (like WaitForSingleObject */
/*/< or WaitForMultipleObjects) to wait until the driver's buffer contains some */
/*/< data. It is particularly useful in GUI applications that need to wait */
/*/< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() */
/*/< function can be used to define the minimum amount of data in the kernel buffer */
/*/< that will cause the event to be signalled. */
UINT ReadTimeOut; /*/< \internal The amount of time after which a read on the driver will be released and */
/*/< ReadEvent will be signaled, also if no packets were captured */
CHAR Name[ ADAPTER_NAME_LENGTH ];
PWAN_ADAPTER pWanAdapter;
UINT Flags; /*/< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. */
#ifdef HAVE_AIRPCAP_API
PAirpcapHandle AirpcapAd;
#endif /* HAVE_AIRPCAP_API */
#ifdef HAVE_NPFIM_API
void * NpfImHandle;
#endif /* HAVE_NPFIM_API */
#ifdef HAVE_DAG_API
dagc_t * pDagCard; /*/< Pointer to the dagc API adapter descriptor for this adapter */
PCHAR DagBuffer; /*/< Pointer to the buffer with the packets that is received from the DAG card */
struct timeval DagReadTimeout; /*/< Read timeout. The dagc API requires a timeval structure */
unsigned DagFcsLen; /*/< Length of the frame check sequence attached to any packet by the card. Obtained from the registry */
DWORD DagFastProcess; /*/< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). */
#endif /* HAVE_DAG_API */
} ADAPTER, * LPADAPTER;
/*!
* \brief Structure that contains a group of packets coming from the driver.
*
* This structure defines the header associated with every packet delivered to the application.
*/
typedef struct _PACKET
{
HANDLE hEvent; /*/< \deprecated Still present for compatibility with old applications. */
OVERLAPPED OverLapped; /*/< \deprecated Still present for compatibility with old applications. */
PVOID Buffer; /*/< Buffer with containing the packets. See the PacketReceivePacket() for */
/*/< details about the organization of the data in this buffer */
UINT Length; /*/< Length of the buffer */
DWORD ulBytesReceived; /*/< Number of valid bytes present in the buffer, i.e. amount of data */
/*/< received by the last call to PacketReceivePacket() */
BOOLEAN bIoComplete; /*/< \deprecated Still present for compatibility with old applications. */
} PACKET, * LPPACKET;
/*!
* \brief Structure containing an OID request.
*
* It is used by the PacketRequest() function to send an OID to the interface card driver.
* It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address,
* the list of the multicast groups defined on it, and so on.
*/
struct _PACKET_OID_DATA
{
ULONG Oid; /*/< OID code. See the Microsoft DDK documentation or the file ntddndis.h */
/*/< for a complete list of valid codes. */
ULONG Length; /*/< Length of the data field */
UCHAR Data[ 1 ]; /*/< variable-lenght field that contains the information passed to or received */
/*/< from the adapter. */
};
typedef struct _PACKET_OID_DATA PACKET_OID_DATA, * PPACKET_OID_DATA;
#ifdef __cplusplus
extern "C" {
#endif
/**
* @}
*/
/*
* BOOLEAN QueryWinPcapRegistryStringA(CHAR *SubKeyName,
* CHAR *Value,
* UINT *pValueLen,
* CHAR *DefaultVal);
*
* BOOLEAN QueryWinPcapRegistryStringW(WCHAR *SubKeyName,
* WCHAR *Value,
* UINT *pValueLen,
* WCHAR *DefaultVal);
*/
/*--------------------------------------------------------------------------- */
/* EXPORTED FUNCTIONS */
/*--------------------------------------------------------------------------- */
PCHAR PacketGetVersion();
PCHAR PacketGetDriverVersion();
BOOLEAN PacketSetMinToCopy( LPADAPTER AdapterObject,
int nbytes );
BOOLEAN PacketSetNumWrites( LPADAPTER AdapterObject,
int nwrites );
BOOLEAN PacketSetMode( LPADAPTER AdapterObject,
int mode );
BOOLEAN PacketSetReadTimeout( LPADAPTER AdapterObject,
int timeout );
BOOLEAN PacketSetBpf( LPADAPTER AdapterObject,
struct bpf_program * fp );
BOOLEAN PacketSetLoopbackBehavior( LPADAPTER AdapterObject,
UINT LoopbackBehavior );
INT PacketSetSnapLen( LPADAPTER AdapterObject,
int snaplen );
BOOLEAN PacketGetStats( LPADAPTER AdapterObject,
struct bpf_stat * s );
BOOLEAN PacketGetStatsEx( LPADAPTER AdapterObject,
struct bpf_stat * s );
BOOLEAN PacketSetBuff( LPADAPTER AdapterObject,
int dim );
BOOLEAN PacketGetNetType( LPADAPTER AdapterObject,
NetType * type );
LPADAPTER PacketOpenAdapter( PCHAR AdapterName );
BOOLEAN PacketSendPacket( LPADAPTER AdapterObject,
LPPACKET pPacket,
BOOLEAN Sync );
INT PacketSendPackets( LPADAPTER AdapterObject,
PVOID PacketBuff,
ULONG Size,
BOOLEAN Sync );
LPPACKET PacketAllocatePacket( void );
VOID PacketInitPacket( LPPACKET lpPacket,
PVOID Buffer,
UINT Length );
VOID PacketFreePacket( LPPACKET lpPacket );
BOOLEAN PacketReceivePacket( LPADAPTER AdapterObject,
LPPACKET lpPacket,
BOOLEAN Sync );
BOOLEAN PacketSetHwFilter( LPADAPTER AdapterObject,
ULONG Filter );
BOOLEAN PacketGetAdapterNames( PTSTR pStr,
PULONG BufferSize );
BOOLEAN PacketGetNetInfoEx( PCHAR AdapterName,
npf_if_addr * buffer,
PLONG NEntries );
BOOLEAN PacketRequest( LPADAPTER AdapterObject,
BOOLEAN Set,
PPACKET_OID_DATA OidData );
HANDLE PacketGetReadEvent( LPADAPTER AdapterObject );
BOOLEAN PacketSetDumpName( LPADAPTER AdapterObject,
void * name,
int len );
BOOLEAN PacketSetDumpLimits( LPADAPTER AdapterObject,
UINT maxfilesize,
UINT maxnpacks );
BOOLEAN PacketIsDumpEnded( LPADAPTER AdapterObject,
BOOLEAN sync );
BOOL PacketStopDriver();
VOID PacketCloseAdapter( LPADAPTER lpAdapter );
BOOLEAN PacketStartOem( PCHAR errorString,
UINT errorStringLength );
BOOLEAN PacketStartOemEx( PCHAR errorString,
UINT errorStringLength,
ULONG flags );
PAirpcapHandle PacketGetAirPcapHandle( LPADAPTER AdapterObject );
/* */
/* Used by PacketStartOemEx */
/* */
#define PACKET_START_OEM_NO_NETMON 0x00000001
#ifdef __cplusplus
}
#endif
#endif /*__PACKET32 */
@@ -0,0 +1,306 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
char pkt1[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x30, 0x09, 0x9c, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x07, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x35, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02,
0x40, 0x00, 0xdf, 0xab, 0x00, 0x00, 0x02, 0x04,
0x05, 0xb4, 0x01, 0x01, 0x04, 0x02
};
char pkt2[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa6, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92
};
char pkt3[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0x9e, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x0d, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00
};
char pkt4[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x02, 0x27, 0x09, 0x9f, 0x40, 0x00, 0x80, 0x06,
0x6d, 0x0d, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x18,
0x42, 0xd8, 0x84, 0x3e, 0x00, 0x00, 0x47, 0x45,
0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50,
0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63,
0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0x2c,
0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x78,
0x2d, 0x78, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70,
0x2c, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f,
0x6a, 0x70, 0x65, 0x67, 0x2c, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x70, 0x6a, 0x70, 0x65,
0x67, 0x2c, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76,
0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, 0x65, 0x78,
0x63, 0x65, 0x6c, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x6d, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2c,
0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64,
0x2e, 0x6d, 0x73, 0x2d, 0x70, 0x6f, 0x77, 0x65,
0x72, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2c, 0x20,
0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73,
0x2d, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x70,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, 0x2d, 0x78,
0x62, 0x61, 0x70, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d,
0x78, 0x70, 0x73, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65, 0x6e, 0x74, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x78, 0x61, 0x6d, 0x6c, 0x2b, 0x78, 0x6d,
0x6c, 0x2c, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a,
0x20, 0x65, 0x6e, 0x2d, 0x67, 0x62, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45,
0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a,
0x20, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x20, 0x64,
0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x0d, 0x0a,
0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65,
0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69,
0x6c, 0x6c, 0x61, 0x2f, 0x34, 0x2e, 0x30, 0x20,
0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69,
0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49,
0x45, 0x20, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x57,
0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e,
0x54, 0x20, 0x35, 0x2e, 0x31, 0x3b, 0x20, 0x53,
0x56, 0x31, 0x3b, 0x20, 0x47, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x54, 0x35, 0x3b, 0x20, 0x2e, 0x4e,
0x45, 0x54, 0x20, 0x43, 0x4c, 0x52, 0x20, 0x32,
0x2e, 0x30, 0x2e, 0x35, 0x30, 0x37, 0x32, 0x37,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x30, 0x2e, 0x30,
0x34, 0x35, 0x30, 0x36, 0x2e, 0x36, 0x34, 0x38,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x35, 0x2e, 0x32,
0x31, 0x30, 0x32, 0x32, 0x29, 0x0d, 0x0a, 0x48,
0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x39, 0x32,
0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x31,
0x32, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b,
0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76,
0x65, 0x0d, 0x0a, 0x0d, 0x0a
};
char pkt5[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa5, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92
};
char pkt6[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa1, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x0a, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00
};
char pkt7[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x02, 0x27, 0x09, 0xa2, 0x40, 0x00, 0x80, 0x06,
0x6d, 0x0a, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc7, 0x36, 0x00, 0x00, 0x06, 0x69, 0x50, 0x18,
0x42, 0xd8, 0x84, 0x3e, 0x00, 0x00, 0x47, 0x45,
0x54, 0x20, 0x2f, 0x20, 0x48, 0x54, 0x54, 0x50,
0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x41, 0x63,
0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0x2c,
0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x78,
0x2d, 0x78, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70,
0x2c, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f,
0x6a, 0x70, 0x65, 0x67, 0x2c, 0x20, 0x69, 0x6d,
0x61, 0x67, 0x65, 0x2f, 0x70, 0x6a, 0x70, 0x65,
0x67, 0x2c, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76,
0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d, 0x65, 0x78,
0x63, 0x65, 0x6c, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x6d, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2c,
0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x6e, 0x64,
0x2e, 0x6d, 0x73, 0x2d, 0x70, 0x6f, 0x77, 0x65,
0x72, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2c, 0x20,
0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73,
0x2d, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x70,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2f, 0x78, 0x2d, 0x6d, 0x73, 0x2d, 0x78,
0x62, 0x61, 0x70, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x76, 0x6e, 0x64, 0x2e, 0x6d, 0x73, 0x2d,
0x78, 0x70, 0x73, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65, 0x6e, 0x74, 0x2c, 0x20, 0x61, 0x70, 0x70,
0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x78, 0x61, 0x6d, 0x6c, 0x2b, 0x78, 0x6d,
0x6c, 0x2c, 0x20, 0x2a, 0x2f, 0x2a, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a,
0x20, 0x65, 0x6e, 0x2d, 0x67, 0x62, 0x0d, 0x0a,
0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45,
0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a,
0x20, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x20, 0x64,
0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x0d, 0x0a,
0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65,
0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69,
0x6c, 0x6c, 0x61, 0x2f, 0x34, 0x2e, 0x30, 0x20,
0x28, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69,
0x62, 0x6c, 0x65, 0x3b, 0x20, 0x4d, 0x53, 0x49,
0x45, 0x20, 0x36, 0x2e, 0x30, 0x3b, 0x20, 0x57,
0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x20, 0x4e,
0x54, 0x20, 0x35, 0x2e, 0x31, 0x3b, 0x20, 0x53,
0x56, 0x31, 0x3b, 0x20, 0x47, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x54, 0x35, 0x3b, 0x20, 0x2e, 0x4e,
0x45, 0x54, 0x20, 0x43, 0x4c, 0x52, 0x20, 0x32,
0x2e, 0x30, 0x2e, 0x35, 0x30, 0x37, 0x32, 0x37,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x30, 0x2e, 0x30,
0x34, 0x35, 0x30, 0x36, 0x2e, 0x36, 0x34, 0x38,
0x3b, 0x20, 0x2e, 0x4e, 0x45, 0x54, 0x20, 0x43,
0x4c, 0x52, 0x20, 0x33, 0x2e, 0x35, 0x2e, 0x32,
0x31, 0x30, 0x32, 0x32, 0x29, 0x0d, 0x0a, 0x48,
0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x39, 0x32,
0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x31,
0x32, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b,
0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76,
0x65, 0x0d, 0x0a, 0x0d, 0x0a
};
char pkt8[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x03, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa4, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92
};
char pkt9[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa3, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x08, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00
};
char pkt10[] = {
0x00, 0x14, 0x22, 0xcb, 0x18, 0x2d, 0x00, 0x01,
0x02, 0x45, 0x09, 0x11, 0x08, 0x00, 0x45, 0x00,
0x00, 0x2c, 0x00, 0x04, 0x00, 0x00, 0x40, 0x06,
0xf8, 0xa3, 0xc0, 0xa8, 0x00, 0x0c, 0xc0, 0xa8,
0x00, 0xc8, 0x00, 0x50, 0x0f, 0xe2, 0x00, 0x00,
0x06, 0x68, 0x09, 0xe7, 0xc7, 0x36, 0x60, 0x12,
0x05, 0x92, 0x28, 0xca, 0x00, 0x00, 0x02, 0x04,
0x05, 0x92
};
char pkt11[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa6, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x05, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x10,
0x42, 0xd8, 0x82, 0x3f, 0x00, 0x00
};
char pkt12[] = {
0x00, 0x01, 0x02, 0x45, 0x09, 0x11, 0x00, 0x14,
0x22, 0xcb, 0x18, 0x2d, 0x08, 0x00, 0x45, 0x00,
0x00, 0x28, 0x09, 0xa7, 0x40, 0x00, 0x80, 0x06,
0x6f, 0x04, 0xc0, 0xa8, 0x00, 0xc8, 0xc0, 0xa8,
0x00, 0x0c, 0x0f, 0xe2, 0x00, 0x50, 0x09, 0xe7,
0xc9, 0x35, 0x00, 0x00, 0x06, 0x69, 0x50, 0x14,
0x00, 0x00, 0x43, 0xf4, 0x00, 0x00
};
typedef struct
{
char * pcData;
int iDataLen;
} xPacketData;
xPacketData xAllPackets[] =
{
{ pkt1, sizeof( pkt1 ) },
/* { pkt2, sizeof( pkt2 ) }, */
{ pkt3, sizeof( pkt3 ) },
{ pkt4, sizeof( pkt4 ) },
/* { pkt5, sizeof( pkt5 ) }, */
{ pkt6, sizeof( pkt6 ) },
{ pkt7, sizeof( pkt7 ) },
{ pkt8, sizeof( pkt8 ) },
{ pkt9, sizeof( pkt9 ) },
{ pkt10, sizeof( pkt10 ) },
/* { pkt11, sizeof( pkt11 ) }, */
/* { pkt12, sizeof( pkt12 ) }, */
/* { pkt13, sizeof( pkt13 ) }, */
/* { pkt14, sizeof( pkt14 ) }, */
/* { pkt15, sizeof( pkt15 ) }, */
/* { pkt16, sizeof( pkt16 ) }, */
};
@@ -0,0 +1,127 @@
/*
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
* Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Politecnico di Torino, CACE Technologies
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __WIN32_EXTENSIONS_H__
#define __WIN32_EXTENSIONS_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Definitions */
/*!
* \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit().
*/
struct pcap_send_queue
{
u_int maxlen; /*/< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field. */
u_int len; /*/< Current size of the queue, in bytes. */
char * buffer; /*/< Buffer containing the packets to be sent. */
};
typedef struct pcap_send_queue pcap_send_queue;
/*!
* \brief This typedef is a support for the pcap_get_airpcap_handle() function
*/
#if !defined( AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_ )
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
typedef struct _AirpcapHandle * PAirpcapHandle;
#endif
#define BPF_MEM_EX_IMM 0xc0
#define BPF_MEM_EX_IND 0xe0
/*used for ST*/
#define BPF_MEM_EX 0xc0
#define BPF_TME 0x08
#define BPF_LOOKUP 0x90
#define BPF_EXECUTE 0xa0
#define BPF_INIT 0xb0
#define BPF_VALIDATE 0xc0
#define BPF_SET_ACTIVE 0xd0
#define BPF_RESET 0xe0
#define BPF_SET_MEMORY 0x80
#define BPF_GET_REGISTER_VALUE 0x70
#define BPF_SET_REGISTER_VALUE 0x60
#define BPF_SET_WORKING 0x50
#define BPF_SET_ACTIVE_READ 0x40
#define BPF_SET_AUTODELETION 0x30
#define BPF_SEPARATION 0xff
/* Prototypes */
pcap_send_queue * pcap_sendqueue_alloc( u_int memsize );
void pcap_sendqueue_destroy( pcap_send_queue * queue );
int pcap_sendqueue_queue( pcap_send_queue * queue,
const struct pcap_pkthdr * pkt_header,
const u_char * pkt_data );
u_int pcap_sendqueue_transmit( pcap_t * p,
pcap_send_queue * queue,
int sync );
HANDLE pcap_getevent( pcap_t * p );
struct pcap_stat * pcap_stats_ex( pcap_t * p,
int * pcap_stat_size );
int pcap_setuserbuffer( pcap_t * p,
int size );
int pcap_live_dump( pcap_t * p,
char * filename,
int maxsize,
int maxpacks );
int pcap_live_dump_ended( pcap_t * p,
int sync );
int pcap_offline_filter( struct bpf_program * prog,
const struct pcap_pkthdr * header,
const u_char * pkt_data );
int pcap_start_oem( char * err_str,
int flags );
PAirpcapHandle pcap_get_airpcap_handle( pcap_t * p );
#ifdef __cplusplus
}
#endif
#endif /*__WIN32_EXTENSIONS_H__ */
@@ -0,0 +1,335 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
/* WinPCap includes. */
#include "pcap.h"
#include "remote-ext.h"
/* uIP includes. */
#include "net/uip.h"
#include "net/uip_arp.h"
#include "net/clock-arch.h"
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
/*
* Query the computer the simulation is being executed on to find the network
* interfaces it has installed.
*/
static pcap_if_t * prvPrintAvailableNetworkInterfaces( void );
/*
* Open the network interface. The number of the interface to be opened is set
* by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h.
*/
static void prvOpenSelectedNetworkInterface( pcap_if_t *pxAllNetworkInterfaces );
/*
* Configure the capture filter to allow blocking reads, and to filter out
* packets that are not of interest to this demo.
*/
static void prvConfigureCaptureBehaviour( void );
pcap_t *pxOpenedInterfaceHandle = NULL;
LARGE_INTEGER freq, sys_start_time;
#define archNUM_BUFFERS 5
#define archNUM_BUFFER_POINTERS ( archNUM_BUFFERS - 1 )
static void prvInterruptSimulator( void *pvParameters );
static unsigned char ucEthernetBuffer[ archNUM_BUFFERS ][ UIP_CONF_BUFFER_SIZE ];
static unsigned char *pucEthernetBufferPointers[ archNUM_BUFFER_POINTERS ];
static long lLengthOfDataInBuffer[ archNUM_BUFFER_POINTERS ] = { 0 };
static unsigned char ucNextBufferToFill = 0U, ucNextBufferToProcess = 0U;
unsigned char *uip_buf = NULL;
char cErrorBuffer[PCAP_ERRBUF_SIZE];
void vNetifTx( void )
{
pcap_sendpacket( pxOpenedInterfaceHandle, uip_buf, uip_len );
pcap_sendpacket( pxOpenedInterfaceHandle, uip_buf, uip_len );
}
/*-----------------------------------------------------------*/
UBaseType_t uxNetifRx( void )
{
UBaseType_t xDataLen;
unsigned char *pucTemp;
/* Check there is really data available. */
xDataLen = lLengthOfDataInBuffer[ ucNextBufferToProcess ];
if( xDataLen != 0L )
{
/* The buffer pointed to by uip_buf is going to change. Remember which
buffer uip_buf is currently pointing to. */
pucTemp = uip_buf;
/* Point uip_buf at the next buffer that contains data. */
uip_buf = pucEthernetBufferPointers[ ucNextBufferToProcess ];
/* The buffer pointed to by
pucEthernetBufferPointeres[ ucNextBufferToProcess ] is now in use by
uip_buf, but the buffer uip_buf was pointing to on entry to this
function is free. Set
pucEthernetBufferPointeres[ ucNextBufferToProcess ] to the free
buffer. */
pucEthernetBufferPointers[ ucNextBufferToProcess ] = pucTemp;
lLengthOfDataInBuffer[ ucNextBufferToProcess ] = 0L;
ucNextBufferToProcess++;
if( ucNextBufferToProcess >= archNUM_BUFFER_POINTERS )
{
ucNextBufferToProcess = 0L;
}
}
return xDataLen;
}
/*-----------------------------------------------------------*/
BaseType_t xNetifInit( void )
{
BaseType_t x;
pcap_if_t *pxAllNetworkInterfaces;
/* Allocate a free buffer to each buffer pointer. */
for( x = 0; x < sizeof( pucEthernetBufferPointers ) / sizeof( unsigned char * ); x++ )
{
pucEthernetBufferPointers[ x ] = &( ucEthernetBuffer[ x ][ 0 ] );
}
/* Start with uip_buf pointing to a buffer that is not referenced from the
pucEthernetBufferPointers[] array. */
uip_buf = &( ucEthernetBuffer[ archNUM_BUFFERS - 1 ][ 0 ] );
/* Query the computer the simulation is being executed on to find the
network interfaces it has installed. */
pxAllNetworkInterfaces = prvPrintAvailableNetworkInterfaces();
/* Open the network interface. The number of the interface to be opened is
set by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h.
Calling this function will set the pxOpenedInterfaceHandle variable. If,
after calling this function, pxOpenedInterfaceHandle is equal to NULL, then
the interface could not be opened. */
if( pxAllNetworkInterfaces != NULL )
{
prvOpenSelectedNetworkInterface( pxAllNetworkInterfaces );
}
return x;
}
/*-----------------------------------------------------------*/
static pcap_if_t * prvPrintAvailableNetworkInterfaces( void )
{
pcap_if_t * pxAllNetworkInterfaces = NULL, *xInterface;
long lInterfaceNumber = 1;
if( pcap_findalldevs_ex( PCAP_SRC_IF_STRING, NULL, &pxAllNetworkInterfaces, cErrorBuffer ) == -1 )
{
printf( "\r\nCould not obtain a list of network interfaces\r\n%s\r\n", cErrorBuffer );
pxAllNetworkInterfaces = NULL;
}
if( pxAllNetworkInterfaces != NULL )
{
/* Print out the list of network interfaces. The first in the list
is interface '1', not interface '0'. */
for( xInterface = pxAllNetworkInterfaces; xInterface != NULL; xInterface = xInterface->next )
{
printf( "%d. %s", lInterfaceNumber, xInterface->name );
if( xInterface->description != NULL )
{
printf( " (%s)\r\n", xInterface->description );
}
else
{
printf( " (No description available)\r\n") ;
}
lInterfaceNumber++;
}
}
if( lInterfaceNumber == 1 )
{
/* The interface number was never incremented, so the above for() loop
did not execute meaning no interfaces were found. */
printf( " \r\nNo network interfaces were found.\r\n" );
pxAllNetworkInterfaces = NULL;
}
printf( "\r\nThe interface that will be opened is set by configNETWORK_INTERFACE_TO_USE which should be defined in FreeRTOSConfig.h\r\n" );
printf( "Attempting to open interface number %d.\r\n", configNETWORK_INTERFACE_TO_USE );
if( ( configNETWORK_INTERFACE_TO_USE < 1L ) || ( configNETWORK_INTERFACE_TO_USE > lInterfaceNumber ) )
{
printf("\r\nconfigNETWORK_INTERFACE_TO_USE is not in the valid range.\r\n" );
if( pxAllNetworkInterfaces != NULL )
{
/* Free the device list, as no devices are going to be opened. */
pcap_freealldevs( pxAllNetworkInterfaces );
pxAllNetworkInterfaces = NULL;
}
}
return pxAllNetworkInterfaces;
}
/*-----------------------------------------------------------*/
static void prvOpenSelectedNetworkInterface( pcap_if_t *pxAllNetworkInterfaces )
{
pcap_if_t *xInterface;
long x;
/* Walk the list of devices until the selected device is located. */
xInterface = pxAllNetworkInterfaces;
for( x = 0L; x < ( configNETWORK_INTERFACE_TO_USE - 1L ); x++ )
{
xInterface = xInterface->next;
}
/* Open the selected interface. */
pxOpenedInterfaceHandle = pcap_open( xInterface->name, /* The name of the selected interface. */
UIP_CONF_BUFFER_SIZE, /* The size of the packet to capture. */
PCAP_OPENFLAG_PROMISCUOUS, /* Open in promiscious mode as the MAC and
IP address is going to be "simulated", and
not be the real MAC and IP address. This allows
trafic to the simulated IP address to be routed
to uIP, and trafic to the real IP address to be
routed to the Windows TCP/IP stack. */
0xfffffffL, /* The read time out. This is going to block
until data is available. */
NULL, /* No authentication is required as this is
not a remote capture session. */
cErrorBuffer
);
if ( pxOpenedInterfaceHandle == NULL )
{
printf( "\r\n%s is not supported by WinPcap and cannot be opened\r\n", xInterface->name );
}
else
{
/* Configure the capture filter to allow blocking reads, and to filter
out packets that are not of interest to this demo. */
prvConfigureCaptureBehaviour();
}
/* The device list is no longer required. */
pcap_freealldevs( pxAllNetworkInterfaces );
}
/*-----------------------------------------------------------*/
static void prvConfigureCaptureBehaviour( void )
{
struct bpf_program xFilterCode;
const long lMinBytesToCopy = 10L, lBlocking = 0L;
unsigned long ulNetMask;
/* Unblock a read as soon as anything is received. */
pcap_setmintocopy( pxOpenedInterfaceHandle, lMinBytesToCopy );
/* Allow blocking. */
pcap_setnonblock( pxOpenedInterfaceHandle, lBlocking, cErrorBuffer );
/* Set up a filter so only the packets of interest are passed to the uIP
stack. cErrorBuffer is used for convenience to create the string. Don't
confuse this with an error message. */
sprintf( cErrorBuffer, "broadcast or multicast or host %d.%d.%d.%d", configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 );
ulNetMask = ( configNET_MASK3 << 24UL ) | ( configNET_MASK2 << 16UL ) | ( configNET_MASK1 << 8L ) | configNET_MASK0;
if( pcap_compile(pxOpenedInterfaceHandle, &xFilterCode, cErrorBuffer, 1, ulNetMask ) < 0 )
{
printf("\r\nThe packet filter string is invalid\r\n" );
}
else
{
if( pcap_setfilter( pxOpenedInterfaceHandle, &xFilterCode ) < 0 )
{
printf( "\r\nAn error occurred setting the packet filter.\r\n" );
}
}
/* Create a task that simulates an interrupt in a real system. This will
block waiting for packets, then send a message to the uIP task when data
is available. */
xTaskCreate( prvInterruptSimulator, ( signed char * ) "MAC_ISR", configMINIMAL_STACK_SIZE, NULL, ( configuIP_TASK_PRIORITY - 1 ), NULL );
}
/*-----------------------------------------------------------*/
static void prvInterruptSimulator( void *pvParameters )
{
static struct pcap_pkthdr *pxHeader;
const unsigned char *pucPacketData;
extern QueueHandle_t xEMACEventQueue;
const unsigned long ulRxEvent = uipETHERNET_RX_EVENT;
long lResult;
/* Just to kill the compiler warning. */
( void ) pvParameters;
for( ;; )
{
/* Get the next packet. */
lResult = pcap_next_ex( pxOpenedInterfaceHandle, &pxHeader, &pucPacketData );
if( lResult )
{
/* Is the next buffer into which data should be placed free? */
if( lLengthOfDataInBuffer[ ucNextBufferToFill ] == 0L )
{
/* Copy the data from the captured packet into the buffer. */
memcpy( pucEthernetBufferPointers[ ucNextBufferToFill ], pucPacketData, pxHeader->len );
/* Note the amount of data that was copied. */
lLengthOfDataInBuffer[ ucNextBufferToFill ] = pxHeader->len;
/* Move onto the next buffer, wrapping around if necessary. */
ucNextBufferToFill++;
if( ucNextBufferToFill >= archNUM_BUFFER_POINTERS )
{
ucNextBufferToFill = 0U;
}
/* Data was received and stored. Send a message to the uIP task
to let it know. */
xQueueSendToBack( xEMACEventQueue, &ulRxEvent, portMAX_DELAY );
}
}
}
}
@@ -0,0 +1,138 @@
/*
* Copyright (C) 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _BITTYPES_H
#define _BITTYPES_H
#ifndef HAVE_U_INT8_T
#if SIZEOF_CHAR == 1
typedef unsigned char u_int8_t;
typedef signed char _int8_t;
#elif SIZEOF_INT == 1
typedef unsigned int u_int8_t;
typedef signed int int8_t;
#else /* XXX */
#error "there's no appropriate type for u_int8_t"
#endif
#define HAVE_U_INT8_T 1
#define HAVE_INT8_T 1
#endif /* HAVE_U_INT8_T */
#ifndef HAVE_U_INT16_T
#if SIZEOF_SHORT == 2
typedef unsigned short u_int16_t;
typedef signed short _int16_t;
#elif SIZEOF_INT == 2
typedef unsigned int u_int16_t;
typedef signed int int16_t;
#elif SIZEOF_CHAR == 2
typedef unsigned char u_int16_t;
typedef signed char int16_t;
#else /* XXX */
#error "there's no appropriate type for u_int16_t"
#endif /* if SIZEOF_SHORT == 2 */
#define HAVE_U_INT16_T 1
#define HAVE_INT16_T 1
#endif /* HAVE_U_INT16_T */
#ifndef HAVE_U_INT32_T
#if SIZEOF_INT == 4
typedef unsigned int u_int32_t;
typedef signed int _int32_t;
#elif SIZEOF_LONG == 4
typedef unsigned long u_int32_t;
typedef signed long int32_t;
#elif SIZEOF_SHORT == 4
typedef unsigned short u_int32_t;
typedef signed short int32_t;
#else /* XXX */
#error "there's no appropriate type for u_int32_t"
#endif /* if SIZEOF_INT == 4 */
#define HAVE_U_INT32_T 1
#define HAVE_INT32_T 1
#endif /* HAVE_U_INT32_T */
#ifndef HAVE_U_INT64_T
#if SIZEOF_LONG_LONG == 8
typedef unsigned long long u_int64_t;
typedef long long int64_t;
#elif defined( _MSC_EXTENSIONS )
typedef unsigned _int64 u_int64_t;
typedef _int64 int64_t;
#elif SIZEOF_INT == 8
typedef unsigned int u_int64_t;
#elif SIZEOF_LONG == 8
typedef unsigned long u_int64_t;
#elif SIZEOF_SHORT == 8
typedef unsigned short u_int64_t;
#else /* XXX */
#error "there's no appropriate type for u_int64_t"
#endif /* if SIZEOF_LONG_LONG == 8 */
#endif /* HAVE_U_INT64_T */
#ifndef PRId64
#ifdef _MSC_EXTENSIONS
#define PRId64 "I64d"
#else /* _MSC_EXTENSIONS */
#define PRId64 "lld"
#endif /* _MSC_EXTENSIONS */
#endif /* PRId64 */
#ifndef PRIo64
#ifdef _MSC_EXTENSIONS
#define PRIo64 "I64o"
#else /* _MSC_EXTENSIONS */
#define PRIo64 "llo"
#endif /* _MSC_EXTENSIONS */
#endif /* PRIo64 */
#ifndef PRIx64
#ifdef _MSC_EXTENSIONS
#define PRIx64 "I64x"
#else /* _MSC_EXTENSIONS */
#define PRIx64 "llx"
#endif /* _MSC_EXTENSIONS */
#endif /* PRIx64 */
#ifndef PRIu64
#ifdef _MSC_EXTENSIONS
#define PRIu64 "I64u"
#else /* _MSC_EXTENSIONS */
#define PRIu64 "llu"
#endif /* _MSC_EXTENSIONS */
#endif /* PRIu64 */
#endif /* _BITTYPES_H */
@@ -0,0 +1,165 @@
/*
* Copyright (c) 1993, 1994, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.5 2006-01-22 18:02:18 gianluca Exp $ (LBL)
*/
/*
* This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows
*/
#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef __MINGW32__
#define IN_MULTICAST( a ) IN_CLASSD( a )
#endif
#define IN_EXPERIMENTAL( a ) ( ( ( ( u_int32_t ) ( a ) ) & 0xf0000000 ) == 0xf0000000 )
#define IN_LOOPBACKNET 127
#if defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF )
/* IPv6 address */
struct in6_addr
{
union
{
u_int8_t u6_addr8[ 16 ];
u_int16_t u6_addr16[ 8 ];
u_int32_t u6_addr32[ 4 ];
}
in6_u;
#define s6_addr in6_u.u6_addr8
#define s6_addr16 in6_u.u6_addr16
#define s6_addr32 in6_u.u6_addr32
#define s6_addr64 in6_u.u6_addr64
};
#define IN6ADDR_ANY_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
#endif /* __MINGW32__ */
#if ( defined _MSC_VER ) || ( defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF ) )
typedef unsigned short sa_family_t;
#endif
#if defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF )
#define __SOCKADDR_COMMON( sa_prefix ) \
sa_family_t sa_prefix ## family
/* Ditto, for IPv6. */
struct sockaddr_in6
{
__SOCKADDR_COMMON( sin6_ );
u_int16_t sin6_port; /* Transport layer port # */
u_int32_t sin6_flowinfo; /* IPv6 flow information */
struct in6_addr sin6_addr; /* IPv6 address */
};
#define IN6_IS_ADDR_V4MAPPED( a ) \
( ( ( ( u_int32_t * ) ( a ) )[ 0 ] == 0 ) && ( ( ( u_int32_t * ) ( a ) )[ 1 ] == 0 ) && \
( ( ( u_int32_t * ) ( a ) )[ 2 ] == htonl( 0xffff ) ) )
#define IN6_IS_ADDR_MULTICAST( a ) ( ( ( u_int8_t * ) ( a ) )[ 0 ] == 0xff )
#define IN6_IS_ADDR_LINKLOCAL( a ) \
( ( ( ( u_int32_t * ) ( a ) )[ 0 ] & htonl( 0xffc00000 ) ) == htonl( 0xfe800000 ) )
#define IN6_IS_ADDR_LOOPBACK( a ) \
( ( ( u_int32_t * ) ( a ) )[ 0 ] == 0 && ( ( u_int32_t * ) ( a ) )[ 1 ] == 0 && \
( ( u_int32_t * ) ( a ) )[ 2 ] == 0 && ( ( u_int32_t * ) ( a ) )[ 3 ] == htonl( 1 ) )
#endif /* __MINGW32__ */
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
#define nd_rd_type nd_rd_hdr.icmp6_type
#define nd_rd_code nd_rd_hdr.icmp6_code
#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[ 0 ]
/*
* IPV6 extension headers
*/
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
#define IPPROTO_IPV6 41 /* IPv6 header. */
#define IPPROTO_ROUTING 43 /* IPv6 routing header */
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
#define IPPROTO_ESP 50 /* encapsulating security payload */
#define IPPROTO_AH 51 /* authentication header */
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
#define IPPROTO_NONE 59 /* IPv6 no next header */
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */
#define IPV6_RTHDR_TYPE_0 0
/* Option types and related macros */
#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
#define IP6OPT_PADN 0x01 /* 00 0 00001 */
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
#define IP6OPT_JUMBO_LEN 6
#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */
#define IP6OPT_RTALERT_LEN 4
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
#define IP6OPT_MINLEN 2
#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */
#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
#define IP6OPT_EID 0x8a /* 10 0 01010 */
#define IP6OPT_TYPE( o ) ( ( o ) & 0xC0 )
#define IP6OPT_TYPE_SKIP 0x00
#define IP6OPT_TYPE_DISCARD 0x40
#define IP6OPT_TYPE_FORCEICMP 0x80
#define IP6OPT_TYPE_ICMP 0xC0
#define IP6OPT_MUTABLE 0x20
#if defined( __MINGW32__ ) && defined( DEFINE_ADDITIONAL_IPV6_STUFF )
#ifndef EAI_ADDRFAMILY
struct addrinfo
{
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
size_t ai_addrlen; /* length of ai_addr */
char * ai_canonname; /* canonical name for hostname */
struct sockaddr * ai_addr; /* binary address */
struct addrinfo * ai_next; /* next structure in linked list */
};
#endif /* ifndef EAI_ADDRFAMILY */
#endif /* __MINGW32__ */
@@ -0,0 +1,51 @@
/*
* FreeRTOS V202212.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*
*/
#ifndef NET_IF_H
#define NET_IF_H
/*
* Send uip_len bytes from uip_buf to the network interface selected by the
* configNETWORK_INTERFACE_TO_USE constant (defined in FreeRTOSConfig.h).
*/
void vNetifTx( void );
/*
* Receive bytes from the network interface selected by the
* configNETWORK_INTERFACE_TO_USE constant (defined in FreeRTOSConfig.h). The
* bytes are placed in uip_buf. The number of bytes copied into uip_buf is
* returned.
*/
UBaseType_t uxNetifRx( void );
/*
* Prepare a packet capture session. This will print out all the network
* interfaces available, and the one actually used is set by the
* configNETWORK_INTERFACE_TO_USE constant that is defined in
* FreeRTOSConfig.h. */
BaseType_t xNetifInit( void );
#endif /* NET_IF_H */
@@ -0,0 +1,47 @@
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007/04/01 21:43:55 guy Exp $ (LBL)
*/
/*
* For backwards compatibility.
*
* Note to OS vendors: do NOT get rid of this file! Some applications
* might expect to be able to include <pcap-bpf.h>.
*/
#include <pcap/bpf.h>
@@ -0,0 +1,42 @@
/*
* Copyright (c) 1994, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.13 2006/10/04 18:13:32 guy Exp $ (LBL)
*/
/*
* For backwards compatibility.
*
* Note to OS vendors: do NOT get rid of this file! Some applications
* might expect to be able to include <pcap-namedb.h>.
*/
#include <pcap/namedb.h>
@@ -0,0 +1,93 @@
/*
* Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
* Copyright (c) 2005 - 2009 CACE Technologies, Inc. Davis (California)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Politecnico di Torino nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @(#) $Header: /tcpdump/master/libpcap/pcap-stdinc.h,v 1.10.2.1 2008-10-06 15:38:39 gianluca Exp $ (LBL)
*/
#define SIZEOF_CHAR 1
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#ifndef _MSC_EXTENSIONS
#define SIZEOF_LONG_LONG 8
#endif
/*
* Avoids a compiler warning in case this was already defined
* (someone defined _WINSOCKAPI_ when including 'windows.h', in order
* to prevent it from including 'winsock.h')
*/
#ifdef _WINSOCKAPI_
#undef _WINSOCKAPI_
#endif
#include <winsock2.h>
#include <fcntl.h>
#include "bittypes.h"
#include <time.h>
#include <io.h>
#ifndef __MINGW32__
#include "IP6_misc.h"
#endif
#define caddr_t char *
#if _MSC_VER < 1500
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strdup _strdup
#endif
#define inline __inline
#ifdef __MINGW32__
#include <stdint.h>
#else /*__MINGW32__*/
/* MSVC compiler */
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef _W64 unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef _W64 int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#endif /*__MINGW32__*/
@@ -0,0 +1,45 @@
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the Computer Systems
* Engineering Group at Lawrence Berkeley Laboratory.
* 4. Neither the name of the University nor of the Laboratory may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006/10/04 18:09:22 guy Exp $ (LBL)
*/
/*
* For backwards compatibility.
*
* Note to OS vendors: do NOT get rid of this file! Many applications
* expect to be able to include <pcap.h>, and at least some of them
* go through contortions in their configure scripts to try to detect
* OSes that have "helpfully" moved pcap.h to <pcap/pcap.h> without
* leaving behind a <pcap.h> file.
*/
#include <pcap/pcap.h>

Some files were not shown because too many files have changed in this diff Show More