mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-12-16 09:54:32 +08:00
FreeRTOS Windows Simulator Build Changes and LTS 2.0 Update (#872)
* Update mbedtls to version v3.2.1 * Adjust include paths for github workflow * Update FreeRTOS+TCP to v3.1.0 * Add initial VS project files for Kernel, +TCP, and mbedtls * winpcap: Consolidate to a single copy of WinPcap * Downgrade library projects to VS 2019. Add heap_4 to kernel. * Remove *.vcxproj.user files and add to gitignore * Disable unwanted kernel config options * Update FreeRTOS+TCP and Kernel include paths * Update FreeRTOS+TCP Windows Minimal sln * Remove .suo and .vcxproj.user files * Update mbedtls transport implementations for mbedtls v3.2.1 * Fix typo in mbedtls_freertos_port.c * Update vcxproj files for +TCP, Kernel, Mbedtls * Fix typo in name WindowSimulator -> WindowsSimulator * Add wpcap lib to FreeRTOS+TCP.vcxproj * Update FreeRTOS+TCP Minimal Demo for Windows Simulator * Mask MSVC string function warnings Aad _CRT_SECURE_NO_WARNINGS preprocessor definition. * Move projects to their own directories to make VisualStudio happy * mbedtls_freertos_port.c: Fix formatting? * Add coreHTTP, Logging libs. Adjust dependencies * Disable FreeRTOS Kernel malloc failed hook * Update coreHTTP Plaintext demo * Rename / relocate transport interface implementations * Remove old VS project files * Remove extra core_http_config.h files * Remove extra FreeRTOSConfig.h files * Remove extra FreeRTOSIPConfig.h files * Remove old mbedtls_config.h files * Remove old FreeRTOSConfig and core_http_config files * Update HTTP Mutual Auth Demo build files * Fix transport_plaintext.h include name * Update HTTP_Plaintext demo build files * Update CoreHTTP_S3_Download VS project files * Update HTTP_S3_Upload demo build files * Update CoreHTTP_S3_Download_Multithreaded demo build files * Add GithubActions builds for FreeRTOS+ CoreHTTP Demos * Update S3DownloadHTTPExample.c to be compatible with mbedtls 3.x * Update GithubActions FreeRTOS+ config file * Combine core_pkcs11_config.h files into a single one * Add corePKCS11 VS project file * Update corePKCS11 WinSim demo project and build files * Update corePKCS11 library to version 3.5.0 * Modifiying demos to build using static libraries * Adding a header file * Two more demos * Update corePKCS11 demo code and auto-format * Downgrade corePKCS11 library build file to v142 / VS 2019 * Speed up CI builds with selective submodule initialization * Separate corePKCS11 demo into it's own job. * Remove WIN32.vcxproj and WIN32.vcxproj.filters files * Remove old configuration header files Partially reverts73829ced60* Revert unwanted coreHTTP demo changes * Changing include paths for demos * Adding an include * MQTT WoflSSL Demo update * wolfSSL Demo changes * Config changes for MQTT Demos * Initial Device Defender demo update. * Initial Device Shadow demo update. * Update mbedtls_transport_pkcs11 for Mbedtls 3.x * Update corePKCS11 MQTT Mutual Auth demo * Add a default definition of SdkLog * Update CorePKCS11 + MQTT Mutual Auth demo sln name * Build all configs of coreHTTP demos * Update coreSNTP Demo build files. * Update coreSNTP Demo sln name * Update FreeRTOS+TCP Posix demo * Update FreeRTOS+TCP Qemu ARM MPS2 AN385 Demo * Update FreeRTOS+TCP Demo Github Actions builds * Update Fleet Provisioning WinSim Demo build files * Remove mbedtls_pk_info_t references from mbedtls_pk_pkcs11.h * Restore / update the FreeRTOS+TCP Minimal WinSim demo * Initial Jobs demo update. * Fix jobs demo build. * Initial OTA over HTTP demo update. * Initial OTA over MQTT demo update. * Ota_Over_Mqtt_Demo build fix. * OTA over MQTT demo fix. * Update HTTP demo solution file name for CI. * Update Github actions workflow to old HTTP demo names. * Update coreSTNP demo to old solution name. * Fix defender demo / fix mbedtls config to use threading alt. * Add MBEDTLS_CONFIG_FILE definition to each config * Fix config file name. * MQTT Mutual auth fixes. * Fix job demo. * Device shadow demo fixes. * Fix coreSNTP demo not setting alt threading functions for mbedtls. * Enable Static allocation, Add default hooks for FreeRTOS Kernel and +TCP * Add xPlatformIsNetworkUp platform function to FreeRTOS+TCP hooks * Enable runtime statistics in the Windows Simualator Kernel config * Revert "Fix coreSNTP demo not setting alt threading functions for mbedtls." This reverts commit9069707519. * Revert mbedtls threading related config changes * Add xPlatformIsNetworkUp function prototype * Remove boileplate FreeRTOS kernel and +tcp hooks * Refactor device defender demo for clarity * Add wait loop calling xPlatformIsNetworkUp * Add missing vPlatformInitLogging function * Add vPlatformInitLogging and vLoggingPrintf defitions to logging headers * Updating the FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator * Updating the FreeRTOS_Plus_Reliance_Edge_and_CLI_Windows_Simulator demo * Updates to the FreeRTOS_Plus_WolfSSL_Windows_Simulator demo * Fixing wrong include path * Upating FreeRTOS_Plus_WolfSSL_FIPS_Ready_Windows_Simulator demo * Update coreMQTT WinSim demos to print start and end condition. * Modifiying repos updated as part of the CLI demo GitHub workflow * Removing duplicate functions from the FreeRTOS_Plus_TCP_Minimal_Windows_Simulator demo * Updated FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator demo * Updating corePKCS11_MQTT_Mutual_Auth_Windows_Simulator Demo to call the static function that creates task * Fix log message using unitialized string in MQTT Multitask demo. * Fixing a broken extern function * Fixing a typo extern function name * Added a reference to coreHTTP * Fixing a pre-processor issue in the OTA_Over_Http_Demo * Updating the MQTT_Mutual_Auth_Demo_with_BG96 demo * Updating the MQTT_Mutual_Auth_Demo_with_HL7802 demo * Changes to the MQTT_Mutual_Auth_Demo_with_SARA_R4 demo * Fix demos for CI. * Adding the source path to the CBMC proofs for FreeRTOS+TCP * Spell check fixes, adding words to lexicons * Fixing a typo * Add arg to skip prompt in setup script. * Update paths of script to be relative to the file. * Changing manifest.yml file to point to corePKCS11 3.5.0 * Added CI markers to cellular demos. * Fix cellular demo flow. * Fix celullar demos. * Initial TCP sockets wrapper rework - will break things. * First cellular demo fix for new sockets wrapper. * Minor fix to cellular sockets wrapper. * Fix mbedtls bio using FreeRTOS Plus TCP call. * Clean up BG96 demo project files. * Update HL7802 demo. * Fix SARA R4 demo for new sockets wrapper. * Fix Device Defender, Device Shadow, and Fleet PRovisioning. * Fix Jobs demo. * Fix OTA over HTTP demo. * Fix OTA over MQTT demo. * Fix HTTP mutual auth demo. * Fix OTA over MQTT demo endianness. * Fix OTA over HTTP demo endianness. * Fix HTTP Plaintext demo. * Fix HTTP S3 download demo. * Fix plaintext transport * Fix OTA demos. * Fix OTA demos. * Fix OTA HTTP demo. * Fix HTTP S3 Download multithreaded demo. * Fix HTTP S3 Upload demo * Fix corePKCS11 Mutual Auth demo. * Updating MQTT_Mutual_Auth * Update pkcs11 setup script. * Updating the MQTT_Basic_TLS Demo * Organize PKCS11 demos project. * Updating MQTT_Keep_Alive demo * Clean up SNTP demo. * Updated MQTT_Multitask demo * Updated MQTT_Plain_Text * Updating the MQTT_Serializer Demo * Updating corePKCS11_MQTT_Mutual_Auth_Windows_Simulator * Updating coreSNTP_Windows_Simulator * Clean up demo projects. * Add markers to PKCS11 mutual auth demo. * Fix Fleet Provisioning demo script. * Fix SNTP demo solution. * Fix coreSNTP project files. * Fix Fleet Provisiong script. * Fix fleet provisioning script. * Fix demo config template. * Fleet provisioning demo markers. * Updating MQTT_Mutual_Auth_wolfSSL demo and the transport_wolfSSL file * Fixing FreeRTOS_Plus_TCP_Echo_POSIX * Fixing CLI and Trace Demos * Fixing TCP_ECHO_POSIX demo * Adding a word to the lexicon * Remove unneeded files. * Update github workflows to use Ubuntu 20.04. * Change OTA demo target names to RTOSDemo for OTAE2E tests. * Fixing Headers * Updating headers * Two more headers * Adding words to the lexicon * Whitepsace * Ignore mbedtls config file for header check. * Removing FreeRTOS Header from the mbedtls_config_v3.2.1.h file * Fix bug in lPKCS11PkMbedtlsCloseSessionAndFree. Add doxygen api docs. * Update lexicon.txt * Fix spelling * Apply suggestions from code review Co-authored-by: jasonpcarroll <23126711+jasonpcarroll@users.noreply.github.com> * Add return code comment for p11_ecdsa_ctx_init * Rename WindowsSimulator folder to VisualStudio_StaticProjects. * Remove references to coroutines * Fix mbedtls_pk_pkcs11.c * Update to LTS 2.0 submodule pointers (#880) * Update submodule pointers to LTS 2.0 * Initial coreMQTT 2.1.1 update. * Update AWS demos for coreMQTT 2.1.1 * Fix deprecated macro for coreMQTT demos. * Fix keep alive demo. * Fix plaintext demo. * Fix MQTT wolfSSL demo. * Fix MQTT PKCS11 demo. * Remove duplicate functions. * Fix Mutual auth demos for Cellular. * Fix OTA demos. * Fix header of plaintext demo config. * Set writev to NULL for OTA demos. * Fix mbedlts config for OTA demos. * Fix spelling. Co-authored-by: Jason Carroll <czjaso@amazon.com> * Removing blank line * Fix jobs demo race condition. * Fix race condition from WinPCap network interface. * Update lexicon. Co-authored-by: Paul Bartell <pbartell@amazon.com> Co-authored-by: Jason Carroll <czjaso@amazon.com> Co-authored-by: Paul Bartell <paul.bartell@gmail.com> Co-authored-by: jasonpcarroll <23126711+jasonpcarroll@users.noreply.github.com>
This commit is contained in:
1
FreeRTOS-Plus/.gitignore
vendored
Normal file
1
FreeRTOS-Plus/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.vcxproj.user
|
||||
@@ -291,20 +291,6 @@ static bool prvPublishDeviceMetricsReport( size_t xReportLength );
|
||||
static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
||||
size_t xDefenderResponseLength );
|
||||
|
||||
/**
|
||||
* @brief The task used to demonstrate the Defender API.
|
||||
*
|
||||
* This task collects metrics from the device using the functions in
|
||||
* metrics_collector.h and uses them to build a defender report using functions
|
||||
* in report_builder.h. Metrics include the number for bytes written and read
|
||||
* over the network, open TCP and UDP ports, and open TCP sockets. The
|
||||
* generated report is then published to the AWS IoT Device Defender service.
|
||||
*
|
||||
* @param[in] pvParameters Parameters as passed at the time of task creation.
|
||||
* Not used in this example.
|
||||
*/
|
||||
static void prvDefenderDemoTask( void * pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static bool prvValidateDefenderResponse( const char * pcDefenderResponse,
|
||||
@@ -468,7 +454,9 @@ static bool prvCollectDeviceMetrics( void )
|
||||
{
|
||||
bool xStatus = false;
|
||||
eMetricsCollectorStatus eStatus;
|
||||
size_t xNumOpenTcpPorts = 0UL, xNumOpenUdpPorts = 0UL, xNumEstablishedConnections = 0UL, i;
|
||||
size_t uxNumOpenTcpPorts = 0UL;
|
||||
size_t uxNumOpenUdpPorts = 0UL;
|
||||
size_t uxNumEstablishedConnections = 0UL;
|
||||
UBaseType_t uxTasksWritten = { 0 };
|
||||
UBaseType_t uxNumTasksRunning;
|
||||
TaskStatus_t pxTaskStatus = { 0 };
|
||||
@@ -487,8 +475,8 @@ static bool prvCollectDeviceMetrics( void )
|
||||
if( eStatus == eMetricsCollectorSuccess )
|
||||
{
|
||||
eStatus = eGetOpenTcpPorts( &( pusOpenTcpPorts[ 0 ] ),
|
||||
democonfigOPEN_TCP_PORTS_ARRAY_SIZE,
|
||||
&( xNumOpenTcpPorts ) );
|
||||
democonfigOPEN_TCP_PORTS_ARRAY_SIZE,
|
||||
&( uxNumOpenTcpPorts ) );
|
||||
|
||||
if( eStatus != eMetricsCollectorSuccess )
|
||||
{
|
||||
@@ -501,8 +489,8 @@ static bool prvCollectDeviceMetrics( void )
|
||||
if( eStatus == eMetricsCollectorSuccess )
|
||||
{
|
||||
eStatus = eGetOpenUdpPorts( &( pusOpenUdpPorts[ 0 ] ),
|
||||
democonfigOPEN_UDP_PORTS_ARRAY_SIZE,
|
||||
&( xNumOpenUdpPorts ) );
|
||||
democonfigOPEN_UDP_PORTS_ARRAY_SIZE,
|
||||
&( uxNumOpenUdpPorts ) );
|
||||
|
||||
if( eStatus != eMetricsCollectorSuccess )
|
||||
{
|
||||
@@ -515,8 +503,8 @@ static bool prvCollectDeviceMetrics( void )
|
||||
if( eStatus == eMetricsCollectorSuccess )
|
||||
{
|
||||
eStatus = eGetEstablishedConnections( &( pxEstablishedConnections[ 0 ] ),
|
||||
democonfigESTABLISHED_CONNECTIONS_ARRAY_SIZE,
|
||||
&( xNumEstablishedConnections ) );
|
||||
democonfigESTABLISHED_CONNECTIONS_ARRAY_SIZE,
|
||||
&( uxNumEstablishedConnections ) );
|
||||
|
||||
if( eStatus != eMetricsCollectorSuccess )
|
||||
{
|
||||
@@ -546,8 +534,8 @@ static bool prvCollectDeviceMetrics( void )
|
||||
if( eStatus == eMetricsCollectorSuccess )
|
||||
{
|
||||
/* Get the current task's status information. The usStackHighWaterMark
|
||||
* field of the task status will be included in the report as a "number"
|
||||
* custom metric. */
|
||||
* field of the task status will be included in the report as a "number"
|
||||
* custom metric. */
|
||||
vTaskGetInfo(
|
||||
/* Query this task. */
|
||||
NULL,
|
||||
@@ -556,6 +544,7 @@ static bool prvCollectDeviceMetrics( void )
|
||||
pdTRUE,
|
||||
/* Don't include the task state in the TaskStatus_t structure. */
|
||||
0 );
|
||||
|
||||
/* Get the task status information for all running tasks. The task IDs
|
||||
* of each task is then extracted to include in the report as a "list of
|
||||
* numbers" custom metric */
|
||||
@@ -578,11 +567,11 @@ static bool prvCollectDeviceMetrics( void )
|
||||
xStatus = true;
|
||||
xDeviceMetrics.pxNetworkStats = &( xNetworkStats );
|
||||
xDeviceMetrics.pusOpenTcpPortsArray = &( pusOpenTcpPorts[ 0 ] );
|
||||
xDeviceMetrics.xOpenTcpPortsArrayLength = xNumOpenTcpPorts;
|
||||
xDeviceMetrics.xOpenTcpPortsArrayLength = uxNumOpenTcpPorts;
|
||||
xDeviceMetrics.pusOpenUdpPortsArray = &( pusOpenUdpPorts[ 0 ] );
|
||||
xDeviceMetrics.xOpenUdpPortsArrayLength = xNumOpenUdpPorts;
|
||||
xDeviceMetrics.xOpenUdpPortsArrayLength = uxNumOpenUdpPorts;
|
||||
xDeviceMetrics.pxEstablishedConnectionsArray = &( pxEstablishedConnections[ 0 ] );
|
||||
xDeviceMetrics.xEstablishedConnectionsArrayLength = xNumEstablishedConnections;
|
||||
xDeviceMetrics.xEstablishedConnectionsArrayLength = uxNumEstablishedConnections;
|
||||
xDeviceMetrics.ulStackHighWaterMark = pxTaskStatus.usStackHighWaterMark;
|
||||
xDeviceMetrics.pxTaskStatusArray = pxTaskStatusArray;
|
||||
xDeviceMetrics.xTaskStatusArrayLength = uxTasksWritten;
|
||||
@@ -699,30 +688,12 @@ static bool prvPublishDeviceMetricsReport( size_t xReportLength )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Create the task that demonstrates the Device Defender library API via
|
||||
* a mutually authenticated MQTT connection with the AWS IoT broker.
|
||||
*/
|
||||
void vStartDefenderDemo( void )
|
||||
{
|
||||
/* This example uses a single application task, which shows that how to use
|
||||
* Device Defender library to generate and validate AWS IoT Device Defender
|
||||
* MQTT topics, and use the coreMQTT library to communicate with the AWS
|
||||
* IoT Device Defender service. */
|
||||
xTaskCreate( prvDefenderDemoTask, /* Function that implements the task. */
|
||||
"DemoTask", /* Text name for the task - only used for debugging. */
|
||||
democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
|
||||
NULL, /* Task parameter - not used in this case. */
|
||||
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
|
||||
NULL ); /* Used to pass out a handle to the created task - not used in this case. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void prvDefenderDemoTask( void * pvParameters )
|
||||
{
|
||||
bool xStatus = false;
|
||||
BaseType_t xExitStatus = EXIT_FAILURE;
|
||||
uint32_t ulReportLength = 0UL, i;
|
||||
size_t uxReportLength = 0UL;
|
||||
size_t uxIdx;
|
||||
bool xMqttSessionEstablished = false;
|
||||
UBaseType_t uxDemoRunCount = 0UL;
|
||||
|
||||
@@ -740,6 +711,18 @@ void prvDefenderDemoTask( void * pvParameters )
|
||||
* DEFENDER_MAX_DEMO_LOOP_COUNT times. */
|
||||
do
|
||||
{
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
|
||||
if( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
LogInfo( ( "Waiting for the network link up event..." ) );
|
||||
|
||||
while( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
vTaskDelay( pdMS_TO_TICKS( 1000U ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Set a report ID to be used.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
@@ -842,7 +825,7 @@ void prvDefenderDemoTask( void * pvParameters )
|
||||
if( xStatus == true )
|
||||
{
|
||||
LogInfo( ( "Generating Device Defender report..." ) );
|
||||
xStatus = prvGenerateDeviceMetricsReport( &( ulReportLength ) );
|
||||
xStatus = prvGenerateDeviceMetricsReport( &( uxReportLength ) );
|
||||
|
||||
/* Free the allocated array in xDeviceMetrics struct which is not
|
||||
* used anymore after prvGenerateDeviceMetricsReport(). This code is
|
||||
@@ -867,7 +850,7 @@ void prvDefenderDemoTask( void * pvParameters )
|
||||
if( xStatus == true )
|
||||
{
|
||||
LogInfo( ( "Publishing Device Defender report..." ) );
|
||||
xStatus = prvPublishDeviceMetricsReport( ulReportLength );
|
||||
xStatus = prvPublishDeviceMetricsReport( uxReportLength );
|
||||
|
||||
if( xStatus != true )
|
||||
{
|
||||
@@ -882,7 +865,7 @@ void prvDefenderDemoTask( void * pvParameters )
|
||||
* the accepted or rejected topics, it updates xReportStatus. */
|
||||
if( xStatus == true )
|
||||
{
|
||||
for( i = 0; i < DEFENDER_RESPONSE_WAIT_SECONDS; i++ )
|
||||
for( uxIdx = 0; uxIdx < DEFENDER_RESPONSE_WAIT_SECONDS; uxIdx++ )
|
||||
{
|
||||
( void ) xProcessLoop( &xMqttContext, 1000 );
|
||||
|
||||
@@ -960,6 +943,8 @@ void prvDefenderDemoTask( void * pvParameters )
|
||||
LogError( ( "Demo failed." ) );
|
||||
}
|
||||
|
||||
LogInfo( ( "-------DEMO FINISHED-------\r\n" ) );
|
||||
|
||||
/* Delete this task. */
|
||||
LogInfo( ( "Deleting Defender Demo task." ) );
|
||||
vTaskDelete( NULL );
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" 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>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{6c548950-0bed-42ef-8039-95a2084a806d}</ProjectGuid>
|
||||
<RootNamespace>DeviceDefenderDemo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\AWS\device-defender\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\AWS\device-defender\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\AWS\device-defender\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="medtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\AWS\device-defender\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\device-defender\source\defender.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" />
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.c" />
|
||||
<ClCompile Include="DemoTasks\DefenderDemoExample.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="metrics_collector.c" />
|
||||
<ClCompile Include="report_builder.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-defender\source\include\defender.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-defender\source\include\defender_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" />
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.h" />
|
||||
<ClInclude Include="core_mqtt_config.h" />
|
||||
<ClInclude Include="defender_config.h" />
|
||||
<ClInclude Include="demo_config.h" />
|
||||
<ClInclude Include="metrics_collector.h" />
|
||||
<ClInclude Include="report_builder.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj">
|
||||
<Project>{c90e6cc5-818b-4c97-8876-0986d989387c}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj">
|
||||
<Project>{72c209c4-49a4-4942-a201-44706c9d77ec}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj">
|
||||
<Project>{be362ac0-b10b-4276-b84e-6304652ba228}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj">
|
||||
<Project>{e1016f3e-94e9-4864-9fd8-1d7c1fefbfd7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files">
|
||||
<UniqueIdentifier>{dd51d59e-5364-4754-8bf8-9d28b504b06d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries">
|
||||
<UniqueIdentifier>{2860744a-0818-43ed-823e-814141580842}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Device Defender">
|
||||
<UniqueIdentifier>{f9d9acc8-facf-4594-848f-c86e8d4448ed}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Device Defender\include">
|
||||
<UniqueIdentifier>{c9e66dd3-1d31-4e7f-91f8-044acb1d500c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT">
|
||||
<UniqueIdentifier>{df5ee1fa-4f3a-47a2-b3f6-5b78ad7b8c90}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\include">
|
||||
<UniqueIdentifier>{69eea975-6c9c-40bc-b0af-4fb5133106c1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\interface">
|
||||
<UniqueIdentifier>{432ee803-f901-47d9-94cc-5ca2f95211ea}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreJSON">
|
||||
<UniqueIdentifier>{ad937432-b2b1-4c00-81ab-2f89f93fab5e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreJSON\include">
|
||||
<UniqueIdentifier>{aae732f5-763c-4654-907f-a3b8d3ac59b7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm">
|
||||
<UniqueIdentifier>{4a9d6aa8-5941-465f-9b9c-4ea26cd54f45}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm\include">
|
||||
<UniqueIdentifier>{402f543a-4604-4007-a33e-88a612b1bccd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config">
|
||||
<UniqueIdentifier>{2bc92365-ac9c-4c19-9f72-fb69e25d2b57}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport">
|
||||
<UniqueIdentifier>{65d207cd-19f3-4660-9f1a-a8d91a5b4389}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include">
|
||||
<UniqueIdentifier>{5f612844-a9d1-495d-9945-78b7502c17eb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper">
|
||||
<UniqueIdentifier>{8d8cb4b4-13f9-4ff1-9465-e1fc9f293fc8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\include">
|
||||
<UniqueIdentifier>{bc47cbaf-951c-4b67-8400-2e7d7efe5bf0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports">
|
||||
<UniqueIdentifier>{528452a5-23b0-41fe-b45e-0bb78c435d75}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp">
|
||||
<UniqueIdentifier>{a1785447-203d-46e5-aa81-d3e2c5c257be}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DemoTasks\DefenderDemoExample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="metrics_collector.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="report_builder.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\device-defender\source\defender.c">
|
||||
<Filter>Additional Libraries\AWS IoT Device Defender</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c">
|
||||
<Filter>Additional Libraries\Backoff Algorithm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c">
|
||||
<Filter>Additional Libraries\coreJSON</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="metrics_collector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="report_builder.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-defender\source\include\defender.h">
|
||||
<Filter>Additional Libraries\AWS IoT Device Defender\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-defender\source\include\defender_config_defaults.h">
|
||||
<Filter>Additional Libraries\AWS IoT Device Defender\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h">
|
||||
<Filter>Additional Libraries\Backoff Algorithm\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h">
|
||||
<Filter>Additional Libraries\coreMQTT\interface</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h">
|
||||
<Filter>Additional Libraries\coreJSON\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core_mqtt_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="defender_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="demo_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,79 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29215.179
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Device_Defender_Demo", "Device_Defender_Demo.vcxproj", "{6C548950-0BED-42EF-8039-95A2084A806D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Statically Linked Libraries", "Statically Linked Libraries", "{DBCD753C-52CF-4671-B979-F19EF96D4303}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
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
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Debug|x64.Build.0 = Debug|x64
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Release|x64.ActiveCfg = Release|x64
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Release|x64.Build.0 = Release|x64
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{6C548950-0BED-42EF-8039-95A2084A806D}.Release|x86.Build.0 = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.Build.0 = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.ActiveCfg = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.Build.0 = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x86.Build.0 = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.Build.0 = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x86.Build.0 = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.ActiveCfg = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.Build.0 = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x86.Build.0 = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.Build.0 = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x86.Build.0 = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.ActiveCfg = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.Build.0 = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x86.ActiveCfg = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x86.Build.0 = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.Build.0 = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.ActiveCfg = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.Build.0 = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {150F08BF-9D61-4CC2-8DBF-1335172A1EA4}
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C} = {DBCD753C-52CF-4671-B979-F19EF96D4303}
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC} = {DBCD753C-52CF-4671-B979-F19EF96D4303}
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228} = {DBCD753C-52CF-4671-B979-F19EF96D4303}
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7} = {DBCD753C-52CF-4671-B979-F19EF96D4303}
|
||||
EndGlobalSection
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E8237739-26DE-4179-84E1-70E13623A2ED}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -51,77 +51,43 @@
|
||||
/* Demo Specific configs. */
|
||||
#include "demo_config.h"
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes for the demos that can be started from this project. Note the
|
||||
* Defender demo is not actually started until the network is already, which is
|
||||
* indicated by vApplicationIPNetworkEventHook() executing - hence
|
||||
* vStartDefenderDemo() is called from inside vApplicationIPNetworkEventHook().
|
||||
*/
|
||||
extern void vStartDefenderDemo( void );
|
||||
|
||||
/*
|
||||
* Just seeds the simple pseudo random number generator.
|
||||
/**
|
||||
* @brief The task used to demonstrate the Defender API.
|
||||
*
|
||||
* !!! NOTE !!!
|
||||
* This is not a secure method of generating random numbers and production
|
||||
* devices should use a true random number generator (TRNG).
|
||||
* This task collects metrics from the device using the functions in
|
||||
* metrics_collector.h and uses them to build a defender report using functions
|
||||
* in report_builder.h. Metrics include the number for bytes written and read
|
||||
* over the network, open TCP and UDP ports, and open TCP sockets. The
|
||||
* generated report is then published to the AWS IoT Device Defender service.
|
||||
*
|
||||
* @param[in] pvParameters Parameters as passed at the time of task creation.
|
||||
* Not used in this example.
|
||||
*/
|
||||
static void prvSRand( UBaseType_t ulSeed );
|
||||
void prvDefenderDemoTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* Miscellaneous initialization including preparing the logging and seeding the
|
||||
* random number generator.
|
||||
*/
|
||||
static void prvMiscInitialisation( void );
|
||||
extern void vPlatformInitIpStack( void );
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. */
|
||||
static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
|
||||
static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
|
||||
static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
|
||||
|
||||
/* Set the following constant to pdTRUE to log using the method indicated by the
|
||||
* name of the constant, or pdFALSE to not log using the method indicated by the
|
||||
* name of the constant. Options include to standard out (xLogToStdout), to a disk
|
||||
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
|
||||
* then UDP messages are sent to the IP address configured as the UDP logging server
|
||||
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
|
||||
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
|
||||
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static UBaseType_t ulNextRand;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/***
|
||||
* See https://www.FreeRTOS.org/iot-device-shadow for configuration and usage instructions.
|
||||
***/
|
||||
vPlatformInitLogging();
|
||||
|
||||
/* Miscellaneous initialization including preparing the logging and seeding
|
||||
* the random number generator. */
|
||||
prvMiscInitialisation();
|
||||
/*
|
||||
* This example uses a single application task, which shows that how to use
|
||||
* Device Defender library to generate and validate AWS IoT Device Defender
|
||||
* MQTT topics, and use the coreMQTT library to communicate with the AWS
|
||||
* IoT Device Defender service.
|
||||
*/
|
||||
xTaskCreate( prvDefenderDemoTask, /* Function that implements the task. */
|
||||
"DemoTask", /* Text name for the task - only used for debugging. */
|
||||
democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
|
||||
NULL, /* Task parameter - not used in this case. */
|
||||
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
|
||||
NULL ); /* Used to pass out a handle to the created task - not used in this case. */
|
||||
|
||||
/* Initialize the network interface.
|
||||
*
|
||||
***NOTE*** Tasks that use the network are created in the network event hook
|
||||
* when the network is connected and ready for use (see the implementation of
|
||||
* vApplicationIPNetworkEventHook() below). The address values passed in here
|
||||
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
|
||||
* but a DHCP server cannot be contacted. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
/* Initialize the FreeRTOS+TCP Stack */
|
||||
vPlatformInitIpStack();
|
||||
|
||||
/* Start the RTOS scheduler. */
|
||||
vTaskStartScheduler();
|
||||
@@ -130,256 +96,13 @@ int main( void )
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
* FreeRTOS web site for more details.
|
||||
*/
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
__debugbreak();
|
||||
configASSERT( 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 )
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
/* Create the tasks that use the IP stack if they have not already been
|
||||
* created. */
|
||||
if( xTasksAlreadyCreated == pdFALSE )
|
||||
{
|
||||
/* Demos that use the network are created after the network is
|
||||
* up. */
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
vStartDefenderDemo();
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
LogInfo( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
|
||||
LogInfo( ( "Subnet Mask: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
|
||||
LogInfo( ( "Gateway Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
|
||||
LogInfo( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine )
|
||||
{
|
||||
volatile uint32_t ulBlockVariable = 0UL;
|
||||
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
( void ) pcFileName;
|
||||
( void ) ulLineNumber;
|
||||
|
||||
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||
|
||||
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||
* this function to be exited. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
{
|
||||
while( ulBlockVariable == 0UL )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/*
|
||||
* Utility function to generate a pseudo random number.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( UBaseType_t ulSeed )
|
||||
{
|
||||
/* Utility function to seed the pseudo random number generator. */
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvMiscInitialisation( void )
|
||||
{
|
||||
time_t xTimeNow;
|
||||
uint32_t ulLoggingIPAddress;
|
||||
uint32_t ulRandomNumbers[ 4 ];
|
||||
|
||||
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
|
||||
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
|
||||
|
||||
/*
|
||||
* Seed random number generator.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
time( &xTimeNow );
|
||||
LogDebug( ( "Seed for randomizer: %lu\n", xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
|
||||
LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ulRandomNumbers[ 0 ], ulRandomNumbers[ 1 ], ulRandomNumbers[ 2 ], ulRandomNumbers[ 3 ] ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
* address plus this name. */
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback that provides the inputs necessary to generate a randomized TCP
|
||||
* Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
|
||||
* THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
|
||||
* SYSTEMS.
|
||||
*/
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return uxRand();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Set *pulNumber to a random number, and return pdTRUE. When the random number
|
||||
* generator is broken, it shall return pdFALSE.
|
||||
*
|
||||
* THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER SO IS
|
||||
* NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.
|
||||
*/
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = uxRand();
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file configures mbed TLS for FreeRTOS. */
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H_
|
||||
#define MBEDTLS_CONFIG_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Generate errors if deprecated functions are used. */
|
||||
#define MBEDTLS_DEPRECATED_REMOVED
|
||||
|
||||
/* Place AES tables in ROM. */
|
||||
#define MBEDTLS_AES_ROM_TABLES
|
||||
|
||||
/* Enable the following cipher modes. */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
|
||||
/* Enable the following cipher padding modes. */
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/* Cipher suite configuration. */
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_NIST_OPTIM
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/* Enable all SSL alert messages. */
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/* Enable the following SSL features. */
|
||||
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#define MBEDTLS_SSL_ALPN
|
||||
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
|
||||
/* Check certificate key usage. */
|
||||
#define MBEDTLS_X509_CHECK_KEY_USAGE
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
|
||||
/* Disable platform entropy functions. */
|
||||
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
|
||||
/* Enable the following mbed TLS features. */
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_ERROR_C
|
||||
#define MBEDTLS_GCM_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_OID_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
#define MBEDTLS_PK_C
|
||||
#define MBEDTLS_PK_PARSE_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_SHA1_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_SSL_CLI_C
|
||||
#define MBEDTLS_SSL_TLS_C
|
||||
#define MBEDTLS_THREADING_ALT
|
||||
#define MBEDTLS_THREADING_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
|
||||
/* Set the memory allocation functions on FreeRTOS. */
|
||||
void * mbedtls_platform_calloc( size_t nmemb,
|
||||
size_t size );
|
||||
void mbedtls_platform_free( void * ptr );
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc
|
||||
#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free
|
||||
|
||||
/* The network send and receive functions on FreeRTOS. */
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
const unsigned char * buf,
|
||||
size_t len );
|
||||
int mbedtls_platform_recv( void * ctx,
|
||||
unsigned char * buf,
|
||||
size_t len );
|
||||
|
||||
/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network
|
||||
* transport layer. */
|
||||
#define MBEDTLS_SSL_SEND mbedtls_platform_send
|
||||
#define MBEDTLS_SSL_RECV mbedtls_platform_recv
|
||||
|
||||
/* The entropy poll function. */
|
||||
int mbedtls_platform_entropy_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen );
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* ifndef MBEDTLS_CONFIG_H_ */
|
||||
@@ -82,10 +82,10 @@ eMetricsCollectorStatus eGetNetworkStats( NetworkStats_t * pxOutNetworkStats )
|
||||
( unsigned long ) xMetrics.xOutput.uxByteCount,
|
||||
( unsigned long ) xMetrics.xOutput.uxPacketCount ) );
|
||||
|
||||
pxOutNetworkStats->ulBytesReceived = xMetrics.xInput.uxByteCount;
|
||||
pxOutNetworkStats->ulPacketsReceived = xMetrics.xInput.uxPacketCount;
|
||||
pxOutNetworkStats->ulBytesSent = xMetrics.xOutput.uxByteCount;
|
||||
pxOutNetworkStats->ulPacketsSent = xMetrics.xOutput.uxPacketCount;
|
||||
pxOutNetworkStats->uxBytesReceived = xMetrics.xInput.uxByteCount;
|
||||
pxOutNetworkStats->uxPacketsReceived = xMetrics.xInput.uxPacketCount;
|
||||
pxOutNetworkStats->uxBytesSent = xMetrics.xOutput.uxByteCount;
|
||||
pxOutNetworkStats->uxPacketsSent = xMetrics.xOutput.uxPacketCount;
|
||||
}
|
||||
|
||||
return eStatus;
|
||||
@@ -154,7 +154,7 @@ eMetricsCollectorStatus eGetOpenUdpPorts( uint16_t * pusOutUdpPortsArray,
|
||||
|
||||
MetricsType_t xMetrics = { 0 };
|
||||
BaseType_t xMetricsStatus = 0;
|
||||
uint32_t xCopyAmount = 0UL;
|
||||
size_t xCopyAmount = 0UL;
|
||||
|
||||
/* pusOutUdpPortsArray can be NULL. */
|
||||
configASSERT( pxOutNumUdpOpenPorts != NULL );
|
||||
@@ -210,8 +210,8 @@ eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnecti
|
||||
MetricsType_t xMetrics = { 0 };
|
||||
BaseType_t xMetricsStatus = 0;
|
||||
size_t xCopyAmount = 0UL;
|
||||
size_t uxIdx;
|
||||
uint32_t ulLocalIp = 0UL;
|
||||
uint32_t i;
|
||||
|
||||
/* pxOutConnectionsArray can be NULL. */
|
||||
configASSERT( pxOutNumEstablishedConnections != NULL );
|
||||
@@ -244,15 +244,15 @@ eMetricsCollectorStatus eGetEstablishedConnections( Connection_t * pxOutConnecti
|
||||
xCopyAmount = xConnectionsArrayLength;
|
||||
}
|
||||
|
||||
for( i = 0; i < xCopyAmount; i++ )
|
||||
for( uxIdx = 0; uxIdx < xCopyAmount; uxIdx++ )
|
||||
{
|
||||
pxOutConnectionsArray[ i ].ulLocalIp = ulLocalIp;
|
||||
pxOutConnectionsArray[ i ].usLocalPort =
|
||||
xMetrics.xTCPSocketList.xTCPList[ i ].usLocalPort;
|
||||
pxOutConnectionsArray[ i ].ulRemoteIp =
|
||||
xMetrics.xTCPSocketList.xTCPList[ i ].ulRemoteIP;
|
||||
pxOutConnectionsArray[ i ].usRemotePort =
|
||||
xMetrics.xTCPSocketList.xTCPList[ i ].usRemotePort;
|
||||
pxOutConnectionsArray[ uxIdx ].ulLocalIp = ulLocalIp;
|
||||
pxOutConnectionsArray[ uxIdx ].usLocalPort =
|
||||
xMetrics.xTCPSocketList.xTCPList[ uxIdx ].usLocalPort;
|
||||
pxOutConnectionsArray[ uxIdx ].ulRemoteIp =
|
||||
xMetrics.xTCPSocketList.xTCPList[ uxIdx ].ulRemoteIP;
|
||||
pxOutConnectionsArray[ uxIdx ].usRemotePort =
|
||||
xMetrics.xTCPSocketList.xTCPList[ uxIdx ].usRemotePort;
|
||||
}
|
||||
|
||||
/* Return the number of elements copied to the array. */
|
||||
|
||||
@@ -51,10 +51,10 @@ typedef enum
|
||||
*/
|
||||
typedef struct NetworkStats
|
||||
{
|
||||
uint32_t ulBytesReceived; /**< Number of bytes received. */
|
||||
uint32_t ulBytesSent; /**< Number of bytes sent. */
|
||||
uint32_t ulPacketsReceived; /**< Number of packets (ethernet frames) received. */
|
||||
uint32_t ulPacketsSent; /**< Number of packets (ethernet frames) sent. */
|
||||
size_t uxBytesReceived; /**< Number of bytes received. */
|
||||
size_t uxBytesSent; /**< Number of bytes sent. */
|
||||
size_t uxPacketsReceived; /**< Number of packets (ethernet frames) received. */
|
||||
size_t uxPacketsSent; /**< Number of packets (ethernet frames) sent. */
|
||||
} NetworkStats_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,79 +42,9 @@
|
||||
/* Interface include. */
|
||||
#include "report_builder.h"
|
||||
|
||||
/* Various JSON characters. */
|
||||
#define reportbuilderJSON_ARRAY_OPEN_MARKER '['
|
||||
#define reportbuilderJSON_ARRAY_CLOSE_MARKER ']'
|
||||
#define reportbuilderJSON_ARRAY_OBJECT_SEPARATOR ','
|
||||
|
||||
/* Helper macro to check if snprintf was successful. */
|
||||
#define reportbuilderSNPRINTF_SUCCESS( retVal, bufLen ) ( ( retVal > 0 ) && ( ( uint32_t ) retVal < bufLen ) )
|
||||
|
||||
/* Formats used to generate the JSON report. */
|
||||
#define reportbuilderJSON_PORT_OBJECT_FORMAT \
|
||||
"{" \
|
||||
"\""DEFENDER_REPORT_PORT_KEY"\": %u" \
|
||||
"},"
|
||||
|
||||
#define reportbuilderJSON_CONNECTION_OBJECT_FORMAT \
|
||||
"{" \
|
||||
"\""DEFENDER_REPORT_LOCAL_PORT_KEY"\": %u," \
|
||||
"\""DEFENDER_REPORT_REMOTE_ADDR_KEY"\": \"%u.%u.%u.%u:%u\"" \
|
||||
"},"
|
||||
|
||||
#define reportbuilderJSON_REPORT_FORMAT_PART1 \
|
||||
"{" \
|
||||
"\""DEFENDER_REPORT_HEADER_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_ID_KEY"\": %u," \
|
||||
"\""DEFENDER_REPORT_VERSION_KEY"\": \"%u.%u\"" \
|
||||
"}," \
|
||||
"\""DEFENDER_REPORT_METRICS_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_TCP_LISTENING_PORTS_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_PORTS_KEY"\": "
|
||||
|
||||
#define reportbuilderJSON_REPORT_FORMAT_PART2 \
|
||||
"," \
|
||||
"\""DEFENDER_REPORT_TOTAL_KEY"\": %u" \
|
||||
"}," \
|
||||
"\""DEFENDER_REPORT_UDP_LISTENING_PORTS_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_PORTS_KEY"\": "
|
||||
|
||||
#define reportbuilderJSON_REPORT_FORMAT_PART3 \
|
||||
"," \
|
||||
"\""DEFENDER_REPORT_TOTAL_KEY"\": %u" \
|
||||
"}," \
|
||||
"\""DEFENDER_REPORT_NETWORK_STATS_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_BYTES_IN_KEY"\": %u," \
|
||||
"\""DEFENDER_REPORT_BYTES_OUT_KEY"\": %u," \
|
||||
"\""DEFENDER_REPORT_PKTS_IN_KEY"\": %u," \
|
||||
"\""DEFENDER_REPORT_PKTS_OUT_KEY"\": %u" \
|
||||
"}," \
|
||||
"\""DEFENDER_REPORT_TCP_CONNECTIONS_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_ESTABLISHED_CONNECTIONS_KEY"\": {" \
|
||||
"\""DEFENDER_REPORT_CONNECTIONS_KEY"\": "
|
||||
|
||||
#define reportbuilderJSON_REPORT_FORMAT_PART4 \
|
||||
"," \
|
||||
"\""DEFENDER_REPORT_TOTAL_KEY"\": %u" \
|
||||
"}" \
|
||||
"}" \
|
||||
"}," \
|
||||
"\""DEFENDER_REPORT_CUSTOM_METRICS_KEY"\": {" \
|
||||
"\"stack_high_water_mark\": [" \
|
||||
"{" \
|
||||
"\""DEFENDER_REPORT_NUMBER_KEY"\": %u" \
|
||||
"}" \
|
||||
"]," \
|
||||
"\"task_numbers\": [" \
|
||||
"{" \
|
||||
"\""DEFENDER_REPORT_NUMBER_LIST_KEY"\": "
|
||||
|
||||
#define reportbuilderJSON_REPORT_FORMAT_PART5 \
|
||||
"}" \
|
||||
"]" \
|
||||
"}" \
|
||||
"}"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -197,13 +127,13 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
||||
uint32_t xBufferLength,
|
||||
size_t xBufferLength,
|
||||
const uint16_t * pusOpenPortsArray,
|
||||
uint32_t xOpenPortsArrayLength,
|
||||
uint32_t * pxOutCharsWritten )
|
||||
size_t xOpenPortsArrayLength,
|
||||
size_t * pxOutCharsWritten )
|
||||
{
|
||||
char * pcCurrentWritePos = pcBuffer;
|
||||
uint32_t i;
|
||||
size_t uxIdx;
|
||||
size_t xRemainingBufferLength = xBufferLength;
|
||||
int32_t lCharactersWritten;
|
||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||
@@ -215,7 +145,7 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
||||
/* Write the JSON array open marker. */
|
||||
if( xRemainingBufferLength > 1 )
|
||||
{
|
||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
||||
*pcCurrentWritePos = '[';
|
||||
xRemainingBufferLength -= 1;
|
||||
pcCurrentWritePos += 1;
|
||||
}
|
||||
@@ -225,12 +155,14 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
||||
}
|
||||
|
||||
/* Write the array elements. */
|
||||
for( i = 0; ( ( i < xOpenPortsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
||||
for( uxIdx = 0U; ( ( uxIdx < xOpenPortsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); uxIdx++ )
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_PORT_OBJECT_FORMAT,
|
||||
pusOpenPortsArray[ i ] );
|
||||
"{"
|
||||
"\"" DEFENDER_REPORT_PORT_KEY "\":%u"
|
||||
"},",
|
||||
( unsigned int ) pusOpenPortsArray[ uxIdx ] );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -255,7 +187,7 @@ static eReportBuilderStatus prvWritePortsArray( char * pcBuffer,
|
||||
/* Write the JSON array close marker. */
|
||||
if( xRemainingBufferLength > 1 )
|
||||
{
|
||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
||||
*pcCurrentWritePos = ']';
|
||||
xRemainingBufferLength -= 1;
|
||||
pcCurrentWritePos += 1;
|
||||
*pxOutCharsWritten = xBufferLength - xRemainingBufferLength;
|
||||
@@ -277,7 +209,7 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
||||
size_t * pxOutCharsWritten )
|
||||
{
|
||||
char * pcCurrentWritePos = pcBuffer;
|
||||
uint32_t i;
|
||||
size_t uxIdx;
|
||||
size_t xRemainingBufferLength = xBufferLength;
|
||||
int32_t lCharactersWritten;
|
||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||
@@ -290,7 +222,7 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
||||
/* Write the JSON array open marker. */
|
||||
if( xRemainingBufferLength > 1 )
|
||||
{
|
||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
||||
*pcCurrentWritePos = '[';
|
||||
xRemainingBufferLength -= 1;
|
||||
pcCurrentWritePos += 1;
|
||||
}
|
||||
@@ -300,18 +232,21 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
||||
}
|
||||
|
||||
/* Write the array elements. */
|
||||
for( i = 0; ( ( i < xConnectionsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
||||
for( uxIdx = 0; ( ( uxIdx < xConnectionsArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); uxIdx++ )
|
||||
{
|
||||
pxConn = &( pxConnectionsArray[ i ] );
|
||||
pxConn = &( pxConnectionsArray[ uxIdx ] );
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_CONNECTION_OBJECT_FORMAT,
|
||||
pxConn->usLocalPort,
|
||||
( pxConn->ulRemoteIp >> 24 ) & 0xFF,
|
||||
( pxConn->ulRemoteIp >> 16 ) & 0xFF,
|
||||
( pxConn->ulRemoteIp >> 8 ) & 0xFF,
|
||||
( pxConn->ulRemoteIp ) & 0xFF,
|
||||
pxConn->usRemotePort );
|
||||
"{"
|
||||
"\""DEFENDER_REPORT_LOCAL_PORT_KEY"\": %u,"
|
||||
"\""DEFENDER_REPORT_REMOTE_ADDR_KEY"\": \"%u.%u.%u.%u:%u\""
|
||||
"},",
|
||||
( unsigned int ) pxConn->usLocalPort,
|
||||
( unsigned int ) ( pxConn->ulRemoteIp >> 24 ) & 0xFF,
|
||||
( unsigned int ) ( pxConn->ulRemoteIp >> 16 ) & 0xFF,
|
||||
( unsigned int ) ( pxConn->ulRemoteIp >> 8 ) & 0xFF,
|
||||
( unsigned int ) ( pxConn->ulRemoteIp ) & 0xFF,
|
||||
( unsigned int ) pxConn->usRemotePort );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -336,7 +271,7 @@ static eReportBuilderStatus prvWriteConnectionsArray( char * pcBuffer,
|
||||
/* Write the JSON array close marker. */
|
||||
if( xRemainingBufferLength > 1 )
|
||||
{
|
||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
||||
*pcCurrentWritePos = ']';
|
||||
xRemainingBufferLength -= 1;
|
||||
pcCurrentWritePos += 1;
|
||||
*pxOutCharsWritten = xBufferLength - xRemainingBufferLength;
|
||||
@@ -358,7 +293,7 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||
size_t * pxOutCharsWritten )
|
||||
{
|
||||
char * pcCurrentWritePos = pcBuffer;
|
||||
uint32_t i;
|
||||
size_t uxIdx;
|
||||
size_t xRemainingBufferLength = xBufferLength;
|
||||
int32_t lCharactersWritten;
|
||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||
@@ -370,7 +305,7 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||
/* Write the JSON array open marker. */
|
||||
if( xRemainingBufferLength > 1 )
|
||||
{
|
||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_OPEN_MARKER;
|
||||
*pcCurrentWritePos = '[';
|
||||
xRemainingBufferLength -= 1;
|
||||
pcCurrentWritePos += 1;
|
||||
}
|
||||
@@ -380,12 +315,12 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||
}
|
||||
|
||||
/* Write the array elements. */
|
||||
for( i = 0; ( ( i < xTaskStatusArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); i++ )
|
||||
for( uxIdx = 0; ( ( uxIdx < xTaskStatusArrayLength ) && ( eStatus == eReportBuilderSuccess ) ); uxIdx++ )
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
"%u,",
|
||||
pxTaskStatusArray[ i ].xTaskNumber );
|
||||
( unsigned int ) pxTaskStatusArray[ uxIdx ].xTaskNumber );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -410,7 +345,7 @@ static eReportBuilderStatus prvWriteTaskIdArray( char * pcBuffer,
|
||||
/* Write the JSON array close marker. */
|
||||
if( xRemainingBufferLength > 1 )
|
||||
{
|
||||
*pcCurrentWritePos = reportbuilderJSON_ARRAY_CLOSE_MARKER;
|
||||
*pcCurrentWritePos = ']';
|
||||
xRemainingBufferLength -= 1;
|
||||
pcCurrentWritePos += 1;
|
||||
*pxOutCharsWritten = xBufferLength - xRemainingBufferLength;
|
||||
@@ -435,7 +370,7 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||
{
|
||||
char * pcCurrentWritePos = pcBuffer;
|
||||
size_t xRemainingBufferLength = xBufferLength;
|
||||
uint32_t bufferWritten;
|
||||
size_t bufferWritten;
|
||||
eReportBuilderStatus eStatus = eReportBuilderSuccess;
|
||||
int32_t lCharactersWritten;
|
||||
|
||||
@@ -463,10 +398,17 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_REPORT_FORMAT_PART1,
|
||||
ulReportId,
|
||||
ulMajorReportVersion,
|
||||
ulMinorReportVersion );
|
||||
"{"
|
||||
"\""DEFENDER_REPORT_HEADER_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_ID_KEY"\": %u,"
|
||||
"\""DEFENDER_REPORT_VERSION_KEY"\": \"%u.%u\""
|
||||
"},"
|
||||
"\""DEFENDER_REPORT_METRICS_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_TCP_LISTENING_PORTS_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_PORTS_KEY"\": ",
|
||||
( unsigned int ) ulReportId,
|
||||
( unsigned int ) ulMajorReportVersion,
|
||||
( unsigned int ) ulMinorReportVersion );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -505,8 +447,12 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_REPORT_FORMAT_PART2,
|
||||
pxMetrics->xOpenTcpPortsArrayLength );
|
||||
","
|
||||
"\""DEFENDER_REPORT_TOTAL_KEY"\": %u"
|
||||
"},"
|
||||
"\""DEFENDER_REPORT_UDP_LISTENING_PORTS_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_PORTS_KEY"\": ",
|
||||
( unsigned int ) pxMetrics->xOpenTcpPortsArrayLength );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -545,13 +491,23 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_REPORT_FORMAT_PART3,
|
||||
pxMetrics->xOpenUdpPortsArrayLength,
|
||||
pxMetrics->pxNetworkStats->ulBytesReceived,
|
||||
pxMetrics->pxNetworkStats->ulBytesSent,
|
||||
pxMetrics->pxNetworkStats->ulPacketsReceived,
|
||||
pxMetrics->pxNetworkStats->ulPacketsSent,
|
||||
DEFENDER_REPORT_ESTABLISHED_CONNECTIONS_KEY );
|
||||
","
|
||||
"\""DEFENDER_REPORT_TOTAL_KEY"\": %u"
|
||||
"},"
|
||||
"\""DEFENDER_REPORT_NETWORK_STATS_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_BYTES_IN_KEY"\": %u,"
|
||||
"\""DEFENDER_REPORT_BYTES_OUT_KEY"\": %u,"
|
||||
"\""DEFENDER_REPORT_PKTS_IN_KEY"\": %u,"
|
||||
"\""DEFENDER_REPORT_PKTS_OUT_KEY"\": %u"
|
||||
"},"
|
||||
"\""DEFENDER_REPORT_TCP_CONNECTIONS_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_ESTABLISHED_CONNECTIONS_KEY"\": {"
|
||||
"\""DEFENDER_REPORT_CONNECTIONS_KEY"\": ",
|
||||
( unsigned int ) pxMetrics->xOpenUdpPortsArrayLength,
|
||||
( unsigned int ) pxMetrics->pxNetworkStats->uxBytesReceived,
|
||||
( unsigned int ) pxMetrics->pxNetworkStats->uxBytesSent,
|
||||
( unsigned int ) pxMetrics->pxNetworkStats->uxPacketsReceived,
|
||||
( unsigned int ) pxMetrics->pxNetworkStats->uxPacketsSent );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -590,9 +546,22 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_REPORT_FORMAT_PART4,
|
||||
pxMetrics->xEstablishedConnectionsArrayLength,
|
||||
pxMetrics->ulStackHighWaterMark );
|
||||
","
|
||||
"\""DEFENDER_REPORT_TOTAL_KEY"\": %u"
|
||||
"}"
|
||||
"}"
|
||||
"},"
|
||||
"\""DEFENDER_REPORT_CUSTOM_METRICS_KEY"\": {"
|
||||
"\"stack_high_water_mark\": ["
|
||||
"{"
|
||||
"\""DEFENDER_REPORT_NUMBER_KEY"\": %u"
|
||||
"}"
|
||||
"],"
|
||||
"\"task_numbers\": ["
|
||||
"{"
|
||||
"\""DEFENDER_REPORT_NUMBER_LIST_KEY"\": ",
|
||||
( unsigned int ) pxMetrics->xEstablishedConnectionsArrayLength,
|
||||
( unsigned int ) pxMetrics->ulStackHighWaterMark );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
@@ -631,7 +600,10 @@ eReportBuilderStatus eGenerateJsonReport( char * pcBuffer,
|
||||
{
|
||||
lCharactersWritten = snprintf( pcCurrentWritePos,
|
||||
xRemainingBufferLength,
|
||||
reportbuilderJSON_REPORT_FORMAT_PART5 );
|
||||
"}"
|
||||
"]"
|
||||
"}"
|
||||
"}" );
|
||||
|
||||
if( !reportbuilderSNPRINTF_SUCCESS( lCharactersWritten, xRemainingBufferLength ) )
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <intrin.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* TCP/IP stack includes. */
|
||||
@@ -50,77 +50,31 @@
|
||||
/* Demo Specific configs. */
|
||||
#include "demo_config.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Prototypes for the demos that can be started from this project. Note the
|
||||
* Shadow demo is not actually started until the network is already, which is
|
||||
* indicated by vApplicationIPNetworkEventHook() executing - hence
|
||||
* vStartShadowDemo() is called from inside vApplicationIPNetworkEventHook().
|
||||
*/
|
||||
extern void vStartShadowDemo( void );
|
||||
extern void prvShadowDemoTask( void * pvParameters );
|
||||
extern void vPlatformInitIpStack( void );
|
||||
|
||||
/*
|
||||
* Just seeds the simple pseudo random number generator.
|
||||
*
|
||||
* !!! NOTE !!!
|
||||
* This is not a secure method of generating random numbers and production
|
||||
* devices should use a true random number generator (TRNG).
|
||||
*/
|
||||
static void prvSRand( UBaseType_t ulSeed );
|
||||
|
||||
/*
|
||||
* Miscellaneous initialization including preparing the logging and seeding the
|
||||
* random number generator.
|
||||
*/
|
||||
static void prvMiscInitialisation( void );
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. */
|
||||
static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
|
||||
static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
|
||||
static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
|
||||
|
||||
/* Set the following constant to pdTRUE to log using the method indicated by the
|
||||
* name of the constant, or pdFALSE to not log using the method indicated by the
|
||||
* name of the constant. Options include to standard out (xLogToStdout), to a disk
|
||||
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
|
||||
* then UDP messages are sent to the IP address configured as the UDP logging server
|
||||
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
|
||||
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
|
||||
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static UBaseType_t ulNextRand;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/***
|
||||
* See https://www.FreeRTOS.org/iot-device-shadow for configuration and usage instructions.
|
||||
***/
|
||||
vPlatformInitLogging();
|
||||
|
||||
/* Miscellaneous initialization including preparing the logging and seeding
|
||||
* the random number generator. */
|
||||
prvMiscInitialisation();
|
||||
/* This example uses a single application task, which shows that how to
|
||||
* use Device Shadow library to generate and validate AWS IoT Device Shadow
|
||||
* MQTT topics, and use the coreMQTT library to communicate with the AWS IoT
|
||||
* Device Shadow service.
|
||||
*/
|
||||
xTaskCreate( prvShadowDemoTask, /* Function that implements the task. */
|
||||
"DemoTask", /* Text name for the task - only used for debugging. */
|
||||
democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
|
||||
NULL, /* Task parameter - not used in this case. */
|
||||
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
|
||||
NULL ); /* Used to pass out a handle to the created task - not used in this case. */
|
||||
|
||||
/* Initialize the network interface.
|
||||
*
|
||||
***NOTE*** Tasks that use the network are created in the network event hook
|
||||
* when the network is connected and ready for use (see the implementation of
|
||||
* vApplicationIPNetworkEventHook() below). The address values passed in here
|
||||
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
|
||||
* but a DHCP server cannot be contacted. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
/* Initialize the FreeRTOS+TCP Stack */
|
||||
vPlatformInitIpStack();
|
||||
|
||||
/* Start the RTOS scheduler. */
|
||||
vTaskStartScheduler();
|
||||
@@ -129,256 +83,13 @@ int main( void )
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
* FreeRTOS web site for more details.
|
||||
*/
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
__debugbreak();
|
||||
configASSERT( 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 )
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
/* Create the tasks that use the IP stack if they have not already been
|
||||
* created. */
|
||||
if( xTasksAlreadyCreated == pdFALSE )
|
||||
{
|
||||
/* Demos that use the network are created after the network is
|
||||
* up. */
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
vStartShadowDemo();
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
LogInfo( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
|
||||
LogInfo( ( "Subnet Mask: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
|
||||
LogInfo( ( "Gateway Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
|
||||
LogInfo( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine )
|
||||
{
|
||||
volatile uint32_t ulBlockVariable = 0UL;
|
||||
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
( void ) pcFileName;
|
||||
( void ) ulLineNumber;
|
||||
|
||||
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||
|
||||
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||
* this function to be exited. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
{
|
||||
while( ulBlockVariable == 0UL )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/*
|
||||
* Utility function to generate a pseudo random number.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( UBaseType_t ulSeed )
|
||||
{
|
||||
/* Utility function to seed the pseudo random number generator. */
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvMiscInitialisation( void )
|
||||
{
|
||||
time_t xTimeNow;
|
||||
uint32_t ulLoggingIPAddress;
|
||||
uint32_t ulRandomNumbers[ 4 ];
|
||||
|
||||
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
|
||||
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
|
||||
|
||||
/*
|
||||
* Seed random number generator.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
time( &xTimeNow );
|
||||
LogDebug( ( "Seed for randomizer: %lu\n", xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
|
||||
LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ulRandomNumbers[ 0 ], ulRandomNumbers[ 1 ], ulRandomNumbers[ 2 ], ulRandomNumbers[ 3 ] ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
* address plus this name. */
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback that provides the inputs necessary to generate a randomized TCP
|
||||
* Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
|
||||
* THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
|
||||
* SYSTEMS.
|
||||
*/
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return uxRand();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Set *pulNumber to a random number, and return pdTRUE. When the random number
|
||||
* generator is broken, it shall return pdFALSE.
|
||||
*
|
||||
* THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER SO IS
|
||||
* NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.
|
||||
*/
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = uxRand();
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
/**
|
||||
* @brief The length of #democonfigTHING_NAME.
|
||||
*/
|
||||
#define THING_NAME_LENGTH ( ( uint16_t ) ( sizeof( democonfigTHING_NAME ) - 1 ) )
|
||||
#define THING_NAME_LENGTH ( ( uint16_t ) ( sizeof( democonfigTHING_NAME ) - 1 ) )
|
||||
|
||||
/**
|
||||
* @brief The length of #democonfigSHADOW_NAME.
|
||||
@@ -216,8 +216,8 @@
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Each compilation unit that consumes the NetworkContext must define it.
|
||||
/**
|
||||
* @brief Each compilation unit that consumes the NetworkContext must define it.
|
||||
* It should contain a single pointer to the type of your desired transport.
|
||||
* When using multiple transports in the same compilation unit, define this pointer as void *.
|
||||
*
|
||||
@@ -348,7 +348,7 @@ static void prvUpdateAcceptedHandler( MQTTPublishInfo_t * pxPublishInfo );
|
||||
* @param[in] pvParameters Parameters as passed at the time of task creation. Not
|
||||
* used in this example.
|
||||
*/
|
||||
static void prvShadowDemoTask( void * pvParameters );
|
||||
void prvShadowDemoTask( void * pvParameters );
|
||||
|
||||
/**
|
||||
* @brief Process payload from `/delete/rejected` topic.
|
||||
@@ -768,25 +768,6 @@ static void prvEventCallback( MQTTContext_t * pxMqttContext,
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* @brief Create the task that demonstrates the Device Shadow library API via a
|
||||
* MQTT mutually authenticated network connection with the AWS IoT broker.
|
||||
*/
|
||||
void vStartShadowDemo( void )
|
||||
{
|
||||
/* This example uses a single application task, which shows that how to
|
||||
* use Device Shadow library to generate and validate AWS IoT Device Shadow
|
||||
* MQTT topics, and use the coreMQTT library to communicate with the AWS IoT
|
||||
* Device Shadow service. */
|
||||
xTaskCreate( prvShadowDemoTask, /* Function that implements the task. */
|
||||
"DemoTask", /* Text name for the task - only used for debugging. */
|
||||
democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
|
||||
NULL, /* Task parameter - not used in this case. */
|
||||
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
|
||||
NULL ); /* Used to pass out a handle to the created task - not used in this case. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Entry point of shadow demo.
|
||||
*
|
||||
@@ -830,6 +811,18 @@ void prvShadowDemoTask( void * pvParameters )
|
||||
* SHADOW_MAX_DEMO_LOOP_COUNT times. */
|
||||
do
|
||||
{
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
|
||||
if( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
LogInfo( ( "Waiting for the network link up event..." ) );
|
||||
|
||||
while( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
vTaskDelay( pdMS_TO_TICKS( 1000U ) );
|
||||
}
|
||||
}
|
||||
|
||||
/****************************** Connect. ******************************/
|
||||
|
||||
xDemoStatus = xEstablishMqttSession( &xMqttContext,
|
||||
@@ -1122,6 +1115,8 @@ void prvShadowDemoTask( void * pvParameters )
|
||||
LogError( ( "Shadow Demo failed." ) );
|
||||
}
|
||||
|
||||
LogInfo( ( "-------DEMO FINISHED-------\r\n" ) );
|
||||
|
||||
/* Delete this task. */
|
||||
LogInfo( ( "Deleting Shadow Demo task." ) );
|
||||
vTaskDelete( NULL );
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" 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>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{717f029b-ade9-433a-9c05-3136171beaef}</ProjectGuid>
|
||||
<RootNamespace>DeviceShadowDemo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\AWS\device-shadow\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\AWS\device-shadow\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\AWS\device-shadow\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\AWS\device-shadow\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-shadow\source\include\shadow.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-shadow\source\include\shadow_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" />
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.h" />
|
||||
<ClInclude Include="core_mqtt_config.h" />
|
||||
<ClInclude Include="demo_config.h" />
|
||||
<ClInclude Include="shadow_config.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\device-shadow\source\shadow.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" />
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.c" />
|
||||
<ClCompile Include="..\Common\main.c" />
|
||||
<ClCompile Include="DemoTasks\ShadowDemoMainExample.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj">
|
||||
<Project>{c90e6cc5-818b-4c97-8876-0986d989387c}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj">
|
||||
<Project>{72c209c4-49a4-4942-a201-44706c9d77ec}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj">
|
||||
<Project>{be362ac0-b10b-4276-b84e-6304652ba228}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj">
|
||||
<Project>{e1016f3e-94e9-4864-9fd8-1d7c1fefbfd7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries">
|
||||
<UniqueIdentifier>{a3c730a6-e260-4aa8-9ac2-34e7b58239aa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Device Shadow">
|
||||
<UniqueIdentifier>{3162edd4-992f-40be-b044-3f4069fde765}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm">
|
||||
<UniqueIdentifier>{2d81cf16-57de-4819-90e6-1a7aa43e1ca7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT">
|
||||
<UniqueIdentifier>{88ec2b7c-46b1-4922-a846-17df01fcc563}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreJSON">
|
||||
<UniqueIdentifier>{561e7533-6144-46a2-8d3c-cfae00f253cc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files">
|
||||
<UniqueIdentifier>{5bce4131-4166-4cf0-a174-9501b84a59d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Device Shadow\include">
|
||||
<UniqueIdentifier>{c90b8caf-7b86-4667-a408-616c9de28018}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm\include">
|
||||
<UniqueIdentifier>{ee35951a-05c0-47e4-89b5-0b03d6df4c31}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\include">
|
||||
<UniqueIdentifier>{0059dfb9-954b-4be9-a039-33bd0d6e59d8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\interface">
|
||||
<UniqueIdentifier>{5b02b44f-c821-4ccf-8653-d4ee6317fab1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreJSON\include">
|
||||
<UniqueIdentifier>{8d194642-3f5f-4ad2-aae2-c1822303b0d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper">
|
||||
<UniqueIdentifier>{a54febab-66c8-49c4-8f14-66b98f5507ad}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport">
|
||||
<UniqueIdentifier>{3f9ffdaf-339e-4ec0-8191-dc24bc8cfa78}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include">
|
||||
<UniqueIdentifier>{9ef7993e-bc65-4a5d-8004-f7c59786ba20}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\include">
|
||||
<UniqueIdentifier>{c31d06d1-374f-46ab-b93f-f9a6e7411114}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports">
|
||||
<UniqueIdentifier>{cf1a86db-4855-4457-9da6-8fa329e4e85e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp">
|
||||
<UniqueIdentifier>{dc36bf1d-c1a0-49a3-ae7f-e5030fcacf3b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config">
|
||||
<UniqueIdentifier>{bff12cfa-4535-4d9d-8177-c40bf4fd3fb9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-shadow\source\include\shadow.h">
|
||||
<Filter>Additional Libraries\AWS IoT Device Shadow\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\device-shadow\source\include\shadow_config_defaults.h">
|
||||
<Filter>Additional Libraries\AWS IoT Device Shadow\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h">
|
||||
<Filter>Additional Libraries\Backoff Algorithm\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h">
|
||||
<Filter>Additional Libraries\coreMQTT\interface</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h">
|
||||
<Filter>Additional Libraries\coreJSON\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core_mqtt_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="demo_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="shadow_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DemoTasks\ShadowDemoMainExample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\device-shadow\source\shadow.c">
|
||||
<Filter>Additional Libraries\AWS IoT Device Shadow</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c">
|
||||
<Filter>Additional Libraries\Backoff Algorithm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c">
|
||||
<Filter>Additional Libraries\coreJSON</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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.
|
||||
* https://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.
|
||||
*----------------------------------------------------------*/
|
||||
#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 0
|
||||
#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 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#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 configuration options. */
|
||||
#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
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* 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. **********************************/
|
||||
|
||||
/* 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 ( 0L )
|
||||
|
||||
/* The address to which logging is sent should UDP logging be enabled. */
|
||||
#define configUDP_LOGGING_ADDR0 192
|
||||
#define configUDP_LOGGING_ADDR1 168
|
||||
#define configUDP_LOGGING_ADDR2 0
|
||||
#define configUDP_LOGGING_ADDR3 11
|
||||
|
||||
/* 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 0x11
|
||||
#define configMAC_ADDR3 0x11
|
||||
#define configMAC_ADDR4 0x11
|
||||
#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 10
|
||||
#define configIP_ADDR1 10
|
||||
#define configIP_ADDR2 10
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* 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 10
|
||||
#define configGATEWAY_ADDR1 10
|
||||
#define configGATEWAY_ADDR2 10
|
||||
#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 208
|
||||
#define configDNS_SERVER_ADDR1 67
|
||||
#define configDNS_SERVER_ADDR2 222
|
||||
#define configDNS_SERVER_ADDR3 222
|
||||
|
||||
/* 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 0
|
||||
#define configNET_MASK2 0
|
||||
#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
|
||||
|
||||
/* 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,
|
||||
... );
|
||||
#define configPRINTF( X ) vLoggingPrintf X
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
@@ -1,309 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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://aws.amazon.com/freertos
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* See the following URL for configuration information.
|
||||
* https://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 0
|
||||
#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 ( 2000 )
|
||||
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
|
||||
|
||||
/* Include support for LLMNR: Link-local Multicast Name Resolution
|
||||
* (non-Microsoft) */
|
||||
#define ipconfigUSE_LLMNR ( 0 )
|
||||
|
||||
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
|
||||
#define ipconfigUSE_NBNS ( 0 )
|
||||
|
||||
/* 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 ( 64 )
|
||||
#define ipconfigDNS_CACHE_ENTRIES ( 4 )
|
||||
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
|
||||
|
||||
/* 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:
|
||||
* https://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
|
||||
* https://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 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 ( 5000 / 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 ( 120000 / 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 the TCP socket wake context with a callback. */
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK_WITH_CONTEXT ( 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 1200
|
||||
|
||||
/* 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
|
||||
|
||||
/* 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 0
|
||||
|
||||
/* 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 2
|
||||
|
||||
/* 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 ( 5000 )
|
||||
|
||||
/* 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
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file configures mbed TLS for FreeRTOS. */
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H_
|
||||
#define MBEDTLS_CONFIG_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Generate errors if deprecated functions are used. */
|
||||
#define MBEDTLS_DEPRECATED_REMOVED
|
||||
|
||||
/* Place AES tables in ROM. */
|
||||
#define MBEDTLS_AES_ROM_TABLES
|
||||
|
||||
/* Enable the following cipher modes. */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
|
||||
/* Enable the following cipher padding modes. */
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/* Cipher suite configuration. */
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_NIST_OPTIM
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/* Enable all SSL alert messages. */
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/* Enable the following SSL features. */
|
||||
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#define MBEDTLS_SSL_ALPN
|
||||
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
|
||||
/* Check certificate key usage. */
|
||||
#define MBEDTLS_X509_CHECK_KEY_USAGE
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
|
||||
/* Disable platform entropy functions. */
|
||||
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
|
||||
/* Enable the following mbed TLS features. */
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_ERROR_C
|
||||
#define MBEDTLS_GCM_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_OID_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
#define MBEDTLS_PK_C
|
||||
#define MBEDTLS_PK_PARSE_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_SHA1_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_SSL_CLI_C
|
||||
#define MBEDTLS_SSL_TLS_C
|
||||
#define MBEDTLS_THREADING_ALT
|
||||
#define MBEDTLS_THREADING_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
|
||||
/* Set the memory allocation functions on FreeRTOS. */
|
||||
void * mbedtls_platform_calloc( size_t nmemb,
|
||||
size_t size );
|
||||
void mbedtls_platform_free( void * ptr );
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc
|
||||
#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free
|
||||
|
||||
/* The network send and receive functions on FreeRTOS. */
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
const unsigned char * buf,
|
||||
size_t len );
|
||||
int mbedtls_platform_recv( void * ctx,
|
||||
unsigned char * buf,
|
||||
size_t len );
|
||||
|
||||
/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network
|
||||
* transport layer. */
|
||||
#define MBEDTLS_SSL_SEND mbedtls_platform_send
|
||||
#define MBEDTLS_SSL_RECV mbedtls_platform_recv
|
||||
|
||||
/* The entropy poll function. */
|
||||
int mbedtls_platform_entropy_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen );
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* ifndef MBEDTLS_CONFIG_H_ */
|
||||
@@ -1,25 +1,79 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29215.179
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Device_Shadow_Demo", "Device_Shadow_Demo.vcxproj", "{717F029B-ADE9-433A-9C05-3136171BEAEF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Statically Linked Libraries", "Statically Linked Libraries", "{DD2D75A0-EA94-448B-A552-4A68E8336436}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
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
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Debug|x64.Build.0 = Debug|x64
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Debug|x86.Build.0 = Debug|Win32
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Release|x64.ActiveCfg = Release|x64
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Release|x64.Build.0 = Release|x64
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Release|x86.ActiveCfg = Release|Win32
|
||||
{717F029B-ADE9-433A-9C05-3136171BEAEF}.Release|x86.Build.0 = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.Build.0 = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.ActiveCfg = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.Build.0 = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x86.Build.0 = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.Build.0 = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x86.Build.0 = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.ActiveCfg = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.Build.0 = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x86.Build.0 = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.Build.0 = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x86.Build.0 = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.ActiveCfg = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.Build.0 = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x86.ActiveCfg = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x86.Build.0 = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.Build.0 = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.ActiveCfg = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.Build.0 = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {150F08BF-9D61-4CC2-8DBF-1335172A1EA4}
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C} = {DD2D75A0-EA94-448B-A552-4A68E8336436}
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC} = {DD2D75A0-EA94-448B-A552-4A68E8336436}
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228} = {DD2D75A0-EA94-448B-A552-4A68E8336436}
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7} = {DD2D75A0-EA94-448B-A552-4A68E8336436}
|
||||
EndGlobalSection
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {03924B69-9775-47B9-9704-9108BBFF7D30}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import argparse
|
||||
from cryptography import x509
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
|
||||
KEY_OUT_NAME = "corePKCS11_Claim_Key.dat"
|
||||
CERT_OUT_NAME = "corePKCS11_Claim_Certificate.dat"
|
||||
KEY_OUT_NAME = f"{os.getcwd()}\\corePKCS11_Claim_Key.dat"
|
||||
CERT_OUT_NAME = f"{os.getcwd()}\\corePKCS11_Claim_Certificate.dat"
|
||||
|
||||
script_file_dir_abs_path = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
def convert_pem_to_der(cert_pem, key_pem):
|
||||
# Convert certificate from PEM to DER
|
||||
@@ -18,7 +20,7 @@ def convert_pem_to_der(cert_pem, key_pem):
|
||||
serialization.PrivateFormat.TraditionalOpenSSL,
|
||||
serialization.NoEncryption(),
|
||||
)
|
||||
with open(f"../{KEY_OUT_NAME}", "wb") as key_out:
|
||||
with open(f"{KEY_OUT_NAME}", "wb") as key_out:
|
||||
key_out.write(key_der)
|
||||
print(
|
||||
f"Successfully converted key PEM to DER. Output file named: {KEY_OUT_NAME}"
|
||||
@@ -26,7 +28,7 @@ def convert_pem_to_der(cert_pem, key_pem):
|
||||
|
||||
cert = x509.load_pem_x509_certificate(
|
||||
bytes(cert_pem, "utf-8"), default_backend())
|
||||
with open(f"../{CERT_OUT_NAME}", "wb") as cert_out:
|
||||
with open(f"{CERT_OUT_NAME}", "wb") as cert_out:
|
||||
cert_out.write(cert.public_bytes(serialization.Encoding.DER))
|
||||
|
||||
print(
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
import os
|
||||
import boto3
|
||||
import botocore
|
||||
import argparse
|
||||
|
||||
KEY_OUT_NAME = "corePKCS11_Claim_Key.dat"
|
||||
CERT_OUT_NAME = "corePKCS11_Claim_Certificate.dat"
|
||||
KEY_OUT_NAME = f"{os.getcwd()}\\corePKCS11_Claim_Key.dat"
|
||||
CERT_OUT_NAME = f"{os.getcwd()}\\corePKCS11_Claim_Certificate.dat"
|
||||
|
||||
THING_PRIVATE_KEY_NAME = "corePKCS11_Key.dat"
|
||||
THING_PUBLIC_KEY_NAME = "corePKCS11_PubKey.dat"
|
||||
THING_CERT_NAME = "corePKCS11_Certificate.dat"
|
||||
THING_PRIVATE_KEY_NAME = f"{os.getcwd()}\\corePKCS11_Key.dat"
|
||||
THING_PUBLIC_KEY_NAME = f"{os.getcwd()}\\corePKCS11_PubKey.dat"
|
||||
THING_CERT_NAME = f"{os.getcwd()}\\corePKCS11_Certificate.dat"
|
||||
|
||||
RESOURCE_STACK_NAME = "FPDemoStack"
|
||||
|
||||
@@ -125,37 +126,45 @@ def delete_resources():
|
||||
|
||||
# Delete the files created by the demo and reset demo_config.h
|
||||
def reset_files():
|
||||
script_file_dir_abs_path = os.path.abspath(os.path.dirname(__file__))
|
||||
# Remove Claim credentials
|
||||
if os.path.exists(f"../{KEY_OUT_NAME}"):
|
||||
os.remove(f"../{KEY_OUT_NAME}")
|
||||
if os.path.exists(f"../{CERT_OUT_NAME}"):
|
||||
os.remove(f"../{CERT_OUT_NAME}")
|
||||
if os.path.exists(f"{KEY_OUT_NAME}"):
|
||||
os.remove(f"{KEY_OUT_NAME}")
|
||||
if os.path.exists(f"{CERT_OUT_NAME}"):
|
||||
os.remove(f"{CERT_OUT_NAME}")
|
||||
|
||||
# Remove demo-generated Thing credentials
|
||||
if os.path.exists(f"../{THING_PRIVATE_KEY_NAME}"):
|
||||
os.remove(f"../{THING_PRIVATE_KEY_NAME}")
|
||||
if os.path.exists(f"../{THING_PUBLIC_KEY_NAME}"):
|
||||
os.remove(f"../{THING_PUBLIC_KEY_NAME}")
|
||||
if os.path.exists(f"../{THING_CERT_NAME}"):
|
||||
os.remove(f"../{THING_CERT_NAME}")
|
||||
if os.path.exists(f"{THING_PRIVATE_KEY_NAME}"):
|
||||
os.remove(f"{THING_PRIVATE_KEY_NAME}")
|
||||
if os.path.exists(f"{THING_PUBLIC_KEY_NAME}"):
|
||||
os.remove(f"{THING_PUBLIC_KEY_NAME}")
|
||||
if os.path.exists(f"{THING_CERT_NAME}"):
|
||||
os.remove(f"{THING_CERT_NAME}")
|
||||
|
||||
# Reset demo_config.h
|
||||
template_file = open("demo_config_empty.templ", 'r')
|
||||
template_file = open(f"{script_file_dir_abs_path}/demo_config_empty.templ", 'r')
|
||||
file_text = template_file.read()
|
||||
|
||||
header_file = open("../demo_config.h", "w")
|
||||
header_file = open(f"{script_file_dir_abs_path}/../demo_config.h", "w")
|
||||
header_file.write(file_text)
|
||||
header_file.close()
|
||||
template_file.close()
|
||||
print("Credentials removed and demo_config.h reset.")
|
||||
|
||||
# Get arguments
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(description="Fleet Provisioning Demo setup script.")
|
||||
parser.add_argument("--force", action="store_true", help="Used to skip the user prompt before executing.")
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
# Parse arguments and execute appropriate functions
|
||||
def main():
|
||||
# Check arguments and go appropriately
|
||||
args = get_args();
|
||||
print("\nThis script will delete ALL Things, credentials, and resources which were created by demo_setup.py and the Fleet Provisioning demo.")
|
||||
print("It may take several minutes for all of the resources to be deleted.")
|
||||
if input("Are you sure you want to do this? (y/n) ") == "y":
|
||||
if args.force or input("Are you sure you want to do this? (y/n) ") == "y":
|
||||
print()
|
||||
reset_files()
|
||||
delete_resources()
|
||||
|
||||
@@ -129,8 +129,7 @@ extern void vLoggingPrintf( const char * pcFormatString,
|
||||
*
|
||||
* #define democonfigROOT_CA_PEM "...insert here..."
|
||||
*/
|
||||
#define democonfigROOT_CA_PEM
|
||||
"-----BEGIN CERTIFICATE-----\n" \
|
||||
#define democonfigROOT_CA_PEM "-----BEGIN CERTIFICATE-----\n" \
|
||||
"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n" \
|
||||
"ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n" \
|
||||
"b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n" \
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import boto3
|
||||
import botocore
|
||||
from convert_credentials_to_der import convert_pem_to_der
|
||||
|
||||
KEY_OUT_NAME = "corePKCS11_Claim_Key.dat"
|
||||
CERT_OUT_NAME = "corePKCS11_Claim_Certificate.dat"
|
||||
KEY_OUT_NAME = f"{os.getcwd()}\\corePKCS11_Claim_Key.dat"
|
||||
CERT_OUT_NAME = f"{os.getcwd()}\\corePKCS11_Claim_Certificate.dat"
|
||||
|
||||
RESOURCE_STACK_NAME = "FPDemoStack"
|
||||
|
||||
script_file_dir_abs_path = os.path.abspath(os.path.dirname(__file__))
|
||||
cf = boto3.client("cloudformation")
|
||||
iot = boto3.client("iot")
|
||||
|
||||
@@ -44,7 +47,7 @@ def create_resources():
|
||||
+ "\nView the stack in the CloudFormation console here:\n" + convert_cf_arn_to_link(stack_response["StackId"]))
|
||||
else:
|
||||
# Read the cloudformation template file contained in the same directory
|
||||
cf_template_file = open("cloudformation_template.json", "r")
|
||||
cf_template_file = open(f"{script_file_dir_abs_path}/cloudformation_template.json", "r")
|
||||
cf_template = cf_template_file.read()
|
||||
cf_template_file.close()
|
||||
|
||||
@@ -93,24 +96,31 @@ def create_credentials():
|
||||
def update_demo_config():
|
||||
endpoint = iot.describe_endpoint(endpointType='iot:Data-ATS')
|
||||
|
||||
template_file = open("demo_config.templ", 'r')
|
||||
template_file = open(f"{script_file_dir_abs_path}/demo_config.templ", 'r')
|
||||
file_text = template_file.read()
|
||||
file_text = file_text.replace(
|
||||
"<IOTEndpoint>", "\"" + endpoint["endpointAddress"] + "\"")
|
||||
|
||||
header_file = open("../demo_config.h", "w")
|
||||
header_file = open(f"{script_file_dir_abs_path}/../demo_config.h", "w")
|
||||
header_file.write(file_text)
|
||||
header_file.close()
|
||||
template_file.close()
|
||||
print("Successfully updated demo_config.h")
|
||||
|
||||
# Get arguments
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(description="Fleet Provisioning Demo setup script.")
|
||||
parser.add_argument("--force", action="store_true", help="Used to skip the user prompt before executing.")
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
# Parse arguments and execute appropriate functions
|
||||
def main():
|
||||
# Check arguments and go appropriately
|
||||
args = get_args();
|
||||
print("\nThis script will set up the AWS resources required for the Fleet Provisioning demo.")
|
||||
print("It may take several minutes for the resources to be provisioned.")
|
||||
if input("Are you sure you want to do this? (y/n) ") == "y":
|
||||
if args.force or input("Are you sure you want to do this? (y/n) ") == "y":
|
||||
print()
|
||||
create_resources()
|
||||
create_credentials()
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
#include "mqtt_pkcs11_demo_helpers.h"
|
||||
#include "pkcs11_operations.h"
|
||||
#include "tinycbor_serializer.h"
|
||||
#include "using_mbedtls_pkcs11.h"
|
||||
|
||||
/**
|
||||
* These configurations are required. Throw compilation error if it is not
|
||||
@@ -520,12 +519,6 @@ static bool prvUnsubscribeFromRegisterThingResponseTopics( void )
|
||||
*/
|
||||
void vStartFleetProvisioningDemo()
|
||||
{
|
||||
/* Configure mbedTLS to use FreeRTOS specific threading function. */
|
||||
mbedtls_threading_set_alt( mbedtls_platform_mutex_init,
|
||||
mbedtls_platform_mutex_free,
|
||||
mbedtls_platform_mutex_lock,
|
||||
mbedtls_platform_mutex_unlock );
|
||||
|
||||
/* This example uses a single application task, which shows that how to use
|
||||
* Fleet Provisioning library to generate and sign certificates with AWS IoT
|
||||
* and create new IoT Things using the AWS IoT Fleet Provisioning API */
|
||||
@@ -569,6 +562,19 @@ int prvFleetProvisioningTask( void * pvParameters )
|
||||
|
||||
do
|
||||
{
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
|
||||
/* Wait for network to link up. */
|
||||
if( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
LogInfo( ( "Waiting for the network link up event..." ) );
|
||||
|
||||
while( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
vTaskDelay( pdMS_TO_TICKS( 1000U ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the buffer lengths to their max lengths. */
|
||||
xCertificateLength = fpdemoCERT_BUFFER_LENGTH;
|
||||
xCertificateIdLength = fpdemoCERT_ID_BUFFER_LENGTH;
|
||||
@@ -839,6 +845,7 @@ int prvFleetProvisioningTask( void * pvParameters )
|
||||
if( xStatus == true )
|
||||
{
|
||||
LogInfo( ( "Demo completed successfully." ) );
|
||||
LogInfo( ( "-------DEMO FINISHED-------\r\n" ) );
|
||||
}
|
||||
|
||||
/* Delete this task. */
|
||||
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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.
|
||||
* https://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.
|
||||
*----------------------------------------------------------*/
|
||||
#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_STATS_FORMATTING_FUNCTIONS 0
|
||||
#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 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#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 configuration options. */
|
||||
#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
|
||||
|
||||
/* 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. **********************************/
|
||||
|
||||
/* 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 ( 0L )
|
||||
|
||||
/* The address to which logging is sent should UDP logging be enabled. */
|
||||
#define configUDP_LOGGING_ADDR0 192
|
||||
#define configUDP_LOGGING_ADDR1 168
|
||||
#define configUDP_LOGGING_ADDR2 0
|
||||
#define configUDP_LOGGING_ADDR3 11
|
||||
|
||||
/* 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 0x11
|
||||
#define configMAC_ADDR3 0x11
|
||||
#define configMAC_ADDR4 0x11
|
||||
#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 10
|
||||
#define configIP_ADDR1 10
|
||||
#define configIP_ADDR2 10
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* 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 10
|
||||
#define configGATEWAY_ADDR1 10
|
||||
#define configGATEWAY_ADDR2 10
|
||||
#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 208
|
||||
#define configDNS_SERVER_ADDR1 67
|
||||
#define configDNS_SERVER_ADDR2 222
|
||||
#define configDNS_SERVER_ADDR3 222
|
||||
|
||||
/* 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 0
|
||||
#define configNET_MASK2 0
|
||||
#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
|
||||
|
||||
/* 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,
|
||||
... );
|
||||
#define configPRINTF( X ) vLoggingPrintf X
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
@@ -1,310 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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.
|
||||
* https://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 0
|
||||
#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 ( 2000 )
|
||||
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
|
||||
|
||||
/* Include support for LLMNR: Link-local Multicast Name Resolution
|
||||
* (non-Microsoft) */
|
||||
#define ipconfigUSE_LLMNR ( 0 )
|
||||
|
||||
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
|
||||
#define ipconfigUSE_NBNS ( 0 )
|
||||
|
||||
/* 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 ( 64 )
|
||||
#define ipconfigDNS_CACHE_ENTRIES ( 4 )
|
||||
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
|
||||
|
||||
/* 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:
|
||||
* https://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
|
||||
* https://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 ( 5000 / 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 ( 120000 / 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 the TCP socket wake context with a callback. */
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK_WITH_CONTEXT ( 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 1200
|
||||
|
||||
/* 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
|
||||
|
||||
/* 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 0
|
||||
|
||||
/* 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 2
|
||||
|
||||
/* 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 ( 5000 )
|
||||
|
||||
/* 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
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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 core_pkcs11_config.h
|
||||
* @brief PCKS#11 config options.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CORE_PKCS11_CONFIG_H_
|
||||
#define _CORE_PKCS11_CONFIG_H_
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/**************************************************/
|
||||
/******* DO NOT CHANGE the following order ********/
|
||||
/**************************************************/
|
||||
|
||||
/* Include logging header files and define logging macros in the following order:
|
||||
* 1. Include the header file "logging_levels.h".
|
||||
* 2. Define the LIBRARY_LOG_NAME and LIBRARY_LOG_LEVEL macros depending on
|
||||
* the logging configuration for PKCS #11.
|
||||
* 3. Include the header file "logging_stack.h", if logging is enabled for PKCS #11.
|
||||
*/
|
||||
#include "logging_levels.h"
|
||||
|
||||
/* Logging configuration for the PKCS #11 library. */
|
||||
#ifndef LIBRARY_LOG_NAME
|
||||
#define LIBRARY_LOG_NAME "PKCS11"
|
||||
#endif
|
||||
|
||||
#ifndef LIBRARY_LOG_LEVEL
|
||||
#define LIBRARY_LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
/* Prototype for the function used to print to console on Windows simulator
|
||||
* of FreeRTOS.
|
||||
* The function prints to the console before the network is connected;
|
||||
* then a UDP port after the network has connected. */
|
||||
extern void vLoggingPrintf( const char * pcFormatString,
|
||||
... );
|
||||
|
||||
/* Map the SdkLog macro to the logging function to enable logging
|
||||
* on Windows simulator. */
|
||||
#ifndef SdkLog
|
||||
#define SdkLog( message ) vLoggingPrintf message
|
||||
#endif
|
||||
|
||||
#include "logging_stack.h"
|
||||
|
||||
/************ End of logging configuration ****************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* @brief Malloc API used by core_pkcs11.h
|
||||
*/
|
||||
#define PKCS11_MALLOC pvPortMalloc
|
||||
|
||||
/**
|
||||
* @brief Free API used by core_pkcs11.h
|
||||
*/
|
||||
#define PKCS11_FREE vPortFree
|
||||
|
||||
/**
|
||||
* @brief PKCS #11 default user PIN.
|
||||
*
|
||||
* The PKCS #11 standard specifies the presence of a user PIN. That feature is
|
||||
* sensible for applications that have an interactive user interface and memory
|
||||
* protections. However, since typical microcontroller applications lack one or
|
||||
* both of those, the user PIN is assumed to be used herein for interoperability
|
||||
* purposes only, and not as a security feature.
|
||||
*
|
||||
* Note: Do not cast this to a pointer! The library calls sizeof to get the length
|
||||
* of this string.
|
||||
*/
|
||||
#define configPKCS11_DEFAULT_USER_PIN "0000"
|
||||
|
||||
/**
|
||||
* @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL
|
||||
* attribute.
|
||||
*/
|
||||
#define pkcs11configMAX_LABEL_LENGTH 32UL
|
||||
|
||||
/**
|
||||
* @brief Maximum number of token objects that can be stored
|
||||
* by the PKCS #11 module.
|
||||
*/
|
||||
#define pkcs11configMAX_NUM_OBJECTS 6UL
|
||||
|
||||
/**
|
||||
* @brief Maximum number of sessions that can be stored
|
||||
* by the PKCS #11 module.
|
||||
*/
|
||||
#define pkcs11configMAX_SESSIONS 10UL
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if a PAL destroy object is implemented.
|
||||
*
|
||||
* If set to 0, no PAL destroy object is implemented, and this functionality
|
||||
* is implemented in the common PKCS #11 layer.
|
||||
*/
|
||||
#define pkcs11configPAL_DESTROY_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if OTA image verification via PKCS #11 module is supported.
|
||||
*
|
||||
* If set to 0, OTA code signing certificate is built in via
|
||||
* aws_ota_codesigner_certificate.h.
|
||||
*/
|
||||
#define pkcs11configOTA_SUPPORTED 1
|
||||
|
||||
/**
|
||||
* @brief Set to 1 if PAL supports storage for JITP certificate,
|
||||
* code verify certificate, and trusted server root certificate.
|
||||
*
|
||||
* If set to 0, PAL does not support storage mechanism for these, and
|
||||
* they are accessed via headers compiled into the code.
|
||||
*/
|
||||
#define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for device private key.
|
||||
*
|
||||
* Private key for connection to AWS IoT endpoint. The corresponding
|
||||
* public key should be registered with the AWS IoT endpoint.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS ( "Device Priv TLS Key" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for device public key.
|
||||
*
|
||||
* The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS ( "Device Pub TLS Key" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the device certificate.
|
||||
*
|
||||
* Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS.
|
||||
*/
|
||||
#define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS ( "Device Cert" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the object to be used for HMAC operations.
|
||||
*/
|
||||
#define pkcs11configLABEL_HMAC_KEY ( "HMAC Key" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the object to be used for CMAC operations.
|
||||
*/
|
||||
#define pkcs11configLABEL_CMAC_KEY ( "CMAC Key" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the object to be used for code verification.
|
||||
*
|
||||
* Used by over-the-air update code to verify an incoming signed image.
|
||||
*/
|
||||
#define pkcs11configLABEL_CODE_VERIFICATION_KEY ( "Code Verify Key" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the claim certificate for Fleet Provisioning.
|
||||
*/
|
||||
#define pkcs11configLABEL_CLAIM_CERTIFICATE ( "Claim Cert" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the claim private key for Fleet Provisioning.
|
||||
*/
|
||||
#define pkcs11configLABEL_CLAIM_PRIVATE_KEY ( "Claim Key" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for Just-In-Time-Provisioning.
|
||||
*
|
||||
* The certificate corresponding to the issuer of the device certificate
|
||||
* (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or
|
||||
* JITP flow.
|
||||
*/
|
||||
#define pkcs11configLABEL_JITP_CERTIFICATE ( "JITP Cert" )
|
||||
|
||||
/**
|
||||
* @brief The PKCS #11 label for the AWS Trusted Root Certificate.
|
||||
*
|
||||
* @see aws_default_root_certificates.h
|
||||
*/
|
||||
#define pkcs11configLABEL_ROOT_CERTIFICATE ( "Root Cert" )
|
||||
|
||||
#endif /* _CORE_PKCS11_CONFIG_H_ include guard. */
|
||||
@@ -1,25 +1,93 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
VisualStudioVersion = 16.0.33027.164
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fleet Provisioning Demo", "fleet_provisioning_demo.vcxproj", "{382DC80F-E278-4BC9-9DB6-59014486DA0F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "corePKCS11", "..\..\..\..\VisualStudio_StaticProjects\corePKCS11\corePKCS11.vcxproj", "{19F0FF1A-3368-491A-9932-A2F089508F51}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Statically Linked Libraries", "Statically Linked Libraries", "{1C742BE7-F270-407A-963E-1B83F000D5AD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C686325E-3261-42F7-AEB1-DDE5280E1CEB}.Release|x86.Build.0 = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.Build.0 = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|Win32.Build.0 = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.ActiveCfg = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.Build.0 = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.Build.0 = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|Win32.Build.0 = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.ActiveCfg = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.Build.0 = Release|x64
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Debug|x64.Build.0 = Debug|x64
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|Win32.Build.0 = Release|Win32
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|x64.ActiveCfg = Release|x64
|
||||
{382DC80F-E278-4BC9-9DB6-59014486DA0F}.Release|x64.Build.0 = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.Build.0 = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|Win32.Build.0 = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.ActiveCfg = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.Build.0 = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.Build.0 = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|Win32.Build.0 = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.ActiveCfg = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.Build.0 = Release|x64
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Debug|x64.Build.0 = Debug|x64
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|Win32.Build.0 = Release|Win32
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|x64.ActiveCfg = Release|x64
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC} = {1C742BE7-F270-407A-963E-1B83F000D5AD}
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C} = {1C742BE7-F270-407A-963E-1B83F000D5AD}
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228} = {1C742BE7-F270-407A-963E-1B83F000D5AD}
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7} = {1C742BE7-F270-407A-963E-1B83F000D5AD}
|
||||
{19F0FF1A-3368-491A-9932-A2F089508F51} = {1C742BE7-F270-407A-963E-1B83F000D5AD}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {573E92F2-7674-4EE8-A7FD-8128A495333D}
|
||||
SolutionGuid = {3876F3F5-8086-4F8E-BB5E-D8840E7D926C}
|
||||
EndGlobalSection
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" 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>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{382dc80f-e278-4bc9-9db6-59014486da0f}</ProjectGuid>
|
||||
<RootNamespace>corePKCS11_MQTT_Mutual_Auth</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Fleet Provisioning Demo</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\ThirdParty\tinycbor\src;..\..\..\..\Source\AWS\fleet-provisioning\source\include;..\..\Mqtt_Demo_Helpers;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\ThirdParty\tinycbor\src;..\..\..\..\Source\AWS\fleet-provisioning\source\include;..\..\Mqtt_Demo_Helpers;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\ThirdParty\tinycbor\src;..\..\..\..\Source\AWS\fleet-provisioning\source\include;..\..\Mqtt_Demo_Helpers;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);.;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Application-Protocols\network_transport;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\ThirdParty\tinycbor\src;..\..\..\..\Source\AWS\fleet-provisioning\source\include;..\..\Mqtt_Demo_Helpers;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg">
|
||||
<VcpkgEnabled>false</VcpkgEnabled>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>
|
||||
</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_pk_pkcs11.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\fleet-provisioning\source\fleet_provisioning.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborencoder.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborencoder_close_container_checked.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborencoder_float.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborerrorstrings.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborparser.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborparser_dup_string.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborparser_float.c" />
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborvalidation.c" />
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_pkcs11_demo_helpers.c" />
|
||||
<ClCompile Include="FleetProvisioningDemoExample.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="pkcs11_operations.c" />
|
||||
<ClCompile Include="tinycbor_serializer.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_pk_pkcs11.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\fleet-provisioning\source\include\fleet_provisioning.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\fleet-provisioning\source\include\fleet_provisioning_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" />
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\cbor.h" />
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\cborinternal_p.h" />
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\cborjson.h" />
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\compilersupport_p.h" />
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\tinycbor-version.h" />
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\utf8_p.h" />
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_pkcs11_demo_helpers.h" />
|
||||
<ClInclude Include="core_mqtt_config.h" />
|
||||
<ClInclude Include="demo_config.h" />
|
||||
<ClInclude Include="fleet_provisioning_config.h" />
|
||||
<ClInclude Include="pkcs11_operations.h" />
|
||||
<ClInclude Include="tinycbor_serializer.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\corePKCS11\corePKCS11.vcxproj">
|
||||
<Project>{19f0ff1a-3368-491a-9932-a2f089508f51}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj">
|
||||
<Project>{c90e6cc5-818b-4c97-8876-0986d989387c}</Project>
|
||||
<Private>false</Private>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj">
|
||||
<Project>{72c209c4-49a4-4942-a201-44706c9d77ec}</Project>
|
||||
<Private>false</Private>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj">
|
||||
<Project>{be362ac0-b10b-4276-b84e-6304652ba228}</Project>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj">
|
||||
<Project>{e1016f3e-94e9-4864-9fd8-1d7c1fefbfd7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source">
|
||||
<UniqueIdentifier>{546ab88a-56ee-4b6f-ac35-b7b63f49ed2f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Headers">
|
||||
<UniqueIdentifier>{9049e888-7797-4792-90cb-a1e9e99a92a8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config">
|
||||
<UniqueIdentifier>{2eaca890-15c6-49a3-be88-574abbba0157}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries">
|
||||
<UniqueIdentifier>{78540744-1e91-4c12-965c-884a2cf92949}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files">
|
||||
<UniqueIdentifier>{9a6a66e0-e0cf-4ffe-9398-a23f26d3d5bb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper">
|
||||
<UniqueIdentifier>{653c873b-f2f7-4848-8db4-4ab67957f4b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\include">
|
||||
<UniqueIdentifier>{56bfdc25-748a-4c0a-a017-1daca6f2b698}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport">
|
||||
<UniqueIdentifier>{874d75af-778f-41a1-89dc-076ebf276fea}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport\include">
|
||||
<UniqueIdentifier>{1b25efaf-5b58-403c-9308-b591c4061c9e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports">
|
||||
<UniqueIdentifier>{a8fad8ec-9a5d-42f0-9b8b-4166cca11354}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp">
|
||||
<UniqueIdentifier>{17955057-1e46-42cb-aa73-a6eb46abc9f5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT">
|
||||
<UniqueIdentifier>{c69eabd6-7eed-4959-9351-41b8c3b731b8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\include">
|
||||
<UniqueIdentifier>{64a78119-97f6-4252-b793-87cb6e7902d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm">
|
||||
<UniqueIdentifier>{a442e1bd-e141-45a4-860d-a8eccab1b8c2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\TinyCBOR">
|
||||
<UniqueIdentifier>{58f51daa-dd72-4e9c-939d-3113f97234ca}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Fleet Provisioning">
|
||||
<UniqueIdentifier>{00849fd3-96f4-4fc3-b84f-fab958b5d5b6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Fleet Provisioning\include">
|
||||
<UniqueIdentifier>{9b4954c3-1f90-4e61-bdc1-15e50cbec10a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm\include">
|
||||
<UniqueIdentifier>{881fa2ff-3816-405f-9906-1f34585f7341}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c">
|
||||
<Filter>Additional Libraries\Backoff Algorithm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborvalidation.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborencoder.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborencoder_close_container_checked.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborencoder_float.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborerrorstrings.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborparser.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborparser_dup_string.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\ThirdParty\tinycbor\src\cborparser_float.c">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tinycbor_serializer.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_pkcs11_demo_helpers.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FleetProvisioningDemoExample.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pkcs11_operations.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_pk_pkcs11.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\fleet-provisioning\source\fleet_provisioning.c">
|
||||
<Filter>Additional Libraries\AWS IoT Fleet Provisioning</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\cbor.h">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\cborinternal_p.h">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\cborjson.h">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\compilersupport_p.h">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\tinycbor-version.h">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\ThirdParty\tinycbor\src\utf8_p.h">
|
||||
<Filter>Additional Libraries\TinyCBOR</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core_mqtt_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="demo_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fleet_provisioning_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pkcs11_operations.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tinycbor_serializer.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_pkcs11_demo_helpers.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_pk_pkcs11.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls_pkcs11.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + PKCS11 + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\fleet-provisioning\source\include\fleet_provisioning.h">
|
||||
<Filter>Additional Libraries\AWS IoT Fleet Provisioning\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\fleet-provisioning\source\include\fleet_provisioning_config_defaults.h">
|
||||
<Filter>Additional Libraries\AWS IoT Fleet Provisioning\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h">
|
||||
<Filter>Additional Libraries\Backoff Algorithm\include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -51,73 +51,20 @@
|
||||
/* Demo Specific configs. */
|
||||
#include "demo_config.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Prototypes for the demos that can be started from this project. Note the
|
||||
* Fleet Provisioning demo is not actually started until the network is already, which is
|
||||
* indicated by vApplicationIPNetworkEventHook() executing - hence
|
||||
* vStartFleetProvisioningDemo() is called from inside vApplicationIPNetworkEventHook().
|
||||
*/
|
||||
extern void vStartFleetProvisioningDemo( void );
|
||||
|
||||
/*
|
||||
* Just seeds the simple pseudo random number generator.
|
||||
*
|
||||
* !!! NOTE !!!
|
||||
* This is not a secure method of generating random numbers and production
|
||||
* devices should use a true random number generator (TRNG).
|
||||
*/
|
||||
static void prvSRand( UBaseType_t ulSeed );
|
||||
|
||||
/*
|
||||
* Miscellaneous initialization including preparing the logging and seeding the
|
||||
* random number generator.
|
||||
*/
|
||||
static void prvMiscInitialisation( void );
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. */
|
||||
static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
|
||||
static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
|
||||
static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
|
||||
|
||||
/* Set the following constant to pdTRUE to log using the method indicated by the
|
||||
* name of the constant, or pdFALSE to not log using the method indicated by the
|
||||
* name of the constant. Options include to standard out (xLogToStdout), to a disk
|
||||
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
|
||||
* then UDP messages are sent to the IP address configured as the UDP logging server
|
||||
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
|
||||
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
|
||||
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static UBaseType_t ulNextRand;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Miscellaneous initialization including preparing the logging and seeding
|
||||
* the random number generator. */
|
||||
prvMiscInitialisation();
|
||||
vPlatformInitLogging();
|
||||
|
||||
/* Initialize the network interface.
|
||||
*
|
||||
***NOTE*** Tasks that use the network are created in the network event hook
|
||||
* when the network is connected and ready for use (see the implementation of
|
||||
* vApplicationIPNetworkEventHook() below). The address values passed in here
|
||||
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
|
||||
* but a DHCP server cannot be contacted. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
vStartFleetProvisioningDemo();
|
||||
|
||||
/* Initialize FreeRTOS+TCP */
|
||||
vPlatformInitIpStack();
|
||||
|
||||
/* Start the RTOS scheduler. */
|
||||
vTaskStartScheduler();
|
||||
@@ -126,256 +73,12 @@ int main( void )
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
* FreeRTOS web site for more details.
|
||||
*/
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
__debugbreak();
|
||||
configASSERT( 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 )
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
/* Create the tasks that use the IP stack if they have not already been
|
||||
* created. */
|
||||
if( xTasksAlreadyCreated == pdFALSE )
|
||||
{
|
||||
/* Demos that use the network are created after the network is
|
||||
* up. */
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
vStartFleetProvisioningDemo();
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
LogInfo( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
|
||||
LogInfo( ( "Subnet Mask: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
|
||||
LogInfo( ( "Gateway Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
|
||||
LogInfo( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine )
|
||||
{
|
||||
volatile uint32_t ulBlockVariable = 0UL;
|
||||
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
( void ) pcFileName;
|
||||
( void ) ulLineNumber;
|
||||
|
||||
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||
|
||||
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||
* this function to be exited. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
{
|
||||
while( ulBlockVariable == 0UL )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/*
|
||||
* Utility function to generate a pseudo random number.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( UBaseType_t ulSeed )
|
||||
{
|
||||
/* Utility function to seed the pseudo random number generator. */
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvMiscInitialisation( void )
|
||||
{
|
||||
time_t xTimeNow;
|
||||
uint32_t ulLoggingIPAddress;
|
||||
uint32_t ulRandomNumbers[ 4 ];
|
||||
|
||||
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
|
||||
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
|
||||
|
||||
/*
|
||||
* Seed random number generator.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
time( &xTimeNow );
|
||||
LogDebug( ( "Seed for randomizer: %lu\n", xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
|
||||
LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ulRandomNumbers[ 0 ], ulRandomNumbers[ 1 ], ulRandomNumbers[ 2 ], ulRandomNumbers[ 3 ] ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
* address plus this name. */
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback that provides the inputs necessary to generate a randomized TCP
|
||||
* Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
|
||||
* THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
|
||||
* SYSTEMS.
|
||||
*/
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return uxRand();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Set *pulNumber to a random number, and return pdTRUE. When the random number
|
||||
* generator is broken, it shall return pdFALSE.
|
||||
*
|
||||
* THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER SO IS
|
||||
* NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.
|
||||
*/
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = uxRand();
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file configures mbed TLS for FreeRTOS. */
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H_
|
||||
#define MBEDTLS_CONFIG_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Generate errors if deprecated functions are used. */
|
||||
#define MBEDTLS_DEPRECATED_REMOVED
|
||||
|
||||
/* Place AES tables in ROM. */
|
||||
#define MBEDTLS_AES_ROM_TABLES
|
||||
|
||||
/* Enable the following cipher modes. */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
|
||||
/* Enable the following cipher padding modes. */
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/* Cipher suite configuration. */
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_NIST_OPTIM
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/* Enable all SSL alert messages. */
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/* Enable the following SSL features. */
|
||||
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#define MBEDTLS_SSL_ALPN
|
||||
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
|
||||
/* Check certificate key usage. */
|
||||
#define MBEDTLS_X509_CHECK_KEY_USAGE
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
|
||||
/* Disable platform entropy functions. */
|
||||
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
|
||||
/* Enable the following mbed TLS features. */
|
||||
#define MBEDTLS_CMAC_C
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_ERROR_C
|
||||
#define MBEDTLS_ENTROPY_HARDWARE_ALT
|
||||
#define MBEDTLS_GCM_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_OID_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
#define MBEDTLS_PEM_WRITE_C
|
||||
#define MBEDTLS_PK_C
|
||||
#define MBEDTLS_PK_PARSE_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_SHA1_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_SSL_CLI_C
|
||||
#define MBEDTLS_SSL_TLS_C
|
||||
#define MBEDTLS_THREADING_ALT
|
||||
#define MBEDTLS_THREADING_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_PK_WRITE_C
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
#define MBEDTLS_X509_CREATE_C
|
||||
#define MBEDTLS_X509_CSR_WRITE_C
|
||||
#define MBEDTLS_CMAC_C
|
||||
|
||||
/* Set the memory allocation functions on FreeRTOS. */
|
||||
void * mbedtls_platform_calloc( size_t nmemb,
|
||||
size_t size );
|
||||
void mbedtls_platform_free( void * ptr );
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc
|
||||
#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free
|
||||
|
||||
/* The network send and receive functions on FreeRTOS. */
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
const unsigned char * buf,
|
||||
size_t len );
|
||||
int mbedtls_platform_recv( void * ctx,
|
||||
unsigned char * buf,
|
||||
size_t len );
|
||||
|
||||
/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network
|
||||
* transport layer. */
|
||||
#define MBEDTLS_SSL_SEND mbedtls_platform_send
|
||||
#define MBEDTLS_SSL_RECV mbedtls_platform_recv
|
||||
|
||||
/* The entropy poll function. */
|
||||
int mbedtls_platform_entropy_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen );
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* ifndef MBEDTLS_CONFIG_H_ */
|
||||
@@ -44,67 +44,16 @@
|
||||
#include "core_pkcs11_config.h"
|
||||
#include "core_pki_utils.h"
|
||||
#include "mbedtls_utils.h"
|
||||
#include "mbedtls_pk_pkcs11.h"
|
||||
|
||||
/* MbedTLS include. */
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/entropy.h"
|
||||
#include "mbedtls/entropy_poll.h"
|
||||
#include "mbedtls/error.h"
|
||||
#include "mbedtls/oid.h"
|
||||
#include "mbedtls/pk.h"
|
||||
#include "mbedtls/pk_internal.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#include "mbedtls/x509_crt.h"
|
||||
#include "mbedtls/x509_csr.h"
|
||||
|
||||
/**
|
||||
* @brief Represents string to be logged when mbedTLS returned error
|
||||
* does not contain a high-level code.
|
||||
*/
|
||||
static const char * pcNoHighLevelMbedTlsCodeStr = "<No-High-Level-Code>";
|
||||
|
||||
/**
|
||||
* @brief Represents string to be logged when mbedTLS returned error
|
||||
* does not contain a low-level code.
|
||||
*/
|
||||
static const char * pcNoLowLevelMbedTlsCodeStr = "<No-Low-Level-Code>";
|
||||
|
||||
/**
|
||||
* @brief Utility for converting the high-level code in an mbedTLS error to
|
||||
* string, if the code-contains a high-level code; otherwise, using a default
|
||||
* string.
|
||||
*/
|
||||
#define mbedtlsHighLevelCodeOrDefault( mbedTlsCode ) \
|
||||
( mbedtls_high_level_strerr( mbedTlsCode ) != NULL ) \
|
||||
? mbedtls_high_level_strerr( mbedTlsCode ) \
|
||||
: pcNoHighLevelMbedTlsCodeStr
|
||||
|
||||
/**
|
||||
* @brief Utility for converting the level-level code in an mbedTLS error to
|
||||
* string, if the code-contains a level-level code; otherwise, using a default
|
||||
* string.
|
||||
*/
|
||||
#define mbedtlsLowLevelCodeOrDefault( mbedTlsCode ) \
|
||||
( mbedtls_low_level_strerr( mbedTlsCode ) != NULL ) \
|
||||
? mbedtls_low_level_strerr( mbedTlsCode ) \
|
||||
: pcNoLowLevelMbedTlsCodeStr
|
||||
|
||||
/**
|
||||
* @brief Struct containing parameters needed by the signing callback.
|
||||
*/
|
||||
typedef struct SigningCallbackContext
|
||||
{
|
||||
CK_SESSION_HANDLE p11Session;
|
||||
CK_OBJECT_HANDLE p11PrivateKey;
|
||||
} SigningCallbackContext_t;
|
||||
|
||||
/**
|
||||
* @brief Parameters for the signing callback. This needs to be global as
|
||||
* MbedTLS passes the key context to the signing function, so we cannot pass
|
||||
* our own.
|
||||
*/
|
||||
static SigningCallbackContext_t xSigningContext = { 0 };
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -120,51 +69,6 @@ static CK_RV prvDestroyProvidedObjects( CK_SESSION_HANDLE xSession,
|
||||
CK_OBJECT_CLASS * pxClass,
|
||||
CK_ULONG xCount );
|
||||
|
||||
/**
|
||||
* @brief Read the specified ECDSA public key into the MbedTLS ECDSA context.
|
||||
*
|
||||
* @param[in] xP11Session The PKCS #11 session.
|
||||
* @param[in] pxEcdsaContext The context in which to store the key.
|
||||
* @param[in] xPublicKey The public key to read.
|
||||
*/
|
||||
static int prvExtractEcPublicKey( CK_SESSION_HANDLE xP11Session,
|
||||
mbedtls_ecdsa_context * pxEcdsaContext,
|
||||
CK_OBJECT_HANDLE xPublicKey );
|
||||
|
||||
/**
|
||||
* @brief MbedTLS callback for signing using the provisioned private key. Used for
|
||||
* signing the CSR.
|
||||
*
|
||||
* @param[in] pxContext Unused.
|
||||
* @param[in] xMdAlg Unused.
|
||||
* @param[in] pucHash Data to sign.
|
||||
* @param[in] xHashLen Length of #pucHash.
|
||||
* @param[out] pucSig The signature
|
||||
* @param[out] pxSigLen The length of the signature.
|
||||
* @param[in] pxRng Unused.
|
||||
* @param[in] pxRngContext Unused.
|
||||
*/
|
||||
static int32_t prvPrivateKeySigningCallback( void * pxContext,
|
||||
mbedtls_md_type_t xMdAlg,
|
||||
const unsigned char * pucHash,
|
||||
size_t xHashLen,
|
||||
unsigned char * pucSig,
|
||||
size_t * pxSigLen,
|
||||
int ( * pxRng )( void *, unsigned char *, size_t ),
|
||||
void * pxRngContext );
|
||||
|
||||
/**
|
||||
* @brief MbedTLS random generation callback to generate random values with
|
||||
* PKCS #11.
|
||||
*
|
||||
* @param[in] pxCtx Pointer to the PKCS #11 session handle.
|
||||
* @param[out] pucRandom Buffer to write random data to.
|
||||
* @param[in] xRandomLength Length of random data to write.
|
||||
*/
|
||||
static int prvRandomCallback( void * pxCtx,
|
||||
unsigned char * pucRandom,
|
||||
size_t xRandomLength );
|
||||
|
||||
/**
|
||||
* @brief Generate a new ECDSA key pair using PKCS #11.
|
||||
*
|
||||
@@ -236,184 +140,6 @@ static CK_RV prvDestroyProvidedObjects( CK_SESSION_HANDLE xSession,
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static int prvExtractEcPublicKey( CK_SESSION_HANDLE xP11Session,
|
||||
mbedtls_ecdsa_context * pxEcdsaContext,
|
||||
CK_OBJECT_HANDLE xPublicKey )
|
||||
{
|
||||
CK_ATTRIBUTE xEcTemplate = { 0 };
|
||||
int xMbedtlsRet = -1;
|
||||
CK_RV xPkcs11ret = CKR_OK;
|
||||
CK_BYTE pxEcPoint[ 67 ] = { 0 };
|
||||
CK_FUNCTION_LIST_PTR xP11FunctionList;
|
||||
|
||||
mbedtls_ecdsa_init( pxEcdsaContext );
|
||||
mbedtls_ecp_group_init( &( pxEcdsaContext->grp ) );
|
||||
|
||||
xPkcs11ret = C_GetFunctionList( &xP11FunctionList );
|
||||
|
||||
if( xPkcs11ret != CKR_OK )
|
||||
{
|
||||
LogError( ( "Could not get a PKCS #11 function pointer." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
xEcTemplate.type = CKA_EC_POINT;
|
||||
xEcTemplate.pValue = pxEcPoint;
|
||||
xEcTemplate.ulValueLen = sizeof( pxEcPoint );
|
||||
xPkcs11ret = xP11FunctionList->C_GetAttributeValue( xP11Session, xPublicKey, &xEcTemplate, 1 );
|
||||
|
||||
if( xPkcs11ret != CKR_OK )
|
||||
{
|
||||
LogError( ( "Failed to extract EC public key. Could not get attribute value. "
|
||||
"C_GetAttributeValue failed with %lu.", xPkcs11ret ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( xPkcs11ret == CKR_OK )
|
||||
{
|
||||
xMbedtlsRet = mbedtls_ecp_group_load( &( pxEcdsaContext->grp ), MBEDTLS_ECP_DP_SECP256R1 );
|
||||
|
||||
if( xMbedtlsRet != 0 )
|
||||
{
|
||||
LogError( ( "Failed creating an EC key. "
|
||||
"mbedtls_ecp_group_load failed: MbedTLS"
|
||||
"error = %s : %s.",
|
||||
mbedtlsHighLevelCodeOrDefault( xMbedtlsRet ),
|
||||
mbedtlsLowLevelCodeOrDefault( xMbedtlsRet ) ) );
|
||||
xPkcs11ret = CKR_FUNCTION_FAILED;
|
||||
}
|
||||
else
|
||||
{
|
||||
xMbedtlsRet = mbedtls_ecp_point_read_binary( &( pxEcdsaContext->grp ), &( pxEcdsaContext->Q ), &pxEcPoint[ 2 ], xEcTemplate.ulValueLen - 2 );
|
||||
|
||||
if( xMbedtlsRet != 0 )
|
||||
{
|
||||
LogError( ( "Failed creating an EC key. "
|
||||
"mbedtls_ecp_group_load failed: MbedTLS"
|
||||
"error = %s : %s.",
|
||||
mbedtlsHighLevelCodeOrDefault( xMbedtlsRet ),
|
||||
mbedtlsLowLevelCodeOrDefault( xMbedtlsRet ) ) );
|
||||
xPkcs11ret = CKR_FUNCTION_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xMbedtlsRet;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static int32_t prvPrivateKeySigningCallback( void * pxContext,
|
||||
mbedtls_md_type_t xMdAlg,
|
||||
const unsigned char * pucHash,
|
||||
size_t xHashLen,
|
||||
unsigned char * pucSig,
|
||||
size_t * pxSigLen,
|
||||
int ( * pxRng )( void *, unsigned char *, size_t ),
|
||||
void * pxRngContext )
|
||||
{
|
||||
CK_RV xRet = CKR_OK;
|
||||
int32_t usResult = 0;
|
||||
CK_MECHANISM xMech = { 0 };
|
||||
CK_BYTE pxToBeSigned[ 256 ];
|
||||
CK_ULONG xToBeSignedLen = sizeof( pxToBeSigned );
|
||||
CK_FUNCTION_LIST_PTR xFunctionList = NULL;
|
||||
|
||||
/* Unreferenced parameters. */
|
||||
( void ) ( pxContext );
|
||||
( void ) ( pxRng );
|
||||
( void ) ( pxRngContext );
|
||||
( void ) ( xMdAlg );
|
||||
|
||||
/* Sanity check buffer length. */
|
||||
if( xHashLen > sizeof( pxToBeSigned ) )
|
||||
{
|
||||
xRet = CKR_ARGUMENTS_BAD;
|
||||
}
|
||||
|
||||
xMech.mechanism = CKM_ECDSA;
|
||||
memcpy( pxToBeSigned, pucHash, xHashLen );
|
||||
xToBeSignedLen = xHashLen;
|
||||
|
||||
if( xRet == CKR_OK )
|
||||
{
|
||||
xRet = C_GetFunctionList( &xFunctionList );
|
||||
}
|
||||
|
||||
if( xRet == CKR_OK )
|
||||
{
|
||||
xRet = xFunctionList->C_SignInit( xSigningContext.p11Session, &xMech,
|
||||
xSigningContext.p11PrivateKey );
|
||||
}
|
||||
|
||||
if( xRet == CKR_OK )
|
||||
{
|
||||
*pxSigLen = sizeof( pxToBeSigned );
|
||||
xRet = xFunctionList->C_Sign( xSigningContext.p11Session, pxToBeSigned,
|
||||
xToBeSignedLen, pucSig, ( CK_ULONG_PTR ) pxSigLen );
|
||||
}
|
||||
|
||||
if( xRet == CKR_OK )
|
||||
{
|
||||
/* PKCS #11 for P256 returns a 64-byte signature with 32 bytes for R and 32
|
||||
* bytes for S. This must be converted to an ASN.1 encoded array. */
|
||||
if( *pxSigLen != pkcs11ECDSA_P256_SIGNATURE_LENGTH )
|
||||
{
|
||||
xRet = CKR_FUNCTION_FAILED;
|
||||
LogError( ( "Failed to sign message using PKCS #11. Expected signature "
|
||||
"length of %lu, but received %lu.",
|
||||
( unsigned long ) pkcs11ECDSA_P256_SIGNATURE_LENGTH,
|
||||
( unsigned long ) *pxSigLen ) );
|
||||
}
|
||||
|
||||
if( xRet == CKR_OK )
|
||||
{
|
||||
PKI_pkcs11SignatureTombedTLSSignature( pucSig, pxSigLen );
|
||||
}
|
||||
}
|
||||
|
||||
if( xRet != CKR_OK )
|
||||
{
|
||||
LogError( ( "Failed to sign message using PKCS #11 with error code %lu.", xRet ) );
|
||||
usResult = -1;
|
||||
}
|
||||
|
||||
return usResult;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static int prvRandomCallback( void * pxCtx,
|
||||
unsigned char * pucRandom,
|
||||
size_t xRandomLength )
|
||||
{
|
||||
CK_SESSION_HANDLE * pxP11Session = ( CK_SESSION_HANDLE * ) pxCtx;
|
||||
CK_RV xRes;
|
||||
CK_FUNCTION_LIST_PTR xP11FunctionList;
|
||||
|
||||
xRes = C_GetFunctionList( &xP11FunctionList );
|
||||
|
||||
if( xRes != CKR_OK )
|
||||
{
|
||||
LogError( ( "Failed to generate a random number in RNG callback. Could not get a "
|
||||
"PKCS #11 function pointer." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
xRes = xP11FunctionList->C_GenerateRandom( *pxP11Session, pucRandom, xRandomLength );
|
||||
|
||||
if( xRes != CKR_OK )
|
||||
{
|
||||
LogError( ( "Failed to generate a random number in RNG callback. "
|
||||
"C_GenerateRandom failed with %lu.", ( unsigned long ) xRes ) );
|
||||
}
|
||||
}
|
||||
|
||||
return ( int ) xRes;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static CK_RV prvGenerateKeyPairEC( CK_SESSION_HANDLE xSession,
|
||||
const char * pcPrivateKeyLabel,
|
||||
const char * pcPublicKeyLabel,
|
||||
@@ -488,7 +214,6 @@ bool xGenerateKeyAndCsr( CK_SESSION_HANDLE xP11Session,
|
||||
CK_OBJECT_HANDLE xPubKeyHandle;
|
||||
CK_RV xPkcs11Ret = CKR_OK;
|
||||
mbedtls_pk_context xPrivKey;
|
||||
mbedtls_pk_info_t xPrivKeyInfo;
|
||||
mbedtls_ecdsa_context xEcdsaContext;
|
||||
mbedtls_x509write_csr xReq;
|
||||
int32_t ulMbedtlsRet = -1;
|
||||
@@ -505,6 +230,11 @@ bool xGenerateKeyAndCsr( CK_SESSION_HANDLE xP11Session,
|
||||
&xPrivKeyHandle,
|
||||
&xPubKeyHandle );
|
||||
|
||||
if( xPkcs11Ret == CKR_OK )
|
||||
{
|
||||
xPkcs11Ret = xPKCS11_initMbedtlsPkContext( &xPrivKey, xP11Session, xPrivKeyHandle );
|
||||
}
|
||||
|
||||
if( xPkcs11Ret == CKR_OK )
|
||||
{
|
||||
mbedtls_x509write_csr_init( &xReq );
|
||||
@@ -524,35 +254,16 @@ bool xGenerateKeyAndCsr( CK_SESSION_HANDLE xP11Session,
|
||||
|
||||
if( ulMbedtlsRet == 0 )
|
||||
{
|
||||
mbedtls_pk_init( &xPrivKey );
|
||||
}
|
||||
|
||||
if( ulMbedtlsRet == 0 )
|
||||
{
|
||||
ulMbedtlsRet = prvExtractEcPublicKey( xP11Session, &xEcdsaContext, xPubKeyHandle );
|
||||
}
|
||||
|
||||
if( ulMbedtlsRet == 0 )
|
||||
{
|
||||
xSigningContext.p11Session = xP11Session;
|
||||
xSigningContext.p11PrivateKey = xPrivKeyHandle;
|
||||
|
||||
memcpy( &xPrivKeyInfo, pxHeader, sizeof( mbedtls_pk_info_t ) );
|
||||
|
||||
xPrivKeyInfo.sign_func = prvPrivateKeySigningCallback;
|
||||
xPrivKey.pk_info = &xPrivKeyInfo;
|
||||
xPrivKey.pk_ctx = &xEcdsaContext;
|
||||
|
||||
mbedtls_x509write_csr_set_key( &xReq, &xPrivKey );
|
||||
|
||||
ulMbedtlsRet = mbedtls_x509write_csr_pem( &xReq, ( unsigned char * ) pcCsrBuffer,
|
||||
xCsrBufferLength, &prvRandomCallback,
|
||||
xCsrBufferLength, &lPKCS11RandomCallback,
|
||||
&xP11Session );
|
||||
}
|
||||
|
||||
mbedtls_x509write_csr_free( &xReq );
|
||||
mbedtls_ecdsa_free( &xEcdsaContext );
|
||||
mbedtls_ecp_group_free( &( xEcdsaContext.grp ) );
|
||||
|
||||
lPKCS11PkMbedtlsCloseSessionAndFree( &xPrivKey );
|
||||
}
|
||||
|
||||
*pxOutCsrLength = strlen( pcCsrBuffer );
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
|
||||
/* Jobs library header. */
|
||||
#include "jobs.h"
|
||||
@@ -224,6 +225,11 @@
|
||||
*/
|
||||
#define DELAY_BETWEEN_DEMO_RETRY_ITERATIONS_TICKS ( pdMS_TO_TICKS( 5000U ) )
|
||||
|
||||
/**
|
||||
* @brief Length of the queue to pass Jobs messages to the job handling task.
|
||||
*/
|
||||
#define JOBS_MESSAGE_QUEUE_LEN ( 10U )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -311,6 +317,11 @@ static BaseType_t xExitActionJobReceived = pdFALSE;
|
||||
*/
|
||||
static BaseType_t xDemoEncounteredError = pdFALSE;
|
||||
|
||||
/**
|
||||
* @brief Queue used to pass incoming Jobs messages to a task to handle them.
|
||||
*/
|
||||
static QueueHandle_t xJobMessageQueue;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -385,7 +396,7 @@ static void prvProcessJobDocument( char * pcJobId,
|
||||
* @param[in] pvParameters Parameters as passed at the time of task creation.
|
||||
* Not used in this example.
|
||||
*/
|
||||
static void prvJobsDemoTask( void * pvParameters );
|
||||
void prvJobsDemoTask( void * pvParameters );
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
@@ -715,8 +726,52 @@ static void prvEventCallback( MQTTContext_t * pxMqttContext,
|
||||
/* Upon successful return, the messageType has been filled in. */
|
||||
if( ( topicType == JobsDescribeSuccess ) || ( topicType == JobsNextJobChanged ) )
|
||||
{
|
||||
/* Handler function to process payload. */
|
||||
prvNextJobHandler( pxDeserializedInfo->pPublishInfo );
|
||||
MQTTPublishInfo_t * pxJobMessagePublishInfo = NULL;
|
||||
char * pcTopicName = NULL;
|
||||
char * pcPayload = NULL;
|
||||
|
||||
/* Copy message to pass into queue. */
|
||||
pxJobMessagePublishInfo = ( MQTTPublishInfo_t * ) pvPortMalloc( sizeof( MQTTPublishInfo_t ) );
|
||||
pcTopicName = ( char * ) pvPortMalloc( pxDeserializedInfo->pPublishInfo->topicNameLength );
|
||||
pcPayload = ( char * ) pvPortMalloc( pxDeserializedInfo->pPublishInfo->payloadLength );
|
||||
|
||||
if( ( pxJobMessagePublishInfo == NULL ) || ( pcTopicName == NULL ) || ( pcPayload == NULL ) )
|
||||
{
|
||||
LogError( ( "Malloc failed for copying job publish info." ) );
|
||||
|
||||
if( pxJobMessagePublishInfo != NULL )
|
||||
{
|
||||
vPortFree( pxJobMessagePublishInfo );
|
||||
}
|
||||
|
||||
if( pcTopicName != NULL )
|
||||
{
|
||||
vPortFree( pcTopicName );
|
||||
}
|
||||
|
||||
if( pcPayload != NULL )
|
||||
{
|
||||
vPortFree( pcPayload );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( pxJobMessagePublishInfo, pxDeserializedInfo->pPublishInfo, sizeof( MQTTPublishInfo_t ) );
|
||||
memcpy( pcTopicName, pxDeserializedInfo->pPublishInfo->pTopicName, pxDeserializedInfo->pPublishInfo->topicNameLength );
|
||||
memcpy( pcPayload, pxDeserializedInfo->pPublishInfo->pPayload, pxDeserializedInfo->pPublishInfo->payloadLength );
|
||||
|
||||
pxJobMessagePublishInfo->pTopicName = pcTopicName;
|
||||
pxJobMessagePublishInfo->pPayload = pcPayload;
|
||||
|
||||
if( xQueueSend( xJobMessageQueue, &pxJobMessagePublishInfo, 0 ) == errQUEUE_FULL )
|
||||
{
|
||||
LogError( ( "Could not enqueue Jobs message." ) );
|
||||
|
||||
vPortFree( pxJobMessagePublishInfo );
|
||||
vPortFree( pcTopicName );
|
||||
vPortFree( pcPayload );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( topicType == JobsUpdateSuccess )
|
||||
{
|
||||
@@ -768,25 +823,6 @@ static void prvEventCallback( MQTTContext_t * pxMqttContext,
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* @brief Create the task that demonstrates the Jobs library API via a
|
||||
* MQTT mutually authenticated network connection with the AWS IoT broker.
|
||||
*/
|
||||
void vStartJobsDemo( void )
|
||||
{
|
||||
/* This example uses a single application task, which shows that how to
|
||||
* use Jobs library to generate and validate AWS IoT Jobs service MQTT topics
|
||||
* via coreMQTT library to communicate with the AWS IoT Jobs service. */
|
||||
xTaskCreate( prvJobsDemoTask, /* Function that implements the task. */
|
||||
"DemoTask", /* Text name for the task - only used for debugging. */
|
||||
democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
|
||||
NULL, /* Task parameter - not used in this case. */
|
||||
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
|
||||
NULL ); /* Used to pass out a handle to the created task - not used in this case. */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Entry point of the Jobs demo.
|
||||
*
|
||||
@@ -816,11 +852,27 @@ void prvJobsDemoTask( void * pvParameters )
|
||||
/* Set the pParams member of the network context with desired transport. */
|
||||
xNetworkContext.pParams = &xTlsTransportParams;
|
||||
|
||||
/* Initialize Jobs message queue. */
|
||||
xJobMessageQueue = xQueueCreate( JOBS_MESSAGE_QUEUE_LEN, sizeof( MQTTPublishInfo_t * ) );
|
||||
configASSERT( xJobMessageQueue != NULL );
|
||||
|
||||
/* This demo runs a single loop unless there are failures in the demo execution.
|
||||
* In case of failures in the demo execution, demo loop will be retried for up to
|
||||
* JOBS_MAX_DEMO_LOOP_COUNT times. */
|
||||
do
|
||||
{
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
|
||||
if( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
LogInfo( ( "Waiting for the network link up event..." ) );
|
||||
|
||||
while( xPlatformIsNetworkUp() == pdFALSE )
|
||||
{
|
||||
vTaskDelay( pdMS_TO_TICKS( 1000U ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* Establish an MQTT connection with AWS IoT over a mutually authenticated TLS session. */
|
||||
xDemoStatus = xEstablishMqttSession( &xMqttContext,
|
||||
&xNetworkContext,
|
||||
@@ -904,11 +956,22 @@ void prvJobsDemoTask( void * pvParameters )
|
||||
( xDemoEncounteredError == pdFALSE ) &&
|
||||
( xDemoStatus == pdPASS ) )
|
||||
{
|
||||
MQTTPublishInfo_t * pxJobMessagePublishInfo;
|
||||
MQTTStatus_t xMqttStatus = MQTTSuccess;
|
||||
|
||||
/* Check if we have notification for the next pending job in the queue from the
|
||||
* NextJobExecutionChanged API of the AWS IoT Jobs service. */
|
||||
xMqttStatus = MQTT_ProcessLoop( &xMqttContext, 300U );
|
||||
xMqttStatus = MQTT_ProcessLoop( &xMqttContext );
|
||||
|
||||
/* Receive any incoming Jobs message. */
|
||||
if( xQueueReceive( xJobMessageQueue, &pxJobMessagePublishInfo, 0 ) == pdTRUE )
|
||||
{
|
||||
/* Handler function to process Jobs message payload. */
|
||||
prvNextJobHandler( pxJobMessagePublishInfo );
|
||||
vPortFree( pxJobMessagePublishInfo->pTopicName );
|
||||
vPortFree( pxJobMessagePublishInfo->pPayload );
|
||||
vPortFree( pxJobMessagePublishInfo );
|
||||
}
|
||||
|
||||
if( xMqttStatus != MQTTSuccess )
|
||||
{
|
||||
@@ -979,6 +1042,8 @@ void prvJobsDemoTask( void * pvParameters )
|
||||
LogInfo( ( "Demo completed successfully." ) );
|
||||
}
|
||||
|
||||
LogInfo( ( "-------DEMO FINISHED-------\r\n" ) );
|
||||
|
||||
/* Delete this demo task. */
|
||||
LogInfo( ( "Deleting Jobs Demo task." ) );
|
||||
vTaskDelete( NULL );
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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.
|
||||
* https://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.
|
||||
*----------------------------------------------------------*/
|
||||
#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 0
|
||||
#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 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#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 configuration options. */
|
||||
#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
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* 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. **********************************/
|
||||
|
||||
/* 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 ( 0L )
|
||||
|
||||
/* The address to which logging is sent should UDP logging be enabled. */
|
||||
#define configUDP_LOGGING_ADDR0 192
|
||||
#define configUDP_LOGGING_ADDR1 168
|
||||
#define configUDP_LOGGING_ADDR2 0
|
||||
#define configUDP_LOGGING_ADDR3 11
|
||||
|
||||
/* 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 0x11
|
||||
#define configMAC_ADDR3 0x11
|
||||
#define configMAC_ADDR4 0x11
|
||||
#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 10
|
||||
#define configIP_ADDR1 10
|
||||
#define configIP_ADDR2 10
|
||||
#define configIP_ADDR3 200
|
||||
|
||||
/* 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 10
|
||||
#define configGATEWAY_ADDR1 10
|
||||
#define configGATEWAY_ADDR2 10
|
||||
#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 208
|
||||
#define configDNS_SERVER_ADDR1 67
|
||||
#define configDNS_SERVER_ADDR2 222
|
||||
#define configDNS_SERVER_ADDR3 222
|
||||
|
||||
/* 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 0
|
||||
#define configNET_MASK2 0
|
||||
#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
|
||||
|
||||
/* 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,
|
||||
... );
|
||||
#define configPRINTF( X ) vLoggingPrintf X
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
@@ -1,309 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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://aws.amazon.com/freertos
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* See the following URL for configuration information.
|
||||
* https://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 0
|
||||
#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 ( 2000 )
|
||||
#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
|
||||
|
||||
/* Include support for LLMNR: Link-local Multicast Name Resolution
|
||||
* (non-Microsoft) */
|
||||
#define ipconfigUSE_LLMNR ( 0 )
|
||||
|
||||
/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
|
||||
#define ipconfigUSE_NBNS ( 0 )
|
||||
|
||||
/* 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 ( 64 )
|
||||
#define ipconfigDNS_CACHE_ENTRIES ( 4 )
|
||||
#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
|
||||
|
||||
/* 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:
|
||||
* https://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
|
||||
* https://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 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 ( 5000 / 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 ( 120000 / 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 the TCP socket wake context with a callback. */
|
||||
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK_WITH_CONTEXT ( 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 1200
|
||||
|
||||
/* 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
|
||||
|
||||
/* 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 0
|
||||
|
||||
/* 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 2
|
||||
|
||||
/* 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 ( 5000 )
|
||||
|
||||
/* 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
|
||||
|
||||
#endif /* FREERTOS_IP_CONFIG_H */
|
||||
@@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" 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>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{9a8fd41d-dd8d-42c0-825a-266aebd15c99}</ProjectGuid>
|
||||
<RootNamespace>JobsDemo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;MBEDTLS_CONFIG_FILE="mbedtls_config_v3.2.1.h";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>.\;..\..\Mqtt_Demo_Helpers;..\..\..\..\Source\AWS\jobs\source\include;..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface;..\..\..\..\Source\Application-Protocols\coreMQTT\source\include;..\..\..\..\Source\coreJSON\source\include;..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include;..\..\..\..\Source\Utilities\backoff_algorithm\source\include;..\..\..\..\Source\Application-Protocols\network_transport;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj">
|
||||
<Project>{c90e6cc5-818b-4c97-8876-0986d989387c}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj">
|
||||
<Project>{72c209c4-49a4-4942-a201-44706c9d77ec}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj">
|
||||
<Project>{be362ac0-b10b-4276-b84e-6304652ba228}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj">
|
||||
<Project>{e1016f3e-94e9-4864-9fd8-1d7c1fefbfd7}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\jobs\source\jobs.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c" />
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c" />
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.c" />
|
||||
<ClCompile Include="DemoTasks\JobsDemoExample.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\jobs\source\include\jobs.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h" />
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h" />
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.h" />
|
||||
<ClInclude Include="core_mqtt_config.h" />
|
||||
<ClInclude Include="demo_config.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files">
|
||||
<UniqueIdentifier>{77910aca-8b76-4e4d-b7d4-cfe4e56b5b64}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries">
|
||||
<UniqueIdentifier>{172d061d-e623-438b-833f-4114ba0abf60}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Jobs">
|
||||
<UniqueIdentifier>{7eaed6c6-f58a-45e5-b5ca-deef0173342c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\AWS IoT Jobs\include">
|
||||
<UniqueIdentifier>{baa73419-9309-46d4-b6ed-3d45224d160c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreJSON">
|
||||
<UniqueIdentifier>{966a910d-f680-4fa5-945d-7549e0f00dcf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT">
|
||||
<UniqueIdentifier>{81e3ec32-9c87-43c1-a942-676c8eaf748f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreJSON\include">
|
||||
<UniqueIdentifier>{b998bcc8-3228-4f9c-a8b2-cbe089f23a8b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\include">
|
||||
<UniqueIdentifier>{84f59601-7949-44e5-936c-eea0c72696fc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\coreMQTT\interface">
|
||||
<UniqueIdentifier>{a76094d7-35e4-4d25-a0e3-6f5d41918de7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm">
|
||||
<UniqueIdentifier>{51f46bf6-a773-4e3f-afc4-edbdb1e64274}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Libraries\Backoff Algorithm\include">
|
||||
<UniqueIdentifier>{be40f75a-0897-4fa0-b167-41164a4b5767}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config">
|
||||
<UniqueIdentifier>{3ad3935f-a395-4b93-9d2e-3a8d964a7293}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper">
|
||||
<UniqueIdentifier>{6f4feeea-d54a-4efd-8c7d-702c02e075eb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\include">
|
||||
<UniqueIdentifier>{f0cce363-133c-49e3-b12d-0eecd41ec82c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport">
|
||||
<UniqueIdentifier>{50ae4d20-b607-4b93-936c-fc7cc8463930}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include">
|
||||
<UniqueIdentifier>{ca775260-7b8f-4425-9259-ffa0fd3fac14}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports">
|
||||
<UniqueIdentifier>{34be0896-d864-4bba-96d0-c6076dbb5c62}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp">
|
||||
<UniqueIdentifier>{3a2cda24-c8a2-4008-9b35-70b14cc6022c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DemoTasks\JobsDemoExample.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\AWS\jobs\source\jobs.c">
|
||||
<Filter>Additional Libraries\AWS IoT Jobs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\coreJSON\source\core_json.c">
|
||||
<Filter>Additional Libraries\coreJSON</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_serializer.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\core_mqtt_state.c">
|
||||
<Filter>Additional Libraries\coreMQTT</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\backoff_algorithm.c">
|
||||
<Filter>Additional Libraries\Backoff Algorithm</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\ports\freertos_plus_tcp\tcp_sockets_wrapper.c">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\ports\freertos_plus_tcp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\Source\AWS\jobs\source\include\jobs.h">
|
||||
<Filter>Additional Libraries\AWS IoT Jobs\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\coreJSON\source\include\core_json.h">
|
||||
<Filter>Additional Libraries\coreJSON\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_config_defaults.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_serializer.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\include\core_mqtt_state.h">
|
||||
<Filter>Additional Libraries\coreMQTT\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\coreMQTT\source\interface\transport_interface.h">
|
||||
<Filter>Additional Libraries\coreMQTT\interface</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Utilities\backoff_algorithm\source\include\backoff_algorithm.h">
|
||||
<Filter>Additional Libraries\Backoff Algorithm\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\Mqtt_Demo_Helpers\mqtt_demo_helpers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="demo_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core_mqtt_config.h">
|
||||
<Filter>Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\mbedtls_bio_tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\transport_mbedtls.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper + MbedTLS Transport\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Source\Application-Protocols\network_transport\tcp_sockets_wrapper\include\tcp_sockets_wrapper.h">
|
||||
<Filter>Additional Network Transport Files\TCP Sockets Wrapper\include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,79 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29215.179
|
||||
VisualStudioVersion = 16.0.31205.134
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RTOSDemo", "WIN32.vcxproj", "{C686325E-3261-42F7-AEB1-DDE5280E1CEB}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Jobs_Demo", "Jobs_Demo.vcxproj", "{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS+TCP", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS+TCP\FreeRTOS+TCP.vcxproj", "{C90E6CC5-818B-4C97-8876-0986D989387C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeRTOS-Kernel", "..\..\..\..\VisualStudio_StaticProjects\FreeRTOS-Kernel\FreeRTOS-Kernel.vcxproj", "{72C209C4-49A4-4942-A201-44706C9D77EC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MbedTLS", "..\..\..\..\VisualStudio_StaticProjects\MbedTLS\MbedTLS.vcxproj", "{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Logging", "..\..\..\..\VisualStudio_StaticProjects\Logging\Logging.vcxproj", "{BE362AC0-B10B-4276-B84E-6304652BA228}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Statically Linked Libraries", "Statically Linked Libraries", "{08E4E650-9DDF-4FF4-8DF7-8C6AF2CC51A4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
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
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Debug|x64.Build.0 = Debug|x64
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Debug|x86.Build.0 = Debug|Win32
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Release|x64.ActiveCfg = Release|x64
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Release|x64.Build.0 = Release|x64
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Release|x86.ActiveCfg = Release|Win32
|
||||
{9A8FD41D-DD8D-42C0-825A-266AEBD15C99}.Release|x86.Build.0 = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x64.Build.0 = Debug|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.ActiveCfg = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x64.Build.0 = Release|x64
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C}.Release|x86.Build.0 = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x64.Build.0 = Debug|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Debug|x86.Build.0 = Debug|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.ActiveCfg = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x64.Build.0 = Release|x64
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC}.Release|x86.Build.0 = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x64.Build.0 = Debug|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.ActiveCfg = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x64.Build.0 = Release|x64
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7}.Release|x86.Build.0 = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x64.Build.0 = Debug|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Debug|x86.Build.0 = Debug|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.ActiveCfg = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x64.Build.0 = Release|x64
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x86.ActiveCfg = Release|Win32
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {150F08BF-9D61-4CC2-8DBF-1335172A1EA4}
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{C90E6CC5-818B-4C97-8876-0986D989387C} = {08E4E650-9DDF-4FF4-8DF7-8C6AF2CC51A4}
|
||||
{72C209C4-49A4-4942-A201-44706C9D77EC} = {08E4E650-9DDF-4FF4-8DF7-8C6AF2CC51A4}
|
||||
{E1016F3E-94E9-4864-9FD8-1D7C1FEFBFD7} = {08E4E650-9DDF-4FF4-8DF7-8C6AF2CC51A4}
|
||||
{BE362AC0-B10B-4276-B84E-6304652BA228} = {08E4E650-9DDF-4FF4-8DF7-8C6AF2CC51A4}
|
||||
EndGlobalSection
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = FreeRTOS_Plus_TCP_Minimal.vsmdi
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {616AA544-F9F0-4165-82DA-7337B0FF599F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <intrin.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include <FreeRTOS.h>
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* TCP/IP stack includes. */
|
||||
@@ -50,73 +50,31 @@
|
||||
/* Demo Specific configs. */
|
||||
#include "demo_config.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Prototypes for the demos that can be started from this project. Note the
|
||||
* Jobs demo is not actually started until the network is already, which is
|
||||
* indicated by vApplicationIPNetworkEventHook() executing - hence
|
||||
* vStartJobsDemo() is called from inside vApplicationIPNetworkEventHook().
|
||||
*/
|
||||
extern void vStartJobsDemo( void );
|
||||
extern void prvJobsDemoTask( void * pvParameters );
|
||||
extern void vPlatformInitLogging( void );
|
||||
|
||||
/*
|
||||
* Just seeds the simple pseudo random number generator.
|
||||
*
|
||||
* !!! NOTE !!!
|
||||
* This is not a secure method of generating random numbers and production
|
||||
* devices should use a true random number generator (TRNG).
|
||||
*/
|
||||
static void prvSRand( UBaseType_t ulSeed );
|
||||
|
||||
/*
|
||||
* Miscellaneous initialization including preparing the logging and seeding the
|
||||
* random number generator.
|
||||
*/
|
||||
static void prvMiscInitialisation( void );
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. */
|
||||
static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
|
||||
static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
|
||||
static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
|
||||
|
||||
/* Set the following constant to pdTRUE to log using the method indicated by the
|
||||
* name of the constant, or pdFALSE to not log using the method indicated by the
|
||||
* name of the constant. Options include to standard out (xLogToStdout), to a disk
|
||||
* file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
|
||||
* then UDP messages are sent to the IP address configured as the UDP logging server
|
||||
* address (see the configUDP_LOGGING_ADDR0 definitions in FreeRTOSConfig.h) and
|
||||
* the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
|
||||
const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
|
||||
|
||||
/* Used by the pseudo random number generator. */
|
||||
static UBaseType_t ulNextRand;
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* Miscellaneous initialization including preparing the logging and seeding
|
||||
* the random number generator. */
|
||||
prvMiscInitialisation();
|
||||
vPlatformInitLogging();
|
||||
|
||||
/* Initialize the network interface.
|
||||
*
|
||||
***NOTE*** Tasks that use the network are created in the network event hook
|
||||
* when the network is connected and ready for use (see the implementation of
|
||||
* vApplicationIPNetworkEventHook() below). The address values passed in here
|
||||
* are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
|
||||
* but a DHCP server cannot be contacted. */
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
/*
|
||||
* This example uses a single application task, which shows that how to
|
||||
* use Jobs library to generate and validate AWS IoT Jobs service MQTT topics
|
||||
* via coreMQTT library to communicate with the AWS IoT Jobs service.
|
||||
*/
|
||||
xTaskCreate( prvJobsDemoTask, /* Function that implements the task. */
|
||||
"DemoTask", /* Text name for the task - only used for debugging. */
|
||||
democonfigDEMO_STACKSIZE, /* Size of stack (in words, not bytes) to allocate for the task. */
|
||||
NULL, /* Task parameter - not used in this case. */
|
||||
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */
|
||||
NULL ); /* Used to pass out a handle to the created task - not used in this case. */
|
||||
|
||||
/* Initialize the FreeRTOS+TCP Stack */
|
||||
vPlatformInitIpStack();
|
||||
|
||||
/* Start the RTOS scheduler. */
|
||||
vTaskStartScheduler();
|
||||
@@ -125,256 +83,13 @@ int main( void )
|
||||
* line will never be reached. If the following line does execute, then
|
||||
* there was insufficient FreeRTOS heap memory available for the idle and/or
|
||||
* timer tasks to be created. See the memory management section on the
|
||||
* FreeRTOS web site for more details (this is standard text that is not
|
||||
* really applicable to the Win32 simulator port). */
|
||||
* FreeRTOS web site for more details.
|
||||
*/
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
__debugbreak();
|
||||
configASSERT( 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 )
|
||||
{
|
||||
uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
|
||||
char cBuffer[ 16 ];
|
||||
static BaseType_t xTasksAlreadyCreated = pdFALSE;
|
||||
|
||||
/* If the network has just come up...*/
|
||||
if( eNetworkEvent == eNetworkUp )
|
||||
{
|
||||
/* Create the tasks that use the IP stack if they have not already been
|
||||
* created. */
|
||||
if( xTasksAlreadyCreated == pdFALSE )
|
||||
{
|
||||
/* Demos that use the network are created after the network is
|
||||
* up. */
|
||||
LogInfo( ( "---------STARTING DEMO---------\r\n" ) );
|
||||
vStartJobsDemo();
|
||||
xTasksAlreadyCreated = pdTRUE;
|
||||
}
|
||||
|
||||
/* Print out the network configuration, which may have come from a DHCP
|
||||
* server. */
|
||||
FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
|
||||
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
|
||||
LogInfo( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
|
||||
LogInfo( ( "Subnet Mask: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
|
||||
LogInfo( ( "Gateway Address: %s\r\n", cBuffer ) );
|
||||
|
||||
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
|
||||
LogInfo( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( const char * pcFile,
|
||||
uint32_t ulLine )
|
||||
{
|
||||
volatile uint32_t ulBlockVariable = 0UL;
|
||||
volatile char * pcFileName = ( volatile char * ) pcFile;
|
||||
volatile uint32_t ulLineNumber = ulLine;
|
||||
|
||||
( void ) pcFileName;
|
||||
( void ) ulLineNumber;
|
||||
|
||||
printf( "vAssertCalled( %s, %u\n", pcFile, ulLine );
|
||||
|
||||
/* Setting ulBlockVariable to a non-zero value in the debugger will allow
|
||||
* this function to be exited. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
{
|
||||
while( ulBlockVariable == 0UL )
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
taskENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxRand( void )
|
||||
{
|
||||
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
|
||||
|
||||
/*
|
||||
* Utility function to generate a pseudo random number.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
|
||||
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSRand( UBaseType_t ulSeed )
|
||||
{
|
||||
/* Utility function to seed the pseudo random number generator. */
|
||||
ulNextRand = ulSeed;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvMiscInitialisation( void )
|
||||
{
|
||||
time_t xTimeNow;
|
||||
uint32_t ulLoggingIPAddress;
|
||||
uint32_t ulRandomNumbers[ 4 ];
|
||||
|
||||
ulLoggingIPAddress = FreeRTOS_inet_addr_quick( configUDP_LOGGING_ADDR0, configUDP_LOGGING_ADDR1, configUDP_LOGGING_ADDR2, configUDP_LOGGING_ADDR3 );
|
||||
vLoggingInit( xLogToStdout, xLogToFile, xLogToUDP, ulLoggingIPAddress, configPRINT_PORT );
|
||||
|
||||
/*
|
||||
* Seed random number generator.
|
||||
*
|
||||
* !!!NOTE!!!
|
||||
* This is not a secure method of generating a random number. Production
|
||||
* devices should use a True Random Number Generator (TRNG).
|
||||
*/
|
||||
time( &xTimeNow );
|
||||
LogDebug( ( "Seed for randomizer: %lu\n", xTimeNow ) );
|
||||
prvSRand( ( uint32_t ) xTimeNow );
|
||||
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 0 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 1 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 2 ] );
|
||||
( void ) xApplicationGetRandomNumber( &ulRandomNumbers[ 3 ] );
|
||||
LogDebug( ( "Random numbers: %08X %08X %08X %08X\n", ulRandomNumbers[ 0 ], ulRandomNumbers[ 1 ], ulRandomNumbers[ 2 ], ulRandomNumbers[ 3 ] ) );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
|
||||
|
||||
const char * pcApplicationHostnameHook( void )
|
||||
{
|
||||
/* Assign the name "FreeRTOS" to this network node. This function will
|
||||
* be called during the DHCP: the machine will be registered with an IP
|
||||
* address plus this name. */
|
||||
return mainHOST_NAME;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
|
||||
|
||||
BaseType_t xApplicationDNSQueryHook( const char * pcName )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Determine if a name lookup is for this node. Two names are given
|
||||
* to this node: that returned by pcApplicationHostnameHook() and that set
|
||||
* by mainDEVICE_NICK_NAME. */
|
||||
if( _stricmp( pcName, pcApplicationHostnameHook() ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else if( _stricmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Callback that provides the inputs necessary to generate a randomized TCP
|
||||
* Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
|
||||
* THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
|
||||
* SYSTEMS.
|
||||
*/
|
||||
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
|
||||
uint16_t usSourcePort,
|
||||
uint32_t ulDestinationAddress,
|
||||
uint16_t usDestinationPort )
|
||||
{
|
||||
( void ) ulSourceAddress;
|
||||
( void ) usSourcePort;
|
||||
( void ) ulDestinationAddress;
|
||||
( void ) usDestinationPort;
|
||||
|
||||
return uxRand();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Set *pulNumber to a random number, and return pdTRUE. When the random number
|
||||
* generator is broken, it shall return pdFALSE.
|
||||
*
|
||||
* THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER SO IS
|
||||
* NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.
|
||||
*/
|
||||
BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
|
||||
{
|
||||
*pulNumber = uxRand();
|
||||
return pdTRUE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS V202112.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
|
||||
*
|
||||
*/
|
||||
|
||||
/* This file configures mbed TLS for FreeRTOS. */
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H_
|
||||
#define MBEDTLS_CONFIG_H_
|
||||
|
||||
/* FreeRTOS include. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Generate errors if deprecated functions are used. */
|
||||
#define MBEDTLS_DEPRECATED_REMOVED
|
||||
|
||||
/* Place AES tables in ROM. */
|
||||
#define MBEDTLS_AES_ROM_TABLES
|
||||
|
||||
/* Enable the following cipher modes. */
|
||||
#define MBEDTLS_CIPHER_MODE_CBC
|
||||
#define MBEDTLS_CIPHER_MODE_CFB
|
||||
#define MBEDTLS_CIPHER_MODE_CTR
|
||||
|
||||
/* Enable the following cipher padding modes. */
|
||||
#define MBEDTLS_CIPHER_PADDING_PKCS7
|
||||
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
|
||||
#define MBEDTLS_CIPHER_PADDING_ZEROS
|
||||
|
||||
/* Cipher suite configuration. */
|
||||
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#define MBEDTLS_ECP_NIST_OPTIM
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
|
||||
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
|
||||
/* Enable all SSL alert messages. */
|
||||
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
|
||||
|
||||
/* Enable the following SSL features. */
|
||||
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#define MBEDTLS_SSL_ALPN
|
||||
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
|
||||
/* Check certificate key usage. */
|
||||
#define MBEDTLS_X509_CHECK_KEY_USAGE
|
||||
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
|
||||
|
||||
/* Disable platform entropy functions. */
|
||||
#define MBEDTLS_NO_PLATFORM_ENTROPY
|
||||
|
||||
/* Enable the following mbed TLS features. */
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_BASE64_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ECDH_C
|
||||
#define MBEDTLS_ECDSA_C
|
||||
#define MBEDTLS_ECP_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_ERROR_C
|
||||
#define MBEDTLS_GCM_C
|
||||
#define MBEDTLS_MD_C
|
||||
#define MBEDTLS_OID_C
|
||||
#define MBEDTLS_PEM_PARSE_C
|
||||
#define MBEDTLS_PK_C
|
||||
#define MBEDTLS_PK_PARSE_C
|
||||
#define MBEDTLS_PKCS1_V15
|
||||
#define MBEDTLS_PLATFORM_C
|
||||
#define MBEDTLS_RSA_C
|
||||
#define MBEDTLS_SHA1_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_SSL_CLI_C
|
||||
#define MBEDTLS_SSL_TLS_C
|
||||
#define MBEDTLS_THREADING_ALT
|
||||
#define MBEDTLS_THREADING_C
|
||||
#define MBEDTLS_X509_USE_C
|
||||
#define MBEDTLS_X509_CRT_PARSE_C
|
||||
|
||||
/* Set the memory allocation functions on FreeRTOS. */
|
||||
void * mbedtls_platform_calloc( size_t nmemb,
|
||||
size_t size );
|
||||
void mbedtls_platform_free( void * ptr );
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_CALLOC_MACRO mbedtls_platform_calloc
|
||||
#define MBEDTLS_PLATFORM_FREE_MACRO mbedtls_platform_free
|
||||
|
||||
/* The network send and receive functions on FreeRTOS. */
|
||||
int mbedtls_platform_send( void * ctx,
|
||||
const unsigned char * buf,
|
||||
size_t len );
|
||||
int mbedtls_platform_recv( void * ctx,
|
||||
unsigned char * buf,
|
||||
size_t len );
|
||||
|
||||
/* These two macro used by mbedtls_ssl_set_bio in using_mbedtls network
|
||||
* transport layer. */
|
||||
#define MBEDTLS_SSL_SEND mbedtls_platform_send
|
||||
#define MBEDTLS_SSL_RECV mbedtls_platform_recv
|
||||
|
||||
/* The entropy poll function. */
|
||||
int mbedtls_platform_entropy_poll( void * data,
|
||||
unsigned char * output,
|
||||
size_t len,
|
||||
size_t * olen );
|
||||
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* ifndef MBEDTLS_CONFIG_H_ */
|
||||
@@ -54,7 +54,7 @@
|
||||
#include "backoff_algorithm.h"
|
||||
|
||||
/* Transport interface implementation include header for TLS. */
|
||||
#include "using_mbedtls.h"
|
||||
#include "transport_mbedtls.h"
|
||||
|
||||
/* Demo specific config. */
|
||||
#include "demo_config.h"
|
||||
@@ -142,6 +142,18 @@
|
||||
*/
|
||||
#define mqttexampleTRANSPORT_SEND_RECV_TIMEOUT_MS ( 200U )
|
||||
|
||||
/**
|
||||
* @brief The length of the outgoing publish records array used by the coreMQTT
|
||||
* library to track QoS > 0 packet ACKS for outgoing publishes.
|
||||
*/
|
||||
#define mqttexampleOUTGOING_PUBLISH_RECORD_LEN ( 10U )
|
||||
|
||||
/**
|
||||
* @brief The length of the incoming publish records array used by the coreMQTT
|
||||
* library to track QoS > 0 packet ACKS for incoming publishes.
|
||||
*/
|
||||
#define mqttexampleINCOMING_PUBLISH_RECORD_LEN ( 10U )
|
||||
|
||||
/**
|
||||
* @brief Maximum number of outgoing publishes maintained in the application
|
||||
* until an ack is received from the broker.
|
||||
@@ -234,6 +246,25 @@ static uint16_t globalUnsubscribePacketIdentifier = 0U;
|
||||
*/
|
||||
static PublishPackets_t outgoingPublishPackets[ MAX_OUTGOING_PUBLISHES ] = { 0 };
|
||||
|
||||
/**
|
||||
* @brief Array to track the outgoing publish records for outgoing publishes
|
||||
* with QoS > 0.
|
||||
*
|
||||
* This is passed into #MQTT_InitStatefulQoS to allow for QoS > 0.
|
||||
*
|
||||
*/
|
||||
static MQTTPubAckInfo_t pOutgoingPublishRecords[ mqttexampleOUTGOING_PUBLISH_RECORD_LEN ];
|
||||
|
||||
/**
|
||||
* @brief Array to track the incoming publish records for incoming publishes
|
||||
* with QoS > 0.
|
||||
*
|
||||
* This is passed into #MQTT_InitStatefulQoS to allow for QoS > 0.
|
||||
*
|
||||
*/
|
||||
static MQTTPubAckInfo_t pIncomingPublishRecords[ mqttexampleINCOMING_PUBLISH_RECORD_LEN ];
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@@ -315,6 +346,18 @@ static BaseType_t xHandlePublishResend( MQTTContext_t * pxMqttContext );
|
||||
*/
|
||||
static uint32_t prvGetTimeMs( void );
|
||||
|
||||
/**
|
||||
* @brief Call #MQTT_ProcessLoop in a loop for the duration of a timeout or
|
||||
* #MQTT_ProcessLoop returns a failure.
|
||||
*
|
||||
* @param[in] pMqttContext MQTT context pointer.
|
||||
* @param[in] ulTimeoutMs Duration to call #MQTT_ProcessLoop for.
|
||||
*
|
||||
* @return Returns the return value of the last call to #MQTT_ProcessLoop.
|
||||
*/
|
||||
static MQTTStatus_t prvProcessLoopWithTimeout( MQTTContext_t * pMqttContext,
|
||||
uint32_t ulTimeoutMs );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static int32_t prvGenerateRandomNumber()
|
||||
@@ -334,26 +377,25 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkContext
|
||||
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
/*
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
*
|
||||
* Custom Authentication uses the contents of the username and password
|
||||
* fields of the MQTT CONNECT packet to authenticate the client.
|
||||
*
|
||||
* For more information, refer to the documentation at:
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html
|
||||
*/
|
||||
* When democonfigCLIENT_USERNAME is defined, use the "mqtt" alpn to connect
|
||||
* to AWS IoT Core with Custom Authentication on port 443.
|
||||
*
|
||||
* Custom Authentication uses the contents of the username and password
|
||||
* fields of the MQTT CONNECT packet to authenticate the client.
|
||||
*
|
||||
* For more information, refer to the documentation at:
|
||||
* https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html
|
||||
*/
|
||||
static const char * ppcAlpnProtocols[] = { "mqtt", NULL };
|
||||
#if democonfigMQTT_BROKER_PORT != 443U
|
||||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#error "Connections to AWS IoT Core with custom authentication must connect to TCP port 443 with the \"mqtt\" alpn."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
#else /* if !defined( democonfigCLIENT_USERNAME ) */
|
||||
/*
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
*/
|
||||
* Otherwise, use the "x-amzn-mqtt-ca" alpn to connect to AWS IoT Core using
|
||||
* x509 Certificate Authentication.
|
||||
*/
|
||||
static const char * ppcAlpnProtocols[] = { "x-amzn-mqtt-ca", NULL };
|
||||
|
||||
#endif /* !defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/*
|
||||
@@ -366,7 +408,7 @@ static TlsTransportStatus_t prvConnectToServerWithBackoffRetries( NetworkContext
|
||||
xNetworkCredentials.pAlpnProtos = NULL;
|
||||
#else /* democonfigMQTT_BROKER_PORT != 8883U */
|
||||
xNetworkCredentials.pAlpnProtos = NULL;
|
||||
#error "MQTT connections to AWS IoT Core are only allowed on ports 443 and 8883."
|
||||
#error "MQTT connections to AWS IoT Core are only allowed on ports 443 and 8883."
|
||||
#endif /* democonfigMQTT_BROKER_PORT != 443U */
|
||||
|
||||
configASSERT( pxNetworkContext != NULL );
|
||||
@@ -459,6 +501,37 @@ static BaseType_t prvGetNextFreeIndexForOutgoingPublishes( uint8_t * pucIndex )
|
||||
|
||||
return xReturnStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static MQTTStatus_t prvProcessLoopWithTimeout( MQTTContext_t * pMqttContext,
|
||||
uint32_t ulTimeoutMs )
|
||||
{
|
||||
uint32_t ulMqttProcessLoopTimeoutTime;
|
||||
uint32_t ulCurrentTime;
|
||||
|
||||
MQTTStatus_t eMqttStatus = MQTTSuccess;
|
||||
|
||||
ulCurrentTime = pMqttContext->getTime();
|
||||
ulMqttProcessLoopTimeoutTime = ulCurrentTime + ulTimeoutMs;
|
||||
|
||||
/* Call MQTT_ProcessLoop multiple times a timeout happens, or
|
||||
* MQTT_ProcessLoop fails. */
|
||||
while( ( ulCurrentTime < ulMqttProcessLoopTimeoutTime ) &&
|
||||
( eMqttStatus == MQTTSuccess || eMqttStatus == MQTTNeedMoreBytes ) )
|
||||
{
|
||||
eMqttStatus = MQTT_ProcessLoop( pMqttContext );
|
||||
ulCurrentTime = pMqttContext->getTime();
|
||||
}
|
||||
|
||||
if( eMqttStatus == MQTTNeedMoreBytes )
|
||||
{
|
||||
eMqttStatus = MQTTSuccess;
|
||||
}
|
||||
|
||||
return eMqttStatus;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vCleanupOutgoingPublishAt( uint8_t ucIndex )
|
||||
@@ -625,6 +698,7 @@ BaseType_t xEstablishMqttSession( MQTTContext_t * pxMqttContext,
|
||||
xTransport.pNetworkContext = pxNetworkContext;
|
||||
xTransport.send = TLS_FreeRTOS_send;
|
||||
xTransport.recv = TLS_FreeRTOS_recv;
|
||||
xTransport.writev = NULL;
|
||||
|
||||
/* Initialize MQTT library. */
|
||||
xMQTTStatus = MQTT_Init( pxMqttContext,
|
||||
@@ -636,70 +710,85 @@ BaseType_t xEstablishMqttSession( MQTTContext_t * pxMqttContext,
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
xReturnStatus = pdFAIL;
|
||||
LogError( ( "MQTT init failed with status %s.",
|
||||
LogError( ( "MQTT_Init failed with status %s.",
|
||||
MQTT_Status_strerror( xMQTTStatus ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Establish MQTT session by sending a CONNECT packet. */
|
||||
|
||||
/* Many fields not used in this demo so start with everything at 0. */
|
||||
( void ) memset( ( void * ) &xConnectInfo, 0x00, sizeof( xConnectInfo ) );
|
||||
|
||||
/* Start with a clean session i.e. direct the MQTT broker to discard any
|
||||
* previous session data. Also, establishing a connection with clean session
|
||||
* will ensure that the broker does not store any data when this client
|
||||
* gets disconnected. */
|
||||
xConnectInfo.cleanSession = true;
|
||||
|
||||
/* The client identifier is used to uniquely identify this MQTT client to
|
||||
* the MQTT broker. In a production device the identifier can be something
|
||||
* unique, such as a device serial number. */
|
||||
xConnectInfo.pClientIdentifier = democonfigCLIENT_IDENTIFIER;
|
||||
xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( democonfigCLIENT_IDENTIFIER );
|
||||
|
||||
/* The maximum time interval in seconds which is allowed to elapse
|
||||
* between two Control Packets.
|
||||
* It is the responsibility of the Client to ensure that the interval between
|
||||
* Control Packets being sent does not exceed this Keep Alive value. In the
|
||||
* absence of sending any other Control Packets, the Client MUST send a
|
||||
* PINGREQ Packet. */
|
||||
xConnectInfo.keepAliveSeconds = mqttexampleKEEP_ALIVE_TIMEOUT_SECONDS;
|
||||
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
/* Append metrics string when connecting to AWS IoT Core with custom auth */
|
||||
xConnectInfo.pUserName = democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING;
|
||||
xConnectInfo.userNameLength = ( uint16_t ) strlen( democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING );
|
||||
|
||||
/* Use the provided password as-is */
|
||||
xConnectInfo.pPassword = democonfigCLIENT_PASSWORD;
|
||||
xConnectInfo.passwordLength = ( uint16_t ) strlen( democonfigCLIENT_PASSWORD );
|
||||
#else
|
||||
/* If no username is needed, only send the metrics string */
|
||||
xConnectInfo.pUserName = AWS_IOT_METRICS_STRING;
|
||||
xConnectInfo.userNameLength = ( uint16_t ) strlen( AWS_IOT_METRICS_STRING );
|
||||
|
||||
/* Password for authentication is not used. */
|
||||
xConnectInfo.pPassword = NULL;
|
||||
xConnectInfo.passwordLength = 0U;
|
||||
#endif /* defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/* Send MQTT CONNECT packet to broker. */
|
||||
xMQTTStatus = MQTT_Connect( pxMqttContext,
|
||||
&xConnectInfo,
|
||||
NULL,
|
||||
mqttexampleCONNACK_RECV_TIMEOUT_MS,
|
||||
&sessionPresent );
|
||||
xMQTTStatus = MQTT_InitStatefulQoS( pxMqttContext,
|
||||
pOutgoingPublishRecords,
|
||||
mqttexampleOUTGOING_PUBLISH_RECORD_LEN,
|
||||
pIncomingPublishRecords,
|
||||
mqttexampleINCOMING_PUBLISH_RECORD_LEN );
|
||||
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
xReturnStatus = pdFAIL;
|
||||
LogError( ( "Connection with MQTT broker failed with status %s.",
|
||||
LogError( ( "MQTT_InitStatefulQos failed with status %s.",
|
||||
MQTT_Status_strerror( xMQTTStatus ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo( ( "MQTT connection successfully established with broker.\n\n" ) );
|
||||
/* Establish MQTT session by sending a CONNECT packet. */
|
||||
|
||||
/* Many fields not used in this demo so start with everything at 0. */
|
||||
( void ) memset( ( void * ) &xConnectInfo, 0x00, sizeof( xConnectInfo ) );
|
||||
|
||||
/* Start with a clean session i.e. direct the MQTT broker to discard any
|
||||
* previous session data. Also, establishing a connection with clean session
|
||||
* will ensure that the broker does not store any data when this client
|
||||
* gets disconnected. */
|
||||
xConnectInfo.cleanSession = true;
|
||||
|
||||
/* The client identifier is used to uniquely identify this MQTT client to
|
||||
* the MQTT broker. In a production device the identifier can be something
|
||||
* unique, such as a device serial number. */
|
||||
xConnectInfo.pClientIdentifier = democonfigCLIENT_IDENTIFIER;
|
||||
xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( democonfigCLIENT_IDENTIFIER );
|
||||
|
||||
/* The maximum time interval in seconds which is allowed to elapse
|
||||
* between two Control Packets.
|
||||
* It is the responsibility of the Client to ensure that the interval between
|
||||
* Control Packets being sent does not exceed this Keep Alive value. In the
|
||||
* absence of sending any other Control Packets, the Client MUST send a
|
||||
* PINGREQ Packet. */
|
||||
xConnectInfo.keepAliveSeconds = mqttexampleKEEP_ALIVE_TIMEOUT_SECONDS;
|
||||
|
||||
#if defined( democonfigCLIENT_USERNAME )
|
||||
/* Append metrics string when connecting to AWS IoT Core with custom auth */
|
||||
xConnectInfo.pUserName = democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING;
|
||||
xConnectInfo.userNameLength = ( uint16_t ) strlen( democonfigCLIENT_USERNAME AWS_IOT_METRICS_STRING );
|
||||
|
||||
/* Use the provided password as-is */
|
||||
xConnectInfo.pPassword = democonfigCLIENT_PASSWORD;
|
||||
xConnectInfo.passwordLength = ( uint16_t ) strlen( democonfigCLIENT_PASSWORD );
|
||||
#else
|
||||
/* If no username is needed, only send the metrics string */
|
||||
xConnectInfo.pUserName = AWS_IOT_METRICS_STRING;
|
||||
xConnectInfo.userNameLength = ( uint16_t ) strlen( AWS_IOT_METRICS_STRING );
|
||||
|
||||
/* Password for authentication is not used. */
|
||||
xConnectInfo.pPassword = NULL;
|
||||
xConnectInfo.passwordLength = 0U;
|
||||
#endif /* defined( democonfigCLIENT_USERNAME ) */
|
||||
|
||||
/* Send MQTT CONNECT packet to broker. */
|
||||
xMQTTStatus = MQTT_Connect( pxMqttContext,
|
||||
&xConnectInfo,
|
||||
NULL,
|
||||
mqttexampleCONNACK_RECV_TIMEOUT_MS,
|
||||
&sessionPresent );
|
||||
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
xReturnStatus = pdFAIL;
|
||||
LogError( ( "Connection with MQTT broker failed with status %s.",
|
||||
MQTT_Status_strerror( xMQTTStatus ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo( ( "MQTT connection successfully established with broker.\n\n" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -819,7 +908,7 @@ BaseType_t xSubscribeToTopic( MQTTContext_t * pxMqttContext,
|
||||
* of receiving publish message before subscribe ack is zero; but application
|
||||
* must be ready to receive any packet. This demo uses MQTT_ProcessLoop to
|
||||
* receive packet from network. */
|
||||
xMQTTStatus = MQTT_ProcessLoop( pxMqttContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
|
||||
xMQTTStatus = prvProcessLoopWithTimeout( pxMqttContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
|
||||
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
@@ -876,7 +965,7 @@ BaseType_t xUnsubscribeFromTopic( MQTTContext_t * pxMqttContext,
|
||||
pcTopicFilter ) );
|
||||
|
||||
/* Process the incoming packet from the broker. */
|
||||
xMQTTStatus = MQTT_ProcessLoop( pxMqttContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
|
||||
xMQTTStatus = prvProcessLoopWithTimeout( pxMqttContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
|
||||
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
@@ -953,7 +1042,7 @@ BaseType_t xPublishToTopic( MQTTContext_t * pxMqttContext,
|
||||
* sends ping request to broker if MQTT_KEEP_ALIVE_INTERVAL_SECONDS
|
||||
* has expired since the last MQTT packet sent and receive
|
||||
* ping responses. */
|
||||
xMQTTStatus = MQTT_ProcessLoop( pxMqttContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
|
||||
xMQTTStatus = prvProcessLoopWithTimeout( pxMqttContext, mqttexamplePROCESS_LOOP_TIMEOUT_MS );
|
||||
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
@@ -975,7 +1064,7 @@ BaseType_t xProcessLoop( MQTTContext_t * pxMqttContext,
|
||||
BaseType_t xReturnStatus = pdFAIL;
|
||||
MQTTStatus_t xMQTTStatus = MQTTSuccess;
|
||||
|
||||
xMQTTStatus = MQTT_ProcessLoop( pxMqttContext, ulTimeoutMs );
|
||||
xMQTTStatus = prvProcessLoopWithTimeout( pxMqttContext, ulTimeoutMs );
|
||||
|
||||
if( xMQTTStatus != MQTTSuccess )
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "core_mqtt.h"
|
||||
|
||||
/* Transport interface implementation include header for TLS. */
|
||||
#include "using_mbedtls.h"
|
||||
#include "transport_mbedtls.h"
|
||||
|
||||
/**
|
||||
* @brief Establish a MQTT connection.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user